iDevGames Forums
2d game with opengl tutorials - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: 2d game with opengl tutorials (/thread-7795.html)



2d game with opengl tutorials - roka-tarat - May 1, 2002 02:56 AM

Hello,

I want to port a win32 2d game made with directx. To take full hardware acceleration advantages, I want to use opengl. Anyone know a good tutorial about creating 2d games with opengl?

Thanks a lot,

Marc Casas


2d game with opengl tutorials - jefftkd - May 1, 2002 07:38 AM

It really isn't that difficult. I don't know of any tutorials, but you will probably want to get the "Red Book" and look up the following things:

+ glOrtho() (to do 2D instead of 3D)
+ glBegin() / glEnd() (for rendering quads/sprites)
+ glBlendFunc() (to add transparencies to your sprites)
+ glRotatef() / glTranslatef() (to rotate and move sprites)

Also, http://www.opengl.org has lots of code examples for many things -- it would blow my mind if they didn't have a tutorial there somewhere.

HTH, Jeff Cool


2d game with opengl tutorials - Mars_999 - May 1, 2002 10:43 AM

Quote:Originally posted by jefftkd
It really isn't that difficult. I don't know of any tutorials, but you will probably want to get the "Red Book" and look up the following things:

+ glOrtho() (to do 2D instead of 3D)
+ glBegin() / glEnd() (for rendering quads/sprites)
+ glBlendFunc() (to add transparencies to your sprites)
+ glRotatef() / glTranslatef() (to rotate and move sprites)

Also, http://www.opengl.org has lots of code examples for many things -- it would blow my mind if they didn't have a tutorial there somewhere.

HTH, Jeff Cool

You can use glOrtho() to do 3D. You just don't get perspective correction like gluPerspective(). I am planning on using glOrtho() for my top down games since you dont' need to worry so much about Perspective correction. If you want to you could have your models drawn to scale before you use them and then you shouldn't have to worry about perspective correction? Hope I am right?


2d game with opengl tutorials - Jeff Binder - May 1, 2002 03:30 PM

Don't forget to read about textures, that's how you'll be rendering your graphics. You also might want to check out vertex arrays and gluOrtho2D().

If you're on OS X, you can get documentation on a specific GL function by typing
man functionname
at the terminal. This information is basically the same as the contents of the OpenGL Reference Manual (the Blue Book), so there's no great rush to buy that book (although it's still handy to have around).

EDIT: I forgot to mention, also check out this web site:
http://nehe.gamedev.net/
It has a lot of good GL tutorials.