Advertisement

Drawing graphics

Started by April 16, 2003 09:52 AM
3 comments, last by thynosferatu 21 years, 10 months ago
How do I put graphics 1) As a Background 2) As a sprite 3)As an object in opengl?
btw, I''m talking about 2d graphics.
Advertisement
1) glBegin()
2) glBegin()
3) glBegin()

Its all the same thing, it just depends how you translate it.
Can you put the entire code as an example? I''m kind of confused right now. Thanks
A few posts down there''s one from me where I show how to put the border around the screen. Well, it''s not really a border it''s a background but it''s the same concept. In a nutshell, there are 2 projection modes in OpenGL, ortho and frustum. In ortho mode, objects further away from the camera aren''t any smaller. A typical use of ortho mode is for rendering in 2D, since it looks exactly the same no matter what the Z coordinate. You can play around with the z coordinates and with enabling/disabling depth testing to make it look like a background or foreground.

Lastly, it was suggested to me that I map the picture to a quad instead of just drawing it because it would render tons faster, and they were right.

I honestly don''t know whether or not OpenGL explicitly supports sprites, but I do know that you can use blending to make a black part of a bitmap seem transparent - check Nehe tutorials #8 and #9, that should get you started.

And what do you mean by drawing an "object"?

This topic is closed to new replies.

Advertisement