Comment 120 for bug 755841

Revision history for this message
In , Baughn (sveina) wrote :

(In reply to comment #75)
> (In reply to comment #74)
> > I have no tearing on GL in fullscreen.
> Please test it with tearing test 720x406 from
> https://bugs.freedesktop.org/show_bug.cgi?id=43674

I can't do that.

Those are movies, and the test program I'm using that doesn't tear doesn't play any movies, it just does raw GL output. mplayer *does* tear in fullscreen, but that's because it doesn't actually set the fullscreen bit.

Here's the full code, so you can try it yourself:

#include <GL/gl.h>
#include <SDL/SDL.h>
#include <strings.h>
#include <stdio.h>

int main(int argc, char **argv) {
  Uint32 i, mode;

  if (argc != 2)
    goto usage;
  if (strcmp(argv[1], "w") == 0)
    mode = SDL_OPENGL;
  else if (strcmp(argv[1], "f") == 0)
    mode = SDL_OPENGL | SDL_FULLSCREEN;
  else
    goto usage;

  SDL_Init(SDL_INIT_VIDEO);
  SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1);
  SDL_SetVideoMode(800, 600, 32, mode);

  for (i = 0; i < 100; i++) {
    glClearColor(1, 1, 1, 1);
    glClear(GL_COLOR_BUFFER_BIT);
    SDL_GL_SwapBuffers();
    glClearColor(0, 0, 0, 1);
    glClear(GL_COLOR_BUFFER_BIT);
    SDL_GL_SwapBuffers();
  }
  return EXIT_SUCCESS;

usage:
  printf("Usage: %s [w|f]\n", argv[0]);
  return EXIT_FAILURE;
}

// Compile with gcc test-gl.c -o test-gl -lSDL -lGL