PDA

View Full Version : glTexImage2D Error?



xerzi
08-12-2014, 08:01 PM
Basically have this:



glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);


glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);


glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA8, 3, 10, 0, GL_ALPHA, GL_UNSIGNED_BYTE, pixels);


There should be 3 pixels per row but it ignores 1 pixel, so it actually goes through 4 * 10 pixels not 3 * 10, and 1 pixel is lost for every row.

I've debugged glTexImage2D(), i've found the cause, i'm not entire sure if which party is involved in the implementation but yah:

http://i.imgur.com/MLaAsNB.png

I've tried it on a 660 gtx and an old 3650 radeon mobile. Both get the same error.

mhagain
08-13-2014, 01:08 AM
http://www.opengl.org/wiki/Common_Mistakes#Texture_upload_and_pixel_reads

Check your glPixelStorei