Special primitive types

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

Recommended Posts

Rendering with DrawPrimitive or DrawPrimitiveUP I can specify one of D3DPRIMITIVETYPE values - such as D3DPT_POINTLIST or D3DPT_TRIANGLESTRIP. Is there any way of specifying my own custom primitives - for example rendering every four vertices as isolated triangle strip?

Share on other sites
Hi there tokaplan,
How are you doing?

[The problem]

[The solution]
Tokaplan, as far as that goes. You don't need to.
The six primitive types given to you are all you need to create any primitive.
Let's say you want to draw a quad(Square)
You define it as the following...

[source lang = c++]//Creationstruct VERTEX	{		float x, y, z,			  u, v;		enum		{			FVF = D3DFVF_XYZ | D3DFVF_TEX1		};	};	VERTEX data[] = {        {-1.0f,-1.0f, 0.0, 0.0f, 1.0f},	{-1.0f, 1.0f, 0.0, 0.0f, 0.0f},	{ 1.0f,-1.0f, 0.0, 1.0f, 1.0f},	{ 1.0f, 1.0f, 0.0, 1.0f, 0.0f}};//renderingpDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);

This is the code for a simple quad.

I hope this helps a bit.
Keep cool

Share on other sites
D3D also provides a system called Higher Order Primitives. I have not worked with it myself, but it provides support for various sorts of patches in hardware. Although it doesn't sound like these are what you're looking for.

The thing you described can be done by stitching triangle strips via degenerate triangles. Basically, these are triangles where two vertices are the same, so that the triangle has no actual surface area. This article discusses attaching triangle strips together in some detail.

Another option is to use triangle lists. Indexed triangle lists that are oredered as if they were made of strips are the most optimal geometry format these days, and highly recommended.

[Edited by - Promit on August 7, 2005 1:06:48 PM]

1. 1
Rutin
38
2. 2
3. 3
4. 4
5. 5

• 11
• 9
• 12
• 14
• 9
• Forum Statistics

• Total Topics
633350
• Total Posts
3011471
• Who's Online (See full list)

There are no registered users currently online

×