]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - gl_backend.c
Fixed partially the sound code for DP video captures. It still can't sync with the...
[xonotic/darkplaces.git] / gl_backend.c
index ee2411725aa021d15b6ebdc375ebf8ec3167be8c..f5117ecedb65f46bacc3a56ddcd377894bfdab9a 100644 (file)
@@ -696,7 +696,7 @@ void GL_TransformToScreen(const vec4_t in, vec4_t out)
        iw = 1.0f / out[3];
        out[0] = r_view_x + (out[0] * iw + 1.0f) * r_view_width * 0.5f;
        out[1] = r_view_y + (out[1] * iw + 1.0f) * r_view_height * 0.5f;
-       out[2] = out[2] * iw;
+       out[2] = r_view_z + (out[2] * iw + 1.0f) * r_view_depth * 0.5f;
 }
 
 // called at beginning of frame
@@ -1190,24 +1190,24 @@ void R_Mesh_Draw_ShowTris(int numverts, int numtriangles, const int *elements)
 ==============================================================================
 */
 
-qboolean SCR_ScreenShot(char *filename, int x, int y, int width, int height, qboolean jpeg)
+qboolean SCR_ScreenShot(char *filename, qbyte *buffer1, qbyte *buffer2, qbyte *buffer3, int x, int y, int width, int height, qboolean flipx, qboolean flipy, qboolean flipdiagonal, qboolean jpeg)
 {
+       int     indices[3] = {0,1,2};
        qboolean ret;
-       qbyte *buffer;
 
        if (!r_render.integer)
                return false;
 
-       buffer = Mem_Alloc(tempmempool, width*height*3);
-       qglReadPixels (x, y, width, height, GL_RGB, GL_UNSIGNED_BYTE, buffer);
+       qglReadPixels (x, y, width, height, GL_RGB, GL_UNSIGNED_BYTE, buffer1);
        CHECKGLERROR
 
+       Image_CopyMux (buffer2, buffer1, width, height, flipx, flipy, flipdiagonal, 3, 3, indices);
+
        if (jpeg)
-               ret = JPEG_SaveImage_preflipped (filename, width, height, buffer);
+               ret = JPEG_SaveImage_preflipped (filename, width, height, buffer2);
        else
-               ret = Image_WriteTGARGB_preflipped (filename, width, height, buffer);
+               ret = Image_WriteTGARGB_preflipped (filename, width, height, buffer2, buffer3);
 
-       Mem_Free(buffer);
        return ret;
 }
 
@@ -1249,7 +1249,7 @@ CalcFov
 float CalcFov (float fov_x, float width, float height)
 {
        // calculate vision size and alter by aspect, then convert back to angle
-       return atan (height / (width / tan(fov_x/360*M_PI))) * 360 / M_PI;
+       return atan (((height/width)/vid_pixelaspect.value)*tan(fov_x/360.*M_PI))*360./M_PI; 
 }
 
 /*