При каждом рендеринге используйте glPushMatrix
glRotatef
нарисуйте цилиндр и закончите ваш рисунок с glPopMatrix
.
Пример: glRotatef(yRotationAngle, 0.0f, 1.0f, 0.0f); // Rotate your object around the y axis on yRotationAngle radians
Пример: OnRender()
функцияпример
void OnRender() {
glClearColor(1.0f, 0.0f, 0.0f, 1.0f); // Clear the background
glClear(GL_COLOR_BUFFER_BIT); //Clear the colour buffer
glLoadIdentity(); // Load the Identity Matrix to reset our drawing locations
glRotatef(yRotationAngle, 0.0f, 1.0f, 0.0f); // Rotate our object around the y axis on yRotationAngle radians
// here *render* your cylinder (create and delete it in the other place. Not while rendering)
gluCylinder(quadratic,0.1f,0.1f,3.0f,32,32);
glFlush(); // Flush the OpenGL buffers to the window
}