View more

View more

View more

Image of the Day Submit

IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

viewport

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

4 replies to this topic

#1nipon  Members

Posted 02 October 2001 - 08:08 AM

i use GLviewport(0,0,height,width); i would like to know number of pixel / 1 length on opengl example glbegin(GLpolygon) GLvertex2f(0,0); GLvertex2f(0,1); glend; i would like to know length of line(in pixel) of this polygon.

#2mkaltner  Members

Posted 02 October 2001 - 08:54 AM

correct me if i''m wrong but wouldn''t that draw a line one pixel long? and depending on the viewport, it''ll LOOK like it''s bigger or smaller but it''s still only 1 pixel, isn''t it?

- Mike

#3nipon  Members

Posted 02 October 2001 - 10:05 PM

no
it ''s bigger than 1 pixel; (almost 10 pixel)
i would like to know its size (in pixel).
because i will map picture to view port of opengl.
For Example

i have one picture(Height=200,width=200).
i will draw this picture to screen of opengl.
How do i do?

thank you

#4Dark  Members

Posted 03 October 2001 - 06:04 AM

Well... There is one problem with this... there really isn''t a fixed size for that so called "1 length" it really depends on the screen resolution you are using... However you can calculate it by retrieving the Perspective Matrix that OpenGL uses and perform some math on that... there is one other thing though... the z-depth is also a factor for the length of the line...

Fortunately OpenGL supports a mechanism for you to create a so called Orthographic matrix... which you can give your own coordinate system, then map the textured quads on it and it will work in every thinkable way. (So just set up an Orthographic Perspective Matrix in OpenGL)

I hope this was of any help... however if you remain really stuck with the problem contact me:

ICQ 130925152
Email e.j.folkertsma@student.utwente.nl or mitolah@hotmail.com

Dark