Create a Cylinder
Friend how to create a cylinder??? If not using GL or GLUT... Because I try using glut... and the result is both side cicle in top and down are not draw... Can you help me....
gluCylinder (and the corresponding GLUT function) do not draw the caps on the cylinder. However, you can simply draw them yourself with gluDisk.
GLUDisk?? What is that??? Maybe you can give a sample code from website or ebook that i can learn..
And maybe another way to create a cylinder
And maybe another way to create a cylinder
for example
{
//you have this
gluCylinder(quadric ,radius, radius, height, 10, 1);
// one circle
gluDisk(quadric, 0., radius, 10, 1);
// shift to another side of cylinder
glTranslate(0.,0.,height);
// another circle
gluDisk(quadric, 0., radius, 10, 1);
}
if you use ligh, you must render one of this disc's, that normals are in correct way (outside from object)
glPushMatrix()
glRotate(180,0.,1.,0.);
gluDisk(quadric, 0., radius, 10, 1);
glPopMatrix();
{
//you have this
gluCylinder(quadric ,radius, radius, height, 10, 1);
// one circle
gluDisk(quadric, 0., radius, 10, 1);
// shift to another side of cylinder
glTranslate(0.,0.,height);
// another circle
gluDisk(quadric, 0., radius, 10, 1);
}
if you use ligh, you must render one of this disc's, that normals are in correct way (outside from object)
glPushMatrix()
glRotate(180,0.,1.,0.);
gluDisk(quadric, 0., radius, 10, 1);
glPopMatrix();
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement