Skip to main content
Up and Coming
May 1, 2014

Another "hidden" OpenGL state change in OculusSDK 0.3.1

Hi,

After a call to ovrHmd_EndFrame(), the vertex arrays in my own render loop no longer showed up.
Took me another hour to find that glBindBuffer(GL_ARRAY_BUFFER, ...) kept its specific binding.
This is now my code surrounding ovrHmd_EndFrame():


glDisable(GL_CULL_FACE); // Oculus wants CW orientations, avoid the problem by turning of culling...
glDisable(GL_DEPTH_TEST); // Nothing is drawn with depth test on...

ovrHmd_EndFrame(l_Hmd);

glBindBuffer(GL_ARRAY_BUFFER, 0); // Unbind GL_ARRAY_BUFFER for my own vertex arrays to work...
glEnable(GL_CULL_FACE); // Turn back on...
glEnable(GL_DEPTH_TEST); // Turn back on...
glClearDepth(1); // Oculus set this to 0 (the near plane), return to normal...
glUseProgramObjectARB(0); // Oculus shader is still active, turn it off...


Does anyone have / know of some kind of OpenGL state snapshot functionality so that I can take a before / after "picture" and compare the two?

Thanks,
Daniel Dekkers

    3 replies

    Up and Coming
    May 1, 2014
    Do you know this tutorial? Very helpful imo, I think that might solve your problem(s) but I'm not certain.

    http://www.antongerdelan.net/opengl/glcontext2.html
    DoZo1971Author
    Up and Coming
    May 1, 2014
    Yes, something like that.
    But I'm not expert enough to handle all the peculiarities of all the different OpenGL versions.
    So I would end up with "some state", or "state that seems important for this particular project".
    I guess GLEW would be a good placeholder. I'll drop it at their mailing list.
    Inspiring
    May 1, 2014
    We are working to resolve these issues with GL state changes in the next release of the SDK.

    I'll be sure that the engineers are aware of this specific case. Thanks.
    AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV