Sign in to follow this  
jbremer

glTexSubImage2D

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this