Results 1 to 4 of 4

Thread: OpenGL for 2D

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2006

    OpenGL for 2D

    I'm doing a 2D graphics project for a class. Is
    it reasonable to use OpenGL? I've got it working
    OK for drawing, but I need an inverse transform
    (viewport to worldspace). This is indeterminate
    in a 3D-2D projection, is there some way around


  2. #2
    Senior Member Frequent Contributor
    Join Date
    Feb 2006

    Re: OpenGL for 2D

    Yes there is, use glOrtho projection, with it you can set the projection to match the window coordinates, or use some custom coordinate grid.

  3. #3
    Super Moderator OpenGL Guru imported_dorbie's Avatar
    Join Date
    Jul 2000
    Bay Area, CA, USA

    Re: OpenGL for 2D

    Exactly, you have complete control over the projection matrix and the viewport.

    If you draw primitives on an x y plane where z is constant this can work even with a glFrustum call made to set up the projection.

    If you go drawing 3D stuff and expect to infer the position from a 2D screen then the solution is not actually indeterminate, is a 3D solution i.e. a point in teh screen defines a world space vector from the eye and a rectangle on the screen is a frustum.

    Doing basic 2D is very straightforward, you have all the tools for this in OpenGL.

  4. #4
    Junior Member Newbie
    Join Date
    Jul 2005

    Re: OpenGL for 2D

    OpenGL is really good for 2D vector graphic. You can see the results that i have achieved with my engine here: .
    Then, if you are interested, you can learn more here:

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean