Jump to content
  • Advertisement
Sign in to follow this  
FrigidHelix

texture coordinates

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

The various websites I read describe the texture coordinates (u, v) such that v increases from 0 to 1, where 0 is the _bottom_ of the texture, and 1 is the _top_ of the texture. When I try this with my own texture I observed the opposite behavior. Perhaps it is because I specify my texture data to glTexImage2D() in row-major form, starting with the topmost row of the image, to the bottom-most. Is everyone else passing data to glTexImage2D in the opposite order? (bottom to top)? And if so why, since most image formats save their data from the top to bottom. thx.

Share this post


Link to post
Share on other sites
Advertisement
If you are consistent in how you specify your texture data and texture coordinates, it doesn't matter how you do it. If that way works for you, then that's good.

Personally, all my texture loading code loads the image bottom up (reversing direction while loading if needed), since that is consistent with the rest of the API. Every default coordinate system in OpenGL got it's origin in the lower left corner, including textures and texture coordinates. Therefore, I choose to follow the API and use the default origin.

I don't know your definition of "most" when you say most formats store the data top down, but some commonly used formats store them bottom up aswell; BMP for example, and TGA can store in both directions (according to a bit in the header). Since they are easy to make custom parses for, they are commonly used. And since they store the data in default order for OpenGL, it's a double score for those formats.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
That's like saying why do some formats specify RGB and some specify BGR?
They just do. Origin of texture coordinates is API-specific. Do not make assumptions.

"Assumption is the mother of all f**kups." :)

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!