Choppy Scrolling

cloke
Unregistered
 
Post: #1
I am trying to scroll an image across the screen. To keep things simple for my question I am using just a white box as my issue seems to even happen at this level. Below I am just drawing a box the size of the window and then shift it to the left one pixel every frame. I get some choppy scrolling and can't figure out what is causing it. I've tried running the below code in a GL Idle function and in a Carbon Timer with the same results. The weird thing is that the choppy stuff seems to happen in the exact same spot everytime I run the app.

Code:
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);

glLoadIdentity();    
glTranslatef(xPos,1.0f,1.0f);
    
glColor3f( 1.0f, 1.0f, 1.0f );   // Bright white
                
glBegin(GL_QUADS);                
glVertex2d(0.0f, 480.0f );    
glVertex2d( 640.0f, 480.0f );
glVertex2d(640.0f, 0 );
glVertex2d( 0.0f, 0.0f );
glEnd();    

glutSwapBuffers();

xPos++;


Below is my InitStuff run at the beginning of the app. This is basically taken from a Nehe tutorial, but maybe it has something to do with my issue.

Code:
    glShadeModel(GL_SMOOTH);              // Enable Smooth Shading
glClearColor(0.0f, 0.0f, 0.0f, 0.5f);      // Black Background
glClearDepth(1.0f);                            // Depth Buffer Setup
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);   // Set Line Antialiasing
glEnable(GL_BLEND);                                        // Enable Blending
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);  // Type Of Blending To Use


I'm using a glOrtho with the origin at the bottom left corner of the screen. Any suggestions would be great.
Quote this message in a reply
cloke
Unregistered
 
Post: #2
Just saw another post related to this same issue. I tried the suggested VBL code and although it seems to run a little better, I still experience a small bit of choppyness. I no longer experience any banding/tearing on the edge.
Quote this message in a reply
Post Reply