]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - gl_backend.c
DP_QC_URI_ESCAPE
[xonotic/darkplaces.git] / gl_backend.c
index f79f5a2102daa23207d9f0399839cc57e0220713..8ea6717062e08eeb2c748b291d5a69859f3d7b96 100644 (file)
@@ -165,7 +165,6 @@ memexpandablearray_t gl_bufferobjectinfoarray;
 
 static void gl_backend_start(void)
 {
-       Con_Print("OpenGL Backend starting...\n");
        CHECKGLERROR
 
        if (qglDrawRangeElements != NULL)
@@ -175,7 +174,7 @@ static void gl_backend_start(void)
                CHECKGLERROR
                qglGetIntegerv(GL_MAX_ELEMENTS_INDICES, &gl_maxdrawrangeelementsindices);
                CHECKGLERROR
-               Con_Printf("glDrawRangeElements detected (max vertices %i, max indices %i)\n", gl_maxdrawrangeelementsvertices, gl_maxdrawrangeelementsindices);
+               Con_DPrintf("GL_MAX_ELEMENTS_VERTICES = %i\nGL_MAX_ELEMENTS_INDICES = %i\n", gl_maxdrawrangeelementsvertices, gl_maxdrawrangeelementsindices);
        }
 
        backendunits = bound(1, gl_textureunits, MAX_TEXTUREUNITS);
@@ -188,20 +187,18 @@ static void gl_backend_start(void)
                CHECKGLERROR
                qglGetIntegerv(GL_MAX_TEXTURE_COORDS_ARB, (int *)&backendarrayunits);
                CHECKGLERROR
-               Con_Printf("GLSL shader support detected: texture units = %i texenv, %i image, %i array\n", backendunits, backendimageunits, backendarrayunits);
+               Con_DPrintf("GLSL shader support detected: texture units = %i texenv, %i image, %i array\n", backendunits, backendimageunits, backendarrayunits);
                backendimageunits = bound(1, backendimageunits, MAX_TEXTUREUNITS);
                backendarrayunits = bound(1, backendarrayunits, MAX_TEXTUREUNITS);
        }
-       else if (backendunits > 1)
-               Con_Printf("multitexture detected: texture units = %i\n", backendunits);
        else
-               Con_Printf("singletexture\n");
+               Con_DPrintf("GL_MAX_TEXTUREUNITS = %i\n", backendunits);
 
        GL_Backend_AllocArrays();
 
        Mem_ExpandableArray_NewArray(&gl_bufferobjectinfoarray, r_main_mempool, sizeof(gl_bufferobjectinfo_t), 128);
 
-       Con_Printf("OpenGL backend started.\n");
+       Con_DPrintf("OpenGL backend started.\n");
 
        CHECKGLERROR
 
@@ -215,7 +212,7 @@ static void gl_backend_shutdown(void)
        backendarrayunits = 0;
        backendactive = false;
 
-       Con_Print("OpenGL Backend shutting down\n");
+       Con_DPrint("OpenGL Backend shutting down\n");
 
        Mem_ExpandableArray_FreeArray(&gl_bufferobjectinfoarray);
 
@@ -265,7 +262,7 @@ void gl_backend_init(void)
        Cvar_RegisterVariable(&gl_mesh_testarrayelement);
        Cvar_RegisterVariable(&gl_mesh_testmanualfeeding);
 
-       Cmd_AddCommand("gl_vbostats", GL_VBOStats_f, "prints a list of all buffer objects (vertex data and triangle elements) and total video memory used by them\n");
+       Cmd_AddCommand("gl_vbostats", GL_VBOStats_f, "prints a list of all buffer objects (vertex data and triangle elements) and total video memory used by them");
 
        R_RegisterModule("GL_Backend", gl_backend_start, gl_backend_shutdown, gl_backend_newmap);
 }
@@ -299,7 +296,11 @@ void GL_SetupView_Orientation_FromEntity(const matrix4x4_t *matrix)
        //Matrix4x4_ConcatRotate(&backend_viewmatrix, -angles[0], 0, 1, 0);
        //Matrix4x4_ConcatRotate(&backend_viewmatrix, -angles[1], 0, 0, 1);
        //Matrix4x4_ConcatTranslate(&backend_viewmatrix, -origin[0], -origin[1], -origin[2]);
+
+       // force an update of the model matrix by copying it off, resetting it, and then calling the R_Mesh_Matrix function with it
+       tempmatrix = backend_modelmatrix;
        memset(&backend_modelmatrix, 0, sizeof(backend_modelmatrix));
+       R_Mesh_Matrix(&tempmatrix);
 }
 
 void GL_SetupView_Mode_Perspective (double frustumx, double frustumy, double zNear, double zFar)
@@ -1824,8 +1825,9 @@ void R_Mesh_TexMatrix(unsigned int unitnum, const matrix4x4_t *matrix)
                        unit->matrix = *matrix;
                        CHECKGLERROR
                        Matrix4x4_ToArrayDoubleGL(&unit->matrix, glmatrix);
-                       qglMatrixMode(GL_TEXTURE);CHECKGLERROR
                        GL_ActiveTexture(unitnum);
+                       GL_ClientActiveTexture(unitnum);
+                       qglMatrixMode(GL_TEXTURE);CHECKGLERROR
                        qglLoadMatrixd(glmatrix);CHECKGLERROR
                        qglMatrixMode(GL_MODELVIEW);CHECKGLERROR
                }
@@ -1837,8 +1839,9 @@ void R_Mesh_TexMatrix(unsigned int unitnum, const matrix4x4_t *matrix)
                {
                        unit->texmatrixenabled = false;
                        CHECKGLERROR
-                       qglMatrixMode(GL_TEXTURE);CHECKGLERROR
                        GL_ActiveTexture(unitnum);
+                       GL_ClientActiveTexture(unitnum);
+                       qglMatrixMode(GL_TEXTURE);CHECKGLERROR
                        qglLoadIdentity();CHECKGLERROR
                        qglMatrixMode(GL_MODELVIEW);CHECKGLERROR
                }