View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# [D3D9] Draw Filled Circle avoiding Triangle Fan

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

4 replies to this topic

### #1X-Shiryu  Members

Posted 24 January 2013 - 02:25 AM

I'm implementing some controls for my GUI system, and now its time to do a RadioButton class, whereas I'll not using textures, but pure primitive shapes.

Its very simple: what I'll do is render a unfilled external circle and if RadioButton is clicked/checked, will be rendered a filled one inside.

Since Triangle Fan is marked as deprecated for D3D10+, can achieve it using Triangle Strips?

Model circle;
float position_x = 50;
float position_y = 350;

const int degrees = 360;
const float degrees_to_radians = 3.14159265f / 180.0f;

circle.ResizeVertices(degrees);

//Direct3D Triangle Strip
//circle.SetPrimitiveType(TriangleStrip);

//Direct3D Line Strip
circle.SetPrimitiveType(LineStrip);

circle.SetPrimitiveCount(circle.GetVertexTotal() - 1);

for (int i = 0; i < degrees; i++)
{

circle.SetVertexColor(i,Color::Black);
}


Using LineStrip top result and TriangleStrip bottom result:

Edited by X-Shiryu, 24 January 2013 - 02:27 AM.

### #2mhagain  Members

Posted 24 January 2013 - 04:15 AM

Why not just use DrawIndexed with triangles instead?  That can replicate any primitive type from earlier versions of D3D.

It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.

### #3X-Shiryu  Members

Posted 24 January 2013 - 04:36 AM

Yeah, i just tried using Triangle List and worked.

Using indices like this: 0 1 2   0 2 3   0 3 4  ..., i can simulate a Triangle Fan and fill circle, but uses more indices.

Edited by X-Shiryu, 24 January 2013 - 04:36 AM.

### #4Amr0  Members

Posted 24 January 2013 - 10:35 AM

Out of curiosity, why not textures?

### #5X-Shiryu  Members

Posted 24 January 2013 - 03:23 PM

Because i'm focusing more on functionalities of controls than graphical aspect, but later i can add a sprite and render it textured.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.