]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - vid_shared.c
VID_CompareMode removed
[xonotic/darkplaces.git] / vid_shared.c
index a35bb1ed26694f23066bf8f413543c336a1272d6..2fbd3df03aa020c2bb4ff73e4dcd1c78c380fbea 100644 (file)
@@ -1,12 +1,15 @@
 
 #include "quakedef.h"
 
+// global video state
+viddef_t vid;
+
 // LordHavoc: these are only set in wgl
 qboolean isG200 = false; // LordHavoc: the Matrox G200 can't do per pixel alpha, and it uses a D3D driver for GL... ugh...
 qboolean isRagePro = false; // LordHavoc: the ATI Rage Pro has limitations with per pixel alpha (the color scaler does not apply to per pixel alpha images...), although not as bad as a G200.
 
 // LordHavoc: GL_ARB_multitexture support
-int gl_textureunits;
+int gl_textureunits = 0;
 // LordHavoc: GL_ARB_texture_env_combine or GL_EXT_texture_env_combine support
 int gl_combine_extension = false;
 // LordHavoc: GL_EXT_compiled_vertex_array support
@@ -21,9 +24,9 @@ int vid_hidden = false;
 int vid_activewindow = true;
 
 cvar_t vid_fullscreen = {0, "vid_fullscreen", "1"};
-cvar_t vid_width = {0, "vid_width", "640"};
-cvar_t vid_height = {0, "vid_height", "480"};
-cvar_t vid_bitsperpixel = {0, "vid_bitsperpixel", "15"};
+cvar_t vid_width = {0, "vid_width", "800"};
+cvar_t vid_height = {0, "vid_height", "600"};
+cvar_t vid_bitsperpixel = {0, "vid_bitsperpixel", "32"};
 
 cvar_t vid_mouse = {CVAR_SAVE, "vid_mouse", "1"};
 cvar_t gl_combine = {0, "gl_combine", "1"};
@@ -143,6 +146,8 @@ void (GLAPIENTRY *qglBindTexture)(GLenum target, GLuint texture);
 void (GLAPIENTRY *qglTexImage2D)(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
 void (GLAPIENTRY *qglTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
 void (GLAPIENTRY *qglDeleteTextures)(GLsizei n, const GLuint *textures);
+void (GLAPIENTRY *qglPixelStoref)(GLenum pname, GLfloat param);
+void (GLAPIENTRY *qglPixelStorei)(GLenum pname, GLint param);
 
 void (GLAPIENTRY *qglDrawRangeElementsEXT)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
 
@@ -257,6 +262,8 @@ static gl_extensionfunctionlist_t opengl110funcs[] =
        {"glTexImage2D", (void **) &qglTexImage2D},
        {"glTexSubImage2D", (void **) &qglTexSubImage2D},
        {"glDeleteTextures", (void **) &qglDeleteTextures},
+       {"glPixelStoref", (void **) &qglPixelStoref},
+       {"glPixelStorei", (void **) &qglPixelStorei},
        {NULL, NULL}
 };
 
@@ -326,15 +333,6 @@ void VID_CheckExtensions(void)
                qglDrawRangeElements = qglDrawRangeElementsEXT;
 }
 
-double VID_CompareMode(int width1, int height1, int bpp1, int width2, int height2, int bpp2)
-{
-       double dw, dh, db;
-       dw = ((width2 - width1) / 2048) * 16;
-       dh = ((height2 - height1) / 1536) * 4;
-       db = (bpp2 - bpp1) / 32;
-       return dw * dw + dh * dh + db * db;
-}
-
 void Force_CenterView_f (void)
 {
        cl.viewangles[PITCH] = 0;
@@ -423,3 +421,15 @@ void VID_InitCvars(void)
                Cvar_SetQuick(&vid_bitsperpixel, com_argv[i+1]);
 }
 
+extern int VID_InitMode (int fullscreen, int width, int height, int bpp);
+int VID_Mode(int fullscreen, int width, int height, int bpp)
+{
+       if (fullscreen)
+               Con_Printf("Video: %dx%dx%d fullscreen\n", width, height, bpp);
+       else
+               Con_Printf("Video: %dx%d windowed\n", width, height);
+       if (VID_InitMode(fullscreen, width, height, bpp))
+               return true;
+       else
+               return false;
+}