我只想在opengl中绘制一个圆柱体.我找到了很多样本但是所有样本都在z轴上绘制了圆柱体.我希望它们在x或y轴上.我怎样才能做到这一点.下面的代码是代码在z方向绘制圆柱体,我不想要它
GLUquadricObj *quadratic; quadratic = gluNewQuadric(); gluCylinder(quadratic,0.1f,3.0f,32,32);
解决方法
您可以使用glRotate(angle,x,y,z)来旋转坐标系:
GLUquadricObj *quadratic; quadratic = gluNewQuadric(); glRotatef(90.0f,0.0f,1.0f,0.0f); gluCylinder(quadratic,32);