Search code examples
c++openglldf

openGL textures that are not 2^x in dimention


I'm trying to display a picture in an openGL environment. The picture's origninal dimensions are 3648x2432, and I want to display it with a 256x384 image. The problem is, 384 is not a power of 2, and when I try to display it, it looks stretched. How can I fix that?


Solution

  • There's three ways of doing this that I know of -

    • The one Albert suggested (resize it until it fits).
    • Subdivide the texture into 2**n-sized rectangles, and piece them together in some way.
    • See if you can use GL_ARB_texture_non_power_of_two. It's probably best to avoid it though, since it looks like it's an Xorg-specific extension.