Jump to content
  • Advertisement
Sign in to follow this  
vivekd

Mapping from pixel to world co-ordinate values

This topic is 4489 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

While drawing lines with desired width, we use a value in glLineWidth(), which represents the width in pixels. How do I get this value in openGL units(i.e world coordinate system)? My objective is to draw a line of a particular width(say 'x' pixels). Now I want to translate the line along x-axis and y-axis by that width('x' pixels). While translating, I need to mention the unit as per the world co-ordintes and not the pixel values. Is anyone aware of this type of mapping from pixels to world co-ordinate values?

Share this post


Link to post
Share on other sites
Advertisement
If the line is in 3D, with a constant and finite thickness in world space, then it won't be an even thickness all the way along in screen space (it would appear thicker nearer to you). If you want to draw such objects then you should probably be making a 3D approximation to the line (use gluCylinder, maybe) and not using GL_LINES.

Share this post


Link to post
Share on other sites
But dont you think that using gluCylinder for every line replacement would make the application heavier or time consuming?

Share this post


Link to post
Share on other sites
Yes, of course. But if you want lines that vary in thickness in screen space then you will have to use some 3D primitives (a GL_POLYGON at least).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!