Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: defined Pixelsizes for Polygones

  1. #1
    Junior Member Newbie
    Join Date
    Nov 2001
    Hambuug, Germany

    defined Pixelsizes for Polygones

    Perhaps this is a stupid question, but I haven't found a good answer in the tutorials I looked in yet.

    At the moment I just want to use openGL Routines to draw 2D Elements on the Screen. On most Tutorials it is simply solved by defining a Polygon wich Elements all have the same Value (normaly 0.0) in the Z Axis.
    But my Problem here is, that theese Polygons sizes are all kind of relative to the size of the window, where they are painted on.
    What I instead of that want, is for example a rectangle which is 40 Pixels wide and 40 Pixels high, without any influence from the size of the window on which it is being painted on.

    Can somebody tell me, whre I can read something about doing this ?
    Run ET run

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

    Re: defined Pixelsizes for Polygones

    The easiest way would be to set your viewport to a fixed size instead of the size of the window. Normally the glViewport is adjusted as the window changes, this determines the projected coordinate window mapping.

    The other thing you could do is adjust the projection, matrix (probably a simple glOrtho in your case) to maintain a fixed size as the viewport changes with window dimensions.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts