Page 1 of 1

Problem with GL

Posted: Sun Sep 21, 2008 9:28 am
by Skeeve
I have a problem with this http://rafb.net/p/34gzzJ89.html

The // doesn't work part should draw a box from the center (glsYc) up to the calculated size if it's positive, and down, if the size is negative. So the vertices are:

Code: Select all

4   3

1   2 - center here
The positive part works, the negative not, i.e. no box is drawn when the vertices are:

Code: Select all

1   2 - center here

4   3
If I start the box not in the center but at the bottom, it increases in size when the calculation gives positive values

Code: Select all

4   3

      - center here


1   2 - bottom
and shrinks for negative ones

Code: Select all

      - center here

4   3

1   2 - bottom
I have no idea why this happens. Can anyone enlighten me please?

Posted: Sun Sep 21, 2008 8:29 pm
by Guided Monkey
I'm much too lazy to see if this is true or even relevant, but if OpenGL uses a right-handed coordinate system, then your second set of vertices defines a quad with the normal facing into the screen. If these quads are not two-sided, then you won't see anything if the normal doesn't point out of the screen.

Like I said, it's just a guess and I am too lazy to look it up.

Posted: Mon Sep 22, 2008 4:27 am
by Skeeve
Sounds logical to me, Money. And it fits to my observation that the bar can be seen if I order the vertices.

Thanks!