|
Please Help.......
I just started learning D3D and I need a little help getting my head on straight. This DIRECT3DVERTEXBUFFER8 is giving me troubles. I have two choices:
1) Create one vertex buffer that will store all objects.
2) Create a separate vertex buffer for each object.
-I know how to do choice 1, though I don''t want to because It
looks really messy and i''d have to store the indices for the
beginning and end of each object.
-The second choice goes a hell of a lot better with OOP, and
seems like it would be much cleaner to implement
As you might guess, I don''t know how to implement the second choice. I can''t find a way to select different vertex buffers to apply transformations to. The Direct3D Device applies the transformations and does the rendering for one big vertex buffer without any problems. How in the world do you handle multiple vertex buffers with it though?
Here''s an example-->
Any ideas on how to accomplish this would help a lot. If I''m going about this incorrectly please fire away.
P.S.(How would stuff like this be done by professionals?...am I even close )
Thanks,
--atreyu
It is a case of setting the stream source. Every time you want to apply a different transformation to a different buffer you have to set the stream source appropriatly....
D3DDevice->SetStreamSource(0, VertexBuffer1, sizeof(CUSTOMVERTEX));
D3DDevice->SetTransformation(D3DTS_WORLD, &matWorld);
//Drawprimitives in this vertex buffer
D3DDevice->SetStreamSource(0, VertexBuffer2, sizeof(CUSTOMVERTEX));
D3DDevice->SetTransformation(D3DTS_WORLD, &matWorld);
//Drawprimitives in this vertex buffer
And do this until all the vertex buffers you need drawn are rendered.
-Omalacon
D3DDevice->SetStreamSource(0, VertexBuffer1, sizeof(CUSTOMVERTEX));
D3DDevice->SetTransformation(D3DTS_WORLD, &matWorld);
//Drawprimitives in this vertex buffer
D3DDevice->SetStreamSource(0, VertexBuffer2, sizeof(CUSTOMVERTEX));
D3DDevice->SetTransformation(D3DTS_WORLD, &matWorld);
//Drawprimitives in this vertex buffer
And do this until all the vertex buffers you need drawn are rendered.
-Omalacon
Thanks Omalacon That got me a lot closer. It works for the rendering stage (ie DrawPrimitive etc). The transformation stage is still being wierd. It rotates both vbuffers no matter what I try with "D3DDevice->SetStreamSource(0, VertexBuffer, sizeof(CUSTOMVERTEX));" I''ll keep messing with it.
By the way, Can anyone tell me what the first parameter in that function does? The DX8 Documentation says it''s the "StreamNumber" and that it "Specifies the data stream, in the range from 0 to the maximum number of streams - 1.". This makes no sense to me and whenever I change the number I get crazy results on the screen.
By the way, Can anyone tell me what the first parameter in that function does? The DX8 Documentation says it''s the "StreamNumber" and that it "Specifies the data stream, in the range from 0 to the maximum number of streams - 1.". This makes no sense to me and whenever I change the number I get crazy results on the screen.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement