Ok i need help to stop flickering with my animations its sopposed to sipn the teapot but it flickers all the code acctually works if u compile it but i need help to stop flickering this is wat i have so far:
#include <GL/glut.h>
#include <gl/glu.h>
#include <gl/glaux.h>
#include <gl/gl.h>
static GLfloat Spin = 0.0;
void DrawObject(void)
{
//drawing STUff
glColor4f(0.0f,1.0f,0.0f,2.0f);
auxWireTeapot(0.5);
}
void MyDisplay(void){
/* Some OpenGL code that draws a frame /
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glPushMatrix();
glRotatef(Spin,Spin,Spin,1.0);
DrawObject();
glPopMatrix();
glFlush();
/ After drawing the frame we swap the buffers */
glutSwapBuffers();
};
void SpinDisplay(void)
{
Spin=Spin+2.0;
if (Spin > 360.0)
Spin = Spin - 360.0;
MyDisplay();
}
void main(int argcp, char **argv){
/* Initialize GLUT state */
glutInit(&argcp, argv);
glutInitWindowSize(640, 480);
glutInitWindowPosition(0, 0);
/* Open a window */
glutCreateWindow(“My OpenGL Application”);
/* Select type of Display mode:
Double buffer & RGBA color */
glutInitDisplayMode(GLUT_RGBA | GLUT_WINDOW_DOUBLEBUFFER);
/* Register Callback Functions */
glutDisplayFunc(MyDisplay);
glutIdleFunc(SpinDisplay);
/* Start Event Processing Engine */
glutMainLoop();
};
Any help would be appreciated thanks!!