Why is my cube not looking 3-D?

Hello everyone,

I made a simple code and followed the example given in the zSpace SDK the basic OpenGL code. I essentially just copied and pasted with a few adjustments, but my cube does not look 3-D. It just looks like a normal image on the screen. The head tracking works, but again just a normal image. Here is my main loop for the code. If you see me missing something I would appreciate the help. To note, I am not very familiar with Opengl itself, but am more comfortable with GLFW so I am using GLFW for my rendering library. Maybe that makes a difference???

Initialize(), update(), and drawSceneforeye() functions shown below are basically the same as in the example code.

GLfloat main()

{

bool isInitialized = initialize();

bool done = !glfwWindowShouldClose(window);

while (done == !glfwWindowShouldClose(window)) {

update();

ZCError error = zcBeginStereoBufferFrame(bufferHandle);

glfwMakeContextCurrent(window);

glfwGetFramebufferSize(window, &w, &h);

//drawing code

drawSceneForEye(ZC_EYE_LEFT);

drawSceneForEye(ZC_EYE_RIGHT);

glfwSwapBuffers(window);

glfwPollEvents();

glfwSetCursorPosCallback(window, cursor_position_callback);

glfwSetScrollCallback(window, scroll_callback);

if (GetAsyncKeyState(VK_ESCAPE)) {

done = glfwWindowShouldClose(window);

}

}

glfwDestroyWindow(window);

glfwTerminate();

return 0;

}; //End main

Hi there,
I don’t know of any major problems that would preclude the sdk from working with GLFW, but then again, I’m not familiar with that framework. Are you able to verify that stereo rendering works in GLFW without the zSpace SDK?

Hello Alex,

Yes I was able to verify that stereo rendering is a function of GLFW. Perhaps I am not using it correctly? Below is my rendering function with the GLFW Stereo setting added.

    GLuint pixelFormat;  // Holds the results after searching for a match

                             // Set the appropriate pixel format.
        PIXELFORMATDESCRIPTOR pfd =
        {
            sizeof(PIXELFORMATDESCRIPTOR),      // Size Of This Pixel Format Descriptor
            1,                                  // Version Number
            PFD_DRAW_TO_WINDOW |                // Format Must Support Window
            PFD_SUPPORT_OPENGL |                // Format Must Support OpenGL
            GLFW_STEREO |                        // Format Must Support Quad-buffer Stereo
            PFD_DOUBLEBUFFER,                   // Must Support Double Buffering
            PFD_TYPE_RGBA,                      // Request An RGBA Format
            24,                                 // 24-bit color depth
            0, 0, 0, 0, 0, 0,                   // Color Bits Ignored
            0,                                  // No Alpha Buffer
            0,                                  // Shift Bit Ignored
            0,                                  // No Accumulation Buffer
            0, 0, 0, 0,                         // Accumulation Bits Ignored
            32,                                 // 32-bit Z-Buffer (Depth Buffer)
            0,                                  // No Stencil Buffer
            0,                                  // No Auxiliary Buffer
            PFD_MAIN_PLANE,                     // Main Drawing Layer
            0,                                  // Reserved
            0, 0, 0                             // Layer Masks Ignored
        };

Can you confirm whether any sample applications, including the original BasicStereo sample, aren’t drawing in stereo as they should? If so, we can try to see if its a driver issue.

If the sample apps work, I would remove the zSpace SDK from the equation and concentrate on getting your GLFW window to just draw a stereo image. The zSpace’s display isn’t unique as far as stereo displays go, so you can leverage the greater opengl and glfw communities to get it drawing as it should. Once you’ve confirmed that your application is outputting a stereo image, I’d come back to the zSpace SDK and leverage it for the camera and stylus information.