]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
VID_Init now takes an int bpp parameter
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 22 Sep 2002 00:19:43 +0000 (00:19 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 22 Sep 2002 00:19:43 +0000 (00:19 +0000)
finished some work on the wgl VID_Init code

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2413 d7cf8633-e32d-0410-b094-e92efae38249

host.c
vid.h
vid_glx.c
vid_null.c
vid_wgl.c

diff --git a/host.c b/host.c
index 18b5c1a04df8627a777a6c7fad1401697da05cd3..a5e620d6b42950dd052d343a56f4dec6e5ca8982 100644 (file)
--- a/host.c
+++ b/host.c
@@ -885,7 +885,7 @@ void Host_Init (void)
 #ifndef _WIN32 // on non win32, mouse comes before video for security reasons
                IN_Init ();
 #endif
-               VID_Init (vid_fullscreen.integer, vid_width.integer, vid_height.integer);
+               VID_Init (vid_fullscreen.integer, vid_width.integer, vid_height.integer, vid_bitsperpixel.integer);
 
                Render_Init();
                S_Init ();
diff --git a/vid.h b/vid.h
index f3da2f4289b1ab064f672daa9027738be4ba66bc..8076076c83fac72ce303dd516e4491600dd1952e 100644 (file)
--- a/vid.h
+++ b/vid.h
@@ -102,7 +102,7 @@ void GL_Init (void);
 
 void VID_CheckExtensions(void);
 
-void VID_Init (int fullscreen, int width, int height);
+void VID_Init (int fullscreen, int width, int height, int bpp);
 // Called at startup
 
 void VID_Shutdown (void);
index 33ecded764021e3467925582cc2b502a23a05663..a80277ff251c0f92611ce605b951663a8768fe9b 100644 (file)
--- a/vid_glx.c
+++ b/vid_glx.c
@@ -636,7 +636,7 @@ int VID_SetGamma(float prescale, float gamma, float scale, float base)
 #endif
 }
 
-void VID_Init(int fullscreen, int width, int height)
+void VID_Init(int fullscreen, int width, int height, int bpp)
 {
        int i;
 // LordHavoc: FIXME: finish this code, we need to allocate colors before we can store them
index 2b4d3b029e60462869ea8bf0ceeb93025209ffcc..6a14679bcaf9dc239c69d5c94cb8a96378ba21d0 100644 (file)
@@ -67,7 +67,7 @@ int VID_SetGamma(float prescale, float gamma, float scale, float base)
        return FALSE;
 }
 
-void VID_Init(int fullscreen, int width, int height)
+void VID_Init(int fullscreen, int width, int height, int bpp)
 {
        InitSig(); // trap evil signals
 }
index 2562f48893ced2bdbcf5bc26032b6d73eb1808fd..0e9b29443b48c94ce98e4741b7cdee1eef2fb638 100644 (file)
--- a/vid_wgl.c
+++ b/vid_wgl.c
@@ -33,14 +33,16 @@ BOOL (WINAPI *qwglSetPixelFormat)(HDC, int, CONST PIXELFORMATDESCRIPTOR *);
 BOOL (WINAPI *qwglSwapBuffers)(HDC);
 HGLRC (WINAPI *qwglCreateContext)(HDC);
 BOOL (WINAPI *qwglDeleteContext)(HGLRC);
+HGLRC (WINAPI *qwglGetCurrentContext)(VOID);
+HDC (WINAPI *qwglGetCurrentDC)(VOID);
 PROC (WINAPI *qwglGetProcAddress)(LPCSTR);
 BOOL (WINAPI *qwglMakeCurrent)(HDC, HGLRC);
 BOOL (WINAPI *qwglSwapIntervalEXT)(int interval);
-const char *(WINAPI *wglGetExtensionsStringARB)(HDC hdc);
+const char *(WINAPI *qwglGetExtensionsStringARB)(HDC hdc);
 
 static gl_extensionfunctionlist_t getextensionsstringfuncs[] =
 {
-       {"wglGetExtensionsString", (void **) &qwglGetExtensionsString},
+       {"wglGetExtensionsString", (void **) &qwglGetExtensionsStringARB},
        {NULL, NULL}
 };
 
@@ -986,14 +988,7 @@ void VID_InitFullDIB (HINSTANCE hInstance)
                        devmode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
 
                        if (ChangeDisplaySettings (&devmode, CDS_TEST | CDS_FULLSCREEN) == DISP_CHANGE_SUCCESSFUL)
