Displaying bitmaps NOT using textured quads

Started by
10 comments, last by griffenjam 22 years, 7 months ago
If you''re writing a "2D" game it''s going to be 3D anyway, as far as the hardware is concerned. You''re just going to be texturing flat quads in 3d space.

Do you ever watch the History channel, where the camera pans across an old photograph or something? SURPRISE! That photograph is actually a real life 3d object displayed as a 2d image on the television. Same concept.
Advertisement
I guess I''ll help you out a bit...

Here''s a technique that will draw any size sprite on an opengl screen.

1) Determine the size of the sprite. (30pixels x 40pixels)
2) Find the closest ^2 that the sprite will fit into. for the 30x40 example it would be 32x64.
3) Make a texture the size of the ^2(32x64) and paint the sprite(30x40) onto the corner.
4) Draw a quad with the texture, but the the texture coordanites set correctly.

You can also use one giant 1024x1024 texture with all your sprites on it and use the appropriate texture coordanites.

You''d really be better of using an API that will allow you direct access to blitting and pixels like DirectDraw, or if your using LINUX or another real OS Allegro or SDL.

The only reason you should stick to opengl is if your going to be doing heavy alpha blending or antialiasing or rotations.

This topic is closed to new replies.

Advertisement