# OpenGL Front face change - any help appreciated!

This topic is 3810 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi again! I'm having a really weird problem with my call to glOrtho(), in that when I call it as GL11.glOrtho(0, Display.getDisplayMode().getWidth(), 0, Display.getDisplayMode().getHeight(), -1, 1); and then draw my quad, the quad displays as I would expect. I draw my quad while my Front Face is Counter-Clockwise (call glFrontFace(GL_CCW); when I init the OpenGL stuff). However, my problem arises when I try calling glOrtho() as GL11.glOrtho(0, Display.getDisplayMode().getWidth(), Display.getDisplayMode().getHeight(), 0, -1, 1);. Here, my quad doesn't display anywhere! After some fiddling around, I found that if I changed the ordering of my vertices on my quad to make them Clockwise, it drew fine! So my question is, does anyone know why this is so? It seems like the Front Face changes unexpectedly when I change my coordinate system using the glOrtho call. I'm guessing there is some concept I'm missing when you change coordinate systems, but I'm really at a loss. btw, I'm using the LWJGL library in Java to do my OpenGL (don't know if that matters tho). Thanks for any help! I appreciate it! Cheers Jarrett

##### Share on other sites
Typically its -1, 1, -1, 1, 0, farPlane

##### Share on other sites
But wouldn't that leave me with an area of only 2 pixels x 2 pixels? I was under the impression that glOrtho() should receive screen dimensions (i.e. the Display.getDisplayMode().getWidth() would return 800 in my case, and likewise .getHeight() returns 600).

##### Share on other sites
Quote:
 Original post by dpadam450Typically its -1, 1, -1, 1, 0, farPlane

I've never seen this used, though I'm aware it is (to the OP: it just maps the viewport coords from -1 to +1, it's nothing to do with the number of pixels). Most code I've come across uses pixel coords like the OP, and -1, +1 for the near and far planes.

If you change your y coordinates, you changing the winding of the polygon you draw. eg:

4--3     1--2|  |  => |  |1--2     4--3

In the first quad, up the page is higher y. In the second, up the page is lower y. Thus while you're drawing your face in exactly the same way, it's no longer ccw, and becomes a back face.

##### Share on other sites
Ahhhh ok, that makes sense. I've recoded my 2D stuff with that in mind and it's working beautifully. Thanks for the insight sprite_hound!

cheers

1. 1
2. 2
JoeJ
18
3. 3
4. 4
frob
12
5. 5

• 13
• 16
• 13
• 20
• 13
• ### Forum Statistics

• Total Topics
632189
• Total Posts
3004653

×