Jump to content
  • Advertisement
Sign in to follow this  
Dun

[directx9] Shapes creating

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

Hello, i am programming a simple network 2d game and i would like to ask. How ci i make more complex objects. For example star or whatever i want. For testing purpouses i currently use simple quad object, but its time to give it some form.

So. How can i make these kind of objects? I read,that texturing the base objects can be the way. But how can i create more non simple shapes using vertexes please? When i create quad for example, i see that it has 4 vertexes, but when i add fifth, i cant predict, what the shape will be like. Can you please give me any advice?

Share this post


Link to post
Share on other sites
Advertisement
Get a pen and paper. Draw the shape you want. Decompose it into triangles. Work out the offsets from the shape centre to each vertex of each triangle. You've got your shape in local space. Add its centre position to each vertex (or use a transform matrix or whatever) when you render it.

It really isn't more complex than that. In Direct3D (don't know what API you are using) even a quad is composed of two triangles. I vaguely remember OpenGL having some kind of built-in quad support but there is really no difference between constructing a quad from two triangles and constructing a star from 'n' triangles.

Share this post


Link to post
Share on other sites

I vaguely remember OpenGL having some kind of built-in quad support but there is really no difference between constructing a quad from two triangles and constructing a star from 'n' triangles.


OpenGL Supports the GL_QUADS primitive, but that will basically just get turned into 2 Triangles as soon as you pass it to the driver. AFAIK Graphics cards know one thing, how to draw Triangles.

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!