Jump to content
  • Advertisement
Sign in to follow this  
Dom_152

OpenGL Not using a vertex buffer

This topic is 4284 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all I was wondering if there would be any performance hit if I don't use a VertexBuffer to store vertex information and use DrawPrimitiveUP() instead. I ask because I want to write something I could eventually port to OpenGL so I want to create my own Vertex storage structure which can be used with both. Also how does DrawPrimitiveUP() work exactly? I mean how does it know which part is the vertexes X component or U component? Does it have something to do with Vertex Declarations? (FVFs?)

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Dom_152
I was wondering if there would be any performance hit if I don't use a VertexBuffer to store vertex information and use DrawPrimitiveUP() instead. I ask because I want to write something I could eventually port to OpenGL so I want to create my own Vertex storage structure which can be used with both.

This is pointless. GL also does have VB. What DrawPrimitiveUP does is roughlty equivalent to (original) vertex arrays.
Quote:
Original post by Dom_152
I mean how does it know which part is the vertexes X component or U component? Does it have something to do with Vertex Declarations? (FVFs?)

Yes, DrawPrimitive works looking at the vertex declarations, the stream ports and the vertex program "input format".
As far as I've understood the vertex decl tells "what ports are active" and "what ports correspond to what VP input semantics". You then set the stream ports independently ("where to get the data") and draw.

Share this post


Link to post
Share on other sites
Quote:

I was wondering if there would be any performance hit if I don't use a VertexBuffer to store vertex information and use DrawPrimitiveUP() instead

IIRC there's is a quite huge performance hit. I think DPUP even constructs a vertexbuffer internally.

regards,
m4gnus

Share this post


Link to post
Share on other sites
Quote:
Original post by m4gnus
Quote:

I was wondering if there would be any performance hit if I don't use a VertexBuffer to store vertex information and use DrawPrimitiveUP() instead

IIRC there's is a quite huge performance hit. I think DPUP even constructs a vertexbuffer internally.

This is a touchy subject. Back in the DX8 days, there was a very big performance hit. Now, in DX9, things are much better.
In fact, DPUP would probably perform better than the straight-forward lock-draw approach. However, things are really not that simple. Once the project starts getting more complicated, or drawing larger amounts of data, things start to be less efficient, and eventually DPUP just breaks.

If you're considering using it for something simple, and can't be bothered to create a VB (which really isn't an issue), go for it. Keep in mind, however, that this might limit you in the future.

Hope this helps.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!