How on earth do you set your screen res after a crash??

Adam Nielsen a.nielsen at shikadi.net
Mon Oct 19 05:23:42 PDT 2009


> Please let me know if anyone knows how to change X11 screen resolutions
> without closing down everything and restarting.

Okay, I figured out a way.  Since it was an OpenGL program crashing, OpenGL
has the answer:

// gcc -o vidmode vidmode.cpp -lglut
#include <GL/glut.h>

int main(int argc, char *argv[])
{
        glutInit( &argc, argv );
        glutInitDisplayMode( GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH );
        //glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
        glutGameModeString("2560x1600:32 at 60");
        glutEnterGameMode();

        return 0;
}

It does seem to grab the screen for a while after running, but I guess if you
call the equivalent exit function it will put you back in your original mode
so you have to live with it.

I guess this looks like a bug with the OpenGL libraries rather than an XOrg
one after all, as I would assume the OpenGL libraries would restore the video
mode if the application terminated unexpectedly.

Cheers,
Adam.




More information about the xorg mailing list