I just want to draw a cylinder in opengl. I found lots of samples but all of them draws cylinders in z axis. I want them be in x or y axis. How can i do this. The code below is the code draw the cylinder in z direction and i dont want it
GLUquadricObj *quadratic;
quadratic = gluNewQuadric();
gluCylinder(quadratic,0.1f,0.1f,3.0f,32,32);
You can use glRotate(angle, x, y, z)
to rotate your coordinate system:
GLUquadricObj *quadratic;
quadratic = gluNewQuadric();
glRotatef(90.0f, 0.0f, 1.0f, 0.0f);
gluCylinder(quadratic,0.1f,0.1f,3.0f,32,32);
http://www.opengl.org/sdk/docs/man/xhtml/glRotate.xml
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With