Hi,
I am looking for some source code in C to draw a cylinder and cone using OpenGL (without GLU routines).
Can someone help?
Many thanks!
Hi,
I am looking for some source code in C to draw a cylinder and cone using OpenGL (without GLU routines).
Can someone help?
Many thanks!
Wouldn't the obvious be to look at the GLU routines source and see how it's done?
are glu sources available? I suppose you can download the Mesa source but I'm not sure if that includes the glu library or not (I suppose it would).
I had a quick look but could not find the source for this. I thought it would be easier if someone had the snippet of code I needed.
Thanks anyway
What are you really looking for - the basic math which describes the surface of those objects?
I have actualy found what I was looking for.
For the cylinder's side for instance:
Code:float hl = length * 0.5f; float a = 0.0f; float step = Math::TWO_PI / (float)numSteps; glBegin(GL_TRIANGLE_STRIP); for (int i = 0; i < numSteps; ++i) { float x = Math::Cos(a) * radius; float y = Math::Sin(a) * radius; glVertex3f(x,y,-hl); glVertex3f(x,y, hl); a += step; } glEnd();