viewport

Started by
3 comments, last by nipon 22 years, 6 months ago
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.
Advertisement
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
"The important thing to remember when programming is: When you're 90% complete, there's still 50% more to go."
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


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



ICQ: 130925152Email: e.j.folkertsma@student.utwente.nl
orthographic projection matrix... orthographic perspective is an oxymoron.

sorry... just had to set that straight... little things like that bug me to death sometimes

This topic is closed to new replies.

Advertisement