Archived

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

Solarbeam

REALLY stuck..

Recommended Posts

Solarbeam    122
Ok, this is my problem. Up till now, ive been using DrawPrimitive to render everything; is that ok? Now, i want to do visibility, but i cant exclude certain polygons for rendering or not rendering; i have to render the whole thing as a call to DrawPrimitive. Is there any way to draw polygon by polygon thats efficient? I just want something that allows me to, say, not draw polygons that are far away...Also, can someone give me some example code on how to use d3dxsimpleshapes? There isnt any REAL documentation on them in the SDK.

Share this post


Link to post
Share on other sites
Heraldin    122
Where does the data you pass to DrawPrimitive come from? You must generate it somehow!

When you''re building your list of triangles to draw, cull the ones which are wholly outside the view frustrum. Avoid costly memory allocations by allocating enough memory for all triangles beforehand.

When culling, do the z (depth) test first. This is a simple comparison of z-values. The other sides of the view frustrum are trickier to deal with.

Dave

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
To my homepage is link to my d3dxsimpleshape demo that I released few months ago. Link is somewhere to news page, so you should check that.

Esa Salminen
python@dlc.fi
www.saunalahti.fi/~python

Share this post


Link to post
Share on other sites
Solarbeam    122
Data structures for storing the primitives? right now, im storing them in an array; is that ok? Also, how can i tell if a polygon is inside or not or behind another polygon and then how do i delete it from the array?

Share this post


Link to post
Share on other sites
Solarbeam    122
No, ive got a z-buffer, but i have the feeling that it''s not culling faces covered by other faces (i.e. its slow when i look at a polygon with other polygons behind it). Um, i still dont understand how to cull to the viewing frustrum. Also, i dont understand how to make distant polygons in an array not draw...Please, im begging you, i need help! My project is at a standstill because of this!

Share this post


Link to post
Share on other sites
Solarbeam    122
WHAT ARE INDEXED PRIMITIVES? I can''t understand what it means by an indice and all this indexed stuff. I''ve asked several times about it on this forum, but no one seemed to know.

------------------------------
*Large explosion consumes building, hero walks away unharmed* (wtf? why?) CUT

Share this post


Link to post
Share on other sites
furby100    102
So you aren''t using indexed primitives then? Well, in that case it makes it a bit simpler. In you vertex array take each polygon as you step through the array and use compute sphere visibility. Then draw the resulting primitive.

------------------------------
#pragma twice


sharewaregames.20m.com

Share this post


Link to post
Share on other sites
Solarbeam    122
Well, thx for the info on indexed primitives...Turns out that my app DOES use them; how do i clip the polygons, then? Also, how do i delete polygons from an array? Please answer w/ code...

------------------------------
*Large explosion consumes building, hero walks away unharmed* (wtf? why?) CUT

Share this post


Link to post
Share on other sites
VyvyanBasterd    122
I recommend you look into adding Vertex Buffers. This will give you a HUGE increase in speed, as well as opening up the ProcessVertices() function, which will clip vertices for you.

VyvyanBasterd

Share this post


Link to post
Share on other sites
Solarbeam    122
Um, alright, how do i specify data to use for the new vertex buffer? I.e. do i specify an array to read vertices from? If so, how? Also, how can i access the vertices in the Vertex Buffer afterwards?

Share this post


Link to post
Share on other sites