OpenGL in Visual Studio 2005

I have been working with OpenGL in Visual Studio 2005. I am running on XP x64. Things were going ok untill I used glEnable(GL_DEPTH_TEST); If I use that I get horrible corruption. I wonder if the GL.h and GLU.h in Visual Studio actually properly support OpenGL and make use of my Graphics Card’s 3D acceleration. Do I need to update the GL header files in Visual Studio? One other thing I wonder about is about programming OpenGL in terms of how the compilation adapts to what the platform can support.

i guess with “horrible corruption” you mean lots of errors during compilation, not during runtime?

No, it compiles ok. It runs without errors. What is displayed however. Little pixel fragments on the screen in the vauge shape of the thing you are trying to render. As soon as I turn depth testing off it displays ok (albeit without the benefit of depth testing). Something about the depth testing seeems to be causing the rendering to go wrong. I thought it might be the version of files used within Visual Studio and it could still be. The header file is dated 1996 (a mere decade old). I tried the getGLString() method to get the OpenGL version which was running but this showed the version to be OpenGL 2.x. The systems OpenGL implementation must therefore be being utilised for the rendering. I don’t know what the problem is. I had done more advanced things than I am doing at the moment using JOGL and this worked fine. I am now translating what I did across to C++ as this is what we are using at University. Now I am having problems with GL_DEPTH_TEST. Something can’t be right.

  1. are you sure you have a pixel format with depth buffer?

  2. are you sure you clear the depth buffer properly before rendering?

My guess is it sounds like Z buffer fighting? What are your near/far planes set to? Try 1.0 and 100.0 if those are possible ranges to start with.

Depth buffer issue looks like a fair suggestion. I may have overlooked that. I will check it out.

Ok feels stupid now Yes I overlooked clearing the Z buffer.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.