Jump to content
  • Advertisement
Sign in to follow this  
ozenc

DirectX Triangle/Polygon class

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

Hi, I have a Vertex class defined as: class Vertex { public: Point point; float rhw; DWORD color; } using this class I want to create a Triangle/Quad class which consists of an array of Vertex*'s. I think I will need such a class because I will implement a BSP class, for which you should have a list of your polygons. However DrawPrimitive function accepts a vertex array, not a vertex* as a parameter. I don't think that copying the contents of the vertex* array into a vertex array before rendering is a good solution. Is there a way to draw Vertex* or am I going the wrong way (is there a better way to do this/represent polygons etc.). Thanks for your help..

Share this post


Link to post
Share on other sites
Advertisement
a vertex* array would mean having a list of pointers to vertices? That is not what you need to be doing, this is what you need to be doing, roughly:


vertex* vertices;

vertices = new vertex[howevermany]


You are going "vertex* vertice[howevermany];" aren't you?

Share this post


Link to post
Share on other sites
Not exactly like that

There is a bunch of vertices stored in a vertex array
Vertex arr[] = {Vertex(...),Vertex(...)...} (dynamic in my case)

and a quad such as

Vertex **quad = new Vertex*[4];
quad[0] = &arr[0]
quad[1] = &arr[10] etc

I need a way of drawing quad

This way I think I can use a vertex for more than 1 poly. (This is how meshes are done I guess)


Share this post


Link to post
Share on other sites
I guess I've found a way(DrawIndexedPrimitive), thanks to this article:

http://www.gamedev.net/reference/articles/article1247.asp

I was going the wrong way, instead of storing Vertex*, I should have had an array of indices.

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!