Paraboloid
Aus DGL Wiki
Version vom 18. Mai 2018, 19:39 Uhr von Mathias (Diskussion | Beiträge)
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();
}