View Full Version : glScale/depth test
07-17-2006, 02:48 PM
whenever i use glScale with a negative number, the depth test seems not to be performed. if i render my geometry as usual, everything is fine, but if i use glScalef( 1.0f, -1.0f, 1.0f ) to mirror the geometry (needed for reflections), it's all screwed up. is this a known issue or am i missing sth obvious? thanks in advance!
07-17-2006, 03:39 PM
With scale -1 you end up with reverse-winding polygons, that are culled by glEnable(GL_CULL_FACE), and depends on glCullFace(GL_BACK).
Play with glFrontFace(GL_CW).
BTW, if someone can explain why we have both glCullface and glFrontface ? The semantic is different, but the operation seem equivalent ?
What am I missing here ?
EDIT: Ok, 2 sided lighting. nevermind :)
07-17-2006, 03:51 PM
First off, there's simply a conceptual difference between "Which type of faces should be culled" and "Which vertex order indicates front-facing polygons". Having both functions allows you to formulate algorithms that use face culling (for example stencil shadow) independently of the polygon winding of your particular geometry.
Secondly, the selection of winding for front facing polygons also affects other parts, not related to culling, such as materials (two sided lighting and front/back side material).
07-17-2006, 04:40 PM
ok so i guess i should use glCullface(GL_FRONT); to solve this problem?
07-18-2006, 03:44 AM
It makes more sense with glFrontFace(GL_CW).
Don't forget to go back to glFrontFace(GL_CCW) when scale is >0.
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.