Welcome Guest [Log In] [Register]
We hope you enjoy your visit.


You're currently viewing the Ultimate 3D Community as a guest. This means that you can only read posts, but can not create posts or topics by yourself. To be able to post you need to register. Then you can participate in the community active and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.

Join our community!

If you are already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
sphere generating
Topic Started: Jan 17 2013, 05:09 AM (124 Views)
alexmach1
Member Avatar
Graphics addict
[ *  *  *  *  *  * ]
I wanted to make a function to easily generate spheres instead of using a model, but all I get is a jumble of polygons. any idea why?
argument0 is the amount of segments, argument1 is the radius.
Code:
 


BeginPolygon(argument0*(argument0/2+1))
//texture=argument2
for(i=1;i<=argument0;i+=1){
for(w=1;w<=argument0/2+1;w+=1){
AddVertex(
sin(degtorad(360*(i/argument0)))*(argument1) *cos(degtorad(180*(w/(argument0/2+1)))),
cos(degtorad(360*(i/argument0)))*(argument1) *cos(degtorad(180*(w/(argument0/2+1)))),
sin(degtorad(180*(w/(argument0/2+1))))*(argument1),
0,0)
}
}
CreatePolygon()
Edited by alexmach1, Jan 17 2013, 05:29 AM.
Offline Profile Quote Post Goto Top
 
Dr. Best
Member Avatar
Administrator
[ *  *  *  *  *  * ]
Polygons are designed to be used for convex, planar shapes. For a sphere you will have to use the model manipulation functions.
Offline Profile Quote Post Goto Top
 
« Previous Topic · Questions about Ultimate 3D · Next Topic »
Add Reply