0
\$\begingroup\$

I'm using FreeImage and Squish library. I think there is no matter what row order is passed to squish::CompressImage (it's simply like inversed image). FreeImage stores rows from bottom to top, the pixel(0, 0) is placed in bottom-left corner. When I put RGBA or DXTn data to glTexImage the data at index 0 should be at top-left corner or at bottom-left corner?

\$\endgroup\$
0
\$\begingroup\$

glTexImage takes it's data pointer starting from the bottom-left corner: https://www.opengl.org/sdk/docs/man/html/glTexImage2D.xhtml

The first element corresponds to the lower left corner of the texture image. Subsequent elements progress left-to-right through the remaining texels in the lowest row of the texture image, and then in successively higher rows of the texture image. The final element corresponds to the upper right corner of the texture image.

However, GL texcoords also begin from point (0,0) being the bottom-left corner, so the two cancel each other out, and for most (but not all) purposes you can treat glTexImage as though it started from top-left.

The exceptions are calls such as glTexSubImage, glCopyTexSubImage where you specify a rectangular region in the texture, and so you need to be aware that (0,0) is bottom-left.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.