Search code examples
c++openglrenderingfullscreenantialiasing

OpenGL fullscreen rendering


I'm currently coding a game in openGL and I've got to a stage where I'm in first person mode controlling the "camera" with W & S, and rotating with the mouse.

For some reason, when I'm in windowed mode, the speeds at which I move and rotate seems MUCH faster than the speeds I get when In fullscreen, but that's not my main issue. (*1)

As a result of the above, I decided to restrict the game to fullscreen.

My level is a cube where each side is a different RGB colour and when I move my mouse very quickly, the corners of the level turn very blocky until I slow down. (*2)

Anyone got any idea what's going on for either the questions (*1, *2).

I tried to screenshot it for you guys, but it looks normal in the screenshot.


Solution

  • Measure your frame times with glutGet(GLUT_ELAPSED_TIME):

    void displayCallback()
    {
        int start = glutGet(GLUT_ELAPSED_TIME);
        drawFrame();
        glutSwapBuffers();
        int end = glutGet(GLUT_ELAPSED_TIME);
        cout << "Frame time: " << (end-start) << "ms" << endl;
    }
    

    If they're around 16-17ms you most likely have some vsync. Managing vsync is system-dependent, both in access method and reliability :(

    Your best bet is frame-rate independence, so you do the Right Thing no matter how fast/slow you're running.