Im new to openGL and I do have the redbook as my reference but I feel like Im missing something in regards to rendering polygons.
I created a model of a cube from which I boolean diff’d a sphere which had a slightly larger diameter than the width of the cube. This left me with a nice interior volume to the cube and nifty hole on each face of the cube. I saved this as a raw triangle file and used this to load vertices into my openGL tutorial program.
My problem is that this model does not render solid and I have toyed with every permutation of Culling and not-culling I can imagine…
Here are a few images from my app
Cube in line mode with front or back face culling enabled (both give the same result)
Now 2 views with Culling disabled…
What is going on here???
Is this some artifact of how Im exporting the model???
Thanks for any pointers you can give…
You need to draw solid with back face culling on.
An optical illusion makes the results appear the same but they are not. You also may have some issues with zbuffering, it looks like you don’t have zbuffering on, or that it lacks precision.
you can also mess around with glCullFace(GL_FRONT)
there is also you’re ‘winding’ which describes if the vertices to your polygon are defined in a clockwise or counter clockwise fashion (set this using: glFrontFace(GL_CCW or GL_CW)). OpenGL uses this information to determine whether your polygon is front facing or back facing by calculating a determinant.
anyway, enough about culling.
your problem seems to be depth testing.
in your initialization:
then in your render ‘OR’ in GL_DEPTH_BUFFER_BIT
into your glClear() call (glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | …)
edit: looks like dorbie got to you as I was writting this
Aeluned your solution worked like a champ!!!
Your help has been much appreciated!