Results 1 to 2 of 2

Thread: Help Me I need help with flickering

  1. #1
    Guest

    Help Me I need help with flickering

    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!!

  2. #2
    Junior Member Newbie
    Join Date
    May 2002
    Posts
    26

    Re: Help Me I need help with flickering

    try putting the glutInitDisplayMode before the glutCreateWindow. i think the problem is because you are creating the window before initializing the display mode

Similar Threads

  1. Still flickering
    By art-ganseforth in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 04-04-2016, 12:25 AM
  2. flickering
    By stranimondi in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 01-17-2006, 11:41 PM
  3. Flickering OGL
    By M/\dm/\n in forum OpenGL: Basic Coding
    Replies: 8
    Last Post: 04-08-2003, 05:19 AM
  4. Flickering?
    By ym in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 10-13-2001, 01:58 AM
  5. Flickering
    By cwhite40 in forum OpenGL: Basic Coding
    Replies: 7
    Last Post: 09-23-2000, 10:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean