samerater's picture

New to OpenGL, My 3D shapes have invisible sides when rotating?

First day with OpenTK, drew some 3D shapes and I get these invisible sides in certain orientations. Why is this? Please help!


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Snorkel's picture

I assume that the depth buffer is not enabled.

You'll need something like this:

GL.DepthMask(true);
GL.Enable(EnableCap.DepthTest);
GL.ClearDepth(1.0f); // clear before starting to draw geometry

and make sure you set the depthbuffer bits on the GraphicsMode.

If you can't fix it please post your code so we can help you :-)

samerater's picture

Thank you very much, that works. I really appreciate the help.

samerater's picture

Also, I think I set up the perspective wrong. If I draw the shapes further back in z, they do not appear to be any smaller. What is the best way to set up the perspective for glcontrol?

lid6j86's picture

i was going to say, also if you see suddenly parts of it 'disappear' as its rotating or moving, the polygons could be going beyond the clipping plane, meaning they wont get rendered (this is set up when you make the ortho or perspective projections)