Jump to content

  • Log In with Google      Sign In   
  • Create Account


use XNA draw a circle


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.

  • You cannot reply to this topic
8 replies to this topic

#1 granberg   Members   -  Reputation: 56

Like
0Likes
Like

Posted 09 August 2011 - 10:38 PM

Hi fellas is someone use XNA 3D primitives I can not find circle include in it,I want to draw a face of cat ,so does someone know how to draw circle in XNA?

Sponsor:

#2 absinthfee   Members   -  Reputation: 102

Like
0Likes
Like

Posted 10 August 2011 - 03:45 AM

There is no circle primitive in directx so there isnt one in XNA either. You could actually drow enough triangles to form a circle, however thats a shitload of work.

Its probably the best to model the face of the cat in an modelling programm and import the model into the game.

#3 JWalsh   Moderators   -  Reputation: 463

Like
0Likes
Like

Posted 10 August 2011 - 11:20 AM

Hi fellas is someone use XNA 3D primitives I can not find circle include in it,I want to draw a face of cat ,so does someone know how to draw circle in XNA?



Hi Granberg,

I'm not entirely sure the full details of what you're trying to do, but there's a couple ways to accomplish it. First, you said you're wanting to use 3D primitives to draw the face. From this I assume you're actually looking for it to be in 3D, not 2D. In which case, you can either use triangles to construct a circle at run-time, or use/import a full 3D model. Whether you're doing it using triangles or a full 3D model, you'll likely want to add a texture to the circle so it looks kind of like a cat's face.

Also, you say "circle", but you might have meant sphere, which is a 3D circle. There is also no primitive for drawing spheres (everything goes back to triangles), but there's a number of nifty algorithms out there for dynamically generating triangles to match the surface of a sphere. One such article on rendering bounding spheres, shows the code of how to draw a sphere.

Finally, you said XNA 3D, but then also said circle, so it may be that you're actually wanting to work in 2D. In which case, you can open up any paint program, draw a cat's face with transparent pixels outside of the cat's face, and then use the SpriteBatch class to draw the face.

If you let us know which above the scenarios most matches what you're looking for we can provide more details.

Cheers!
Jeromy Walsh
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints

#4 granberg   Members   -  Reputation: 56

Like
0Likes
Like

Posted 10 August 2011 - 12:20 PM

I think I have alreally been choose use triangle form a circle ,but how to do that?

#5 JWalsh   Moderators   -  Reputation: 463

Like
0Likes
Like

Posted 10 August 2011 - 12:46 PM

I think I have alreally been choose use triangle form a circle ,but how to do that?


Is this circle going to be facing the screen or is it going to be moving around in 3-space? Also, do you need the geometry to be a circle, or just the head? Because you can always draw a quad (two triangles) with a transparent circular texture on it.
Jeromy Walsh
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints

#6 granberg   Members   -  Reputation: 56

Like
0Likes
Like

Posted 10 August 2011 - 01:53 PM

The circle is just going to be facing the screen only the head and eyes(because the cat's eye is a circle).

#7 Watermelon Chris   Members   -  Reputation: 104

Like
0Likes
Like

Posted 10 August 2011 - 03:27 PM

Unless your trying to do this for one reason or another... But your gonna draw a cat 'face' with xna primatives?

Why not just make the model in blender and import it into xna?

#8 laztrezort   Members   -  Reputation: 961

Like
0Likes
Like

Posted 10 August 2011 - 04:31 PM

If you (or someone else reading this thread) really wants only 2D circles (and lines, arcs, rectangles, etc.), you can try out one of the 2D primitive libraries available for XNA, such as this one.

Or, Farseer includes some methods to create a texture2D from a shape, you can check out their source code for it (but it is closely tied, of course, to their physics API).

#9 granberg   Members   -  Reputation: 56

Like
0Likes
Like

Posted 11 August 2011 - 07:35 PM

please show some example of draw a circle using two traimgle and others I also need draw a fence to around a house ,similiar must use XNA primitive,cound you tell me how to make this looks like in 3D?




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.



PARTNERS