PDA

View Full Version : glTexImage2D crashes on NV 93.71



knackered
05-15-2007, 07:30 AM
anyone else get this crash?

GLuint texID;
glGenTextures(1, &texID);
glBindTexture(GL_TEXTURE_2D, texID);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
int w=4000-1, h=4000;
char* pixels = new char[w*h*3];
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, w, h, 0, GL_RGB, GL_UNSIGNED_BYTE, pixels);

skynet
05-15-2007, 07:39 AM
What's your unpack alignment?

knackered
05-15-2007, 07:51 AM
4, why do you ask?
sooorryyy. :)

k_szczech
05-15-2007, 08:41 AM
Considering your recent comments on catalyst "the unsinkable" I'm surprized to see such heroic attempt to exploit a weakness in your favoured driver.

Now seriously - what do you guys think of making alignment 1 by default? Should be convenient for beginners and if someone wishes to use 2 or 4 he can always easily change it anyway.
I guess such minor change wouldn't be much of a problem to introduce even at late development stage of Longs Peak specs and implementation (I assume both NVIDIA and ATI started their implementations allready).

knackered
05-15-2007, 10:41 AM
I doubted the chosen one, and was proven wrong. Praise be the chosen one.

It's a legacy thing left over from when textures could only be power of two and hence would always have a width aligned to 4 pixels. I can't get used to this freedom to have textures whatever size I want.
As with all legacy things, the default of 4 should be ousted in the new GL.

Relic
05-16-2007, 02:19 AM
>>when textures could only be power of two and hence would always have a width aligned to 4 pixels.<<

Not true, the alignment is per row and tightly packed user data of a power-of-two 2x2 GL_RGB8 texture has rows not aligned to 4 bytes, which will bite beginners most often when using mipmaps.

knackered
05-16-2007, 08:42 AM
come again?

k_szczech
05-16-2007, 10:23 AM
What Relic says it that's safe to use any format if your texture has power of two size and is at least 4x4.
If you want to pass mipmaps you have to pass 2x2 texture image (1x1 is no problem :) ). That means with RGB8 you need to be carefull with alignment.

knackered
05-16-2007, 12:26 PM
ah right, ok cheers.

Joseph Steel
05-17-2007, 12:21 AM
I don't know if you've fixed your problem, but looking at the code, the dimensions of the texture are not powers of 2 (3999x4000).

knackered
05-17-2007, 01:57 AM
thank you joseph, good call.