Texture transformations (D3D) - is it worth it?

Started by
1 comment, last by risingdragon3 23 years, 3 months ago
Well basically I''m doing a 2d tile engine in D3D. So i''ve got my vertex buffer with the quad, and I use a transformation to place the quad on the screen (thanks furby). However the problem now is animations. They''re contained in one surface, each frame after each other. The main problem tho'' is updating the texture co-ordinates. I''m trying to make the vertex buffer as static as possible, i.e. no locks after the first inital lock to fill up the quad. So I''m thinking of using texture matrix transformations to adjust the texture values each frame to draw the new frame. Is this worth the bother? Or should I just lock the VB and refill? ------------------------------ BCB DX Library - RAD C++ Game development for BCB
Advertisement
Warning: I''m about to postulate a theory..

Why not use an Index Buffer and a Vertex Buffer???
Fill up your vertex buffer with the vertices of your animation
cells, so that you only have to lock it once

THEN

use an index buffer to index which vertices you wish to render..
(avoiding anymore locking)..

would this work??

Wazoo
Learn about game programming!Games Programming in C++: Start to Finish
Yes that would work ... yes ...
however you would need more memeory for the extra vertices. Also you would have to multiply those extra vertices (a tiny amount tho'') by each animation - that could add up to something large.
A typical vertex is 32 * 6 bytes (x,y,z,diffuse,u,v) = 192 bytes.
* by lets say 10 frames on average = 1.9 kb.
* for 10 animations = 19 kb.
Tiny I know, but compared to a 4x4 float matrix per animation it IS large:
16*32*10 = 5 kb.
And with texture transformations you can do real-time shears, flips, etc. It''s more flexable.
However it would seem to be slower ....
Which is better?
How much slower is texture transformations? Anyone know?

------------------------------
BCB DX Library - RAD C++ Game development for BCB

This topic is closed to new replies.

Advertisement