PDA

View Full Version : glTexImage2D problem with a large image



PeterHer
02-02-2009, 04: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?

Thanks.

Peter.

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

glGetIntegerv (GL_MAX_TEXTURE_SIZE, &max_texture_size);

PeterHer
02-02-2009, 07: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?

Thanks

Jan
02-02-2009, 09: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.

Jan.

PeterHer
02-03-2009, 01: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.

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

PeterHer
02-03-2009, 05:37 AM
Thanks.

Problem solved.