31 {0.0, 0.0}, {1.0, 0.0}, {1.0, 1.0}, {0.0, 1.0}
51 qglActiveTexture(texunit->
texture);
52 qglClientActiveTexture(texunit->
texture);
72 Com_Printf(
"Bad texnum (%d) in: %s (%d): %s\n", texnum, file, line,
function);
80 if (texnum == texunit->
texnum)
107 static float last_b, last_p, last_s, last_h;
150 const int v =
static_cast<int>(target);
152 case GL_VERTEX_ARRAY:
155 case GL_TEXTURE_COORD_ARRAY:
161 case GL_NORMAL_ARRAY:
162 glNormalPointer(type, 0, array);
184 const int v =
static_cast<int>(target);
186 case GL_VERTEX_ARRAY:
189 case GL_TEXTURE_COORD_ARRAY:
195 case GL_NORMAL_ARRAY:
221 if (target == GL_ELEMENT_ARRAY_BUFFER) {
222 qglBindBuffer(GL_ELEMENT_ARRAY_BUFFER,
id);
225 qglBindBuffer(GL_ARRAY_BUFFER,
id);
240 glBlendFunc(src, dest);
254 glEnable(GL_MULTISAMPLE);
256 glDisable(GL_MULTISAMPLE);
270 glDepthMask(GL_FALSE);
273 glDepthMask(GL_TRUE);
285 glEnable(GL_ALPHA_TEST);
287 glDisable(GL_ALPHA_TEST);
298 glEnable(GL_STENCIL_TEST);
300 glDisable(GL_STENCIL_TEST);
305 if (enable == texunit->
enabled)
314 glEnable(GL_TEXTURE_2D);
316 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
326 glDisable(GL_TEXTURE_2D);
327 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
340 glEnableClientState(GL_COLOR_ARRAY);
342 glDisableClientState(GL_COLOR_ARRAY);
355 if (enable && (!program || !program->
id))
366 glEnableClientState(GL_NORMAL_ARRAY);
368 glDisableClientState(GL_NORMAL_ARRAY);
378 const vec4_t blackColor = {0.0, 0.0, 0.0, 1.0};
391 glLightf(index, GL_LINEAR_ATTENUATION, 0);
392 glLightf(index, GL_QUADRATIC_ATTENUATION, 16.0 / (light->
radius * light->
radius));
397 glLightfv(index, GL_POSITION, position);
398 glLightfv(index, GL_AMBIENT, blackColor);
399 glLightfv(index, GL_DIFFUSE, light->
color);
400 glLightfv(index, GL_SPECULAR, blackColor);
405 const vec4_t blackColor = {0.0, 0.0, 0.0, 1.0};
417 glLightf(index, GL_LINEAR_ATTENUATION, 0.0);
418 glLightf(index, GL_QUADRATIC_ATTENUATION, 0.0);
419 glLightfv(index, GL_AMBIENT, blackColor);
420 glLightfv(index, GL_DIFFUSE, blackColor);
421 glLightfv(index, GL_SPECULAR, blackColor);
501 if (enable && (!program || !program->
id))
512 glEnable(GL_TEXTURE_2D);
516 glDisable(GL_TEXTURE_2D);
528 if (enable && (!program || !program->
id))
539 float userdata[] = {
static_cast<float>(source->
width), static_cast<float>(dir) };
559 glEnable(GL_POLYGON_OFFSET_FILL);
560 glPolygonOffset(-1.0, 1.0);
573 glPolygonOffset(0.0, 0.0);
574 glDisable(GL_POLYGON_OFFSET_FILL);
581 #define FOG_START 300.0
582 #define FOG_END 2500.0
609 glFogf(GL_FOG_DENSITY, 0.0);
618 #ifndef GL_VERSION_ES_CM_1_0
619 static GLenum glowRenderTarget = GL_COLOR_ATTACHMENT1_EXT;
715 if (enable && image !=
nullptr) {
730 if (enable && image !=
nullptr) {
753 ymin = xmin * yaspect;
754 ymax = xmax * yaspect;
756 glFrustum(xmin, xmax, ymin, ymax, zNear, zFar);
767 int x, x2, y2, y, w, h;
778 glViewport(x, y2, w, h);
783 glMatrixMode(GL_PROJECTION);
793 glTranslatef(x, -y, 0.0
f);
797 glMatrixMode(GL_MODELVIEW);
799 glRotatef(-90.0, 1.0, 0.0, 0.0);
800 glRotatef(90.0, 0.0, 0.0, 1.0);
814 glEnable(GL_DEPTH_TEST);
833 glMatrixMode(GL_PROJECTION);
840 glMatrixMode(GL_MODELVIEW);
850 glDisable(GL_DEPTH_TEST);
852 glDisable(GL_LIGHTING);
883 glClearColor(0, 0, 0, 0);
885 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
895 glEnableClientState(GL_VERTEX_ARRAY);
902 glEnableClientState(GL_NORMAL_ARRAY);
904 glDisableClientState(GL_NORMAL_ARRAY);
931 glAlphaFunc(GL_GREATER, 0.01
f);
934 glFogi(GL_FOG_MODE, GL_LINEAR);
939 glStencilFunc(GL_GEQUAL, 1, 0xff);
940 glStencilOp(GL_KEEP, GL_KEEP, GL_INCR);
943 glPolygonOffset(1, 1);
961 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, mode);
974 glDisable(GL_TEXTURE_2D);
979 glEnable(GL_TEXTURE_2D);
986 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
988 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
990 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_ALPHA);
991 glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_INTERPOLATE);
993 glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
995 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
997 glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, rgba);
1019 glColor4f(color[0], color[1], color[2], color[3]);
void R_EnableDrawAsGlow(bool enable)
bool R_EnableRenderbuffer(bool enable)
Enable the render to the framebuffer.
#define texunit_specularmap
void R_DisableAttribute(const char *name)
void R_UseProgram(r_program_t *prog)
r_program_t * warp_program
#define VectorCopy(src, dest)
void R_UseFramebuffer(const r_framebuffer_t *buf)
bind specified framebuffer object so we render to it
void R_EnableTexture(gltexunit_t *texunit, bool enable)
void R_EnableBumpmap(const image_t *normalmap)
Enables bumpmapping and binds the given normalmap.
void R_TexEnv(GLenum mode)
void glBindTexture(GLenum target, GLuint id)
QGL_EXTERN GLint GLenum type
bool roughnessmap_enabled
void R_ProgramParameter2fv(const char *name, GLfloat *value)
void R_BindBuffer(GLenum target, GLenum type, GLuint id)
void R_EnableAnimation(const mAliasMesh_t *mesh, float backlerp, bool enable)
Enables animation using keyframe interpolation on the GPU.
#define COMPONENTS_VERTEX_ARRAY3D
void R_EnableShell(bool enable)
void R_EnableStencilTest(bool enable)
r_program_t * active_program
void R_BindLightmapTexture(GLuint texnum)
void R_BindNormalmapTexture(GLuint texnum)
void R_EnableAlphaTest(bool enable)
void R_DisableSpotLight(int index)
GLfloat * vertex_array_3d
const GLenum *typedef GLint
void R_BlendFunc(GLenum src, GLenum dest)
void R_SetDefaultState(void)
local graphics definitions
static r_program_t * lastProgram
cvar_t * r_dynamic_lights
#define MIN_GL_CONSTANT_ATTENUATION
void Com_Printf(const char *const fmt,...)
static void R_BindTexture_(int texnum)
#define COMPONENTS_INDEX_ARRAY
gltexunit_t texunits[MAX_GL_TEXUNITS]
bool renderbuffer_enabled
const GLuint *typedef GLuint *typedef GLenum
void R_BindDeluxemapTexture(GLuint texnum)
GLshort * vertex_array_2d
void R_ClearStaticLights(void)
Remove all static light data.
void R_EnableMultisample(bool enable)
#define Mem_SafeReAlloc(ptr, size)
#define texunit_normalmap
void R_SetupSpotLight(int index, const light_t *light)
void R_Color(const vec4_t rgba)
Change the color to given value.
gltexunit_t * active_texunit
void R_EnableWarp(r_program_t *program, bool enable)
void R_ReallocateTexunitArray(gltexunit_t *texunit, int size)
Reallocate texcoord array of the specified texunit, if needed.
void R_ProgramParameter3fv(const char *name, GLfloat *value)
void R_ProgramParameter1i(const char *name, GLint value)
void R_EnableColorArray(bool enable)
texunits maintain multitexture state
GLfloat * next_vertex_array_3d
material_t defaultMaterial
void R_BindDefaultArray(GLenum target)
Binds the appropriate shared vertex array to the specified target.
#define COMPONENTS_TANGENT_ARRAY
QGL_EXTERN GLenum GLuint * dest
r_program_t * simple_glow_program
bool dynamic_lighting_enabled
void R_DrawBuffers(unsigned int drawBufferNum)
Activate draw buffer(s)
#define COMPONENTS_COLOR_ARRAY
void R_EnableRoughnessMap(const image_t *image, bool enable)
#define GL_ARRAY_LENGTH_CHUNK
r_program_t * world_program
void R_EnableAttribute(const char *name)
#define COMPONENTS_VERTEX_ARRAY2D
const material_t * active_material
void R_EnableBlend(bool enable)
void R_AttributePointer(const char *name, GLuint size, const GLvoid *array)
#define SKYBOX_DEPTH
Center position of skybox along z-axis. This is used to make sure we see only the inside of Skybox...
#define GL_NEXT_TANGENT_ARRAY
#define GL_NEXT_NORMAL_ARRAY
void R_UseMaterial(const material_t *material)
GLfloat * next_normal_array
void R_EnableBlur(r_program_t *program, bool enable, r_framebuffer_t *source, r_framebuffer_t *dest, int dir)
void R_BindColorAttachments(unsigned int n, unsigned int *attachments)
Activate draw buffer(s)
#define MAX_WORLD_WIDTH
-MAX_WORLD_WIDTH up tp +MAX_WORLD_WIDTH
bool R_EnableLighting(r_program_t *program, bool enable)
Enables hardware-accelerated lighting with the specified program. This should be called after any tex...
r_program_t * model_program
static void MYgluPerspective(GLfloat zNear, GLfloat zFar)
bool stencil_test_enabled
#define texunit_roughnessmap
GLfloat * next_tangent_array
#define texunit_deluxemap
void R_ReallocateStateArrays(int size)
Reallocate arrays of GL primitives if needed.
QGL_EXTERN int GLboolean GLfloat * v
void R_ProgramParameter1f(const char *name, GLfloat value)
void R_TexOverride(vec4_t rgba)
Sets special texture environment mode to override texture color; don't forget to call R_TexOverride(n...
void R_EnableSpecularMap(const image_t *image, bool enable)
#define COMPONENTS_NORMAL_ARRAY
const vec2_t default_texcoords[4]
static void R_UpdateGlowBufferBinding(void)
void R_BindTextureForTexUnit(GLuint texnum, gltexunit_t *texunit)
#define R_BindTexture(tn)
const struct image_s * active_normalmap
void R_EnableGlowMap(const image_t *image)
#define COMPONENTS_TEXCOORD_ARRAY
void R_EnableFog(bool enable)
#define GL_NEXT_VERTEX_ARRAY
void R_BindTextureDebug(int texnum, const char *file, int line, const char *function)
bool R_SelectTexture(gltexunit_t *texunit)
Returns false if the texunit is not supported.
void R_BindArray(GLenum target, GLenum type, const void *array)