Paraboloid
Aus DGL Wiki
Version vom 7. August 2010, 21:51 Uhr von Wladimir (Diskussion | Beiträge) (Die Seite wurde neu angelegt: „<source lang="c"> void paraboloid(int slices,int subdivisions,int height) { int h,i; float alpha; float fh; float dh=(float)height/(float)subdivis…“)
void paraboloid(int slices,int subdivisions,int height)
{
int h,i;
float alpha;
float fh;
float dh=(float)height/(float)subdivisions;
float dx=PI2/slices;
glBegin(GL_TRIANGLE_STRIP);
for(h=0,fh=0.0f;h<subdivisions;h++,fh+=dh)
{
for(i=0,alpha=0.0f;i<=slices;i++,alpha+=dx)
{
glVertex3f(fh*cosf(alpha),fh*fh,fh*sinf(alpha));
glVertex3f((fh+dh)*cosf(alpha),(fh+dh)*(fh+dh),fh*sinf(alpha));
}
}
glEnd();
}