🎉 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
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
Morgan
You could write your own sphere function using
Someone translate.
------------------------
Captured Reality.
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?
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?
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.
So in reality you don''t want to know how to draw a sphere but how to shade a circle.
Taken from my software rendered engine...
The HOR & VER are the total amount of vertices spread over the sphere.
![](http://www.baskuenen.myweb.nl/images/title.jpg)
Edited by - baskuenen on June 9, 2000 10:57:15 PM
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.
![](http://www.baskuenen.myweb.nl/images/title.jpg)
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!
![](smile.gif)
![](http://www.baskuenen.myweb.nl/images/title.jpg)
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
a2k
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement