Jump to content
  • Advertisement
Sign in to follow this  
jfgd

OpenGL PartialCone() ???

This topic is 4258 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!