View Full Version : glTexSubImage2D

02-10-2004, 10:36 PM
Can anyone tell me how to get this darn function to work!!!

02-10-2004, 11:35 PM
Hardly an advanced question, but here it goes:

/* create empty images to work with */
unsigned char image[128][128][4];
unsigned char subimage[32][32][4];

/* make a 128x128 texture from the first image */
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, 128, 128, 0, GL_RGBA, GL_UNSIGNED_BYTE, image);

/* modify the texture with the 32x32 subimage starting at 64,64 */
glTexSubImage2D(GL_TEXTURE_2D, 0, 64, 64, 32, 32, GL_RGBA, GL_UNSIGNED_BYTE, subimage);

[This message has been edited by kansler (edited 02-11-2004).]

02-11-2004, 12:43 PM
Man! Thats stupid, I thought the darn thing ripped a sub image from the existing texture! Oh man, now i gotta rely on texture coords to get a sub image. http://www.opengl.org/discussion_boards/ubb/frown.gif