-                       {
-                       // if the width is more than twice the height, reduce it by half because this
-                       // is probably a dual-screen monitor
-                               if ((!COM_CheckParm("-noadjustaspect")) && (devmode.dmPelsWidth > (devmode.dmPelsHeight << 1)))
-                                       VID_AddMode(MS_FULLDIB, devmode.dmPelsWidth >> 1, devmode.dmPelsHeight, 0, 1, 1, 1, devmode.dmBitsPerPel);
-                               else
-                                       VID_AddMode(MS_FULLDIB, devmode.dmPelsWidth, devmode.dmPelsHeight, 0, 0, 1, 1, devmode.dmBitsPerPel);
-                       }
+                               VID_AddMode(MS_FULLDIB, devmode.dmPelsWidth, devmode.dmPelsHeight, 0, 1, 1, devmode.dmBitsPerPel);
                }
 
                modenum++;
@@ -1015,7 +1010,7 @@ void VID_InitFullDIB (HINSTANCE hInstance)
                        devmode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
 
                        if (ChangeDisplaySettings (&devmode, CDS_TEST | CDS_FULLSCREEN) == DISP_CHANGE_SUCCESSFUL)
-                               VID_AddMode(MS_FULLDIB, devmode.dmPelsWidth, devmode.dmPelsHeight, 0, 0, 1, 1, devmode.dmBitsPerPel);
+                               VID_AddMode(MS_FULLDIB, devmode.dmPelsWidth, devmode.dmPelsHeight, 0, 1, 1, devmode.dmBitsPerPel);
                }
                switch (bpp)
                {
@@ -1233,10 +1228,11 @@ void *GL_GetProcAddress(const char *name)
 VID_Init
 ===================
 */
-void VID_Init (int fullscreen, int width, int height)
+void VID_Init (int fullscreen, int width, int height, int bpp)
 {
-       int i;
-       int basenummodes, bpp, findbpp, done;
+       int i, bestmode;
+       double rating, bestrating;
+       int basenummodes, done;
        HDC hdc;
        DEVMODE devmode;
 
@@ -1287,11 +1283,14 @@ void VID_Init (int fullscreen, int width, int height)
                bestrating = 1000000000;
                for (i = 0;i < nummodes;i++)
                {
-                       rating = VID_CompareMode(fullscreen, width, height, bpp, modelist[i].fullscreen, modelist[i].width, modelist[i].height, modelist[i].bpp);
-                       if (bestrating > rating)
+                       if (fullscreen == modelist[i].fullscreen)
                        {
-                               bestrating = rating;
-                               bestmode = i;
+                               rating = VID_CompareMode(width, height, bpp, modelist[i].width, modelist[i].height, modelist[i].bpp);
+                               if (bestrating > rating)
+                               {
+                                       bestrating = rating;
+                                       bestmode = i;
+                               }
                        }
                }
 
@@ -1306,7 +1305,7 @@ void VID_Init (int fullscreen, int width, int height)
        maindc = GetDC(mainwindow);
        bSetupPixelFormat(maindc);
 
-       if (!gl_checkextension("wgl", wglfuncs, NULL, false))
+       if (!GL_CheckExtension("wgl", wglfuncs, NULL, false))
                Sys_Error("wgl functions not found\n");
 
        baseRC = qwglCreateContext( maindc );
@@ -1319,13 +1318,13 @@ void VID_Init (int fullscreen, int width, int height)
        gl_vendor = qglGetString(GL_VENDOR);
        gl_version = qglGetString(GL_VERSION);
        gl_extensions = qglGetString(GL_EXTENSIONS);
-       gl_platformname = "WGL";
+       gl_platform = "WGL";
        gl_platformextensions = "";
 
-       if (gl_checkextension("WGL_ARB_extensions_string", extensionsstringfuncs, NULL, false))
+       if (GL_CheckExtension("WGL_ARB_extensions_string", getextensionsstringfuncs, NULL, false))
                gl_platformextensions = qwglGetExtensionsStringARB(maindc);
 
-       gl_videosyncavailable = gl_checkextension("WGL_EXT_swap_control", wglswapintervalfuncs, NULL, false);
+       gl_videosyncavailable = GL_CheckExtension("WGL_EXT_swap_control", wglswapintervalfuncs, NULL, false);
 
        GL_Init ();