Pergunta

I am trying to change the size of the window of my app with:

    mysurface = SDL_SetVideoMode(width, height, 32, SDL_OPENGL);

Although I am using vsync swapbuffers (in driver xorg-video-ati), I can see flickering when the window size changes (I guess one or more black frames):

    void Video::draw()
{
    if (videoChanged){
        mysurface = SDL_SetVideoMode(width, height, 32, SDL_OPENGL);
        scene->init(); //Update glFrustum & glViewPort
    }
    scene->draw();
    SDL_GL_SwapBuffers();
}

So please, someone knows, if...
The SDL_SetVideoMode is not vsync'ed as is SDL_GL_SwapBuffers()?
Or is it destroying the window and creating another and the buffer is black in meantime?
Someone knows a working code to do this? Maybe in freeglut?

Foi útil?

Solução

In SDL-1 when you're using a windowed video mode the window is completely torn down and a new one created when changing the video mode. Of course there's some undefined data inbetween, which is perceived as flicker. This issue has been addressed in SDL-2. Either use that or use a different OpenGL framework, that resizes windows without gong a full window recreation.


If you're using a FULLSCREEN video mode then something different happens additionally:

A change of the video mode actually changes the video signal timings going from the graphics card to the display. After such a change the display has to find synchronization with the new settings and that takes some time. This of course comes with some flickering as the display may try to display a frame of different timings with the old settings until it detects that those no longer match. It's a physical effect and there's nothing you can do in software to fix this, other than not changing the video mode at all.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top