Skip to main content
gamedev.net
🔒 Locked

Stupid Question

Started by fathom88 5 replies 700+ views
Original Post
fathom88
fathom88
If I use OpenGL in windows, I can't use GDI, right?? I'm pretty sure I can't. I wanted to use the GDI to draw simple objects things over my complex OpenGL scene. Thanks. I just wanted to make sure.
Wan
Wan
It's not entirely impossible, nor is it recommended.
Why can't you just use OpenGL to draw these simple objects things?
If you're taking about 2D menus or buttons, use the ortho projection.
fathom88
fathom88
>>Why can't you just use OpenGL to draw these simple objects >>things?

I wanted to avoid re-drawing the entire scene. I wanted to draw my simple object without having to go through the trouble of rendering the complex static scene in the backgorund.

>>If you're taking about 2D menus or buttons, use the ortho >>projection.

I'm not sure what you mean by this. Do you mean create a second view port and rendering it below another view port (a window with two view ports; one covering the top half of the window another covering the bottom half). I trying to draw my simple object over my scene. Thanks for the help. It's appreciated.
dimebolt
dimebolt
Quote:
Original post by fathom88
>>Why can't you just use OpenGL to draw these simple objects >>things?

I wanted to avoid re-drawing the entire scene. I wanted to draw my simple object without having to go through the trouble of rendering the complex static scene in the backgorund.


Why would you have to re-draw the entire scene? I don't understand.

Quote:
Original post by fathom88
>>If you're taking about 2D menus or buttons, use the ortho >>projection.

I'm not sure what you mean by this. Do you mean create a second view port and rendering it below another view port (a window with two view ports; one covering the top half of the window another covering the bottom half). I trying to draw my simple object over my scene. Thanks for the help. It's appreciated.


No second viewport is necessary. After rendering the 3D scene, just push an orthographic projection on the projection matrix stack and draw your 2D objects. Just make sure you disable depth buffer reads to make sure 2D stuff is always on top.

Tom
Cocalus
Cocalus
I looked around a bit, it could be done done with a single buffered opengl( at least in winnt), But mixing the two is really slow, and basically a bad idea.

And the ortho stuff draws on top of your scene.

Basically you draw you 3d stuff like normal. And after you've drawn finished drawing your scene, you then draw some 2d stuff on top with opengl.

I'm writing this from memory, so I hope I got everything
//All the 3d stuff is drawn by this pointglMatrixMode(GL_PROJECTION);glPushMatrix();glOrtho(...); //uses what ever settings work for the 2d stuff you want to drawglMatrixMode(GL_MODELVIEW);glLoadidentity();glDisable(GL_DEPTH_TEST);//Now draw your 2d stuff here with opengl, if you need to keep your 3d modelview matrix you can push it before glLoadIdentity, and pop it after drawing 2d stuff.glEnable(GL_DEPTH_TEST);glMatrixMode(GL_PROJECTION);glPopMatrix();glMatrixMode(GL_MODELVIEW);
smitty1276
smitty1276
Do yo mean that you have a complex scene that you want to render ONE TIME, and some other objects (simple ones) that will be rendered repeatedly on top?

If that's the case, you can either render to a texture ONE TIME and display the result in the background on a textured quad, or you can just load the background from an image if its static in that sense, and if your circumstances permit.

fathom88
fathom88
Yes and No. The complex image is static for all of one second. Then it needs to be updated with new data. Scene is re-drawn. The simple object does get updated and drawn repeated; only at a much higher rate.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.