View Full Version : Writing images directly to buffer
Hi. I'm writing a 3D engine that lets you walk around a 3D world and want to display a 2D image on the screen at the bottom to display information and the like that will stay in one spot and not move around the game world. From what I've seen, all the blitting functions in OpenGl require world coordinates and do everything in 3D. How do I draw something to the screen that ignores vector coordinates and stays in 2D while everything else is 3D? Thanks for the help.
06-23-2000, 03:17 PM
i've started to write a 3d engine too.
but i'm in trouble here..
is ask to much to take a little look in your code ??? http://www.opengl.org/discussion_boards/ubb/smile.gif)
what language ????
just change the projection matrix to an Orthographic projections.
For simplicity, use gluOrtho2d or something like that.
Either you go to projection mode and set up Ortho projection mode, or you render everything right behind the near clipping plane in the same Z axis, scaling your X and Y coordinates correctly.
If you do this with source alpha blending and an appropriate alpha set, your 2D graphics will work as "overlay" on top of your 3d.
I know about using the Ortho2D function to change the projection but won't that mess up all the 3D rendering I've done already? Also after figuring out how to do stuff on top I would also like to figure out how to do a flat constant bitmap background that doesn't change with camera movements and doing the overlays will not allow me to do a background. I still don't see how all this is possible yet I see it done in games all the time. Thanks for the help.
changing the projection matrix won't mess up anything. What has been drawn is drawn!
By changing the projection matrix, you just modify the way the new colors will be added to framebuffer.
Do a background that never changes. You can do this :
1. Disable writing to depth buffer.
2. Draw a texturemap rectangle that fill the screen. The texture being the bitmap you are going to use.
3. Draw stuff like you use to. (enabling depth writing if necessary).
Okay. Now my question is how do you disable depth writing? I understand now how all this stuff works and why even if I draw something 2D at the beginning it still stays on top so if someone could tell me how to limit what I draw to when I draw the 2D stuff I could easily get all this patched up. Thanks for the help.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.