Jump to content
  • Advertisement
Sign in to follow this  
MadJerry

OpenGL UV mapping problem

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

Hi there. I have an interesting problem with uv mapping In 2D graphics. If you can take a look @ these screens http://www.codeminion.com/codeminion/files/bad.JPG http://www.codeminion.com/codeminion/files/good.JPG you will see the problem right away. The only difference is that the first quad is a rectangular figure and the second one has the two upper vertices moved a bit to the middle it seems like a uv is the mapping problem. The graphics are rendered using DirectX draw primitive, I also tried this on OpenGL and I’m having the same results. It only happens when the quad is not rectangular figure. Both directx and opengl have orthogonal projection set. So the question is if there is a way to properly stretch the texture on the quad ? Thanks in advance Jerry

Share this post


Link to post
Share on other sites
Advertisement
Hi Jerry,

Check this page by Cass Everitt for more details. Basically this problem appears because the geometry has different representations in object and texture space (quad vs trapezoid), and it has to do with the way quads are rendered using graphics hardware.

You can either use the solution proposed by Everitt (calculate a suitable q-coord for the vertices) or you can use this approach : Correcting Texture Mapping Errors Introduced by Graphics Hardware.

The problem with the first method is that in some situations the number of times a texture is tiled can be different from what you wanted it to be. E.g. it may be repeated more times in the V direction because of the "pespective" projection. The problem with the second method is that it may need too many subdivisions in order to look correct.

Hope that helps.

HellRaiZer

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!