PDA

View Full Version : glTexSubImage2D crashes



lobbel
05-07-2010, 10:38 AM
Hello when I resize the Windowsize I also need to resize a
texture and fill it with content. So I resize the Texture
with glTexImage2D and then upload the changed data with
glTexSubImage. But when I resize the Window just a little bit then the application crashes at glTexSubImage2D. But I dont
know why. But when I resize the window with the maximize button
in the windowbar there are no crashes. I can do it as often as
I want. But resizing the window picking the window border and
change the size cause in a crash.

any ideas ?


regards,
lobbel

Edit: it crashes only if I change the window width.

lobbel
05-07-2010, 10:44 AM
solved,
it was my mistake.. :D

regards,
lobbel

Dynamite
07-20-2010, 06:16 AM
Hi lobbel,

i'v got the same problem. What was your mistake and how did you solve it ?

Thanks,
Anton.

Dynamite
07-20-2010, 12:00 PM
Ok, I have solved the problem by changing the format from GL_RGB to GL_RGBA. Seems to be a bug in nvidia driver.

Anton.

ZbuffeR
07-20-2010, 02:39 PM
Read "7. Watch Your Pixel Store Alignment" here :
http://www.opengl.org/resources/features/KilgardTechniques/oglpitfall/

GL_RGB is not a multiple of 4 bytes (the default). And if you don't take special care, you will get access to invalid memory -> crash.

Just use this and it should work with GL_RGB too :
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glPixelStorei(GL_PACK_ALIGNMENT, 1);