Advertisement Jump to content
Sign in to follow this  

Special primitive types

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

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 this post

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

[The problem]
Specifying your own primitive types?

[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++]

struct VERTEX
float x, y, z,
u, v;
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}};

pDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);

This is the code for a simple quad.

I hope this helps a bit.
Keep cool

Share this post

Link to post
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]

Share this post

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

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!