Modifying textures in OpenGL

Started by
3 comments, last by DBX 20 years, 8 months ago
Using the glTexSubImage2D function, how can I pass data that has a different pitch from width*channels? I have a bitmap in memory which covers a number of GL textures (i.e. 320 pixels wide is a 256 wide texture and a 64 wide teture), but I want to update part of this bitmap using glTexSubImage but it requires the data being sent has a set pitch.
Advertisement
Why don''t you just split the data from your memory in two textures, at load time, and feed OpenGL with the 256 texture, then the 64 texture?

Height Map Editor | Eternal Lands | Fast User Directory
Because the large texture is being modified on occasion, and as such I would prefer to treat it as a single large bitmap (i.e. with each row contiguous).
Then when I want to update the OpenGL texture, possibly only part of each texture needs to be uploaded (i.e. the part that has changed)

(EDIT: Yes I could split it into the different textures each time, but this is an overhead that could be avoided if there is some way to specify the pitch of the source data to glTexSubImage or some variant)

[edited by - DBX on July 26, 2003 10:27:36 AM]
Found it - glPixelStorei - it was right under my nose.
I can''t believe I am the only person on this board who knows about this function.
Do as you wish, but keeping each texture separately is more managable, and can eb faster, depending on what exactly you want to do.

Height Map Editor | Eternal Lands | Fast User Directory

This topic is closed to new replies.

Advertisement