spheres without glu

Started by
14 comments, last by TheMatrixXXX 21 years, 10 months ago
can you tell me how to generate sphere vertices? i want an array with vertices so i can edit the mesh like in 3ds max, so i can´t use the glu tools. thx --=[[TheMatrixXXX]]=--
--=[[TheMatrixXXX]]=--
Advertisement
p(r,s,t)=(r*cos(s)*sin(t),r*sin(s)*sin(t),r*cos(t)) where r is the radius, s varies from 0 to 2pi and t varies from 0 to pi.
Keys to success: Ability, ambition and opportunity.
Try the skydome tutorial at www.spheregames.com.
---visit #directxdev on afternet <- not just for directx, despite the name
try this.
look at glut source code.

thx for your answers
i used the skydome tut to create a sphere but when i render it with GL_TRIANLGE_STRIP ogl fills the triangles white
is there a way to disable this to get the wireframe mode?

thx
--=[[TheMatrixXXX]]=--

thx to invective for the create link, its very useful
--=[[TheMatrixXXX]]=--
glBegin(GL_LINE_STRIP);
//...render what you need
glEnd();
glPolygonMode(GL_LINE);

To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.
To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.
But as someone already mentioned in the Nehe forum the pol mode command slows your rendering down..
This is a very cool piece of code, I adapted from the source that invective pointed to here and I am very pleased with the results, however...

How do I generate texture mapping coordinates from this calculated sphere? Any ideas...

I am using the code from source3.c as my basis. I am rendering the sphere by using GL_TRIANGLES mode and rendering as follows:


      glBegin( GL_TRIANGLES );  for (i=0; i<NumFacets; i++)  {    glVertex3f( Facets[i].p1.x * Size, Facets[i].p1.y * Size, Facets[i].p1.z * Size );    glVertex3f( Facets[i].p2.x * Size, Facets[i].p2.y * Size, Facets[i].p2.z * Size );    glVertex3f( Facets[i].p3.x * Size, Facets[i].p3.y * Size, Facets[i].p3.z * Size );  }glEnd();      


Which appears to be correct, as the sphere shows up very nicely, but I can't seem to figure out the proper way to generate my texture mapping coordinates.


[edited by - oeginc on June 12, 2002 6:22:58 AM]

This topic is closed to new replies.

Advertisement