glTexSubImage2D

BlitzMax Forums/BlitzMax OpenGL Programming/glTexSubImage2D

If I load two pixmaps. Make one of them into a texture. Then wants to update that one with the other pixmap, how would that work?

I have tried this approach, which doesn't work. The texture just gets updated with some garbage pixels:

tmp1 = LoadPixmap( "test1.png" )
tmp2 = LoadPixmap( "test2.png" )
tex1 = bglTexFromPixmap( tmp1 )
glBindTexture GL_TEXTURE_2D,tex1
glTexSubImage2D( GL_TEXTURE_2D, 0, xOffset, yOffset, width, height , GL_RGBA, GL_UNSIGNED_BYTE, tmp2.pixels )


Anyone got working examples of doing this?