]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Fixed black screen when using fullscreen mode on Mac OS X
authormolivier <molivier@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 20 Nov 2005 15:14:10 +0000 (15:14 +0000)
committermolivier <molivier@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 20 Nov 2005 15:14:10 +0000 (15:14 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5812 d7cf8633-e32d-0410-b094-e92efae38249

vid_agl.c

index 78616057133df6590e322543efa702733750ab67..12752c3554e1ce065050f0fb64ca0285add9706a 100644 (file)
--- a/vid_agl.c
+++ b/vid_agl.c
@@ -378,13 +378,22 @@ int VID_InitMode(int fullscreen, int width, int height, int bpp)
 
        // Set context and show the window
        context = qaglCreateContext(pixelFormat, NULL);
-       qaglDestroyPixelFormat(pixelFormat);
        if (context == NULL)
                Sys_Error ("aglCreateContext failed");
-       if (!qaglSetDrawable(context, GetWindowPort(window)))
-               Sys_Error ("aglSetDrawable failed");
+       if (fullscreen)
+       {
+               if (!qaglSetFullScreen (context, width, height, 0, 0))
+                       Sys_Error("aglSetFullScreen failed");
+               vid_isfullscreen = true;
+       }
+       else
+       {
+               if (!qaglSetDrawable(context, GetWindowPort(window)))
+                       Sys_Error ("aglSetDrawable failed");
+       }
        if (!qaglSetCurrentContext(context))
                Sys_Error ("aglSetCurrentContext failed");
+       qaglDestroyPixelFormat(pixelFormat);
 
        scr_width = width;
        scr_height = height;
@@ -392,13 +401,6 @@ int VID_InitMode(int fullscreen, int width, int height, int bpp)
        if ((qglGetString = (const GLubyte* (GLAPIENTRY *)(GLenum name))GL_GetProcAddress("glGetString")) == NULL)
                Sys_Error("glGetString not found in %s", gl_driver);
 
-       if (fullscreen)
-       {
-               if (!qaglSetFullScreen (context, width, height, 0, 0))
-                       Sys_Error("aglSetFullScreen failed");
-               vid_isfullscreen = true;
-       }
-
        gl_renderer = (const char *)qglGetString(GL_RENDERER);
        gl_vendor = (const char *)qglGetString(GL_VENDOR);
        gl_version = (const char *)qglGetString(GL_VERSION);