🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Spheres

Started by
6 comments, last by mesHead 24 years ago
Could someone please tell me how to draw spheres. Thanks. -- mesHead.
mesHead
Advertisement
Simple answer: use gluSphere() you can even texture map it unlike glutSolidSphere (for more info find gluSphere() in glu.h and read the function prototype).

Morgan
You could write your own sphere function using
Function Circle3D(Radius As Single, AngleA As Single, AngleB As Single) As D3DVECTOR    On Error Resume Next    Dim AA As Single    Dim AB As Single    AA = AngleA * PI / 180    AB = AngleB * PI / 180    With Circle3D        .X = Radius * Cos(AA) * Cos(AB)        .Y = Radius * Sin(AB)        .Z = Radius * Sin(AA) * Cos(AB)    End WithEnd Function 


Someone translate.

------------------------
Captured Reality.
You could also use a magical thing called quadirc''s which fuc****
good!!!

They fix textures for you and etc.

example make a nice planet:
GLUquadricObj *planetobj; //diffine a quadirc pointer


in your init func put:
planetobj=gluNewQuadric();
gluQuadricNormals(planetobj, GLU_SMOOTH);// normals
gluQuadricTexture(planetobj, GL_TRUE);//Texture Cordinates

gluSphere(planetobj,radius,nr of vertical "segments",nr of horisontal "segments");

ohh well what the heck lets try it?
______________________________ohh well what the heck lets try it?
Though I never wrote a sphere function myself, you have to imagine that all a sphere is is a circle shaded in a particular way to make it look like a sphere.

So in reality you don''t want to know how to draw a sphere but how to shade a circle.
-----------------------------------------------All messages are of my own personal opinion and not meant to offend. But if they do - tough :)Neuro.
Taken from my software rendered engine...
for(int j=0; j<=VER; j++)for(int i=0; i< HOR; i++){	VERTEX *V = AddVertex();	V->x = fSize * cos(PI*2/HOR*i) * sin(PI/VER*j);	V->y = fSize * sin(PI*2/HOR*i) * sin(PI/VER*j);	V->z = fSize * cos(PI/VER*j);}  


The HOR & VER are the total amount of vertices spread over the sphere.




Edited by - baskuenen on June 9, 2000 10:57:15 PM
quote:
Though I never wrote a sphere function myself, you have to imagine that all a sphere is is a circle shaded in a particular way to make it look like a sphere.

So in reality you don''t want to know how to draw a sphere but how to shade a circle.


Sorry, but I have to disagree Neuro,
How about being inside a sphere. (space simulator background)
How about "Z-buffer"-drawing the sphere while colliding with another object.

But it isn''t a bad post though! Maybe mesHead can use this, if he/she isn''t in a sphere orso...?...


i''d like to disagree with Neuro too. what Neuro suggests is how do you draw mickey mouse ears that, when you rotate around the object, it''s still a circle. it''ll still be flat on only two planes, not a sphere. anyway... carry on.

a2k
------------------General Equation, this is Private Function reporting for duty, sir!a2k

This topic is closed to new replies.

Advertisement