PDA

View Full Version : Using OpenGL For 2D Stuff...



Sephiroth
05-20-2003, 06:31 AM
OK, I've been doing 3D in OpenGL for ages now, and it works just fine. However, I want to try some 2D stuff now, and I was wondering how I would go about displaying everything in a 2D aspect. I want to try making a platform game, like Sonic or Mario, which is why I need a 2D display mode. Thanks for the help.

nexusone
05-20-2003, 08:42 AM
I think openGL works great in that type 2D application.

On a 2D game like Sonic, you draw in layers.
First the back ground scene, then the next layers scene, object layer (Sonic, Rings things to bump into), forground layers ( score graphic, etc.).

With openGL layers become Z depth, and use textured qauds for sprites.

nehe.gamedev.net has a nice tutor on a simple 2D game.... lesson 32 I think.



Originally posted by Sephiroth:
OK, I've been doing 3D in OpenGL for ages now, and it works just fine. However, I want to try some 2D stuff now, and I was wondering how I would go about displaying everything in a 2D aspect. I want to try making a platform game, like Sonic or Mario, which is why I need a 2D display mode. Thanks for the help.

Sephiroth
05-20-2003, 10:03 AM
Ah good, that is whatI have been coding for. I'm setting the engine up similar to that. Here's a basic run-down. Each map specifies a clear-color in case the background has transparency, for effects such as sky behind a moving background. Then there are up to four background layers drawn, each having the ability to use transparency for a wide range of effects. Now we draw the blocks and such that the player can collide with. Next up is the player and enemy stuff, as well as usable objects. Finally we have the info (score, health, whatever). And if the user had pressed the menu button, we'd draw the menus last.

Anyways, thanks for the info! I just wanted to make sure that I was going about this project the right way before I had some fancy engine that looked like crud!