2d and 3d
Hi
I''m tryng to mix 2d and 3d in opengl, but nothing shows up in 2d
Correct me if i''m wrong, but my code is something like this:
x,y,x1,y1 are pixel coordinates
glMatrixMode(GL_PROJECTION); glPushMatrix();
gluOrtho2D(0,0,800,600); // -->to make a window 800x600 pixels
glBegin(GL_QUADS);
glVertex2d(x, y);
glVertex2d(x,-y);
glVertex2d(-x,y);
glVertex2d(-x,-y);
glEnd();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
and here, i have my code for a spining cube..
I sure i can simulate pixel coordinates.., it''s not logical
to use space coordinates in 3d, is this correct?
Where is the problem??
can anyone help me??
thanks
Lombardix
a little off topic, but you push the projection matrice onto the stack, and pop it back into the modelview matrice =)
yes, i do that so that i can get the 3d projection as t was before i start the 3d drawing..., isn''t it correct?
sorry.., i didn''t wrote correctly..
I push the matrix so i can preserve the 3d projection, then i make the 2d drawing, and then i put back the 3d projection...
I push the matrix so i can preserve the 3d projection, then i make the 2d drawing, and then i put back the 3d projection...
yes, i''m telling the color...
Can some nice soul teach me to draw 2d and 3d scenes at the same time in opengl??
Lombardix
Can some nice soul teach me to draw 2d and 3d scenes at the same time in opengl??
Lombardix
Keep it in projection mode, just draw the 2D images in the distance so you can see them...
Make sure to use "glDisable(GL_DEPTH_TEST)" and then re-enable it when you''re done drawing the 2D images.
Make sure to use "glDisable(GL_DEPTH_TEST)" and then re-enable it when you''re done drawing the 2D images.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement