PDA

View Full Version : draw a cone



fox
11-15-2000, 06:39 AM
Hi

Need code for drawing a cone and a chopped off cone

Cheers

[This message has been edited by fox (edited 11-15-2000).]

jc
11-15-2000, 06:48 AM
why don't you try glutsolidcone ?(if it exists http://www.opengl.org/discussion_boards/ubb/smile.gif )

ipo
11-15-2000, 04:21 PM
For a cone try gluCylinder with a radius of 0.0 for its top face. For a chopped cone use a larger radius that is smaller than that of its base.

fox
11-16-2000, 01:30 AM
Yes could you give me a sample code -I think you have to use it in conjunction with gluNewQuadric - also could I use this to draw a solid and a wire frame cone?

Cheers




[This message has been edited by fox (edited 11-16-2000).]

fox
11-16-2000, 11:16 PM
Any code using gluCylinder?

Cheers

jc
11-16-2000, 11:27 PM
no code but spec...
http://www.iro.umontreal.ca/~dift3730/docs/GL/glu/cylinder.html

fox
11-17-2000, 01:54 AM
I've had a look at the spec - what should the first parameter be?

Cheers

ipo
11-17-2000, 05:05 PM
Try this

void drawSolidCylinder(GLdouble base, GLdouble height, GLint slices, GLint stacks) {

GLUquadricObj *theQuadric;

theQuadric = gluNewQuadric();

gluQuadricDrawStyle(theQuadric, GLU_FILL);
gluQuadricNormals(theQuadric, GLU_SMOOTH);
gluCylinder(theQuadric, base, base, height, slices, stacks);

gluDeleteQuadric(theQuadric);
}

Change

gluQuadricDrawStyle(theQuadric, GLU_FILL);

to

gluQuadricDrawStyle(theQuadric, GLU_LINE);

fo a wire cone.


[This message has been edited by ipo (edited 11-17-2000).]