Texture Map Max Size

I am trying to map a texure to a mesh. I make a call that looks like this:

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 512, 2048, 0, GL_RGB, GL_UNSIGNED_BYTE, pImageBuffer );

and eveything works fine. But the real size of my image is 512 x 4096. When i change the height parameter to 4096 i get an error: GL_INVALID_VALUE from the glGetError function. This leads me to believe that 2048 is the max height for an 2D image buffer. Is this so? and if it is, is that a value that can be modified? Thanks -

Hi !

The max limits are specified by the hardware, you can use glGetIntegerv to find out the max limit (GL_MAX_TEXTURE_SIZE), but it might also be a memory problem (409640963 is 50MB!)


You should do as mikael_aronsson suggested and if the max texture size is 2048 then you can break up your existing texture data into 2 separate textures 512x2048. It does make it more tedious when mapping it but you’ll figure that out.