OpenGL: Animated Textures

Started by
7 comments, last by a2k 23 years, 8 months ago
what''s faster for animated textures? using glTexsubimage2d, or just loading a texture into a texture object (all frames of animation) and then resetting the coords of the texture? i have a feeling that loading the whole thing into a texture object, and then just resetting the texture coords would be faster because it''s in a texture object, but opengl books say that using gltexsubimage2d is more efficient. choices choices... a2k
------------------General Equation, this is Private Function reporting for duty, sir!a2k
Advertisement
I think that glTexCoord is the best and simple solution but it needs that your animation frames are stored on the same texture object.
And it would be nice if your textures are less or equal than 256x256 because few video cards support big textures.
Since 256x256 is too little you may use more than one texture object for a single animation.
IpSeDiXiT
i do stick multiple images in one texture cause i assumed it would be quicker than doing another bind (but i havent tested it). though one problem u have to be aware of is the borders of the frames merging when u use linear mapping
_____________
|......|.........|
|......|.........|
-------------
so on the diagram above which is two images contained on one texture with linear the texels on the left side of the middle line will bleed over to the right hand side and visaversa
thanks, guys. why is it then, that OpenGL documents say that using glTexSubImage is fast? i mean, why can''t programmers just manipulate the texture coordinates of a texture object, to the proper frame of animation?

a2k
------------------General Equation, this is Private Function reporting for duty, sir!a2k
be careful about packing multiple images onto one texture. if you mip map, it will bleed in texels from other frames of your animation.
hmm, i haven''t gotten into mipmapping yet, but i''ll keep that in mind when i get there. actually, i started this discussion because i needed to animate player statistics, not something in my 3d world.

a2k
------------------General Equation, this is Private Function reporting for duty, sir!a2k
Hi!

If you have 256x256 texture which is animated procedurally (water/fire effects, etc...) then you should use glTexSubImage. It''s the fastest way to change the data of a complete texture in OpenGL. If you have prerendered animation frames, then sticking them in a single texture is the fastest (as was mentioned by serveral people here). Be aware of size limitations ... Of course, if you have a ton of animation frames, then glTexSubImage might still be the way to go. When bilinear filtering (LINEAR mapping), then the edges of your individual animation frames might get blended together. A way of minimizing this effect is to use ''sanding''. Sanding repeats the texture pixels along the edges of each frame ... ok, you do loose some texture space, but it''ll help a bunch.

MK42
Damm, so putting all your textures isn’t the perfect solution, is it? I had this idea, that I compose all (or many textures into one big one, but I guess this isn’t going to work. So could somebody tell me what the optimal texture size (in OpenGL) is?

Thanks,


Pascalix;
Pascalix;
use gluscaleimage(.... and see for yourself
also keep in mind what the internal format of the texture is this can have a huge say over the textures quality and speed

This topic is closed to new replies.

Advertisement