2011-12-25 22:59:36 +00:00
|
|
|
/*
|
|
|
|
glsl_main.c
|
|
|
|
|
|
|
|
GLSL rendering
|
|
|
|
|
|
|
|
Copyright (C) 2011 Bill Currie <bill@taniwha.org>
|
|
|
|
|
|
|
|
Author: Bill Currie <bill@taniwha.org>
|
|
|
|
Date: 2011/12/23
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to:
|
|
|
|
|
|
|
|
Free Software Foundation, Inc.
|
|
|
|
59 Temple Place - Suite 330
|
|
|
|
Boston, MA 02111-1307, USA
|
|
|
|
|
|
|
|
*/
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2022-03-07 14:32:44 +00:00
|
|
|
#include <stdlib.h>
|
2012-02-22 07:32:34 +00:00
|
|
|
|
2011-12-25 22:59:36 +00:00
|
|
|
#include "QF/image.h"
|
2011-12-31 08:24:20 +00:00
|
|
|
#include "QF/sys.h"
|
2011-12-25 22:59:36 +00:00
|
|
|
|
2011-12-26 07:08:55 +00:00
|
|
|
#include "QF/GLSL/defines.h"
|
|
|
|
#include "QF/GLSL/funcs.h"
|
2011-12-25 22:59:36 +00:00
|
|
|
|
2012-02-14 08:28:09 +00:00
|
|
|
#include "r_internal.h"
|
2019-07-08 16:00:47 +00:00
|
|
|
#include "vid_gl.h"
|
2011-12-25 22:59:36 +00:00
|
|
|
|
2012-02-18 13:28:42 +00:00
|
|
|
tex_t *
|
2012-02-22 07:32:34 +00:00
|
|
|
glsl_SCR_CaptureBGR (void)
|
2012-01-05 10:19:37 +00:00
|
|
|
{
|
|
|
|
byte *r, *b;
|
|
|
|
int count, i;
|
|
|
|
tex_t *tex;
|
|
|
|
|
|
|
|
count = vid.width * vid.height;
|
2021-01-24 15:54:41 +00:00
|
|
|
tex = malloc (sizeof (tex_t) + count * 3);
|
|
|
|
tex->data = (byte *) (tex + 1);
|
2012-01-05 10:19:37 +00:00
|
|
|
SYS_CHECKMEM (tex);
|
|
|
|
tex->width = vid.width;
|
|
|
|
tex->height = vid.height;
|
|
|
|
tex->format = tex_rgb;
|
|
|
|
tex->palette = 0;
|
2012-02-22 07:48:57 +00:00
|
|
|
qfeglReadPixels (0, 0, vid.width, vid.height, GL_RGB,
|
2012-01-05 10:19:37 +00:00
|
|
|
GL_UNSIGNED_BYTE, tex->data);
|
|
|
|
for (i = 0, r = tex->data, b = tex->data + 2; i < count;
|
|
|
|
i++, r += 3, b += 3) {
|
|
|
|
byte t = *b;
|
|
|
|
*b = *r;
|
|
|
|
*r = t;
|
|
|
|
}
|
|
|
|
return tex;
|
|
|
|
}
|