]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - gl_backend.c
Added an implementation of Lehmer random number generator with Lecuyer constant,...
[xonotic/darkplaces.git] / gl_backend.c
index 28418bf3a42ad35af80332f704df461edba7b822..450d194f2d03d02090c0b3db1731362fdfbabf1b 100644 (file)
@@ -130,7 +130,7 @@ int gl_maxdrawrangeelementsvertices;
 int gl_maxdrawrangeelementsindices;
 
 #ifdef DEBUGGL
-int errornumber = 0;
+int gl_errornumber = 0;
 
 void GL_PrintError(int errornumber, const char *filename, int linenumber)
 {
@@ -1097,7 +1097,7 @@ void R_Viewport_InitCubeSideView(r_viewport_t *v, const matrix4x4_t *cameramatri
        m[14] = -2 * nearclip * farclip / (farclip - nearclip);
 
        Matrix4x4_FromArrayFloatGL(&basematrix, cubeviewmatrix[side]);
-       Matrix4x4_Invert_Simple(&tempmatrix, &v->cameramatrix);
+       Matrix4x4_Invert_Full(&tempmatrix, &v->cameramatrix);
        Matrix4x4_Concat(&v->viewmatrix, &basematrix, &tempmatrix);
 
        if (nearplane)
@@ -1125,7 +1125,7 @@ void R_Viewport_InitRectSideView(r_viewport_t *v, const matrix4x4_t *cameramatri
        m[14] = -2 * nearclip * farclip / (farclip - nearclip);
 
        Matrix4x4_FromArrayFloatGL(&basematrix, rectviewmatrix[side]);
-       Matrix4x4_Invert_Simple(&tempmatrix, &v->cameramatrix);
+       Matrix4x4_Invert_Full(&tempmatrix, &v->cameramatrix);
        Matrix4x4_Concat(&v->viewmatrix, &basematrix, &tempmatrix);
 
        switch(vid.renderpath)
@@ -1277,8 +1277,16 @@ int R_Mesh_CreateFramebufferObject(rtexture_t *depthtexture, rtexture_t *colorte
                        if (depthtexture  && depthtexture->texnum ) qglFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT  , depthtexture->gltexturetypeenum , depthtexture->texnum , 0);CHECKGLERROR
                        if (depthtexture  && depthtexture->renderbuffernum ) qglFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT  , GL_RENDERBUFFER, depthtexture->renderbuffernum );CHECKGLERROR
 #else
-                       if (depthtexture  && depthtexture->texnum ) qglFramebufferTexture2D(GL_FRAMEBUFFER, depthtexture->glisdepthstencil ? GL_DEPTH_STENCIL_ATTACHMENT : GL_DEPTH_ATTACHMENT  , depthtexture->gltexturetypeenum , depthtexture->texnum , 0);CHECKGLERROR
-                       if (depthtexture  && depthtexture->renderbuffernum ) qglFramebufferRenderbuffer(GL_FRAMEBUFFER, depthtexture->glisdepthstencil ? GL_DEPTH_STENCIL_ATTACHMENT : GL_DEPTH_ATTACHMENT  , GL_RENDERBUFFER, depthtexture->renderbuffernum );CHECKGLERROR
+                       if (depthtexture  && depthtexture->texnum )
+                       {
+                               qglFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT  , depthtexture->gltexturetypeenum , depthtexture->texnum , 0);CHECKGLERROR
+                               if (depthtexture->glisdepthstencil) qglFramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT  , depthtexture->gltexturetypeenum , depthtexture->texnum , 0);CHECKGLERROR
+                       }
+                       if (depthtexture  && depthtexture->renderbuffernum )
+                       {
+                               qglFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT  , GL_RENDERBUFFER, depthtexture->renderbuffernum );CHECKGLERROR
+                               if (depthtexture->glisdepthstencil) qglFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT  , GL_RENDERBUFFER, depthtexture->renderbuffernum );CHECKGLERROR
+                       }
 #endif
                        if (colortexture  && colortexture->texnum ) qglFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 , colortexture->gltexturetypeenum , colortexture->texnum , 0);CHECKGLERROR
                        if (colortexture2 && colortexture2->texnum) qglFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1 , colortexture2->gltexturetypeenum, colortexture2->texnum, 0);CHECKGLERROR