Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
concavator's avatar
concavator
Honored Guest
7 years ago

Native OpenGL Foveated Rendering sample???

I've spent several hours today trying to modify vrcubeworld_nativeactivity to incorporate foveated rendering and it simply will..not...work.  OpenGL throws no errors, but it never looks foveated.  Can somebody please help or point me to an example of foveated rendering in OpenGL???

```
//??????
if(framebuffer.useFoveatedRendering)
{
GLint query = 0;
glGetTexParameteriv(colorTextureTarget, GL_TEXTURE_FOVEATED_FEATURE_QUERY_QCOM, &query);

if(((query & GL_FOVEATION_ENABLE_BIT_QCOM) == GL_FOVEATION_ENABLE_BIT_QCOM) && ((query & GL_FOVEATION_SCALED_BIN_METHOD_BIT_QCOM) == GL_FOVEATION_SCALED_BIN_METHOD_BIT_QCOM))
{
vout << "Foveation appears to be supported" << endl; //this is printed
}

//none of these fail, but nothing happens (rendering looks the same)
GL(glBindTexture(colorTextureTarget, colorTexture));
GL(glTexParameteri(colorTextureTarget, GL_TEXTURE_FOVEATED_FEATURE_BITS_QCOM, GL_FOVEATION_ENABLE_BIT_QCOM));

float focalX1 = 0.0f; // Gaze of left eye
float focalY1 = 0.0f; // Gaze of left eye
float focalX2 = 0.0f; // Gaze of right eye
float focalY2 = 0.0f; // Gaze of right eye
float gainX = 8000.0f; // 4 is considered weak foveation, 10 is strong
float gainY = 8000.0f;
float area = 2000.0f;

GL(glTextureFoveationParametersQCOM(colorTexture, 0, 0, focalX1, focalY1, gainX, gainY, area));
GL(glTextureFoveationParametersQCOM(colorTexture, 1, 0, focalX1, focalY1, gainX, gainY, area));
}
```