glTexSubImage2D

Started by
0 comments, last by TomasH 18 years, 10 months ago
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?
Advertisement
Well, that should work... Given that tmp2 is indeed stored in unsigned bytes RGBA. You should check the type and format (as well as width, height etc.) As to exactly how, well, I can't help you, since I don't know what kind of structure tmp2 is (though I guess the information you need is stored there), or how LoadPixmap and bglTexFromPixmap look.

This topic is closed to new replies.

Advertisement