5#define MAX_RENDERTARGETS 4
7cvar_t gl_debug = {
CF_CLIENT,
"gl_debug",
"0",
"enables OpenGL 4.3 debug output, 0 = off, 1 = HIGH severity only, 2 = also MEDIUM severity, 3 = also LOW severity messages. (note: enabling may not take effect until vid_restart on some drivers, and only X11 and Windows are known to support the debug context)"};
34void GL_PrintError(
GLenum errornumber,
const char *filename,
unsigned int linenumber)
43#ifdef GL_INVALID_VALUE
48#ifdef GL_INVALID_OPERATION
53#ifdef GL_STACK_OVERFLOW
58#ifdef GL_STACK_UNDERFLOW
63#ifdef GL_OUT_OF_MEMORY
68#ifdef GL_INVALID_FRAMEBUFFER_OPERATION
82 const char *sev =
"ENUM?", *typ =
"ENUM?", *
src =
"ENUM?", *col =
"";
110#define BACKENDACTIVECHECK if (!gl_state.active) Sys_Error("GL backend function called when backend is not active");
114typedef struct gltextureunit_s
129typedef struct gl_state_s
141 float polygonoffset[2];
283 Con_Print(
"OpenGL backend shutting down\n");
315 for (
i = 0;
i < endindex;
i++)
390 out[0] =
v->x + (out[0] * iw + 1.0f) *
v->width * 0.5f;
394 out[1] =
v->y + (out[1] * iw + 1.0f) *
v->height * 0.5f;
396 out[2] =
v->z + (out[2] * iw + 1.0f) *
v->depth * 0.5f;
432 int i, ix1, iy1, ix2, iy2;
457 for (
i = 0;
i < 8;
i++)
461 sign[
i] = dist[
i] > 0;
470 if (numvertices > 0 && numvertices < 8)
473 for (
i = 0;
i < 12;
i++)
477 if (sign[j] != sign[k])
479 f = dist[j] / (dist[j] - dist[k]);
480 VectorLerp(corner[j],
f, corner[k], vertex[numvertices]);
494 for (
i = 0;
i < numvertices;
i++)
503 if (y1 >
v2[1]) y1 =
v2[1];
514 ix1 = (
int)(
x1 - 1.0f);
517 iy1 = (
int)(y1 - 1.0f);
518 ix2 = (
int)(
x2 + 1.0f);
521 iy2 = (
int)(
y2 + 1.0f);
531 if (ix2 <= ix1 || iy2 <= iy1)
537 scissor[2] = ix2 - ix1;
538 scissor[3] = iy2 - iy1;
556 float clipPlane[4],
v3[3], v4[3];
572 q[0] = ((clipPlane[0] < 0.0f ? -1.0f : clipPlane[0] > 0.0f ? 1.0f : 0.0f) + m[8]) / m[0];
573 q[1] = ((clipPlane[1] < 0.0f ? -1.0f : clipPlane[1] > 0.0f ? 1.0f : 0.0f) + m[9]) / m[5];
575 q[3] = (1.0f + m[10]) / m[14];
581 m[2] = clipPlane[0] * d;
582 m[6] = clipPlane[1] * d;
583 m[10] = clipPlane[2] * d + 1.0f;
584 m[14] = clipPlane[3] * d;
587void R_Viewport_InitOrtho(
r_viewport_t *
v,
const matrix4x4_t *cameramatrix,
int x,
int y,
int width,
int height,
float x1,
float y1,
float x2,
float y2,
float nearclip,
float farclip,
const float *nearplane)
589 float left =
x1,
right =
x2, bottom =
y2, top = y1, zNear = nearclip, zFar = farclip;
591 memset(
v, 0,
sizeof(*
v));
593 v->cameramatrix = *cameramatrix;
600 memset(m, 0,
sizeof(m));
601 m[0] = 2/(
right - left);
602 m[5] = 2/(top - bottom);
603 m[10] = -2/(zFar - zNear);
605 m[13] = - (top + bottom)/(top - bottom);
606 m[14] = - (zFar + zNear)/(zFar - zNear);
614 v->screentodepth[0] = -farclip / (farclip - nearclip);
615 v->screentodepth[1] = farclip * nearclip / (farclip - nearclip);
630 Con_Printf(
"%f %f %f -> %f %f %f\n", test1[0], test1[1], test1[2], test2[0], test2[1], test2[2]);
635void R_Viewport_InitOrtho3D(
r_viewport_t *
v,
const matrix4x4_t *cameramatrix,
int x,
int y,
int width,
int height,
float frustumx,
float frustumy,
float nearclip,
float farclip,
const float *nearplane)
639 memset(
v, 0,
sizeof(*
v));
642 v->cameramatrix = *cameramatrix;
649 memset(m, 0,
sizeof(m));
650 m[0] = 1.0 / frustumx;
651 m[5] = 1.0 / frustumy;
652 m[10] = -2 / (farclip - nearclip);
653 m[14] = -(farclip + nearclip) / (farclip - nearclip);
655 v->screentodepth[0] = -farclip / (farclip - nearclip);
656 v->screentodepth[1] = farclip * nearclip / (farclip - nearclip);
677void R_Viewport_InitPerspective(
r_viewport_t *
v,
const matrix4x4_t *cameramatrix,
int x,
int y,
int width,
int height,
float frustumx,
float frustumy,
float nearclip,
float farclip,
const float *nearplane)
681 memset(
v, 0,
sizeof(*
v));
684 v->cameramatrix = *cameramatrix;
691 memset(m, 0,
sizeof(m));
692 m[0] = 1.0 / frustumx;
693 m[5] = 1.0 / frustumy;
694 m[10] = -(farclip + nearclip) / (farclip - nearclip);
696 m[14] = -2 * nearclip * farclip / (farclip - nearclip);
697 v->screentodepth[0] = -farclip / (farclip - nearclip);
698 v->screentodepth[1] = farclip * nearclip / (farclip - nearclip);
722 const float nudge = 1.0 - 1.0 / (1<<23);
724 memset(
v, 0,
sizeof(*
v));
727 v->cameramatrix = *cameramatrix;
734 memset(m, 0,
sizeof(m));
735 m[ 0] = 1.0 / frustumx;
736 m[ 5] = 1.0 / frustumy;
739 m[14] = -2 * nearclip * nudge;
740 v->screentodepth[0] = (m[10] + 1) * 0.5 - 1;
741 v->screentodepth[1] = m[14] * -0.5;
847 memset(
v, 0,
sizeof(*
v));
849 v->cameramatrix = *cameramatrix;
853 memset(m, 0,
sizeof(m));
855 m[10] = -(farclip + nearclip) / (farclip - nearclip);
857 m[14] = -2 * nearclip * farclip / (farclip - nearclip);
873 memset(
v, 0,
sizeof(*
v));
875 v->cameramatrix = *cameramatrix;
876 v->x = offsetx + (side & 1) *
size;
877 v->y = offsety + (side >> 1) *
size;
881 memset(m, 0,
sizeof(m));
883 m[10] = -(farclip + nearclip) / (farclip - nearclip);
885 m[14] = -2 * nearclip * farclip / (farclip - nearclip);
952#ifdef GL_UNIFORM_BUFFER
981 if (depthtexture && depthtexture->
texnum )
1008 else if (colortexture3)
1013 else if (colortexture2)
1018 else if (colortexture)
1032 Con_Printf(
CON_ERROR "R_Mesh_CreateFramebufferObject: glCheckFramebufferStatus returned %i\n", status);
1104 Con_Print(
"gl_debug: GL_ARB_debug_output is supported, enabling callback\n");
1170 if (qglBlendFuncSeparate)
1288 qglStencilFunc(compare, comparereference, comparemask);
CHECKGLERROR
1406 int state = (
r ? 1 : 0) | (
g ? 2 : 0) | (
b ? 4 : 0) | (
a ? 8 : 0);
1471void GL_Clear(
int mask,
const float *colorvalue,
float depthvalue,
int stencilvalue)
1474 static const float blackcolor[4] = {0.0f, 0.0f, 0.0f, 1.0f};
1477 colorvalue = blackcolor;
1480 mask &= ~GL_STENCIL_BUFFER_BIT;
1490 qglClearColor(colorvalue[0], colorvalue[1], colorvalue[2], colorvalue[3]);
CHECKGLERROR
1543#ifdef CONFIG_VIDEO_CAPTURE
1558 qglGenBuffers(PBO_COUNT,
cls.capturevideo.PBOs);
1559 for (
int i = 0;
i < PBO_COUNT; ++
i)
1570 cls.capturevideo.FBO = 0;
1573 qglGenFramebuffers(1, &
cls.capturevideo.FBO);
1575 qglGenTextures(1, &
cls.capturevideo.FBOtex);
1591 if (++
cls.capturevideo.PBOindex >= PBO_COUNT)
1592 cls.capturevideo.PBOindex = 0;
1593 if ((oldestPBOindex =
cls.capturevideo.PBOindex + 1) >= PBO_COUNT)
1600 if (
cls.capturevideo.FBO)
1611 if (
cls.capturevideo.FBO)
1616 if (newframestepframenum >= PBO_COUNT)
1622 cls.capturevideo.writeVideoFrame(newframestepframenum -
cls.capturevideo.framestepframe, pixbuf);
1635 for (
int i = 1;
i < PBO_COUNT; ++
i)
1638 qglDeleteTextures(1, &
cls.capturevideo.FBOtex);
1639 qglDeleteFramebuffers(1, &
cls.capturevideo.FBO);
1640 qglDeleteBuffers(PBO_COUNT,
cls.capturevideo.PBOs);
1653 Con_Printf(
CON_WARN "WARNING: gl_printcheckerror is on but gl_paranoid is off, turning it on...\n");
1664 shaderobject = qglCreateShader(shadertypeenum);
CHECKGLERROR
1670 qglGetShaderInfoLog(shaderobject,
sizeof(compilelog),
NULL, compilelog);
CHECKGLERROR
1671 if (compilelog[0] && ((strstr(compilelog,
"error") || strstr(compilelog,
"ERROR") || strstr(compilelog,
"Error")) || ((strstr(compilelog,
"WARNING") || strstr(compilelog,
"warning") || strstr(compilelog,
"Warning")) &&
developer.
integer) ||
developer_extra.
integer))
1673 int i, j, pretextlines = 0;
1674 for (
i = 0;
i < numstrings - 1;
i++)
1675 for (j = 0;strings[
i][j];j++)
1676 if (strings[
i][j] ==
'\n')
1678 Con_Printf(
"%s shader compile log:\n%s\n(line offset for any above warnings/errors: %i)\n", shadertype, compilelog, pretextlines);
1680 if (!shadercompiled)
1685 qglAttachShader(programobject, shaderobject);
CHECKGLERROR
1690unsigned int GL_Backend_CompileProgram(
int vertexstrings_count,
const char **vertexstrings_list,
int geometrystrings_count,
const char **geometrystrings_list,
int fragmentstrings_count,
const char **fragmentstrings_list)
1692 GLint programlinked;
1693 GLuint programobject = 0;
1712 qglBindFragDataLocation(programobject, 0,
"dp_FragColor");
1719#if defined(GL_GEOMETRY_SHADER) && !defined(USE_GLES2)
1720 if (geometrystrings_count && !
GL_Backend_CompileShader(programobject, GL_GEOMETRY_SHADER,
"geometry", geometrystrings_count, geometrystrings_list))
1729 qglGetProgramInfoLog(programobject,
sizeof(linklog),
NULL, linklog);
CHECKGLERROR
1734 if (strstr(linklog,
"error") || strstr(linklog,
"ERROR") || strstr(linklog,
"Error") || strstr(linklog,
"WARNING") || strstr(linklog,
"warning") || strstr(linklog,
"Warning") ||
developer_extra.
integer)
1743 if (strstr(linklog,
"fragment shader will run in software"))
1744 programlinked =
false;
1750 return programobject;
1759 qglDeleteProgram(prog);
1764void R_Mesh_Draw(
int firstvertex,
int numvertices,
int firsttriangle,
int numtriangles,
const int *element3i,
const r_meshbuffer_t *element3i_indexbuffer,
int element3i_bufferoffset,
const unsigned short *element3s,
const r_meshbuffer_t *element3s_indexbuffer,
int element3s_bufferoffset)
1766 unsigned int numelements = numtriangles * 3;
1768 size_t bufferoffset3i;
1770 size_t bufferoffset3s;
1771 if (numvertices < 3 || numtriangles < 1)
1774 Con_DPrintf(
"R_Mesh_Draw(%d, %d, %d, %d, %8p, %8p, %8x, %8p, %8p, %8x);\n", firstvertex, numvertices, firsttriangle, numtriangles, (
void *)element3i, (
void *)element3i_indexbuffer, (
int)element3i_bufferoffset, (
void *)element3s, (
void *)element3s_indexbuffer, (
int)element3s_bufferoffset);
1779 element3i += firsttriangle * 3;
1780 if (element3i_indexbuffer)
1781 element3i_bufferoffset += firsttriangle * 3 *
sizeof(*element3i);
1783 element3s += firsttriangle * 3;
1784 if (element3s_indexbuffer)
1785 element3s_bufferoffset += firsttriangle * 3 *
sizeof(*element3s);
1789 if (!element3s_indexbuffer)
1794 if (!element3i_indexbuffer)
1797 bufferobject3i = element3i_indexbuffer ? element3i_indexbuffer->
bufferobject : 0;
1798 bufferoffset3i = element3i_bufferoffset;
1799 bufferobject3s = element3s_indexbuffer ? element3s_indexbuffer->
bufferobject : 0;
1800 bufferoffset3s = element3s_bufferoffset;
1809 for (
i = 0;
i < (
unsigned int) numtriangles * 3;
i++)
1811 if (element3i[
i] < firstvertex || element3i[
i] >= firstvertex + numvertices)
1813 Con_Printf(
CON_WARN "R_Mesh_Draw: invalid vertex index %i (outside range %i - %i) in element3i array\n", element3i[
i], firstvertex, firstvertex + numvertices);
1820 for (
i = 0;
i < (
unsigned int) numtriangles * 3;
i++)
1822 if (element3s[
i] < firstvertex || element3s[
i] >= firstvertex + numvertices)
1824 Con_Printf(
CON_WARN "R_Mesh_Draw: invalid vertex index %i (outside range %i - %i) in element3s array\n", element3s[
i], firstvertex, firstvertex + numvertices);
1842 else if (bufferobject3i)
1867 buffer->bufferobject = 0;
1870 buffer->isindexbuffer = isindexbuffer;
1871 buffer->isuniformbuffer = isuniformbuffer;
1872 buffer->isdynamic = isdynamic;
1873 buffer->isindex16 = isindex16;
1883 if (
buffer->isindexbuffer)
1899 if (!
buffer->bufferobject)
1902 if (
buffer->isuniformbuffer)
1904 else if (
buffer->isindexbuffer)
1912#ifdef GL_UNIFORM_BUFFER
1913 if (
buffer->isuniformbuffer)
1923 if (
buffer->isuniformbuffer)
1957 int index16count, index16mem;
1958 int index32count, index32mem;
1959 int vertexcount, vertexmem;
1960 int uniformcount, uniformmem;
1961 int totalcount, totalmem;
1964 memset(bufferstat, 0,
sizeof(bufferstat));
1966 for (
i = 0;
i < endindex;
i++)
1971 if (
buffer->isuniformbuffer)
1975 else if (
buffer->isindexbuffer)
1979 isdynamic =
buffer->isdynamic;
1980 bufferstat[
type][isdynamic][0]++;
1981 bufferstat[
type][isdynamic][1] +=
buffer->size;
1993 totalcount = index16count + index32count + vertexcount + uniformcount;
1994 totalmem = index16mem + index32mem + vertexmem + uniformmem;
1995 Con_Printf(
"%i 16bit indexbuffers totalling %i bytes (%.3f MB)\n%i 32bit indexbuffers totalling %i bytes (%.3f MB)\n%i vertexbuffers totalling %i bytes (%.3f MB)\n%i uniformbuffers totalling %i bytes (%.3f MB)\ncombined %i buffers totalling %i bytes (%.3fMB)\n", index16count, index16mem, index16mem / 10248576.0, index32count, index32mem, index32mem / 10248576.0, vertexcount, vertexmem, vertexmem / 10248576.0, uniformcount, uniformmem, uniformmem / 10248576.0, totalcount, totalmem, totalmem / 10248576.0);
2008 int bufferobject = vertexbuffer ? vertexbuffer->
bufferobject : 0;
2010 Con_DPrintf(
CON_WARN "Warning: no bufferobject in R_Mesh_VertexPointer(%i, %i, %i, %p, %p, %08x)", components, gltype, (
int)
stride,
pointer, (
void *)vertexbuffer, (
unsigned int)bufferoffset);
2038 int bufferobject = vertexbuffer ? vertexbuffer->
bufferobject : 0;
2090 int bufferobject = vertexbuffer ? vertexbuffer->
bufferobject : 0;
2154 unsigned int unitnum;
2209 unsigned int unitnum;
2240 int bufferoffset_vertex3f = 0;
2241 int bufferoffset_color4f = 0;
2242 int bufferoffset_texcoord2f = 0;
2261void R_Mesh_PrepareVertices_Mesh_Arrays(
int numvertices,
const float *vertex3f,
const float *svector3f,
const float *tvector3f,
const float *normal3f,
const float *color4f,
const float *texcoordtexture2f,
const float *texcoordlightmap2f)
2270 int bufferoffset_vertex3f = 0;
2271 int bufferoffset_color4f = 0;
2272 int bufferoffset_texcoordtexture2f = 0;
2273 int bufferoffset_svector3f = 0;
2274 int bufferoffset_tvector3f = 0;
2275 int bufferoffset_normal3f = 0;
2276 int bufferoffset_texcoordlightmap2f = 0;
2287 if (texcoordtexture2f)
2289 if (texcoordlightmap2f)
void Cmd_AddCommand(unsigned flags, const char *cmd_name, xcommand_t function, const char *description)
called by the init functions of other parts of the program to register commands and functions to call...
#define CF_CLIENT
cvar/command that only the client can change/execute
#define CF_ARCHIVE
cvar should have its set value saved to config.cfg and persist across sessions
#define dp_strlcpy(dst, src, dsize)
void Con_Print(const char *msg)
Prints to all appropriate console targets, and adds timestamps.
void Con_DPrintf(const char *fmt,...)
A Con_Printf that only shows up if the "developer" cvar is set.
void Con_Printf(const char *fmt,...)
Prints to all appropriate console targets.
void Cvar_SetValueQuick(cvar_t *var, float value)
void Cvar_RegisterVariable(cvar_t *variable)
registers a cvar that already has the name, string, and optionally the archive elements set.
static int(ZEXPORT *qz_inflate)(z_stream *strm
unsigned short quadelement3s[QUADELEMENTS_MAXQUADS *6]
float rectviewmatrix[6][16]
void GL_ActiveTexture(unsigned int num)
static void gl_backend_devicelost(void)
static int bboxedges[12][2]
void R_Mesh_PrepareVertices_Vertex3f(int numvertices, const float *vertex3f, const r_meshbuffer_t *vertexbuffer, int bufferoffset)
float gl_modelviewprojection16f[16]
matrix4x4_t gl_modelmatrix
void GL_Clear(int mask, const float *colorvalue, float depthvalue, int stencilvalue)
void R_Mesh_VertexPointer(int components, int gltype, size_t stride, const void *pointer, const r_meshbuffer_t *vertexbuffer, size_t bufferoffset)
void GL_BlendEquationSubtract(qbool negated)
void R_Mesh_CopyToTexture(rtexture_t *tex, int tx, int ty, int sx, int sy, int width, int height)
void GL_CullFace(int state)
void GL_ColorMask(int r, int g, int b, int a)
unsigned short polygonelement3s[(POLYGONELEMENTS_MAXPOINTS-2) *3]
void R_Mesh_TexCoordPointer(unsigned int unitnum, int components, int gltype, size_t stride, const void *pointer, const r_meshbuffer_t *vertexbuffer, size_t bufferoffset)
static void GL_Backend_ResetState(void)
void GL_DepthMask(int state)
static void R_Viewport_ApplyNearClipPlaneFloatGL(const r_viewport_t *v, float *m, float normalx, float normaly, float normalz, float dist)
static void GL_VBOStats_f(cmd_state_t *cmd)
void R_GetViewport(r_viewport_t *v)
void SCR_ScreenShot_f(cmd_state_t *cmd)
int R_Mesh_TexBound(unsigned int unitnum, int id)
void GL_Backend_FreeProgram(unsigned int prog)
matrix4x4_t gl_modelviewprojectionmatrix
static void gl_backend_shutdown(void)
void GL_ReadPixelsBGRA(int x, int y, int width, int height, unsigned char *outpixels)
static void GL_BindVBO(int bufferobject)
#define BACKENDACTIVECHECK
int polygonelement3i[(POLYGONELEMENTS_MAXPOINTS-2) *3]
void R_Mesh_TexBind(unsigned int unitnum, rtexture_t *tex)
void R_Viewport_InitCubeSideView(r_viewport_t *v, const matrix4x4_t *cameramatrix, int side, int size, float nearclip, float farclip, const float *nearplane)
void R_Mesh_ColorPointer(int components, int gltype, size_t stride, const void *pointer, const r_meshbuffer_t *vertexbuffer, size_t bufferoffset)
void R_SetStencil(qbool enable, int writemask, int fail, int zfail, int zpass, int compare, int comparereference, int comparemask)
void GL_DepthFunc(int state)
void R_Mesh_Draw(int firstvertex, int numvertices, int firsttriangle, int numtriangles, const int *element3i, const r_meshbuffer_t *element3i_indexbuffer, int element3i_bufferoffset, const unsigned short *element3s, const r_meshbuffer_t *element3s_indexbuffer, int element3s_bufferoffset)
void R_Viewport_InitRectSideView(r_viewport_t *v, const matrix4x4_t *cameramatrix, int side, int size, int border, float nearclip, float farclip, const float *nearplane, int offsetx, int offsety)
static void gl_backend_start(void)
void GL_Mesh_ListVBOs(qbool printeach)
void R_Mesh_ClearBindingsForTexture(int texnum)
void R_Viewport_TransformToScreen(const r_viewport_t *v, const vec4_t in, vec4_t out)
void R_Viewport_InitPerspective(r_viewport_t *v, const matrix4x4_t *cameramatrix, int x, int y, int width, int height, float frustumx, float frustumy, float nearclip, float farclip, const float *nearplane)
void GL_DepthTest(int state)
void GL_DepthRange(float nearfrac, float farfrac)
void R_Viewport_InitOrtho3D(r_viewport_t *v, const matrix4x4_t *cameramatrix, int x, int y, int width, int height, float frustumx, float frustumy, float nearclip, float farclip, const float *nearplane)
cvar_t gl_printcheckerror
void R_Mesh_SetRenderTargets(int fbo)
int quadelement3i[QUADELEMENTS_MAXQUADS *6]
void GL_PolygonOffset(float planeoffset, float depthoffset)
r_meshbuffer_t * R_Mesh_CreateMeshBuffer(const void *data, size_t size, const char *name, qbool isindexbuffer, qbool isuniformbuffer, qbool isdynamic, qbool isindex16)
int R_Mesh_CreateFramebufferObject(rtexture_t *depthtexture, rtexture_t *colortexture, rtexture_t *colortexture2, rtexture_t *colortexture3, rtexture_t *colortexture4)
static void gl_backend_devicerestored(void)
static void GLAPIENTRY GL_DebugOutputCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, const GLvoid *userParam)
float cubeviewmatrix[6][16]
void R_SetViewport(const r_viewport_t *v)
void R_Viewport_InitOrtho(r_viewport_t *v, const matrix4x4_t *cameramatrix, int x, int y, int width, int height, float x1, float y1, float x2, float y2, float nearclip, float farclip, const float *nearplane)
matrix4x4_t gl_modelviewmatrix
void R_Mesh_DestroyMeshBuffer(r_meshbuffer_t *buffer)
void R_Mesh_ResetTextureState(void)
matrix4x4_t gl_projectionmatrix
void GL_Color(float cr, float cg, float cb, float ca)
void R_Mesh_PrepareVertices_Mesh_Arrays(int numvertices, const float *vertex3f, const float *svector3f, const float *tvector3f, const float *normal3f, const float *color4f, const float *texcoordtexture2f, const float *texcoordlightmap2f)
static gl_state_t gl_state
static void GL_BindUBO(int bufferobject)
void GL_BlendFunc(int blendfunc1, int blendfunc2)
static void gl_backend_newmap(void)
qbool R_ScissorForBBox(const float *mins, const float *maxs, int *scissor)
void R_Viewport_InitPerspectiveInfinite(r_viewport_t *v, const matrix4x4_t *cameramatrix, int x, int y, int width, int height, float frustumx, float frustumy, float nearclip, const float *nearplane)
void GL_AlphaToCoverage(qbool state)
void GL_Scissor(int x, int y, int width, int height)
float gl_modelview16f[16]
void R_Mesh_PrepareVertices_Generic_Arrays(int numvertices, const float *vertex3f, const float *color4f, const float *texcoord2f)
qbool gl_modelmatrixchanged
static const GLuint drawbuffers[4]
void R_Mesh_UpdateMeshBuffer(r_meshbuffer_t *buffer, const void *data, size_t size, qbool subdata, size_t offset)
static const char * buffertypename[R_BUFFERDATA_COUNT]
static void GL_BindEBO(int bufferobject)
matrix4x4_t gl_viewmatrix
static qbool GL_Backend_CompileShader(int programobject, GLenum shadertypeenum, const char *shadertype, int numstrings, const char **strings)
void R_Mesh_DestroyFramebufferObject(int fbo)
void GL_SetMirrorState(qbool state)
void GL_ScissorTest(int state)
void gl_backend_init(void)
unsigned int GL_Backend_CompileProgram(int vertexstrings_count, const char **vertexstrings_list, int geometrystrings_count, const char **geometrystrings_list, int fragmentstrings_count, const char **fragmentstrings_list)
void GL_CaptureVideo_BeginVideo(void)
void R_EntityMatrix(const matrix4x4_t *matrix)
void GL_CaptureVideo_EndVideo(void)
void GL_CaptureVideo_VideoFrame(int newframestepframenum)
#define QUADELEMENTS_MAXQUADS
#define POLYGONELEMENTS_MAXPOINTS
mempool_t * r_main_mempool
r_meshbuffer_t * R_BufferData_Store(size_t datasize, const void *data, r_bufferdata_type_t type, int *returnbufferoffset)
request space in a vertex/index/uniform buffer for the chosen data, returns the buffer pointer and of...
GLsizei GLsizei GLchar * source
GLenum GLsizei GLsizei height
GLint GLenum GLsizei GLsizei GLint border
GLfloat GLfloat GLfloat v2
#define GL_FRAGMENT_SHADER
#define GL_UNIFORM_BUFFER
GLvoid *GLAPIENTRY * qglMapBuffer(GLenum target, GLenum access)
#define GL_TEXTURE_CUBE_MAP
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB
#define GL_UNSIGNED_SHORT
#define GL_DEBUG_TYPE_PORTABILITY_ARB
GLenum GLuint GLenum GLsizei length
#define GL_DEBUG_SOURCE_APPLICATION_ARB
#define GL_COLOR_ATTACHMENT0
#define GL_INVALID_OPERATION
GLint GLenum GLint GLint y
#define GL_COLOR_ATTACHMENT2
#define GL_DEBUG_TYPE_PERFORMANCE_ARB
GLint GLenum GLboolean GLsizei stride
#define GL_STACK_OVERFLOW
#define GL_COLOR_ATTACHMENT1
#define GL_DEBUG_SEVERITY_HIGH_ARB
#define GL_DEBUG_SOURCE_API_ARB
#define GL_COLOR_ATTACHMENT3
#define GL_FRAMEBUFFER_COMPLETE
#define GL_DRAW_FRAMEBUFFER
GLsizeiptr const GLvoid * data
#define GL_PIXEL_PACK_BUFFER
#define GL_FUNC_REVERSE_SUBTRACT
#define GL_DEBUG_SEVERITY_LOW_ARB
#define GL_COMPILE_STATUS
#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB
#define GL_COLOR_BUFFER_BIT
#define GL_SAMPLE_ALPHA_TO_COVERAGE
GLuint GLuint GLintptr offset
#define GL_DEBUG_TYPE_ERROR_ARB
#define GL_INVALID_FRAMEBUFFER_OPERATION
#define GL_FRAMEBUFFER_BINDING
#define GL_DEBUG_SOURCE_THIRD_PARTY_ARB
#define GL_READ_FRAMEBUFFER
GLfloat GLfloat GLfloat GLfloat v3
#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB
#define GL_STENCIL_BUFFER_BIT
#define GL_DEBUG_TYPE_OTHER_ARB
#define GL_DEBUG_SOURCE_OTHER_ARB
#define GL_DEPTH_ATTACHMENT
#define GL_ELEMENT_ARRAY_BUFFER
#define GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB
#define GL_DEBUG_SOURCE_SHADER_COMPILER_ARB
#define GL_STENCIL_ATTACHMENT
#define GL_DEPTH_BUFFER_BIT
#define GL_STACK_UNDERFLOW
#define GL_DEBUG_SEVERITY_MEDIUM_ARB
#define VectorLerp(v1, lerp, v2, out)
#define VectorNegate(a, b)
#define BoxesOverlap(a, b, c, d)
#define Vector4Set(vec, r, g, b, a)
#define VectorSet(vec, x, y, z)
#define DotProduct4(a, b)
#define VectorCopy(in, out)
#define VectorScale(in, scale, out)
void Matrix4x4_Concat(matrix4x4_t *out, const matrix4x4_t *in1, const matrix4x4_t *in2)
void Matrix4x4_Transform(const matrix4x4_t *in, const float v[3], float out[3])
void Matrix4x4_Transform4(const matrix4x4_t *in, const float v[4], float out[4])
void Matrix4x4_Transform3x3(const matrix4x4_t *in, const float v[3], float out[3])
void Matrix4x4_FromArrayFloatGL(matrix4x4_t *out, const float in[16])
int Matrix4x4_Invert_Full(matrix4x4_t *out, const matrix4x4_t *in1)
void Matrix4x4_CreateRotate(matrix4x4_t *out, double angle, double x, double y, double z)
void Matrix4x4_ConcatRotate(matrix4x4_t *out, double angle, double x, double y, double z)
#define MAX_INPUTLINE
maximum size of console commandline, QuakeC strings, and many other text processing buffers
void R_RegisterModule(const char *name, void(*start)(void), void(*shutdown)(void), void(*newmap)(void), void(*devicelost)(void), void(*devicerestored)(void))
@ r_stat_vertexbufferuploadsize
@ r_stat_vertexbufferuploadcount
@ r_stat_indexbufferuploadcount
@ r_stat_indexbufferuploadsize
@ R_BUFFERDATA_COUNT
uniform buffer
@ R_BUFFERDATA_UNIFORM
index buffer - 32bit (because D3D cares)
@ R_BUFFERDATA_INDEX32
index buffer - 16bit (because D3D cares)
@ R_BUFFERDATA_INDEX16
vertex buffer
@ R_VIEWPORTTYPE_PERSPECTIVE_INFINITEFARCLIP
@ R_VIEWPORTTYPE_PERSPECTIVECUBESIDE
@ R_VIEWPORTTYPE_PERSPECTIVE
command interpreter state - the tokenizing and execution of commands, as well as pointers to which cv...
int defaultframebufferobject
qbool pointer_color_enabled
memexpandablearray_t meshbufferarray
const r_meshbuffer_t * pointer_color_vertexbuffer
size_t pointer_color_stride
int pointer_vertex_gltype
void * preparevertices_tempdata
int preparevertices_numvertices
size_t preparevertices_tempdatamaxsize
const void * pointer_vertex_pointer
int pointer_color_components
gltextureunit_t units[MAX_TEXTUREUNITS]
const void * pointer_color_pointer
const r_meshbuffer_t * pointer_vertex_vertexbuffer
size_t pointer_vertex_stride
int pointer_vertex_components
size_t pointer_vertex_offset
size_t pointer_color_offset
size_t pointer_texcoord_offset
const void * pointer_texcoord_pointer
int pointer_texcoord_gltype
size_t pointer_texcoord_stride
int pointer_texcoord_components
const r_meshbuffer_t * pointer_texcoord_vertexbuffer
r_viewport_t viewport
note: if r_viewscale is used, the viewport.width and viewport.height may be less than width and heigh...
viddef_mode_t mode
currently active video mode
void Sys_Error(const char *error,...) DP_FUNC_PRINTF(1) DP_FUNC_NORETURN
Causes the entire program to exit ASAP.
viddef_t vid
global video state
size_t Mem_ExpandableArray_IndexRange(const memexpandablearray_t *l)
void Mem_ExpandableArray_NewArray(memexpandablearray_t *l, mempool_t *mempool, size_t recordsize, int numrecordsperarray)
void Mem_ExpandableArray_FreeRecord(memexpandablearray_t *l, void *record)
void * Mem_ExpandableArray_AllocRecord(memexpandablearray_t *l)
void * Mem_ExpandableArray_RecordAtIndex(const memexpandablearray_t *l, size_t index)
void Mem_ExpandableArray_FreeArray(memexpandablearray_t *l)