#### Archived

This topic is now archived and is closed to further replies.

# 2d and 3d

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

## Recommended Posts

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

##### Share on other sites
a little off topic, but you push the projection matrice onto the stack, and pop it back into the modelview matrice =)

##### Share on other sites
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?

##### Share on other sites
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...

##### Share on other sites
are you telling it what color to draw? glColor3f(r,g,b);

##### Share on other sites
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

##### Share on other sites
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.

• 15
• 13
• 35
• 39