Forum Discussion

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

Missing objects while rendering using DK2

Hello,

I'm having some issues rendering my scene in an in-house framework using the DK2, so this might make diagnosis of this issue a bit difficult, but bare with me.

Problem:
When rendering, only objects rendered using display lists and GLUT, more specifically glutSolidSphere(), will show up in the scene. Most other objects are drawn using glVertexPointer(), glNormalPointer(), glTexCoordPointer() which point to internal memory blocks(not GPU, not using VBOs), which are accessed by a call to glDrawElements().
All of the rendering routines seem to work fine on their own, but when the oculus code is introduced, just some of the objects are not being drawn.

Thanks in advance for any suggestions, comments, etc!
If any more information is needed than what is mentioned below, just ask.

The environment is:
Windows 7
C++ & VS2013
LibOVR 0.4.3
OpenGL 4.3 (but rendering uses various methods from many opengl versions)
GLFW Window management
Multi-threaded (but I believe that all oculus/opengl/etc initialization and rendering is done in the same thread)

Initialization steps:
1. ovr_Initialize()
2. glfwInit()
3. glfwCreateWindows(...)
4. glfwMakeContextCurrent(...)
5. glewInit()
6. <internal rendering initialization> (load models, textures, etc)
7. <oculus rending intialization> (creation of hmd device, configure rendering, etc)
-- Based off forum user: nuclear's code: here

Then my program proceeds to the main rendering loop until termination.

Drawing happens in the following steps:
1. Render scene to frame buffer, we can call this fbo1
2. ovrHmd_BeginFrame(...)
3. Bind framebuffer for oculus rendering, we can call this fbo2
<start loop to render each eye's view>
3. Setup ovr rendering code with separate eye configurations/viewports/etc (again based off nuclear's code)
4. Render fbo1's contents into a quad drawn using glBegin(GL_QUADS)/glEnd()
<end loop>
5. Unbind fbo2
6. ovrHmd_EndFrame(...) to render fbo2 using oculus SDK rendering

2 Replies

  • "sradigan" wrote:
    Most other objects are drawn using glVertexPointer(), glNormalPointer(), glTexCoordPointer() which point to internal memory blocks(not GPU, not using VBOs), which are accessed by a call to glDrawElements().

    It sounds like our distortion renderer is interfering with your GL state. That shouldn't happen, since our 0.4.4 renderer uses a separate context. Can you try using a vertex array? Just call:

    // At startup
    glEnableClientState(GL_VERTEX_ARRAY);
    glEnableClientState(GL_NORMAL_ARRAY);
    GLuint buffer;
    glGenBuffers(1, &buffer);
    glBindBuffer(GL_ARRAY_BUFFER, buffer);

    // <Render loop>

    // At shutdown
    glDeleteBuffers(1, &buffer);
    glBindBuffer(GL_ARRAY_BUFFER, 0);
    glDisableClientState(GL_VERTEX_ARRAY);
    glDisableClientState(GL_NORMAL_ARRAY);
  • Hey vrdaveb,

    Thanks for the quick reply, sorry I'm getting back to you so late. I didn't realize there was an update to the sdk, upgrading to version 0.4.4 fixed my issue, all objects are showing up correctly now. I believe your initial suspicions were correct.

    Thanks!