View Full Version : Help!!
I have a cuboid - why does the back face block the front when you look directly at it but disappear when you zoom out and look from above - also why are some of the sides missing or transparent - I did apply
which took away the top and back faces of all the objects rather than just the one I wanted so I removed the line and now the back face of cuboid overlap with the front face when rotating the scene
make sure your polygon winding is the same across all faces.(The order you specify your verts) Counter-clockwise seems to be popular, if your unsure on how do do this then glDisable(GL_CULL_FACE) should stop your faces disapearing.
check you have this consistant, and for a hack you could do the example.
GLenum face, //GL_FRONT, GL_BACK, GL_FRONT_AND_BACK
GLenum mode //GL_FILL, GL_LINE, GL_POINT
should also help your polys to be displayed from all angles.
I've checked the polygon winding - it's fine - I tried glDisable(GL_CULL_FACE) - it doesn't seem to make a difference
This is my code in Onsize()
gluPerspective(60, aspect, 0.0,300);//60,aspect, 0.0, 300
I also tried glPolygonMode(GL_FRONT, GL_LINE);
placing it just before drawing each face - and i get a blank screen
10-10-2000, 04:47 AM
I encountered a similar problem some time ago... while rotating a cube I could see faces appear and disappear in a strange way, and it was a mix of these errors:
- I didn't set up properly normals
- I didn't ordered poly vertex counter-clockwise
- I was applying an incorrect transformation
Try to check these...
10-10-2000, 07:09 AM
Yes, you must be sure to wind your polys in the right direction. Also make sure you've got depth testing turned on. I believe by default, if you looked at one side of the poly and from that perspective you saw it wound in a counter-clockwise direction, that side is considered the "front" of the poly and the other side is the backface. You can change this default behaviour with an OpenGL call the name of which escapes me at the moment. Anyway, make sure you wind your polys in the right direction. I've heard people say it doesn't matter which way you wind as long as it is consistent and from what I know, if you're using backface culling, this is dead wrong. It does matter which way if you aren't specifying to OpenGL which way you're winding because the way you wind it determines which side is the front and which is the back.
I've re-examined the polygon windings and made a few changes but get the same result
When added the back-face culling - in onpaint I added the line below
- I think this may be the problem - removing it gives a blank screen I'm not sure why because I already have glEnable(GL_LIGHTING); glEnable(GL_DEPTH_TEST); and glEnable(GL_LIGHT0);
I can submit some code if that helps
[This message has been edited by fox (edited 10-11-2000).]
10-11-2000, 04:05 AM
The problem only happens when you zoom out?
If so, then I'd tend to think you have a problem with your farplane:nearplane ratio.
Hey it works it works - yes it work ha ha ha ha ha ha ha ha ha ha ha ha
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.