A Question about Vertex Buffers

Started by
13 comments, last by Biggles 22 years, 1 month ago
Another option has presented itself: DrawPrimitiveUP(). This function doesn''t use a vertex buffer, instead using an array stored in memory. While it would probably be slower, it may not be that much slower and it would certainly be a lot simpler to use for a sprite class.


--------------------

Never eat anything bigger than your own head.
--------------------Never eat anything bigger than your own head.
Advertisement
Hmmmm I think that DrawPrimitiveUP() function is just copying stuff into its own VB and setting the source itself. Not good.


--------------------

Never eat anything bigger than your own head.
--------------------Never eat anything bigger than your own head.
lol... ok... from the top

first post :

yes.. you'ld then lock the buffer.. write your vertices.. and unlock it. As to the indexing that's your call, I'd probably use the number of squares (0 to 99) and then mutliply them by 4 to get the actual buffer index. That said it's a matter of preference, either way works as long as you make sure you add the right indices to the list if and when you make the buffer bigger.

second post :

hmm.. that's wierd. I could see if your origin bitmap was in the wrong position (using the transform commands in the wrong order), but I'm not sure why it would scale wrong. What order are you issuing the commands in? What are the starting and ending vertex positions after you pass your co-ordinates through the transform matrix? Can I see a code snippet to see exactly what you're doing?

third post :

I'd try to stay away from DrawPrimitveUp myself... bad mojo =O





Edited by - Sorrow on February 23, 2002 11:32:08 PM
I''ve fixed the problem with the scaling and translation. It turns out I wasn''t multiplying the matrices correctly. Instead of creating a scaling matrix and a translation matrix, then multiplying them together, I was creating a scaling matrix and then creating a translation one on top of that. It''s been a while since I did the 3D stuff so I''d forgotten a lot of the matrices stuff for it.

As for the VB thing: I''ve decided to go with the single 4-big VB and changing the world matrix, since that is easy to implement and works nicely. Thanks for your help.


--------------------

Never eat anything bigger than your own head.
--------------------Never eat anything bigger than your own head.
np

This topic is closed to new replies.

Advertisement