]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - vid_shared.c
fix onground clearing by ANDing it with a downtrace by 1 unit - this does NOT cause...
[xonotic/darkplaces.git] / vid_shared.c
index 2af2694351df95a99372fa80b571c21224259c77..23d4bbe73a6df21c33e5494b19b1ca7619ee0516 100644 (file)
@@ -87,6 +87,15 @@ qboolean vid_activewindow = true;
 
 // we don't know until we try it!
 cvar_t vid_hardwaregammasupported = {CVAR_READONLY,"vid_hardwaregammasupported","1", "indicates whether hardware gamma is supported (updated by attempts to set hardware gamma ramps)"};
+
+// VorteX: more info cvars, mostly set in VID_CheckExtensions
+cvar_t gl_info_vendor = {CVAR_READONLY, "gl_info_vendor", "", "indicates brand of graphics chip"};
+cvar_t gl_info_renderer = {CVAR_READONLY, "gl_info_renderer", "", "indicates graphics chip model and other information"};
+cvar_t gl_info_version = {CVAR_READONLY, "gl_info_version", "", "indicates version of current renderer. begins with 1.0.0, 1.1.0, 1.2.0, 1.3.1 etc."};
+cvar_t gl_info_extensions = {CVAR_READONLY, "gl_info_extensions", "", "indicates extension list found by engine, space separated."};
+cvar_t gl_info_platform = {CVAR_READONLY, "gl_info_platform", "", "indicates GL platform: WGL, GLX, or AGL."};
+cvar_t gl_info_driver = {CVAR_READONLY, "gl_info_driver", "", "name of driver library (opengl32.dll, libGL.so.1, or whatever)."};
+
 // whether hardware gamma ramps are currently in effect
 qboolean vid_usinghwgamma = false;
 
@@ -255,13 +264,13 @@ GLboolean (GLAPIENTRY *qglIsTexture)(GLuint texture);
 void (GLAPIENTRY *qglPixelStoref)(GLenum pname, GLfloat param);
 void (GLAPIENTRY *qglPixelStorei)(GLenum pname, GLint param);
 
