Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

ThomasHopf

OpenGL 2D Graphics with OpenGL

This topic is 6225 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi! Is there any possiblity to use common 2d functions like bitmap blitting or drawing lines with openGL? i am searching for a solution that works with pixel coordinates, so i can blit images or draw lines like with the gdi, but gdi isn''t working with my GL code (because of the double buffering?)

Share this post


Link to post
Share on other sites
Advertisement
well, you can do 2d in OpenGL, but it isn''t as easy as drawing sprites. Instead of sprites you use textured quads. to get the 2d world set up, do this:
glViewport(0,0,screen_width,screen_height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0f,screen_width,screen_height,0.0f,-1.0f,1.0f);
glMatrixMode(GL_MODELVIEW);

then, you can say glVertex2f(x,y) to draw your quads.

HHSDrum@yahoo.com
Polarisoft Home Page

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!