View Full Version : glTexImage2D problem with a large image

02-02-2009, 03:41 AM
Hi All,

Displaying an image from 8192 x 300 pixels is no problem with

glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, ImageWidth, ImageHeight, 0,GL_LUMINANCE, GL_UNSIGNED_SHORT, addr(WordBuffer[0]));

But if I use this same function with an image of 12288 x 300 pixels nothing is being displayed.

Any idea why this is?
Is 12288 to large?



02-02-2009, 03:49 AM
Textures have size limitation, check for it with:

glGetIntegerv (GL_MAX_TEXTURE_SIZE, &max_texture_size);

02-02-2009, 06:43 AM
glGetError returns GL_INVALID_VALUE.

Is glDrawPixels capable of displaying a large image?
In the past I used glTexImage2D because I wanted to manipulate the image on screen like glRotatef, glScalef and glTranslatef.

Are these functions also avaible for glDrawPixels?


02-02-2009, 08:32 AM
As already said, check glGetIntegerv (GL_MAX_TEXTURE_SIZE, &max_texture_size), that will tell you the maximum size, that is supported by your particular GPU.

However, to spoil the fun, i will tell you that there is currently no GPU that supports textures bigger than 8192 pixels in any one direction.


02-03-2009, 12:02 AM
You're right. I tried glGetIntegerv (GL_MAX_TEXTURE_SIZE, &max_texture_size) but it returned 91537540. Bud I made an error.
I correct it and now it's returning 8192.

I have modifed my code, so I replaced glTexImage2D by glDrawPixels. The first test shows an image of 12288 x 300.
Unfortunately the frame rate drops when zooming out (whole image on screen). Frame rate drops from 60Hz to 20Hz.

Thanks all for your help.

02-03-2009, 02:15 AM
stay away from drawpixels.
just split your texture in several tiles.

02-03-2009, 04:37 AM

Problem solved.