PartialCone() ???

Started by
0 comments, last by mameman 16 years, 12 months ago
Hi! I just wanted to ask, if anybody can send me or point me to OpenGL code, which draws a partial cone i.e. something like gluPartialDisk, but for cones. I know it is not very hard to write something like this, but why reinvent the wheel, when there are many more interessting things to program!;) The function should look something like this PartialCone(coneHeight, baseRadius, smallRadius, bigRadius, stacks, slices, startAngle, sweepAngle) When looking at the cone from the top, the parameters smallRadius and bigRadius should produce the same output as the parameters 'inner' and 'outer' in gluPartialDisk, while startAngle and sweepAngle the same as 'start' and 'sweep'. Hope somebody needed code like this already, else I will just have to sit down and take the time;) Thanks in advance!! PS: Here is a definition of gluPartialDisk gluPartialDisk( GLUquadric* quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops, GLdouble start, GLdouble sweep) quad Specifies a quadrics object (created with gluNewQuadric). inner Specifies the inner radius of the partial disk (can be 0). outer Specifies the outer radius of the partial disk. slices Specifies the number of subdivisions around the Z axis. loops Specifies the number of concentric rings about the origin into which the partial disk is subdivided. start Specifies the starting angle, in degrees, of the disk portion. sweep Specifies the sweep angle, in degrees, of the disk portion.
Advertisement
I won't give any specfic code ;). But you may want to THINK about generating the vertices yourself. It's quite simple. Assume a standard coordinate system with the Y axis pointing up. All you have to do then is generate the top vertex (0.0f, HEIGHT, 0.0f) and then generate the points in the xy plane. HINT: use a circle.

To render just use a triangle fan.

Should get you started.

MAMEman.

This topic is closed to new replies.

Advertisement