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
DrawIndexedPrimtive vs DrawPrimtive
November 15, 1999 12:25 AM
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.
November 15, 1999 12:25 AM
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement