The following call to glTexImage2D creates an incorrect texture on my ATI Radeon HD 4350 with updated drivers:
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB8, 2731, // width 512, // height 0, GL_BGR, GL_UNSIGNED_BYTE, pixels);
Anything larger than 2,730 in the x dimension causes problems. For some values, the texture is white, for others, it is distorted. I can provide images, if it will help. GL_MAX_TEXTURE_SIZE is 8K and the code works on my GeForce 8.
As a workaround, I found that you can glTexImage2D with null, then immediately glTexSubImage2D:
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB8, 2731, // width 512, // height 0, GL_BGR, GL_UNSIGNED_BYTE, 0); // null pixels glTexSubImage2D( GL_TEXTURE_2D, 0, 0, // x offset 0, // y offset 2731, // width 512, // height GL_BGR, GL_UNSIGNED_BYTE, pixels);
Has anyone ran into this before? Do you suggest any other workarounds?
Also, the y dimension seems to have a higher limit than 2,730; somewhere between 4K and 8K.