-void (GLAPIENTRY *qglTexImage1D)(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+//void (GLAPIENTRY *qglTexImage1D)(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
 void (GLAPIENTRY *qglTexImage2D)(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
-void (GLAPIENTRY *qglTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
+//void (GLAPIENTRY *qglTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, 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 *qglCopyTexImage1D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
+//void (GLAPIENTRY *qglCopyTexImage1D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
 void (GLAPIENTRY *qglCopyTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-void (GLAPIENTRY *qglCopyTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
+//void (GLAPIENTRY *qglCopyTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
 void (GLAPIENTRY *qglCopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
 
 
@@ -401,7 +410,7 @@ void (GLAPIENTRY *qglBindFramebufferEXT)(GLenum target, GLuint framebuffer);
 void (GLAPIENTRY *qglDeleteFramebuffersEXT)(GLsizei n, const GLuint *framebuffers);
 void (GLAPIENTRY *qglGenFramebuffersEXT)(GLsizei n, GLuint *framebuffers);
 GLenum (GLAPIENTRY *qglCheckFramebufferStatusEXT)(GLenum target);
-void (GLAPIENTRY *qglFramebufferTexture1DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+//void (GLAPIENTRY *qglFramebufferTexture1DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
 void (GLAPIENTRY *qglFramebufferTexture2DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
 void (GLAPIENTRY *qglFramebufferTexture3DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
 void (GLAPIENTRY *qglFramebufferRenderbufferEXT)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
@@ -410,10 +419,10 @@ void (GLAPIENTRY *qglGenerateMipmapEXT)(GLenum target);
 
 void (GLAPIENTRY *qglCompressedTexImage3DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
 void (GLAPIENTRY *qglCompressedTexImage2DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border,  GLsizei imageSize, const void *data);
-void (GLAPIENTRY *qglCompressedTexImage1DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data);
+//void (GLAPIENTRY *qglCompressedTexImage1DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data);
 void (GLAPIENTRY *qglCompressedTexSubImage3DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
 void (GLAPIENTRY *qglCompressedTexSubImage2DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
-void (GLAPIENTRY *qglCompressedTexSubImage1DARB)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data);
+//void (GLAPIENTRY *qglCompressedTexSubImage1DARB)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data);
 void (GLAPIENTRY *qglGetCompressedTexImageARB)(GLenum target, GLint lod, void *img);
 
 void (GLAPIENTRY *qglGenQueriesARB)(GLsizei n, GLuint *ids);
@@ -434,6 +443,7 @@ int GL_CheckExtension(const char *minglver_or_ext, const dllfunction_t *funcs, c
        int failed = false;
        const dllfunction_t *func;
        struct { int major, minor; } min_version, curr_version;
+       char extstr[MAX_INPUTLINE];
        int ext;
 
        if(sscanf(minglver_or_ext, "%d.%d", &min_version.major, &min_version.minor) == 2)
@@ -497,6 +507,10 @@ int GL_CheckExtension(const char *minglver_or_ext, const dllfunction_t *funcs, c
        // delay the return so it prints all missing functions
        if (failed)
                return false;
+       // VorteX: add to found extension list
+       dpsnprintf(extstr, sizeof(extstr), "%s %s ", gl_info_extensions.string, minglver_or_ext);
+       Cvar_SetQuick(&gl_info_extensions, extstr);
+
        Con_DPrint("enabled\n");
        return true;
 }
@@ -584,13 +598,13 @@ static dllfunction_t opengl110funcs[] =
 //     {"glPrioritizeTextures", (void **) &qglPrioritizeTextures},
 //     {"glAreTexturesResident", (void **) &qglAreTexturesResident},
        {"glIsTexture", (void **) &qglIsTexture},
-       {"glTexImage1D", (void **) &qglTexImage1D},
+//     {"glTexImage1D", (void **) &qglTexImage1D},
        {"glTexImage2D", (void **) &qglTexImage2D},
-       {"glTexSubImage1D", (void **) &qglTexSubImage1D},
+//     {"glTexSubImage1D", (void **) &qglTexSubImage1D},
        {"glTexSubImage2D", (void **) &qglTexSubImage2D},
-       {"glCopyTexImage1D", (void **) &qglCopyTexImage1D},
+//     {"glCopyTexImage1D", (void **) &qglCopyTexImage1D},
        {"glCopyTexImage2D", (void **) &qglCopyTexImage2D},
-       {"glCopyTexSubImage1D", (void **) &qglCopyTexSubImage1D},
+//     {"glCopyTexSubImage1D", (void **) &qglCopyTexSubImage1D},
        {"glCopyTexSubImage2D", (void **) &qglCopyTexSubImage2D},
        {"glScissor", (void **) &qglScissor},
        {"glPolygonOffset", (void **) &qglPolygonOffset},
@@ -786,7 +800,7 @@ static dllfunction_t fbofuncs[] =
        {"glDeleteFramebuffersEXT"                  , (void **) &qglDeleteFramebuffersEXT},
        {"glGenFramebuffersEXT"                     , (void **) &qglGenFramebuffersEXT},
        {"glCheckFramebufferStatusEXT"              , (void **) &qglCheckFramebufferStatusEXT},
-       {"glFramebufferTexture1DEXT"                , (void **) &qglFramebufferTexture1DEXT},
+//     {"glFramebufferTexture1DEXT"                , (void **) &qglFramebufferTexture1DEXT},
        {"glFramebufferTexture2DEXT"                , (void **) &qglFramebufferTexture2DEXT},
        {"glFramebufferTexture3DEXT"                , (void **) &qglFramebufferTexture3DEXT},
        {"glFramebufferRenderbufferEXT"             , (void **) &qglFramebufferRenderbufferEXT},
@@ -799,10 +813,10 @@ static dllfunction_t texturecompressionfuncs[] =
 {
        {"glCompressedTexImage3DARB",    (void **) &qglCompressedTexImage3DARB},
        {"glCompressedTexImage2DARB",    (void **) &qglCompressedTexImage2DARB},
-       {"glCompressedTexImage1DARB",    (void **) &qglCompressedTexImage1DARB},
+//     {"glCompressedTexImage1DARB",    (void **) &qglCompressedTexImage1DARB},
        {"glCompressedTexSubImage3DARB", (void **) &qglCompressedTexSubImage3DARB},
        {"glCompressedTexSubImage2DARB", (void **) &qglCompressedTexSubImage2DARB},
-       {"glCompressedTexSubImage1DARB", (void **) &qglCompressedTexSubImage1DARB},
+//     {"glCompressedTexSubImage1DARB", (void **) &qglCompressedTexSubImage1DARB},
        {"glGetCompressedTexImageARB",   (void **) &qglGetCompressedTexImageARB},
        {NULL, NULL}
 };
@@ -824,6 +838,9 @@ void VID_CheckExtensions(void)
 {
        gl_stencil = vid_bitsperpixel.integer == 32;
 
+       // VorteX: reset extensions info cvar, it got filled by GL_CheckExtension
+       Cvar_SetQuick(&gl_info_extensions, "");
+
        // reset all the gl extension variables here
        // this should match the declarations
        gl_max_texture_size = 0;
@@ -960,6 +977,13 @@ void VID_CheckExtensions(void)
     gl_support_amd_texture_texture4 = GL_CheckExtension("GL_AMD_texture_texture4", NULL, "-notexture4", false);
 // COMMANDLINEOPTION: GL: -notexturegather disables GL_ARB_texture_gather (which provides fetch4 sampling)
     gl_support_arb_texture_gather = GL_CheckExtension("GL_ARB_texture_gather", NULL, "-notexturegather", false);
+
+       // VorteX: set other info (maybe place them in VID_InitMode?)
+       Cvar_SetQuick(&gl_info_vendor, gl_vendor);
+       Cvar_SetQuick(&gl_info_renderer, gl_renderer);
+       Cvar_SetQuick(&gl_info_version, gl_version);
+       Cvar_SetQuick(&gl_info_platform, gl_platform ? gl_platform : "");
+       Cvar_SetQuick(&gl_info_driver, gl_driver ? gl_driver : "");
 }
 
 void Force_CenterView_f (void)
@@ -1170,6 +1194,12 @@ void VID_RestoreSystemGamma(void)
 void VID_Shared_Init(void)
 {
        Cvar_RegisterVariable(&vid_hardwaregammasupported);
+       Cvar_RegisterVariable(&gl_info_vendor);
+       Cvar_RegisterVariable(&gl_info_renderer);
+       Cvar_RegisterVariable(&gl_info_version);
+       Cvar_RegisterVariable(&gl_info_extensions);
+       Cvar_RegisterVariable(&gl_info_platform);
+       Cvar_RegisterVariable(&gl_info_driver);
        Cvar_RegisterVariable(&v_gamma);
        Cvar_RegisterVariable(&v_brightness);
        Cvar_RegisterVariable(&v_contrastboost);