Original Post
Hi, I posted this question a few days ago in game programming forum, but I'm stuck again so hopefully some of you guys here can help.
I need to animate many objects at the same time, I'm talking like 100+ objects on screen each being transformed (rotated, scaled, moved) with it's own transform matrix. Each object is just a simple indexed polygon with a texture on it. The way I have it set up now is: SetTransform(polygon1Matrix); DrawIndexedPrimitive(); repeat with polygon2Matrix for all the polygons. So in effect I have 1 DIP call per polygon. So not surprisingly after 10 polygons were added the framerate dropped noticably (I am using the debug libraries, but I still don't think 27 fps for 10-15 polys is acceptable on gtx 260). My question is, how can I animate each polygon without having to call a DIP for each matrix I set. Now the reason I'm reposting this question is because the answer I got in another forum was to squeeze a matrix that contains the transform into the vertex definition, then in the vertex shader multiply that matrix by the vertex position.. But I have spent the past 3 hours trying to do that, I realized that it's no easy task. There's no matrix flag in the FVF declaration, so I must fool the shader somehow by encoding my matrix into other components like the color, or texture, which I'm not exactly sure how to do. But this seems like a really awkward approach for something so common. I have seen this done in many many games, so there must be some way to do this without jumping through these hoops. Any thoughts?
I need to animate many objects at the same time, I'm talking like 100+ objects on screen each being transformed (rotated, scaled, moved) with it's own transform matrix. Each object is just a simple indexed polygon with a texture on it. The way I have it set up now is: SetTransform(polygon1Matrix); DrawIndexedPrimitive(); repeat with polygon2Matrix for all the polygons. So in effect I have 1 DIP call per polygon. So not surprisingly after 10 polygons were added the framerate dropped noticably (I am using the debug libraries, but I still don't think 27 fps for 10-15 polys is acceptable on gtx 260). My question is, how can I animate each polygon without having to call a DIP for each matrix I set. Now the reason I'm reposting this question is because the answer I got in another forum was to squeeze a matrix that contains the transform into the vertex definition, then in the vertex shader multiply that matrix by the vertex position.. But I have spent the past 3 hours trying to do that, I realized that it's no easy task. There's no matrix flag in the FVF declaration, so I must fool the shader somehow by encoding my matrix into other components like the color, or texture, which I'm not exactly sure how to do. But this seems like a really awkward approach for something so common. I have seen this done in many many games, so there must be some way to do this without jumping through these hoops. Any thoughts?