• Advertisement

Archived

This topic is now archived and is closed to further replies.

Guest Anonymous Poster

DrawIndexedPrimtive vs DrawPrimtive

This topic is 6732 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

Guest Anonymous Poster
I dont know to much, but I was just thinking if you wanted to save space, maybe you could take every other pixel, or just degrade the detail of the terrain. Maybe I dont know what I talking about ,
jus tryin to help, later

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Alright, here's what happens in a little demo i wrote a while back. I load a bitmap from a file, and scan through it pixel by pixel, creating a giant array of D3DVERTEX's as I go. When I'm done, I have this cool looking terrain. The problem is, It's HUGE! I want to be able to load larger maps than 100x100 for detail's sake, but I run out of memory fast. This is because my array of vertices is 100*100*6, 6 because it is all rendered as a Triangle list. I was wondering if DrawIndexedPrimitive might remedy this problem? It seems to me that it would only take up more space, since that would then be two arrays instead of one, but everyone says to use DIP over DP. Also, In case you haven't yet, check out my post on "GetBitmapBits". The problem is causing pressure to build up in my brain, and I fear it will soon burst.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
hmmmm...doesn't sound like indexed primitives would help you too much in this case. Basically all they do is ensure that each vertex in your model is only stored ONCE in the vertex array. Your polygon list is then an array of POINTERS indexing these vertices. This way Direct3D has far less transform and lighting to do than if you just used DrawPrimitive b/c presumably you would be storing each vertex multiple times. A good example is a circle that is created by sweeping multiple triangles around a central point. Using DrawPrimitive, the central vertex would appear once for each individual triangle. If there are 30 triangles making up the circle, then the central point will be transformed and lit 30 times. If you use DrawIndexedPrimitive, you can just store this central vertex once, and each triangle can maintain an "index" to this point so that directx knows how to draw that triangle. On some models, this makes a HUGE difference(i've seen framerates go from 30 to well over 100 just by changing this).

Unfortunately, it sounds like you're gonna need a LOT of vertices either way using height maps to generate terrain like that. Using DrawIndexedPrimitive may cut down the vertices a bit for you if you're storing them multiple times, but you're still gonna need at least 100x100 like you said if you want a vertex generated from each pixel in the image.

Blue Man

Share this post


Link to post
Share on other sites

  • Advertisement