🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

2D stuff in OGL

Started by
3 comments, last by kill 24 years, 6 months ago
It can display bitmaps?
William Reiach - Human Extrodinaire

Marlene and Me


Advertisement
Here's how I setup 2D for a 2D Pong game I did in OpenGL, which you can actually d/l from http://www.jps.net/mrhino/ .

code:
// set up viewingglMatrixMode(GL_PROJECTION);glLoadIdentity();glOrtho(0.0, float(WINDOW_WIDTH), 0.0, float(WINDOW_HEIGHT), -1.0, 1.0);glMatrixMode(GL_MODELVIEW);

That sets the projection and all that stuff to 2D, and then when you render, you just use the x and y coordinates using glVertex2i(x,y) or whatever your flavor. Hope that helps.

Kevin

Admin for GameDev.net.

Gromit-

OpenGL does provide functionality to draw pixels (and hence bitmaps) but you're probably better off using textures to take advantage of OpenGL's features(read hardware acceleration).

This won't be pixel perfect but it can allow you to do cool stuff. Grand Theft Auto (which is basically 2D end though it was 3D) does this nice thing where the overhead view zooms out when you're moving really fast and then in when you're moving slow. GTA II does some really neat stuff where things fly toward the camera. If you started crunching bitmaps for that it'd look pretty ugly.

If you strictly need to use bitmaps though it's probably not the way to go.

-the logistical one-http://members.bellatlantic.net/~olsongt
Hi. I am writing an action puzzle game, and recently I decided to write my graphics in OGL. My game is 2D, but I am using some 3D effects OGL provides. However, I just put everything in 3D space. What do people mean when they say OGL does stuff in 2D? Does it mean u turn of projection? Would someone please explain what this whole thing means, and if possible, how to do it.
Thanx
I have yet to look into teaching myself opengl. Haven't had enough time. So I am certainly no expert on the subject.
William Reiach - Human Extrodinaire

Marlene and Me


This topic is closed to new replies.

Advertisement