And the code to draw the object is in a different file/class (ie the worldGroup->drawObj() call)
And that function has these few lines.
void simWaypoint::drawObj(){
objPosY);
GLfloat currentcolor[3];
glGetFloatv( GL_CURRENT_COLOR, currentcolor);

What I get is just the background and I cant see my red square drawn by the other objects function.
If I comment out drawGround in the main program, I can see my red dot there. Help!

MikeC

11-02-2004, 02:30 PM

I'm deeply suspicious of the line:

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

Clearing the depth buffer implies that you a) have a depth buffer and b) have enabled it. In a 2d app, depth-buffering really doesn't make any sense, since everything is at the same depth.

If you *have* enabled GL_DEPTH_TEST and haven't changed glDepthFunc from the default GL_LESS, GL isn't going to draw your red dot because it's at exactly the same depth (0) as your background.

HTH
Mike

amoskoh

11-02-2004, 04:08 PM

thats why i was wondering how the shapes are ordered in my 2d application?
I assumed that it would be layered according to which I drew last. So having the draw for my object last meant that I drew it over the background?
So If i disabled the depth test.. how would the shapes be ordered?

ZbuffeR

11-02-2004, 04:14 PM

No depth test means last drawn is always 'on top'.

MikeC

11-02-2004, 04:15 PM

Originally posted by amoskoh:

I assumed that it would be layered according to which I drew last. [...]
So If i disabled the depth test.. how would the shapes be ordered?The way you assumed.

Also known as "Painter's Algorithm" - later paint goes on top of earlier. Depth-buffering is designed specifically to avoid this, which makes your use of it somewhat ironic.

amoskoh

11-02-2004, 06:13 PM

oh. ok yeah it turns out ok when i remove the depth test.
Thanks a bunch