Moving and rotating triangle lists efficiently...

Started by
2 comments, last by ToddTT 22 years, 4 months ago
The question... I''m trying to learn DirectX from the SDK samples and online help. But some answers aren''t exactly staring me in the face. What''s the most efficient way to move and rotate a triangle list? (And assume I have multiple triangle lists that all need to move and rotate differently, all at the same time.) What I''ve tried... I started writing code that fills up a vertex buffer upon every render, modifying the contents each time. This seems like too much work, and not very efficient. I know the answer involves matrices, but I''m not sure what to do with the matrices I would create/concatenate. Do I walk the vertices in my buffer and multipy them by a transform matrix, one by one? Does the answer involve vertex shaders(which I still haven''t completely figured out how to use)? Thanks!!!! - Todd
Advertisement
look at the sdk tutorial sample on matrices and in the docs for info on "SetTransform"

basically, you give the matrix and the vertex buffer to the device and render the triangles. the device will apply the transform to all of the vertices (in hardware if you have good hardware)

let me know if this doesn''t make sense.
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
quote:Original post by CrazedGenius
look at the sdk tutorial sample on matrices and in the docs for info on "SetTransform"

basically, you give the matrix and the vertex buffer to the device and render the triangles. the device will apply the transform to all of the vertices (in hardware if you have good hardware)

let me know if this doesn''t make sense.


Awesome! Thanks. I misunderstood the usage of world transforms... I thought this transform was only set once per render, affecting the whole "world". This sh@# is cool!

Thanks!

-Todd


SetTransform actually does affect the whole world. If you want to apply different matrices for your objects you call SetTransform, then you render your object (DrawPrimitive) then you apply the next matrix, render the next object and so on....

This topic is closed to new replies.

Advertisement