mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-18 15:01:41 +00:00
Rename the glsl qfgl functions to qfegl.
Keep them separate from the gl renderer :)
This commit is contained in:
parent
36504547a8
commit
d445b4ef88
17 changed files with 447 additions and 447 deletions
|
@ -55,5 +55,6 @@ extern int gl_tess;
|
|||
extern int gl_max_lights;
|
||||
|
||||
void GL_EndRendering (void);
|
||||
void GL_Init_Common (void);
|
||||
|
||||
#endif // __QF_GL_vid_h
|
||||
|
|
|
@ -38,19 +38,19 @@
|
|||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
#define QFGL_WANT(ret, name, args) extern ret (GLAPIENTRY * qf##name) args;
|
||||
#define QFGL_NEED(ret, name, args) extern ret (GLAPIENTRY * qf##name) args;
|
||||
#define QFGL_WANT(ret, name, args) extern ret (GLAPIENTRY * qfe##name) args;
|
||||
#define QFGL_NEED(ret, name, args) extern ret (GLAPIENTRY * qfe##name) args;
|
||||
#include "QF/GLSL/qf_funcs_list.h"
|
||||
#undef QFGL_NEED
|
||||
#undef QFGL_WANT
|
||||
|
||||
extern void *libgl_handle;
|
||||
|
||||
qboolean GLF_Init (void);
|
||||
qboolean GLF_FindFunctions (void);
|
||||
void *QFGL_ProcAddress (void *handle, const char *name, qboolean);
|
||||
qboolean EGLF_Init (void);
|
||||
qboolean EGLF_FindFunctions (void);
|
||||
void *QFEGL_ProcAddress (void *handle, const char *name, qboolean);
|
||||
|
||||
void *QFGL_LoadLibrary (void);
|
||||
void *QFGL_GetProcAddress (void *handle, const char *name);
|
||||
void *QFEGL_LoadLibrary (void);
|
||||
void *QFEGL_GetProcAddress (void *handle, const char *name);
|
||||
|
||||
#endif // __QF_GLSL_funcs_h_
|
||||
|
|
|
@ -41,6 +41,7 @@ extern int glsl_palette;
|
|||
extern int glsl_colormap;
|
||||
|
||||
void GLSL_EndRendering (void);
|
||||
void GLSL_Init_Common (void);
|
||||
int GLSL_CompileShader (const char *name, const char *shader_src, int type);
|
||||
int GLSL_LinkProgram (const char *name, int vert, int frag);
|
||||
int GLSL_ResolveShaderParam (int program, shaderparam_t *param);
|
||||
|
|
|
@ -78,6 +78,4 @@ void R_DrawAliasModel (entity_t *e);
|
|||
|
||||
void R_MarkLeaves (void);
|
||||
|
||||
void GL_Init_Common (void);
|
||||
|
||||
#endif//__r_internal_h
|
||||
|
|
|
@ -74,7 +74,7 @@ glsl_alias_clear (model_t *m)
|
|||
|
||||
bufs[0] = hdr->posedata;
|
||||
bufs[1] = hdr->commands;
|
||||
qfglDeleteBuffers (2, bufs);
|
||||
qfeglDeleteBuffers (2, bufs);
|
||||
|
||||
skins = ((maliasskindesc_t *) ((byte *) hdr + hdr->skindesc));
|
||||
for (i = 0; i < hdr->mdl.numskins; i++) {
|
||||
|
@ -225,18 +225,18 @@ Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr, void *_m, int _s,
|
|||
hdr->poseverts = numverts;
|
||||
|
||||
// load the vertex data and indices into GL
|
||||
qfglGenBuffers (2, bnum);
|
||||
qfeglGenBuffers (2, bnum);
|
||||
hdr->posedata = bnum[0];
|
||||
hdr->commands = bnum[1];
|
||||
qfglBindBuffer (GL_ARRAY_BUFFER, hdr->posedata);
|
||||
qfglBindBuffer (GL_ELEMENT_ARRAY_BUFFER, hdr->commands);
|
||||
qfglBufferData (GL_ARRAY_BUFFER, vertexsize, verts, GL_STATIC_DRAW);
|
||||
qfglBufferData (GL_ELEMENT_ARRAY_BUFFER, indexsize, indices,
|
||||
qfeglBindBuffer (GL_ARRAY_BUFFER, hdr->posedata);
|
||||
qfeglBindBuffer (GL_ELEMENT_ARRAY_BUFFER, hdr->commands);
|
||||
qfeglBufferData (GL_ARRAY_BUFFER, vertexsize, verts, GL_STATIC_DRAW);
|
||||
qfeglBufferData (GL_ELEMENT_ARRAY_BUFFER, indexsize, indices,
|
||||
GL_STATIC_DRAW);
|
||||
|
||||
// all done
|
||||
qfglBindBuffer (GL_ARRAY_BUFFER, 0);
|
||||
qfglBindBuffer (GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
qfeglBindBuffer (GL_ARRAY_BUFFER, 0);
|
||||
qfeglBindBuffer (GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
free (verts);
|
||||
free (indices);
|
||||
}
|
||||
|
|
|
@ -99,8 +99,8 @@ Mod_ProcessTexture (texture_t *tx)
|
|||
memcpy (&data[j * 128], &tx_data[j * 256 + i * 128], 128);
|
||||
tx->sky_tex[i] = GLSL_LoadQuakeTexture (tx->name, 128, 128, data);
|
||||
// GLSL_LoadQuakeTexture () leaves the texture bound
|
||||
qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
}
|
||||
tx->gl_texturenum = 0;
|
||||
} else {
|
||||
|
|
|
@ -87,10 +87,10 @@ Skin_ProcessTranslation (int cmap, const byte *translation)
|
|||
*dst++ = 255; // alpha = 1
|
||||
}
|
||||
}
|
||||
qfglBindTexture (GL_TEXTURE_2D, cmap_tex[cmap - 1]);
|
||||
qfglTexSubImage2D (GL_TEXTURE_2D, 0, TOP_RANGE, 0, 16, VID_GRADES,
|
||||
qfeglBindTexture (GL_TEXTURE_2D, cmap_tex[cmap - 1]);
|
||||
qfeglTexSubImage2D (GL_TEXTURE_2D, 0, TOP_RANGE, 0, 16, VID_GRADES,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, top);
|
||||
qfglTexSubImage2D (GL_TEXTURE_2D, 0, BOTTOM_RANGE, 0, 16, VID_GRADES,
|
||||
qfeglTexSubImage2D (GL_TEXTURE_2D, 0, BOTTOM_RANGE, 0, 16, VID_GRADES,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, bottom);
|
||||
}
|
||||
|
||||
|
@ -103,17 +103,17 @@ Skin_SetupSkin (skin_t *skin, int cmap)
|
|||
tex_t *tex = skin->texels;
|
||||
|
||||
skin->texnum = skin_tex[cmap - 1];
|
||||
qfglBindTexture (GL_TEXTURE_2D, skin->texnum);
|
||||
qfglTexImage2D (GL_TEXTURE_2D, 0, GL_LUMINANCE,
|
||||
qfeglBindTexture (GL_TEXTURE_2D, skin->texnum);
|
||||
qfeglTexImage2D (GL_TEXTURE_2D, 0, GL_LUMINANCE,
|
||||
tex->width, tex->height,
|
||||
0, GL_LUMINANCE, GL_UNSIGNED_BYTE, tex->data);
|
||||
qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,
|
||||
qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,
|
||||
GL_CLAMP_TO_EDGE);
|
||||
qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,
|
||||
qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,
|
||||
GL_CLAMP_TO_EDGE);
|
||||
qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
|
||||
qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
|
||||
GL_NEAREST);
|
||||
qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
|
||||
qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
|
||||
GL_NEAREST);
|
||||
}
|
||||
skin->auxtex = cmap_tex[cmap - 1];
|
||||
|
@ -137,15 +137,15 @@ Skin_InitTranslations (void)
|
|||
*dst++ = *in++;
|
||||
*dst++ = 255; // alpha = 1
|
||||
}
|
||||
qfglGenTextures (MAX_TRANSLATIONS, cmap_tex);
|
||||
qfglGenTextures (MAX_TRANSLATIONS, skin_tex);
|
||||
qfeglGenTextures (MAX_TRANSLATIONS, cmap_tex);
|
||||
qfeglGenTextures (MAX_TRANSLATIONS, skin_tex);
|
||||
for (i = 0; i < MAX_TRANSLATIONS; i++) {
|
||||
qfglBindTexture (GL_TEXTURE_2D, cmap_tex[i]);
|
||||
qfglTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 256, VID_GRADES, 0,
|
||||
qfeglBindTexture (GL_TEXTURE_2D, cmap_tex[i]);
|
||||
qfeglTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 256, VID_GRADES, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, map);
|
||||
qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -170,13 +170,13 @@ set_arrays (const shaderparam_t *vert, const shaderparam_t *norm,
|
|||
const shaderparam_t *st, aliasvrt_t *pose)
|
||||
{
|
||||
byte *pose_offs = (byte *) pose;
|
||||
qfglVertexAttribPointer (vert->location, 3, GL_UNSIGNED_SHORT,
|
||||
qfeglVertexAttribPointer (vert->location, 3, GL_UNSIGNED_SHORT,
|
||||
0, sizeof (aliasvrt_t),
|
||||
pose_offs + field_offset (aliasvrt_t, vertex));
|
||||
qfglVertexAttribPointer (norm->location, 3, GL_SHORT,
|
||||
qfeglVertexAttribPointer (norm->location, 3, GL_SHORT,
|
||||
1, sizeof (aliasvrt_t),
|
||||
pose_offs + field_offset (aliasvrt_t, normal));
|
||||
qfglVertexAttribPointer (st->location, 2, GL_SHORT,
|
||||
qfeglVertexAttribPointer (st->location, 2, GL_SHORT,
|
||||
0, sizeof (aliasvrt_t),
|
||||
pose_offs + field_offset (aliasvrt_t, st));
|
||||
}
|
||||
|
@ -253,37 +253,37 @@ glsl_R_DrawAlias (void)
|
|||
skin_size[0] = hdr->mdl.skinwidth;
|
||||
skin_size[1] = hdr->mdl.skinheight;
|
||||
|
||||
qfglActiveTexture (GL_TEXTURE0 + 1);
|
||||
qfglBindTexture (GL_TEXTURE_2D, colormap);
|
||||
qfglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfglBindTexture (GL_TEXTURE_2D, skin_tex);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 1);
|
||||
qfeglBindTexture (GL_TEXTURE_2D, colormap);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfeglBindTexture (GL_TEXTURE_2D, skin_tex);
|
||||
|
||||
#ifndef TETRAHEDRON
|
||||
qfglBindBuffer (GL_ARRAY_BUFFER, hdr->posedata);
|
||||
qfglBindBuffer (GL_ELEMENT_ARRAY_BUFFER, hdr->commands);
|
||||
qfeglBindBuffer (GL_ARRAY_BUFFER, hdr->posedata);
|
||||
qfeglBindBuffer (GL_ELEMENT_ARRAY_BUFFER, hdr->commands);
|
||||
#endif
|
||||
|
||||
qfglVertexAttrib4fv (quake_mdl.colora.location, color);
|
||||
qfglVertexAttrib4fv (quake_mdl.colorb.location, color);
|
||||
qfglUniform1f (quake_mdl.blend.location, blend);
|
||||
qfglUniform1f (quake_mdl.ambient.location, ambient);
|
||||
qfglUniform1f (quake_mdl.shadelight.location, shadelight);
|
||||
qfglUniform3fv (quake_mdl.lightvec.location, 1, lightvec);
|
||||
qfglUniform2fv (quake_mdl.skin_size.location, 1, skin_size);
|
||||
qfglUniformMatrix4fv (quake_mdl.mvp_matrix.location, 1, false, mvp_mat);
|
||||
qfglUniformMatrix3fv (quake_mdl.norm_matrix.location, 1, false, norm_mat);
|
||||
qfeglVertexAttrib4fv (quake_mdl.colora.location, color);
|
||||
qfeglVertexAttrib4fv (quake_mdl.colorb.location, color);
|
||||
qfeglUniform1f (quake_mdl.blend.location, blend);
|
||||
qfeglUniform1f (quake_mdl.ambient.location, ambient);
|
||||
qfeglUniform1f (quake_mdl.shadelight.location, shadelight);
|
||||
qfeglUniform3fv (quake_mdl.lightvec.location, 1, lightvec);
|
||||
qfeglUniform2fv (quake_mdl.skin_size.location, 1, skin_size);
|
||||
qfeglUniformMatrix4fv (quake_mdl.mvp_matrix.location, 1, false, mvp_mat);
|
||||
qfeglUniformMatrix3fv (quake_mdl.norm_matrix.location, 1, false, norm_mat);
|
||||
|
||||
#ifndef TETRAHEDRON
|
||||
set_arrays (&quake_mdl.vertexa, &quake_mdl.normala, &quake_mdl.sta, pose1);
|
||||
set_arrays (&quake_mdl.vertexb, &quake_mdl.normalb, &quake_mdl.stb, pose2);
|
||||
qfglDrawElements (GL_TRIANGLES, 3 * hdr->mdl.numtris,
|
||||
qfeglDrawElements (GL_TRIANGLES, 3 * hdr->mdl.numtris,
|
||||
GL_UNSIGNED_SHORT, 0);
|
||||
#else
|
||||
set_arrays (&quake_mdl.vertexa, &quake_mdl.normala, &quake_mdl.sta,
|
||||
debug_verts);
|
||||
set_arrays (&quake_mdl.vertexb, &quake_mdl.normalb, &quake_mdl.stb,
|
||||
debug_verts);
|
||||
qfglDrawElements (GL_TRIANGLES,
|
||||
qfeglDrawElements (GL_TRIANGLES,
|
||||
sizeof (debug_indices) / sizeof (debug_indices[0]),
|
||||
GL_UNSIGNED_SHORT, debug_indices);
|
||||
#endif
|
||||
|
@ -300,44 +300,44 @@ glsl_R_AliasBegin (void)
|
|||
// pre-multiply the view and projection matricies
|
||||
Mat4Mult (glsl_projection, glsl_view, alias_vp);
|
||||
|
||||
qfglUseProgram (quake_mdl.program);
|
||||
qfglEnableVertexAttribArray (quake_mdl.vertexa.location);
|
||||
qfglEnableVertexAttribArray (quake_mdl.vertexb.location);
|
||||
qfglEnableVertexAttribArray (quake_mdl.normala.location);
|
||||
qfglEnableVertexAttribArray (quake_mdl.normalb.location);
|
||||
qfglEnableVertexAttribArray (quake_mdl.sta.location);
|
||||
qfglEnableVertexAttribArray (quake_mdl.stb.location);
|
||||
qfglDisableVertexAttribArray (quake_mdl.colora.location);
|
||||
qfglDisableVertexAttribArray (quake_mdl.colorb.location);
|
||||
qfeglUseProgram (quake_mdl.program);
|
||||
qfeglEnableVertexAttribArray (quake_mdl.vertexa.location);
|
||||
qfeglEnableVertexAttribArray (quake_mdl.vertexb.location);
|
||||
qfeglEnableVertexAttribArray (quake_mdl.normala.location);
|
||||
qfeglEnableVertexAttribArray (quake_mdl.normalb.location);
|
||||
qfeglEnableVertexAttribArray (quake_mdl.sta.location);
|
||||
qfeglEnableVertexAttribArray (quake_mdl.stb.location);
|
||||
qfeglDisableVertexAttribArray (quake_mdl.colora.location);
|
||||
qfeglDisableVertexAttribArray (quake_mdl.colorb.location);
|
||||
|
||||
VectorCopy (glsl_Fog_GetColor (), fog);
|
||||
fog[3] = glsl_Fog_GetDensity () / 64.0;
|
||||
qfglUniform4fv (quake_mdl.fog.location, 1, fog);
|
||||
qfeglUniform4fv (quake_mdl.fog.location, 1, fog);
|
||||
|
||||
qfglUniform1i (quake_mdl.colormap.location, 1);
|
||||
qfglActiveTexture (GL_TEXTURE0 + 1);
|
||||
qfglEnable (GL_TEXTURE_2D);
|
||||
qfeglUniform1i (quake_mdl.colormap.location, 1);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 1);
|
||||
qfeglEnable (GL_TEXTURE_2D);
|
||||
|
||||
qfglUniform1i (quake_mdl.skin.location, 0);
|
||||
qfglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfglEnable (GL_TEXTURE_2D);
|
||||
qfeglUniform1i (quake_mdl.skin.location, 0);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfeglEnable (GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
void
|
||||
glsl_R_AliasEnd (void)
|
||||
{
|
||||
qfglBindBuffer (GL_ARRAY_BUFFER, 0);
|
||||
qfglBindBuffer (GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
qfeglBindBuffer (GL_ARRAY_BUFFER, 0);
|
||||
qfeglBindBuffer (GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
|
||||
qfglDisableVertexAttribArray (quake_mdl.vertexa.location);
|
||||
qfglDisableVertexAttribArray (quake_mdl.vertexb.location);
|
||||
qfglDisableVertexAttribArray (quake_mdl.normala.location);
|
||||
qfglDisableVertexAttribArray (quake_mdl.normalb.location);
|
||||
qfglDisableVertexAttribArray (quake_mdl.sta.location);
|
||||
qfglDisableVertexAttribArray (quake_mdl.stb.location);
|
||||
qfeglDisableVertexAttribArray (quake_mdl.vertexa.location);
|
||||
qfeglDisableVertexAttribArray (quake_mdl.vertexb.location);
|
||||
qfeglDisableVertexAttribArray (quake_mdl.normala.location);
|
||||
qfeglDisableVertexAttribArray (quake_mdl.normalb.location);
|
||||
qfeglDisableVertexAttribArray (quake_mdl.sta.location);
|
||||
qfeglDisableVertexAttribArray (quake_mdl.stb.location);
|
||||
|
||||
qfglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfglDisable (GL_TEXTURE_2D);
|
||||
qfglActiveTexture (GL_TEXTURE0 + 1);
|
||||
qfglDisable (GL_TEXTURE_2D);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfeglDisable (GL_TEXTURE_2D);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 1);
|
||||
qfeglDisable (GL_TEXTURE_2D);
|
||||
}
|
||||
|
|
|
@ -612,11 +612,11 @@ glsl_R_BuildDisplayLists (model_t **models, int num_models)
|
|||
Sys_MaskPrintf (SYS_GLSL, "R_BuildDisplayLists: %ld verts total\n",
|
||||
vertices->size / sizeof (bspvert_t));
|
||||
if (!bsp_vbo)
|
||||
qfglGenBuffers (1, &bsp_vbo);
|
||||
qfglBindBuffer (GL_ARRAY_BUFFER, bsp_vbo);
|
||||
qfglBufferData (GL_ARRAY_BUFFER, vertices->size, vertices->str,
|
||||
qfeglGenBuffers (1, &bsp_vbo);
|
||||
qfeglBindBuffer (GL_ARRAY_BUFFER, bsp_vbo);
|
||||
qfeglBufferData (GL_ARRAY_BUFFER, vertices->size, vertices->str,
|
||||
GL_STATIC_DRAW);
|
||||
qfglBindBuffer (GL_ARRAY_BUFFER, 0);
|
||||
qfeglBindBuffer (GL_ARRAY_BUFFER, 0);
|
||||
dstring_delete (vertices);
|
||||
}
|
||||
|
||||
|
@ -803,26 +803,26 @@ draw_elechain (elechain_t *ec, int matloc, int vertloc, int tlstloc,
|
|||
last_color = color;
|
||||
if (!color)
|
||||
color = default_color;
|
||||
qfglVertexAttrib4fv (quake_bsp.color.location, color);
|
||||
qfeglVertexAttrib4fv (quake_bsp.color.location, color);
|
||||
}
|
||||
if (ec->transform) {
|
||||
Mat4Mult (bsp_vp, ec->transform, mat);
|
||||
qfglUniformMatrix4fv (matloc, 1, false, mat);
|
||||
qfeglUniformMatrix4fv (matloc, 1, false, mat);
|
||||
} else {
|
||||
qfglUniformMatrix4fv (matloc, 1, false, bsp_vp);
|
||||
qfeglUniformMatrix4fv (matloc, 1, false, bsp_vp);
|
||||
}
|
||||
for (el = ec->elements; el; el = el->next) {
|
||||
if (!el->list->size)
|
||||
continue;
|
||||
count = el->list->size / sizeof (GLushort);
|
||||
qfglVertexAttribPointer (vertloc, 4, GL_FLOAT,
|
||||
qfeglVertexAttribPointer (vertloc, 4, GL_FLOAT,
|
||||
0, sizeof (bspvert_t),
|
||||
el->base + field_offset (bspvert_t, vertex));
|
||||
if (tlstloc >= 0)
|
||||
qfglVertexAttribPointer (tlstloc, 4, GL_FLOAT,
|
||||
qfeglVertexAttribPointer (tlstloc, 4, GL_FLOAT,
|
||||
0, sizeof (bspvert_t),
|
||||
el->base + field_offset (bspvert_t,tlst));
|
||||
qfglDrawElements (GL_TRIANGLES, count,
|
||||
qfeglDrawElements (GL_TRIANGLES, count,
|
||||
GL_UNSIGNED_SHORT, el->list->str);
|
||||
dstring_clear (el->list);
|
||||
}
|
||||
|
@ -838,48 +838,48 @@ bsp_begin (void)
|
|||
|
||||
Mat4Mult (glsl_projection, glsl_view, bsp_vp);
|
||||
|
||||
qfglUseProgram (quake_bsp.program);
|
||||
qfglEnableVertexAttribArray (quake_bsp.vertex.location);
|
||||
qfglEnableVertexAttribArray (quake_bsp.tlst.location);
|
||||
qfglDisableVertexAttribArray (quake_bsp.color.location);
|
||||
qfeglUseProgram (quake_bsp.program);
|
||||
qfeglEnableVertexAttribArray (quake_bsp.vertex.location);
|
||||
qfeglEnableVertexAttribArray (quake_bsp.tlst.location);
|
||||
qfeglDisableVertexAttribArray (quake_bsp.color.location);
|
||||
|
||||
qfglVertexAttrib4fv (quake_bsp.color.location, default_color);
|
||||
qfeglVertexAttrib4fv (quake_bsp.color.location, default_color);
|
||||
|
||||
VectorCopy (glsl_Fog_GetColor (), fog);
|
||||
fog[3] = glsl_Fog_GetDensity () / 64.0;
|
||||
qfglUniform4fv (quake_bsp.fog.location, 1, fog);
|
||||
qfeglUniform4fv (quake_bsp.fog.location, 1, fog);
|
||||
|
||||
qfglUniform1i (quake_bsp.colormap.location, 2);
|
||||
qfglActiveTexture (GL_TEXTURE0 + 2);
|
||||
qfglEnable (GL_TEXTURE_2D);
|
||||
qfglBindTexture (GL_TEXTURE_2D, glsl_colormap);
|
||||
qfeglUniform1i (quake_bsp.colormap.location, 2);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 2);
|
||||
qfeglEnable (GL_TEXTURE_2D);
|
||||
qfeglBindTexture (GL_TEXTURE_2D, glsl_colormap);
|
||||
|
||||
qfglUniform1i (quake_bsp.lightmap.location, 1);
|
||||
qfglActiveTexture (GL_TEXTURE0 + 1);
|
||||
qfglEnable (GL_TEXTURE_2D);
|
||||
qfglBindTexture (GL_TEXTURE_2D, glsl_R_LightmapTexture ());
|
||||
qfeglUniform1i (quake_bsp.lightmap.location, 1);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 1);
|
||||
qfeglEnable (GL_TEXTURE_2D);
|
||||
qfeglBindTexture (GL_TEXTURE_2D, glsl_R_LightmapTexture ());
|
||||
|
||||
qfglUniform1i (quake_bsp.texture.location, 0);
|
||||
qfglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfglEnable (GL_TEXTURE_2D);
|
||||
qfeglUniform1i (quake_bsp.texture.location, 0);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfeglEnable (GL_TEXTURE_2D);
|
||||
|
||||
qfglBindBuffer (GL_ARRAY_BUFFER, bsp_vbo);
|
||||
qfeglBindBuffer (GL_ARRAY_BUFFER, bsp_vbo);
|
||||
}
|
||||
|
||||
static void
|
||||
bsp_end (void)
|
||||
{
|
||||
qfglDisableVertexAttribArray (quake_bsp.vertex.location);
|
||||
qfglDisableVertexAttribArray (quake_bsp.tlst.location);
|
||||
qfeglDisableVertexAttribArray (quake_bsp.vertex.location);
|
||||
qfeglDisableVertexAttribArray (quake_bsp.tlst.location);
|
||||
|
||||
qfglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfglDisable (GL_TEXTURE_2D);
|
||||
qfglActiveTexture (GL_TEXTURE0 + 1);
|
||||
qfglDisable (GL_TEXTURE_2D);
|
||||
qfglActiveTexture (GL_TEXTURE0 + 2);
|
||||
qfglDisable (GL_TEXTURE_2D);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfeglDisable (GL_TEXTURE_2D);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 1);
|
||||
qfeglDisable (GL_TEXTURE_2D);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 2);
|
||||
qfeglDisable (GL_TEXTURE_2D);
|
||||
|
||||
qfglBindBuffer (GL_ARRAY_BUFFER, 0);
|
||||
qfeglBindBuffer (GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -892,43 +892,43 @@ turb_begin (void)
|
|||
|
||||
Mat4Mult (glsl_projection, glsl_view, bsp_vp);
|
||||
|
||||
qfglUseProgram (quake_turb.program);
|
||||
qfglEnableVertexAttribArray (quake_turb.vertex.location);
|
||||
qfglEnableVertexAttribArray (quake_turb.tlst.location);
|
||||
qfglDisableVertexAttribArray (quake_turb.color.location);
|
||||
qfeglUseProgram (quake_turb.program);
|
||||
qfeglEnableVertexAttribArray (quake_turb.vertex.location);
|
||||
qfeglEnableVertexAttribArray (quake_turb.tlst.location);
|
||||
qfeglDisableVertexAttribArray (quake_turb.color.location);
|
||||
|
||||
qfglVertexAttrib4fv (quake_turb.color.location, default_color);
|
||||
qfeglVertexAttrib4fv (quake_turb.color.location, default_color);
|
||||
|
||||
VectorCopy (glsl_Fog_GetColor (), fog);
|
||||
fog[3] = glsl_Fog_GetDensity () / 64.0;
|
||||
qfglUniform4fv (quake_turb.fog.location, 1, fog);
|
||||
qfeglUniform4fv (quake_turb.fog.location, 1, fog);
|
||||
|
||||
qfglUniform1i (quake_turb.palette.location, 1);
|
||||
qfglActiveTexture (GL_TEXTURE0 + 1);
|
||||
qfglEnable (GL_TEXTURE_2D);
|
||||
qfglBindTexture (GL_TEXTURE_2D, glsl_palette);
|
||||
qfeglUniform1i (quake_turb.palette.location, 1);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 1);
|
||||
qfeglEnable (GL_TEXTURE_2D);
|
||||
qfeglBindTexture (GL_TEXTURE_2D, glsl_palette);
|
||||
|
||||
qfglUniform1f (quake_turb.realtime.location, vr_data.realtime);
|
||||
qfeglUniform1f (quake_turb.realtime.location, vr_data.realtime);
|
||||
|
||||
qfglUniform1i (quake_turb.texture.location, 0);
|
||||
qfglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfglEnable (GL_TEXTURE_2D);
|
||||
qfeglUniform1i (quake_turb.texture.location, 0);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfeglEnable (GL_TEXTURE_2D);
|
||||
|
||||
qfglBindBuffer (GL_ARRAY_BUFFER, bsp_vbo);
|
||||
qfeglBindBuffer (GL_ARRAY_BUFFER, bsp_vbo);
|
||||
}
|
||||
|
||||
static void
|
||||
turb_end (void)
|
||||
{
|
||||
qfglDisableVertexAttribArray (quake_turb.vertex.location);
|
||||
qfglDisableVertexAttribArray (quake_turb.tlst.location);
|
||||
qfeglDisableVertexAttribArray (quake_turb.vertex.location);
|
||||
qfeglDisableVertexAttribArray (quake_turb.tlst.location);
|
||||
|
||||
qfglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfglDisable (GL_TEXTURE_2D);
|
||||
qfglActiveTexture (GL_TEXTURE0 + 1);
|
||||
qfglDisable (GL_TEXTURE_2D);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfeglDisable (GL_TEXTURE_2D);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 1);
|
||||
qfeglDisable (GL_TEXTURE_2D);
|
||||
|
||||
qfglBindBuffer (GL_ARRAY_BUFFER, 0);
|
||||
qfeglBindBuffer (GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -969,62 +969,62 @@ sky_begin (void)
|
|||
sky_params.sky_matrix = &quake_skybox.sky_matrix;
|
||||
sky_params.fog = &quake_skybox.fog;
|
||||
|
||||
qfglUseProgram (quake_skybox.program);
|
||||
qfglEnableVertexAttribArray (quake_skybox.vertex.location);
|
||||
qfeglUseProgram (quake_skybox.program);
|
||||
qfeglEnableVertexAttribArray (quake_skybox.vertex.location);
|
||||
|
||||
qfglUniform1i (quake_skybox.sky.location, 0);
|
||||
qfglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfglEnable (GL_TEXTURE_CUBE_MAP);
|
||||
qfglBindTexture (GL_TEXTURE_CUBE_MAP, skybox_tex);
|
||||
qfeglUniform1i (quake_skybox.sky.location, 0);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfeglEnable (GL_TEXTURE_CUBE_MAP);
|
||||
qfeglBindTexture (GL_TEXTURE_CUBE_MAP, skybox_tex);
|
||||
} else {
|
||||
sky_params.mvp_matrix = &quake_skyid.mvp_matrix;
|
||||
sky_params.sky_matrix = &quake_skyid.sky_matrix;
|
||||
sky_params.vertex = &quake_skyid.vertex;
|
||||
sky_params.fog = &quake_skyid.fog;
|
||||
|
||||
qfglUseProgram (quake_skyid.program);
|
||||
qfglEnableVertexAttribArray (quake_skyid.vertex.location);
|
||||
qfeglUseProgram (quake_skyid.program);
|
||||
qfeglEnableVertexAttribArray (quake_skyid.vertex.location);
|
||||
|
||||
qfglUniform1i (quake_skyid.palette.location, 2);
|
||||
qfglActiveTexture (GL_TEXTURE0 + 2);
|
||||
qfglEnable (GL_TEXTURE_2D);
|
||||
qfglBindTexture (GL_TEXTURE_2D, glsl_palette);
|
||||
qfeglUniform1i (quake_skyid.palette.location, 2);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 2);
|
||||
qfeglEnable (GL_TEXTURE_2D);
|
||||
qfeglBindTexture (GL_TEXTURE_2D, glsl_palette);
|
||||
|
||||
qfglUniform1f (quake_skyid.realtime.location, vr_data.realtime);
|
||||
qfeglUniform1f (quake_skyid.realtime.location, vr_data.realtime);
|
||||
|
||||
qfglUniform1i (quake_skyid.trans.location, 0);
|
||||
qfglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfglEnable (GL_TEXTURE_2D);
|
||||
qfeglUniform1i (quake_skyid.trans.location, 0);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfeglEnable (GL_TEXTURE_2D);
|
||||
|
||||
qfglUniform1i (quake_skyid.solid.location, 1);
|
||||
qfglActiveTexture (GL_TEXTURE0 + 1);
|
||||
qfglEnable (GL_TEXTURE_2D);
|
||||
qfeglUniform1i (quake_skyid.solid.location, 1);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 1);
|
||||
qfeglEnable (GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
VectorCopy (glsl_Fog_GetColor (), fog);
|
||||
fog[3] = glsl_Fog_GetDensity () / 64.0;
|
||||
qfglUniform4fv (sky_params.fog->location, 1, fog);
|
||||
qfeglUniform4fv (sky_params.fog->location, 1, fog);
|
||||
|
||||
spin (mat);
|
||||
qfglUniformMatrix4fv (sky_params.sky_matrix->location, 1, false, mat);
|
||||
qfeglUniformMatrix4fv (sky_params.sky_matrix->location, 1, false, mat);
|
||||
|
||||
qfglBindBuffer (GL_ARRAY_BUFFER, bsp_vbo);
|
||||
qfeglBindBuffer (GL_ARRAY_BUFFER, bsp_vbo);
|
||||
}
|
||||
|
||||
static void
|
||||
sky_end (void)
|
||||
{
|
||||
qfglDisableVertexAttribArray (sky_params.vertex->location);
|
||||
qfeglDisableVertexAttribArray (sky_params.vertex->location);
|
||||
|
||||
qfglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfglDisable (GL_TEXTURE_2D);
|
||||
qfglDisable (GL_TEXTURE_CUBE_MAP);
|
||||
qfglActiveTexture (GL_TEXTURE0 + 1);
|
||||
qfglDisable (GL_TEXTURE_2D);
|
||||
qfglActiveTexture (GL_TEXTURE0 + 2);
|
||||
qfglDisable (GL_TEXTURE_2D);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfeglDisable (GL_TEXTURE_2D);
|
||||
qfeglDisable (GL_TEXTURE_CUBE_MAP);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 1);
|
||||
qfeglDisable (GL_TEXTURE_2D);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 2);
|
||||
qfeglDisable (GL_TEXTURE_2D);
|
||||
|
||||
qfglBindBuffer (GL_ARRAY_BUFFER, 0);
|
||||
qfeglBindBuffer (GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
@ -1109,8 +1109,8 @@ glsl_R_DrawWorld (void)
|
|||
elechain_t *ec = 0;
|
||||
|
||||
tex = r_texture_chains[i];
|
||||
qfglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfglBindTexture (GL_TEXTURE_2D, tex->gl_texturenum);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfeglBindTexture (GL_TEXTURE_2D, tex->gl_texturenum);
|
||||
|
||||
build_tex_elechain (tex);
|
||||
|
||||
|
@ -1141,7 +1141,7 @@ glsl_R_DrawWaterSurfaces ()
|
|||
surf = is->surface;
|
||||
if (tex != surf->texinfo->texture) {
|
||||
if (tex) {
|
||||
qfglBindTexture (GL_TEXTURE_2D, tex->gl_texturenum);
|
||||
qfeglBindTexture (GL_TEXTURE_2D, tex->gl_texturenum);
|
||||
for (ec = tex->elechain; ec; ec = ec->next)
|
||||
draw_elechain (ec, quake_turb.mvp_matrix.location,
|
||||
quake_turb.vertex.location,
|
||||
|
@ -1155,7 +1155,7 @@ glsl_R_DrawWaterSurfaces ()
|
|||
add_surf_elements (tex, is, &ec, &el);
|
||||
}
|
||||
if (tex) {
|
||||
qfglBindTexture (GL_TEXTURE_2D, tex->gl_texturenum);
|
||||
qfeglBindTexture (GL_TEXTURE_2D, tex->gl_texturenum);
|
||||
for (ec = tex->elechain; ec; ec = ec->next)
|
||||
draw_elechain (ec, quake_turb.mvp_matrix.location,
|
||||
quake_turb.vertex.location,
|
||||
|
@ -1188,10 +1188,10 @@ glsl_R_DrawSky (void)
|
|||
if (tex != surf->texinfo->texture) {
|
||||
if (tex) {
|
||||
if (!skybox_loaded) {
|
||||
qfglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfglBindTexture (GL_TEXTURE_2D, tex->sky_tex[0]);
|
||||
qfglActiveTexture (GL_TEXTURE0 + 1);
|
||||
qfglBindTexture (GL_TEXTURE_2D, tex->sky_tex[1]);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfeglBindTexture (GL_TEXTURE_2D, tex->sky_tex[0]);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 1);
|
||||
qfeglBindTexture (GL_TEXTURE_2D, tex->sky_tex[1]);
|
||||
}
|
||||
for (ec = tex->elechain; ec; ec = ec->next)
|
||||
draw_elechain (ec, sky_params.mvp_matrix->location,
|
||||
|
@ -1205,10 +1205,10 @@ glsl_R_DrawSky (void)
|
|||
}
|
||||
if (tex) {
|
||||
if (!skybox_loaded) {
|
||||
qfglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfglBindTexture (GL_TEXTURE_2D, tex->sky_tex[0]);
|
||||
qfglActiveTexture (GL_TEXTURE0 + 1);
|
||||
qfglBindTexture (GL_TEXTURE_2D, tex->sky_tex[1]);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfeglBindTexture (GL_TEXTURE_2D, tex->sky_tex[0]);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 1);
|
||||
qfeglBindTexture (GL_TEXTURE_2D, tex->sky_tex[1]);
|
||||
}
|
||||
for (ec = tex->elechain; ec; ec = ec->next)
|
||||
draw_elechain (ec, sky_params.mvp_matrix->location,
|
||||
|
@ -1347,9 +1347,9 @@ glsl_R_LoadSkys (const char *sky)
|
|||
}
|
||||
|
||||
if (!skybox_tex)
|
||||
qfglGenTextures (1, &skybox_tex);
|
||||
qfeglGenTextures (1, &skybox_tex);
|
||||
|
||||
qfglBindTexture (GL_TEXTURE_CUBE_MAP, skybox_tex);
|
||||
qfeglBindTexture (GL_TEXTURE_CUBE_MAP, skybox_tex);
|
||||
|
||||
//blender envmap
|
||||
// bk rt ft
|
||||
|
@ -1371,7 +1371,7 @@ glsl_R_LoadSkys (const char *sky)
|
|||
x = sky_coords[i][0] * size;
|
||||
y = sky_coords[i][1] * size;
|
||||
copy_sub_tex (tex, x, y, sub);
|
||||
qfglTexImage2D (sky_target[i], 0,
|
||||
qfeglTexImage2D (sky_target[i], 0,
|
||||
sub->format == 3 ? GL_RGB : GL_RGBA,
|
||||
sub->width, sub->height, 0,
|
||||
sub->format == 3 ? GL_RGB : GL_RGBA,
|
||||
|
@ -1394,18 +1394,18 @@ glsl_R_LoadSkys (const char *sky)
|
|||
}
|
||||
}
|
||||
Sys_MaskPrintf (SYS_GLSL, "Loaded %s\n", name);
|
||||
qfglTexImage2D (sky_target[i], 0,
|
||||
qfeglTexImage2D (sky_target[i], 0,
|
||||
tex->format == 3 ? GL_RGB : GL_RGBA,
|
||||
tex->width, tex->height, 0,
|
||||
tex->format == 3 ? GL_RGB : GL_RGBA,
|
||||
GL_UNSIGNED_BYTE, tex->data);
|
||||
}
|
||||
}
|
||||
qfglTexParameteri (GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S,
|
||||
qfeglTexParameteri (GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S,
|
||||
GL_CLAMP_TO_EDGE);
|
||||
qfglTexParameteri (GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T,
|
||||
qfeglTexParameteri (GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T,
|
||||
GL_CLAMP_TO_EDGE);
|
||||
qfglTexParameteri (GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
qfglTexParameteri (GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
qfglGenerateMipmap (GL_TEXTURE_CUBE_MAP);
|
||||
qfeglTexParameteri (GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
qfeglTexParameteri (GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
qfeglGenerateMipmap (GL_TEXTURE_CUBE_MAP);
|
||||
}
|
||||
|
|
|
@ -247,29 +247,29 @@ draw_pic (float x, float y, int w, int h, qpic_t *pic,
|
|||
make_quad (pic, x, y, w, h, srcx, srcy, srcw, srch, verts);
|
||||
gl = (glpic_t *) pic->data;
|
||||
|
||||
qfglUseProgram (quake_icon.program);
|
||||
qfglEnableVertexAttribArray (quake_icon.vertex.location);
|
||||
qfeglUseProgram (quake_icon.program);
|
||||
qfeglEnableVertexAttribArray (quake_icon.vertex.location);
|
||||
|
||||
qfglUniformMatrix4fv (quake_icon.matrix.location, 1, false, proj_matrix);
|
||||
qfeglUniformMatrix4fv (quake_icon.matrix.location, 1, false, proj_matrix);
|
||||
|
||||
qfglUniform1i (quake_icon.icon.location, 0);
|
||||
qfglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfglEnable (GL_TEXTURE_2D);
|
||||
qfglBindTexture (GL_TEXTURE_2D, gl->texnum);
|
||||
qfeglUniform1i (quake_icon.icon.location, 0);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfeglEnable (GL_TEXTURE_2D);
|
||||
qfeglBindTexture (GL_TEXTURE_2D, gl->texnum);
|
||||
|
||||
qfglUniform1i (quake_icon.palette.location, 1);
|
||||
qfglActiveTexture (GL_TEXTURE0 + 1);
|
||||
qfglEnable (GL_TEXTURE_2D);
|
||||
qfglBindTexture (GL_TEXTURE_2D, glsl_palette);
|
||||
qfeglUniform1i (quake_icon.palette.location, 1);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 1);
|
||||
qfeglEnable (GL_TEXTURE_2D);
|
||||
qfeglBindTexture (GL_TEXTURE_2D, glsl_palette);
|
||||
|
||||
qfglVertexAttrib4fv (quake_icon.color.location, color);
|
||||
qfeglVertexAttrib4fv (quake_icon.color.location, color);
|
||||
|
||||
qfglVertexAttribPointer (quake_icon.vertex.location, 4, GL_FLOAT,
|
||||
qfeglVertexAttribPointer (quake_icon.vertex.location, 4, GL_FLOAT,
|
||||
0, 0, verts);
|
||||
|
||||
qfglDrawArrays (GL_TRIANGLES, 0, 6);
|
||||
qfeglDrawArrays (GL_TRIANGLES, 0, 6);
|
||||
|
||||
qfglDisableVertexAttribArray (quake_icon.vertex.location);
|
||||
qfeglDisableVertexAttribArray (quake_icon.vertex.location);
|
||||
}
|
||||
|
||||
qpic_t *
|
||||
|
@ -443,9 +443,9 @@ glsl_Draw_Init (void)
|
|||
|
||||
backtile_pic = glsl_Draw_PicFromWad ("backtile");
|
||||
gl = (glpic_t *) backtile_pic->data;
|
||||
qfglBindTexture (GL_TEXTURE_2D, gl->texnum);
|
||||
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
qfeglBindTexture (GL_TEXTURE_2D, gl->texnum);
|
||||
qfeglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
qfeglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
@ -471,33 +471,33 @@ queue_character (int x, int y, byte chr)
|
|||
static void
|
||||
flush_text (void)
|
||||
{
|
||||
qfglUseProgram (quake_text.program);
|
||||
qfglEnableVertexAttribArray (quake_text.vertex.location);
|
||||
qfglEnableVertexAttribArray (quake_text.dchar.location);
|
||||
qfeglUseProgram (quake_text.program);
|
||||
qfeglEnableVertexAttribArray (quake_text.vertex.location);
|
||||
qfeglEnableVertexAttribArray (quake_text.dchar.location);
|
||||
|
||||
qfglUniformMatrix4fv (quake_text.matrix.location, 1, false, proj_matrix);
|
||||
qfeglUniformMatrix4fv (quake_text.matrix.location, 1, false, proj_matrix);
|
||||
|
||||
qfglUniform1i (quake_text.charmap.location, 0);
|
||||
qfglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfglEnable (GL_TEXTURE_2D);
|
||||
qfglBindTexture (GL_TEXTURE_2D, char_texture);
|
||||
qfeglUniform1i (quake_text.charmap.location, 0);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfeglEnable (GL_TEXTURE_2D);
|
||||
qfeglBindTexture (GL_TEXTURE_2D, char_texture);
|
||||
|
||||
qfglUniform1i (quake_text.palette.location, 1);
|
||||
qfglActiveTexture (GL_TEXTURE0 + 1);
|
||||
qfglEnable (GL_TEXTURE_2D);
|
||||
qfglBindTexture (GL_TEXTURE_2D, glsl_palette);
|
||||
qfeglUniform1i (quake_text.palette.location, 1);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 1);
|
||||
qfeglEnable (GL_TEXTURE_2D);
|
||||
qfeglBindTexture (GL_TEXTURE_2D, glsl_palette);
|
||||
|
||||
qfglVertexAttrib4f (quake_text.color.location, 1, 1, 1, 1);
|
||||
qfeglVertexAttrib4f (quake_text.color.location, 1, 1, 1, 1);
|
||||
|
||||
qfglVertexAttribPointer (quake_text.vertex.location, 4, GL_UNSIGNED_SHORT,
|
||||
qfeglVertexAttribPointer (quake_text.vertex.location, 4, GL_UNSIGNED_SHORT,
|
||||
0, 10, char_queue->str);
|
||||
qfglVertexAttribPointer (quake_text.dchar.location, 1, GL_UNSIGNED_SHORT,
|
||||
qfeglVertexAttribPointer (quake_text.dchar.location, 1, GL_UNSIGNED_SHORT,
|
||||
0, 10, char_queue->str + 8);
|
||||
|
||||
qfglDrawArrays (GL_TRIANGLES, 0, char_queue->size / 10);
|
||||
qfeglDrawArrays (GL_TRIANGLES, 0, char_queue->size / 10);
|
||||
|
||||
qfglDisableVertexAttribArray (quake_text.dchar.location);
|
||||
qfglDisableVertexAttribArray (quake_text.vertex.location);
|
||||
qfeglDisableVertexAttribArray (quake_text.dchar.location);
|
||||
qfeglDisableVertexAttribArray (quake_text.vertex.location);
|
||||
char_queue->size = 0;
|
||||
}
|
||||
|
||||
|
@ -678,30 +678,30 @@ glsl_Draw_ConsoleBackground (int lines, byte alpha)
|
|||
|
||||
GL_FlushText (); // Flush text that should be rendered before the console
|
||||
|
||||
qfglUseProgram (quake_icon.program);
|
||||
qfglEnableVertexAttribArray (quake_icon.vertex.location);
|
||||
qfeglUseProgram (quake_icon.program);
|
||||
qfeglEnableVertexAttribArray (quake_icon.vertex.location);
|
||||
|
||||
qfglUniformMatrix4fv (quake_icon.matrix.location, 1, false, proj_matrix);
|
||||
qfeglUniformMatrix4fv (quake_icon.matrix.location, 1, false, proj_matrix);
|
||||
|
||||
qfglUniform1i (quake_icon.icon.location, 0);
|
||||
qfglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfglEnable (GL_TEXTURE_2D);
|
||||
qfglBindTexture (GL_TEXTURE_2D, conback_texture);
|
||||
qfeglUniform1i (quake_icon.icon.location, 0);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfeglEnable (GL_TEXTURE_2D);
|
||||
qfeglBindTexture (GL_TEXTURE_2D, conback_texture);
|
||||
|
||||
qfglUniform1i (quake_icon.palette.location, 1);
|
||||
qfglActiveTexture (GL_TEXTURE0 + 1);
|
||||
qfglEnable (GL_TEXTURE_2D);
|
||||
qfglBindTexture (GL_TEXTURE_2D, glsl_palette);
|
||||
qfeglUniform1i (quake_icon.palette.location, 1);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 1);
|
||||
qfeglEnable (GL_TEXTURE_2D);
|
||||
qfeglBindTexture (GL_TEXTURE_2D, glsl_palette);
|
||||
|
||||
qfglVertexAttrib4f (quake_icon.color.location,
|
||||
qfeglVertexAttrib4f (quake_icon.color.location,
|
||||
1, 1, 1, bound (0, alpha, 255) / 255.0);
|
||||
|
||||
qfglVertexAttribPointer (quake_icon.vertex.location, 4, GL_FLOAT,
|
||||
qfeglVertexAttribPointer (quake_icon.vertex.location, 4, GL_FLOAT,
|
||||
0, 0, verts);
|
||||
|
||||
qfglDrawArrays (GL_TRIANGLES, 0, 6);
|
||||
qfeglDrawArrays (GL_TRIANGLES, 0, 6);
|
||||
|
||||
qfglDisableVertexAttribArray (quake_icon.vertex.location);
|
||||
qfeglDisableVertexAttribArray (quake_icon.vertex.location);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -764,10 +764,10 @@ ortho_mat (float *proj, float xmin, float xmax, float ymin, float ymax,
|
|||
static void
|
||||
set_2d (int width, int height)
|
||||
{
|
||||
qfglViewport (0, 0, vid.width, vid.height);
|
||||
qfeglViewport (0, 0, vid.width, vid.height);
|
||||
|
||||
qfglDisable (GL_DEPTH_TEST);
|
||||
qfglDisable (GL_CULL_FACE);
|
||||
qfeglDisable (GL_DEPTH_TEST);
|
||||
qfeglDisable (GL_CULL_FACE);
|
||||
|
||||
ortho_mat (proj_matrix, 0, width, height, 0, -99999, 99999);
|
||||
}
|
||||
|
|
|
@ -134,7 +134,7 @@ R_SetupView (void)
|
|||
y = (vid.height - (r_refdef.vrect.y + r_refdef.vrect.height));
|
||||
w = r_refdef.vrect.width;
|
||||
h = r_refdef.vrect.height;
|
||||
qfglViewport (x, y, w, h);
|
||||
qfeglViewport (x, y, w, h);
|
||||
|
||||
Mat4Zero (mat);
|
||||
VectorCopy (vpn, mat + 0);
|
||||
|
@ -148,8 +148,8 @@ R_SetupView (void)
|
|||
VectorNegate (r_refdef.vieworg, mat + 12);
|
||||
Mat4Mult (glsl_view, mat, glsl_view);
|
||||
|
||||
qfglEnable (GL_CULL_FACE);
|
||||
qfglEnable (GL_DEPTH_TEST);
|
||||
qfeglEnable (GL_CULL_FACE);
|
||||
qfeglEnable (GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -190,11 +190,11 @@ R_DrawViewModel (void)
|
|||
return;
|
||||
|
||||
// hack the depth range to prevent view model from poking into walls
|
||||
qfglDepthRangef (0, 0.3);
|
||||
qfeglDepthRangef (0, 0.3);
|
||||
glsl_R_AliasBegin ();
|
||||
glsl_R_DrawAlias ();
|
||||
glsl_R_AliasEnd ();
|
||||
qfglDepthRangef (0, 1);
|
||||
qfeglDepthRangef (0, 1);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -216,8 +216,8 @@ glsl_R_InitParticles (void)
|
|||
byte data[64][64][2];
|
||||
tex_t *tex;
|
||||
|
||||
qfglEnable (GL_VERTEX_PROGRAM_POINT_SIZE);
|
||||
qfglGetFloatv (GL_ALIASED_POINT_SIZE_RANGE, v);
|
||||
qfeglEnable (GL_VERTEX_PROGRAM_POINT_SIZE);
|
||||
qfeglGetFloatv (GL_ALIASED_POINT_SIZE_RANGE, v);
|
||||
Sys_MaskPrintf (SYS_GLSL, "point size: %g - %g\n", v[0], v[1]);
|
||||
|
||||
vert = GLSL_CompileShader ("quakepnt.vert", quakepoint_vert,
|
||||
|
@ -244,22 +244,22 @@ glsl_R_InitParticles (void)
|
|||
GLSL_ResolveShaderParam (quake_part.program, &quake_part.fog);
|
||||
|
||||
memset (data, 0, sizeof (data));
|
||||
qfglGenTextures (1, &part_tex);
|
||||
qfglBindTexture (GL_TEXTURE_2D, part_tex);
|
||||
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
qfglTexImage2D (GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, 64, 64, 0,
|
||||
qfeglGenTextures (1, &part_tex);
|
||||
qfeglBindTexture (GL_TEXTURE_2D, part_tex);
|
||||
qfeglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
qfeglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
qfeglTexImage2D (GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, 64, 64, 0,
|
||||
GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, data);
|
||||
tex = R_DotParticleTexture ();
|
||||
qfglTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, 32, 32, GL_LUMINANCE_ALPHA,
|
||||
qfeglTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, 32, 32, GL_LUMINANCE_ALPHA,
|
||||
GL_UNSIGNED_BYTE, tex->data);
|
||||
free (tex);
|
||||
tex = R_SparkParticleTexture ();
|
||||
qfglTexSubImage2D (GL_TEXTURE_2D, 0, 32, 0, 32, 32, GL_LUMINANCE_ALPHA,
|
||||
qfeglTexSubImage2D (GL_TEXTURE_2D, 0, 32, 0, 32, 32, GL_LUMINANCE_ALPHA,
|
||||
GL_UNSIGNED_BYTE, tex->data);
|
||||
free (tex);
|
||||
tex = R_SmokeParticleTexture ();
|
||||
qfglTexSubImage2D (GL_TEXTURE_2D, 0, 0, 32, 32, 32, GL_LUMINANCE_ALPHA,
|
||||
qfeglTexSubImage2D (GL_TEXTURE_2D, 0, 0, 32, 32, 32, GL_LUMINANCE_ALPHA,
|
||||
GL_UNSIGNED_BYTE, tex->data);
|
||||
free (tex);
|
||||
|
||||
|
@ -1547,25 +1547,25 @@ draw_qf_particles (void)
|
|||
|
||||
Mat4Mult (glsl_projection, glsl_view, vp_mat);
|
||||
|
||||
qfglDepthMask (GL_FALSE);
|
||||
qfglUseProgram (quake_part.program);
|
||||
qfglEnableVertexAttribArray (quake_part.vertex.location);
|
||||
qfglEnableVertexAttribArray (quake_part.color.location);
|
||||
qfglEnableVertexAttribArray (quake_part.st.location);
|
||||
qfeglDepthMask (GL_FALSE);
|
||||
qfeglUseProgram (quake_part.program);
|
||||
qfeglEnableVertexAttribArray (quake_part.vertex.location);
|
||||
qfeglEnableVertexAttribArray (quake_part.color.location);
|
||||
qfeglEnableVertexAttribArray (quake_part.st.location);
|
||||
|
||||
VectorCopy (glsl_Fog_GetColor (), fog);
|
||||
fog[3] = glsl_Fog_GetDensity () / 64.0;
|
||||
qfglUniform4fv (quake_part.fog.location, 1, fog);
|
||||
qfeglUniform4fv (quake_part.fog.location, 1, fog);
|
||||
|
||||
qfglUniformMatrix4fv (quake_part.mvp_matrix.location, 1, false, vp_mat);
|
||||
qfeglUniformMatrix4fv (quake_part.mvp_matrix.location, 1, false, vp_mat);
|
||||
|
||||
qfglUniform1i (quake_part.texture.location, 0);
|
||||
qfglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfglEnable (GL_TEXTURE_2D);
|
||||
qfglBindTexture (GL_TEXTURE_2D, part_tex);
|
||||
qfeglUniform1i (quake_part.texture.location, 0);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfeglEnable (GL_TEXTURE_2D);
|
||||
qfeglBindTexture (GL_TEXTURE_2D, part_tex);
|
||||
|
||||
// LordHavoc: particles should not affect zbuffer
|
||||
qfglDepthMask (GL_FALSE);
|
||||
qfeglDepthMask (GL_FALSE);
|
||||
|
||||
minparticledist = DotProduct (r_refdef.vieworg, vpn) +
|
||||
r_particles_nearclip->value;
|
||||
|
@ -1650,16 +1650,16 @@ draw_qf_particles (void)
|
|||
activeparticles++;
|
||||
}
|
||||
}
|
||||
qfglVertexAttribPointer (quake_part.vertex.location, 3, GL_FLOAT,
|
||||
qfeglVertexAttribPointer (quake_part.vertex.location, 3, GL_FLOAT,
|
||||
0, sizeof (partvert_t),
|
||||
&particleVertexArray[0].vertex);
|
||||
qfglVertexAttribPointer (quake_part.color.location, 4, GL_UNSIGNED_BYTE,
|
||||
qfeglVertexAttribPointer (quake_part.color.location, 4, GL_UNSIGNED_BYTE,
|
||||
1, sizeof (partvert_t),
|
||||
&particleVertexArray[0].color);
|
||||
qfglVertexAttribPointer (quake_part.st.location, 2, GL_FLOAT,
|
||||
qfeglVertexAttribPointer (quake_part.st.location, 2, GL_FLOAT,
|
||||
0, sizeof (partvert_t),
|
||||
&particleVertexArray[0].texcoord);
|
||||
qfglDrawElements (GL_TRIANGLES, vacount, GL_UNSIGNED_SHORT, pVAindices);
|
||||
qfeglDrawElements (GL_TRIANGLES, vacount, GL_UNSIGNED_SHORT, pVAindices);
|
||||
|
||||
k = 0;
|
||||
while (maxparticle >= activeparticles) {
|
||||
|
@ -1670,12 +1670,12 @@ draw_qf_particles (void)
|
|||
}
|
||||
numparticles = activeparticles;
|
||||
|
||||
qfglDepthMask (GL_TRUE);
|
||||
qfglDisableVertexAttribArray (quake_part.vertex.location);
|
||||
qfglDisableVertexAttribArray (quake_part.color.location);
|
||||
qfglDisableVertexAttribArray (quake_part.st.location);
|
||||
qfglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfglDisable (GL_TEXTURE_2D);
|
||||
qfeglDepthMask (GL_TRUE);
|
||||
qfeglDisableVertexAttribArray (quake_part.vertex.location);
|
||||
qfeglDisableVertexAttribArray (quake_part.color.location);
|
||||
qfeglDisableVertexAttribArray (quake_part.st.location);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfeglDisable (GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1692,21 +1692,21 @@ draw_id_particles (void)
|
|||
Mat4Mult (glsl_projection, glsl_view, vp_mat);
|
||||
|
||||
// LordHavoc: particles should not affect zbuffer
|
||||
qfglDepthMask (GL_FALSE);
|
||||
qfglUseProgram (quake_point.program);
|
||||
qfglEnableVertexAttribArray (quake_point.vertex.location);
|
||||
qfglEnableVertexAttribArray (quake_point.color.location);
|
||||
qfeglDepthMask (GL_FALSE);
|
||||
qfeglUseProgram (quake_point.program);
|
||||
qfeglEnableVertexAttribArray (quake_point.vertex.location);
|
||||
qfeglEnableVertexAttribArray (quake_point.color.location);
|
||||
|
||||
qfglUniformMatrix4fv (quake_point.mvp_matrix.location, 1, false, vp_mat);
|
||||
qfeglUniformMatrix4fv (quake_point.mvp_matrix.location, 1, false, vp_mat);
|
||||
|
||||
VectorCopy (glsl_Fog_GetColor (), fog);
|
||||
fog[3] = glsl_Fog_GetDensity () / 64.0;
|
||||
qfglUniform4fv (quake_point.fog.location, 1, fog);
|
||||
qfeglUniform4fv (quake_point.fog.location, 1, fog);
|
||||
|
||||
qfglUniform1i (quake_point.palette.location, 0);
|
||||
qfglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfglEnable (GL_TEXTURE_2D);
|
||||
qfglBindTexture (GL_TEXTURE_2D, glsl_palette);
|
||||
qfeglUniform1i (quake_point.palette.location, 0);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfeglEnable (GL_TEXTURE_2D);
|
||||
qfeglBindTexture (GL_TEXTURE_2D, glsl_palette);
|
||||
|
||||
minparticledist = DotProduct (r_refdef.vieworg, vpn) +
|
||||
r_particles_nearclip->value;
|
||||
|
@ -1738,13 +1738,13 @@ draw_id_particles (void)
|
|||
activeparticles++;
|
||||
}
|
||||
}
|
||||
qfglVertexAttribPointer (quake_point.vertex.location, 3, GL_FLOAT,
|
||||
qfeglVertexAttribPointer (quake_point.vertex.location, 3, GL_FLOAT,
|
||||
0, sizeof (partvert_t),
|
||||
&particleVertexArray[0].vertex);
|
||||
qfglVertexAttribPointer (quake_point.color.location, 1, GL_UNSIGNED_BYTE,
|
||||
qfeglVertexAttribPointer (quake_point.color.location, 1, GL_UNSIGNED_BYTE,
|
||||
1, sizeof (partvert_t),
|
||||
&particleVertexArray[0].color);
|
||||
qfglDrawArrays (GL_POINTS, 0, vacount);
|
||||
qfeglDrawArrays (GL_POINTS, 0, vacount);
|
||||
|
||||
k = 0;
|
||||
while (maxparticle >= activeparticles) {
|
||||
|
@ -1755,11 +1755,11 @@ draw_id_particles (void)
|
|||
}
|
||||
numparticles = activeparticles;
|
||||
|
||||
qfglDepthMask (GL_TRUE);
|
||||
qfglDisableVertexAttribArray (quake_point.vertex.location);
|
||||
qfglDisableVertexAttribArray (quake_point.color.location);
|
||||
qfglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfglDisable (GL_TEXTURE_2D);
|
||||
qfeglDepthMask (GL_TRUE);
|
||||
qfeglDisableVertexAttribArray (quake_point.vertex.location);
|
||||
qfeglDisableVertexAttribArray (quake_point.color.location);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfeglDisable (GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -76,7 +76,7 @@ extern void (*R_DrawSpriteModel) (struct entity_s *ent);
|
|||
static unsigned int
|
||||
R_TestErrors (unsigned int numerous)
|
||||
{
|
||||
switch (qfglGetError ()) {
|
||||
switch (qfeglGetError ()) {
|
||||
case GL_NO_ERROR:
|
||||
return numerous;
|
||||
break;
|
||||
|
@ -176,7 +176,7 @@ glsl_SCR_UpdateScreen (double realtime, SCR_Func scr_3dfunc,
|
|||
if (!scr_initialized)
|
||||
return;
|
||||
|
||||
qfglClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
qfeglClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
begun = 1;
|
||||
|
||||
|
@ -199,7 +199,7 @@ glsl_SCR_UpdateScreen (double realtime, SCR_Func scr_3dfunc,
|
|||
scr_funcs++;
|
||||
GL_FlushText ();
|
||||
}
|
||||
qfglFlush ();
|
||||
qfeglFlush ();
|
||||
}
|
||||
|
||||
tex_t *
|
||||
|
@ -216,7 +216,7 @@ glsl_SCR_CaptureBGR (void)
|
|||
tex->height = vid.height;
|
||||
tex->format = tex_rgb;
|
||||
tex->palette = 0;
|
||||
qfglReadPixels (0, 0, vid.width, vid.height, GL_RGB,
|
||||
qfeglReadPixels (0, 0, vid.width, vid.height, GL_RGB,
|
||||
GL_UNSIGNED_BYTE, tex->data);
|
||||
for (i = 0, r = tex->data, b = tex->data + 2; i < count;
|
||||
i++, r += 3, b += 3) {
|
||||
|
|
|
@ -290,26 +290,26 @@ R_DrawSprite (void)
|
|||
|
||||
R_GetSpriteFrames (ent, sprite, &frame1, &frame2, &blend);
|
||||
|
||||
qfglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfglBindTexture (GL_TEXTURE_2D, frame1->gl_texturenum);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfeglBindTexture (GL_TEXTURE_2D, frame1->gl_texturenum);
|
||||
|
||||
qfglActiveTexture (GL_TEXTURE0 + 1);
|
||||
qfglBindTexture (GL_TEXTURE_2D, frame2->gl_texturenum);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 1);
|
||||
qfeglBindTexture (GL_TEXTURE_2D, frame2->gl_texturenum);
|
||||
|
||||
qfglVertexAttrib4fv (quake_sprite.colora.location, color);
|
||||
qfglVertexAttrib4fv (quake_sprite.colorb.location, color);
|
||||
qfglVertexAttrib1f (quake_sprite.blend.location, blend);
|
||||
qfeglVertexAttrib4fv (quake_sprite.colora.location, color);
|
||||
qfeglVertexAttrib4fv (quake_sprite.colorb.location, color);
|
||||
qfeglVertexAttrib1f (quake_sprite.blend.location, blend);
|
||||
|
||||
make_quad (frame1, svpn, svright, svup, vertsa);
|
||||
make_quad (frame2, svpn, svright, svup, vertsb);
|
||||
|
||||
qfglVertexAttribPointer (quake_sprite.vertexa.location, 3, GL_FLOAT,
|
||||
qfeglVertexAttribPointer (quake_sprite.vertexa.location, 3, GL_FLOAT,
|
||||
0, 0, vertsa);
|
||||
qfglVertexAttribPointer (quake_sprite.vertexb.location, 3, GL_FLOAT,
|
||||
qfeglVertexAttribPointer (quake_sprite.vertexb.location, 3, GL_FLOAT,
|
||||
0, 0, vertsb);
|
||||
qfglVertexAttribPointer (quake_sprite.uvab.location, 4, GL_FLOAT,
|
||||
qfeglVertexAttribPointer (quake_sprite.uvab.location, 4, GL_FLOAT,
|
||||
0, 0, uvab);
|
||||
qfglDrawArrays (GL_TRIANGLES, 0, 6);
|
||||
qfeglDrawArrays (GL_TRIANGLES, 0, 6);
|
||||
}
|
||||
|
||||
// All sprites are drawn in a batch, so avoid thrashing the gl state
|
||||
|
@ -319,46 +319,46 @@ R_SpriteBegin (void)
|
|||
mat4_t mat;
|
||||
quat_t fog;
|
||||
|
||||
qfglUseProgram (quake_sprite.program);
|
||||
qfglEnableVertexAttribArray (quake_sprite.vertexa.location);
|
||||
qfglEnableVertexAttribArray (quake_sprite.vertexb.location);
|
||||
qfglEnableVertexAttribArray (quake_sprite.uvab.location);
|
||||
qfglDisableVertexAttribArray (quake_sprite.colora.location);
|
||||
qfglDisableVertexAttribArray (quake_sprite.colorb.location);
|
||||
qfglDisableVertexAttribArray (quake_sprite.blend.location);
|
||||
qfeglUseProgram (quake_sprite.program);
|
||||
qfeglEnableVertexAttribArray (quake_sprite.vertexa.location);
|
||||
qfeglEnableVertexAttribArray (quake_sprite.vertexb.location);
|
||||
qfeglEnableVertexAttribArray (quake_sprite.uvab.location);
|
||||
qfeglDisableVertexAttribArray (quake_sprite.colora.location);
|
||||
qfeglDisableVertexAttribArray (quake_sprite.colorb.location);
|
||||
qfeglDisableVertexAttribArray (quake_sprite.blend.location);
|
||||
|
||||
VectorCopy (glsl_Fog_GetColor (), fog);
|
||||
fog[3] = glsl_Fog_GetDensity () / 64.0;
|
||||
qfglUniform4fv (quake_sprite.fog.location, 1, fog);
|
||||
qfeglUniform4fv (quake_sprite.fog.location, 1, fog);
|
||||
|
||||
qfglUniform1i (quake_sprite.spritea.location, 0);
|
||||
qfglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfglEnable (GL_TEXTURE_2D);
|
||||
qfeglUniform1i (quake_sprite.spritea.location, 0);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfeglEnable (GL_TEXTURE_2D);
|
||||
|
||||
qfglUniform1i (quake_sprite.spriteb.location, 1);
|
||||
qfglActiveTexture (GL_TEXTURE0 + 1);
|
||||
qfglEnable (GL_TEXTURE_2D);
|
||||
qfeglUniform1i (quake_sprite.spriteb.location, 1);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 1);
|
||||
qfeglEnable (GL_TEXTURE_2D);
|
||||
|
||||
qfglUniform1i (quake_sprite.palette.location, 2);
|
||||
qfglActiveTexture (GL_TEXTURE0 + 2);
|
||||
qfglEnable (GL_TEXTURE_2D);
|
||||
qfglBindTexture (GL_TEXTURE_2D, glsl_palette);
|
||||
qfeglUniform1i (quake_sprite.palette.location, 2);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 2);
|
||||
qfeglEnable (GL_TEXTURE_2D);
|
||||
qfeglBindTexture (GL_TEXTURE_2D, glsl_palette);
|
||||
|
||||
Mat4Mult (glsl_projection, glsl_view, mat);
|
||||
qfglUniformMatrix4fv (quake_sprite.matrix.location, 1, false, mat);
|
||||
qfeglUniformMatrix4fv (quake_sprite.matrix.location, 1, false, mat);
|
||||
}
|
||||
|
||||
void
|
||||
R_SpriteEnd (void)
|
||||
{
|
||||
qfglDisableVertexAttribArray (quake_sprite.vertexa.location);
|
||||
qfglDisableVertexAttribArray (quake_sprite.vertexb.location);
|
||||
qfglDisableVertexAttribArray (quake_sprite.uvab.location);
|
||||
qfeglDisableVertexAttribArray (quake_sprite.vertexa.location);
|
||||
qfeglDisableVertexAttribArray (quake_sprite.vertexb.location);
|
||||
qfeglDisableVertexAttribArray (quake_sprite.uvab.location);
|
||||
|
||||
qfglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfglDisable (GL_TEXTURE_2D);
|
||||
qfglActiveTexture (GL_TEXTURE0 + 1);
|
||||
qfglDisable (GL_TEXTURE_2D);
|
||||
qfglActiveTexture (GL_TEXTURE0 + 2);
|
||||
qfglDisable (GL_TEXTURE_2D);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 0);
|
||||
qfeglDisable (GL_TEXTURE_2D);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 1);
|
||||
qfeglDisable (GL_TEXTURE_2D);
|
||||
qfeglActiveTexture (GL_TEXTURE0 + 2);
|
||||
qfeglDisable (GL_TEXTURE_2D);
|
||||
}
|
||||
|
|
|
@ -74,15 +74,15 @@ GLSL_LoadQuakeTexture (const char *identifier, int width, int height,
|
|||
{
|
||||
GLuint tnum;
|
||||
|
||||
qfglGenTextures (1, &tnum);
|
||||
qfglBindTexture (GL_TEXTURE_2D, tnum);
|
||||
qfglTexImage2D (GL_TEXTURE_2D, 0, GL_LUMINANCE,
|
||||
qfeglGenTextures (1, &tnum);
|
||||
qfeglBindTexture (GL_TEXTURE_2D, tnum);
|
||||
qfeglTexImage2D (GL_TEXTURE_2D, 0, GL_LUMINANCE,
|
||||
width, height, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, data);
|
||||
qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
qfglGenerateMipmap (GL_TEXTURE_2D);
|
||||
qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
qfeglGenerateMipmap (GL_TEXTURE_2D);
|
||||
|
||||
return tnum;
|
||||
}
|
||||
|
@ -140,13 +140,13 @@ GLSL_LoadQuakeMipTex (const texture_t *tex)
|
|||
for (swidth = 1; swidth < tex->width; swidth <<= 1);
|
||||
for (sheight = 1; sheight < tex->height; sheight <<= 1);
|
||||
|
||||
qfglGenTextures (1, &tnum);
|
||||
qfglBindTexture (GL_TEXTURE_2D, tnum);
|
||||
qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
|
||||
qfeglGenTextures (1, &tnum);
|
||||
qfeglBindTexture (GL_TEXTURE_2D, tnum);
|
||||
qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
|
||||
GL_NEAREST_MIPMAP_NEAREST);
|
||||
qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
|
||||
if (swidth != tex->width || sheight != tex->height)
|
||||
buffer = malloc (swidth * sheight);
|
||||
|
@ -174,7 +174,7 @@ GLSL_LoadQuakeMipTex (const texture_t *tex)
|
|||
} else {
|
||||
scaled = data + tex->offsets[lod];
|
||||
}
|
||||
qfglTexImage2D (GL_TEXTURE_2D, lod, GL_LUMINANCE, swidth, sheight,
|
||||
qfeglTexImage2D (GL_TEXTURE_2D, lod, GL_LUMINANCE, swidth, sheight,
|
||||
0, GL_LUMINANCE, GL_UNSIGNED_BYTE, scaled);
|
||||
}
|
||||
if (swidth > 1 || sheight > 1) {
|
||||
|
@ -188,7 +188,7 @@ GLSL_LoadQuakeMipTex (const texture_t *tex)
|
|||
sheight >>= 1;
|
||||
swidth = max (swidth, 1);
|
||||
sheight = max (sheight, 1);
|
||||
qfglTexImage2D (GL_TEXTURE_2D, lod, GL_LUMINANCE, swidth, sheight,
|
||||
qfeglTexImage2D (GL_TEXTURE_2D, lod, GL_LUMINANCE, swidth, sheight,
|
||||
0, GL_LUMINANCE, GL_UNSIGNED_BYTE, mip);
|
||||
scaled = mip;
|
||||
mip += swidth * sheight;
|
||||
|
@ -206,15 +206,15 @@ GLSL_LoadRGBTexture (const char *identifier, int width, int height, byte *data)
|
|||
{
|
||||
GLuint tnum;
|
||||
|
||||
qfglGenTextures (1, &tnum);
|
||||
qfglBindTexture (GL_TEXTURE_2D, tnum);
|
||||
qfglTexImage2D (GL_TEXTURE_2D, 0, GL_RGB,
|
||||
qfeglGenTextures (1, &tnum);
|
||||
qfeglBindTexture (GL_TEXTURE_2D, tnum);
|
||||
qfeglTexImage2D (GL_TEXTURE_2D, 0, GL_RGB,
|
||||
width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);
|
||||
qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
qfglGenerateMipmap (GL_TEXTURE_2D);
|
||||
qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
qfeglGenerateMipmap (GL_TEXTURE_2D);
|
||||
|
||||
return tnum;
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ void
|
|||
GLSL_ReleaseTexture (int tex)
|
||||
{
|
||||
GLuint tnum = tex;
|
||||
qfglDeleteTextures (1, &tnum);
|
||||
qfeglDeleteTextures (1, &tnum);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -254,7 +254,7 @@ glsl_scraps_f (void)
|
|||
void
|
||||
GLSL_TextureInit (void)
|
||||
{
|
||||
qfglGetIntegerv (GL_MAX_TEXTURE_SIZE, &max_tex_size);
|
||||
qfeglGetIntegerv (GL_MAX_TEXTURE_SIZE, &max_tex_size);
|
||||
Sys_MaskPrintf (SYS_GLSL, "max texture size: %d\n", max_tex_size);
|
||||
|
||||
Cmd_AddCommand ("glsl_scraps", glsl_scraps_f, "Dump GLSL scrap stats");
|
||||
|
@ -291,7 +291,7 @@ GLSL_CreateScrap (int size, int format)
|
|||
Sys_Error ("GL_CreateScrap: Invalid texture format");
|
||||
}
|
||||
scrap = malloc (sizeof (scrap_t));
|
||||
qfglGenTextures (1, &scrap->tnum);
|
||||
qfeglGenTextures (1, &scrap->tnum);
|
||||
scrap->size = size;
|
||||
scrap->format = format;
|
||||
scrap->bpp = bpp;
|
||||
|
@ -303,15 +303,15 @@ GLSL_CreateScrap (int size, int format)
|
|||
|
||||
data = calloc (1, size * size * bpp);
|
||||
|
||||
qfglBindTexture (GL_TEXTURE_2D, scrap->tnum);
|
||||
qfglTexImage2D (GL_TEXTURE_2D, 0, format,
|
||||
qfeglBindTexture (GL_TEXTURE_2D, scrap->tnum);
|
||||
qfeglTexImage2D (GL_TEXTURE_2D, 0, format,
|
||||
size, size, 0, format, GL_UNSIGNED_BYTE, data);
|
||||
qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
//FIXME parameterize (linear for lightmaps)
|
||||
qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
qfglGenerateMipmap (GL_TEXTURE_2D);
|
||||
qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
qfeglGenerateMipmap (GL_TEXTURE_2D);
|
||||
free (data);
|
||||
|
||||
return scrap;
|
||||
|
@ -469,8 +469,8 @@ GLSL_SubpicUpdate (subpic_t *subpic, byte *data)
|
|||
scrap_t *scrap = (scrap_t *) subpic->scrap;
|
||||
vrect_t *rect = (vrect_t *) subpic->rect;
|
||||
|
||||
qfglBindTexture (GL_TEXTURE_2D, scrap->tnum);
|
||||
qfglTexSubImage2D (GL_TEXTURE_2D, 0, rect->x, rect->y,
|
||||
qfeglBindTexture (GL_TEXTURE_2D, scrap->tnum);
|
||||
qfeglTexSubImage2D (GL_TEXTURE_2D, 0, rect->x, rect->y,
|
||||
subpic->width, subpic->height, scrap->format,
|
||||
GL_UNSIGNED_BYTE, data);
|
||||
}
|
||||
|
|
|
@ -66,13 +66,13 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
|
||||
|
||||
void *
|
||||
QFGL_ProcAddress (void *handle, const char *name, qboolean crit)
|
||||
QFEGL_ProcAddress (void *handle, const char *name, qboolean crit)
|
||||
{
|
||||
void *glfunc = NULL;
|
||||
|
||||
Sys_MaskPrintf (SYS_VID, "DEBUG: Finding symbol %s ... ", name);
|
||||
|
||||
glfunc = QFGL_GetProcAddress (handle, name);
|
||||
glfunc = QFEGL_GetProcAddress (handle, name);
|
||||
if (glfunc) {
|
||||
Sys_MaskPrintf (SYS_VID, "found [%p]\n", glfunc);
|
||||
return glfunc;
|
||||
|
@ -93,9 +93,9 @@ QFGL_ProcAddress (void *handle, const char *name, qboolean crit)
|
|||
|
||||
// First we need to get all the function pointers declared.
|
||||
#define QFGL_WANT(ret, name, args) \
|
||||
ret (GLAPIENTRY * qf##name) args;
|
||||
ret (GLAPIENTRY * qfe##name) args;
|
||||
#define QFGL_NEED(ret, name, args) \
|
||||
ret (GLAPIENTRY * qf##name) args;
|
||||
ret (GLAPIENTRY * qfe##name) args;
|
||||
#include "QF/GLSL/qf_funcs_list.h"
|
||||
#undef QFGL_NEED
|
||||
#undef QFGL_WANT
|
||||
|
@ -103,19 +103,19 @@ void *libgl_handle;
|
|||
|
||||
// Then we need to open the libGL and set all the symbols.
|
||||
qboolean
|
||||
GLF_Init (void)
|
||||
EGLF_Init (void)
|
||||
{
|
||||
libgl_handle = QFGL_LoadLibrary ();
|
||||
libgl_handle = QFEGL_LoadLibrary ();
|
||||
return true;
|
||||
}
|
||||
|
||||
qboolean
|
||||
GLF_FindFunctions (void)
|
||||
EGLF_FindFunctions (void)
|
||||
{
|
||||
#define QFGL_WANT(ret, name, args) \
|
||||
qf##name = QFGL_ProcAddress (libgl_handle, #name, false);
|
||||
qfe##name = QFEGL_ProcAddress (libgl_handle, #name, false);
|
||||
#define QFGL_NEED(ret, name, args) \
|
||||
qf##name = QFGL_ProcAddress (libgl_handle, #name, true);
|
||||
qfe##name = QFEGL_ProcAddress (libgl_handle, #name, true);
|
||||
#include "QF/GLSL/qf_funcs_list.h"
|
||||
#undef QFGL_NEED
|
||||
#undef QFGL_WANT
|
||||
|
|
|
@ -108,16 +108,16 @@ VID_SetPalette (unsigned char *palette)
|
|||
|
||||
if (!glsl_colormap) {
|
||||
GLuint tex;
|
||||
qfglGenTextures (1, &tex);
|
||||
qfeglGenTextures (1, &tex);
|
||||
glsl_colormap = tex;
|
||||
}
|
||||
qfglBindTexture (GL_TEXTURE_2D, glsl_colormap);
|
||||
qfglTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 256, VID_GRADES, 0,
|
||||
qfeglBindTexture (GL_TEXTURE_2D, glsl_colormap);
|
||||
qfeglTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 256, VID_GRADES, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, pal);
|
||||
qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
|
||||
for (i = 0, ip = palette, op = pal; i < 255; i++) {
|
||||
*op++ = *ip++;
|
||||
|
@ -129,38 +129,38 @@ VID_SetPalette (unsigned char *palette)
|
|||
|
||||
if (!glsl_palette) {
|
||||
GLuint tex;
|
||||
qfglGenTextures (1, &tex);
|
||||
qfeglGenTextures (1, &tex);
|
||||
glsl_palette = tex;
|
||||
}
|
||||
qfglBindTexture (GL_TEXTURE_2D, glsl_palette);
|
||||
qfglTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 256, 1, 0,
|
||||
qfeglBindTexture (GL_TEXTURE_2D, glsl_palette);
|
||||
qfeglTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 256, 1, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, pal);
|
||||
qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
free (pal);
|
||||
}
|
||||
|
||||
void
|
||||
GL_Init_Common (void)
|
||||
GLSL_Init_Common (void)
|
||||
{
|
||||
GLF_FindFunctions ();
|
||||
EGLF_FindFunctions ();
|
||||
|
||||
GLSL_Common_Init_Cvars ();
|
||||
|
||||
GLSL_TextureInit ();
|
||||
|
||||
qfglClearColor (0, 0, 0, 0);
|
||||
qfeglClearColor (0, 0, 0, 0);
|
||||
|
||||
qfglPixelStorei (GL_UNPACK_ALIGNMENT, 1);
|
||||
qfeglPixelStorei (GL_UNPACK_ALIGNMENT, 1);
|
||||
|
||||
qfglEnable (GL_TEXTURE_2D);
|
||||
qfglFrontFace (GL_CW);
|
||||
qfglCullFace (GL_BACK);
|
||||
qfeglEnable (GL_TEXTURE_2D);
|
||||
qfeglFrontFace (GL_CW);
|
||||
qfeglCullFace (GL_BACK);
|
||||
|
||||
qfglEnable (GL_BLEND);
|
||||
qfglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
qfeglEnable (GL_BLEND);
|
||||
qfeglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -171,19 +171,19 @@ GLSL_CompileShader (const char *name, const char *shader_src, int type)
|
|||
int compiled;
|
||||
|
||||
src[0] = shader_src;
|
||||
shader = qfglCreateShader (type);
|
||||
qfglShaderSource (shader, 1, src, 0);
|
||||
qfglCompileShader (shader);
|
||||
qfglGetShaderiv (shader, GL_COMPILE_STATUS, &compiled);
|
||||
shader = qfeglCreateShader (type);
|
||||
qfeglShaderSource (shader, 1, src, 0);
|
||||
qfeglCompileShader (shader);
|
||||
qfeglGetShaderiv (shader, GL_COMPILE_STATUS, &compiled);
|
||||
if (!compiled || (developer->int_val & SYS_GLSL)) {
|
||||
dstring_t *log = dstring_new ();
|
||||
int size;
|
||||
qfglGetShaderiv (shader, GL_INFO_LOG_LENGTH, &size);
|
||||
qfeglGetShaderiv (shader, GL_INFO_LOG_LENGTH, &size);
|
||||
log->size = size + 1; // for terminating null
|
||||
dstring_adjust (log);
|
||||
qfglGetShaderInfoLog (shader, log->size, 0, log->str);
|
||||
qfeglGetShaderInfoLog (shader, log->size, 0, log->str);
|
||||
if (!compiled)
|
||||
qfglDeleteShader (shader);
|
||||
qfeglDeleteShader (shader);
|
||||
Sys_Printf ("Shader (%s) compile log:\n----8<----\n%s----8<----\n",
|
||||
name, log->str);
|
||||
dstring_delete (log);
|
||||
|
@ -258,27 +258,27 @@ dump_program (const char *name, int program)
|
|||
GLenum ptype = 0;
|
||||
|
||||
pname = dstring_new ();
|
||||
qfglGetProgramiv (program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &size);
|
||||
qfeglGetProgramiv (program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &size);
|
||||
pname->size = size;
|
||||
dstring_adjust (pname);
|
||||
|
||||
qfglGetProgramiv(program, GL_ACTIVE_UNIFORMS, &count);
|
||||
qfeglGetProgramiv(program, GL_ACTIVE_UNIFORMS, &count);
|
||||
Sys_Printf("Program %s (%d) has %i uniforms\n", name, program, count);
|
||||
for (ind = 0; ind < count; ind++) {
|
||||
qfglGetActiveUniform(program, ind, pname->size, 0, &psize, &ptype,
|
||||
qfeglGetActiveUniform(program, ind, pname->size, 0, &psize, &ptype,
|
||||
pname->str);
|
||||
Sys_Printf ("Uniform %i name \"%s\" size %i type %s\n", (int)ind,
|
||||
pname->str, (int)psize, type_name (ptype));
|
||||
}
|
||||
|
||||
qfglGetProgramiv (program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &size);
|
||||
qfeglGetProgramiv (program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &size);
|
||||
pname->size = size;
|
||||
dstring_adjust (pname);
|
||||
|
||||
qfglGetProgramiv(program, GL_ACTIVE_ATTRIBUTES, &count);
|
||||
qfeglGetProgramiv(program, GL_ACTIVE_ATTRIBUTES, &count);
|
||||
Sys_Printf("Program %s (%d) has %i attributes\n", name, program, count);
|
||||
for (ind = 0; ind < count; ind++) {
|
||||
qfglGetActiveAttrib(program, ind, pname->size, 0, &psize, &ptype,
|
||||
qfeglGetActiveAttrib(program, ind, pname->size, 0, &psize, &ptype,
|
||||
pname->str);
|
||||
Sys_Printf ("Attribute %i name \"%s\" size %i type %s\n", (int)ind,
|
||||
pname->str, (int)psize, type_name (ptype));
|
||||
|
@ -292,21 +292,21 @@ GLSL_LinkProgram (const char *name, int vert, int frag)
|
|||
int program;
|
||||
int linked;
|
||||
|
||||
program = qfglCreateProgram ();
|
||||
qfglAttachShader (program, vert);
|
||||
qfglAttachShader (program, frag);
|
||||
qfglLinkProgram (program);
|
||||
program = qfeglCreateProgram ();
|
||||
qfeglAttachShader (program, vert);
|
||||
qfeglAttachShader (program, frag);
|
||||
qfeglLinkProgram (program);
|
||||
|
||||
qfglGetProgramiv (program, GL_LINK_STATUS, &linked);
|
||||
qfeglGetProgramiv (program, GL_LINK_STATUS, &linked);
|
||||
if (!linked || (developer->int_val & SYS_GLSL)) {
|
||||
dstring_t *log = dstring_new ();
|
||||
int size;
|
||||
qfglGetProgramiv (program, GL_INFO_LOG_LENGTH, &size);
|
||||
qfeglGetProgramiv (program, GL_INFO_LOG_LENGTH, &size);
|
||||
log->size = size + 1; // for terminating null
|
||||
dstring_adjust (log);
|
||||
qfglGetProgramInfoLog (program, log->size, 0, log->str);
|
||||
qfeglGetProgramInfoLog (program, log->size, 0, log->str);
|
||||
if (!linked)
|
||||
qfglDeleteProgram (program);
|
||||
qfeglDeleteProgram (program);
|
||||
Sys_Printf ("Program (%s) link log:\n----8<----\n%s----8<----\n",
|
||||
name, log->str);
|
||||
dstring_delete (log);
|
||||
|
@ -322,9 +322,9 @@ int
|
|||
GLSL_ResolveShaderParam (int program, shaderparam_t *param)
|
||||
{
|
||||
if (param->uniform) {
|
||||
param->location = qfglGetUniformLocation (program, param->name);
|
||||
param->location = qfeglGetUniformLocation (program, param->name);
|
||||
} else {
|
||||
param->location = qfglGetAttribLocation (program, param->name);
|
||||
param->location = qfeglGetAttribLocation (program, param->name);
|
||||
}
|
||||
if (param->location < 0) {
|
||||
Sys_Printf ("could not resolve %s %s\n",
|
||||
|
@ -351,19 +351,19 @@ GLSL_DumpAttribArrays (void)
|
|||
GLint current[4] = {-1, -1, -1, -1};
|
||||
void *pointer = 0;
|
||||
|
||||
qfglGetIntegerv (GL_MAX_VERTEX_ATTRIBS, &max);
|
||||
qfeglGetIntegerv (GL_MAX_VERTEX_ATTRIBS, &max);
|
||||
|
||||
for (ind = 0; ind < max; ind++) {
|
||||
qfglGetVertexAttribiv (ind, GL_VERTEX_ATTRIB_ARRAY_ENABLED, &enabled);
|
||||
qfeglGetVertexAttribiv (ind, GL_VERTEX_ATTRIB_ARRAY_ENABLED, &enabled);
|
||||
Sys_Printf ("attrib %d: %sabled\n", ind, enabled ? "en" : "dis");
|
||||
qfglGetVertexAttribiv (ind, GL_VERTEX_ATTRIB_ARRAY_SIZE, &size);
|
||||
qfglGetVertexAttribiv (ind, GL_VERTEX_ATTRIB_ARRAY_STRIDE, &stride);
|
||||
qfglGetVertexAttribiv (ind, GL_VERTEX_ATTRIB_ARRAY_TYPE, &type);
|
||||
qfglGetVertexAttribiv (ind, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, &norm);
|
||||
qfglGetVertexAttribiv (ind, GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING,
|
||||
qfeglGetVertexAttribiv (ind, GL_VERTEX_ATTRIB_ARRAY_SIZE, &size);
|
||||
qfeglGetVertexAttribiv (ind, GL_VERTEX_ATTRIB_ARRAY_STRIDE, &stride);
|
||||
qfeglGetVertexAttribiv (ind, GL_VERTEX_ATTRIB_ARRAY_TYPE, &type);
|
||||
qfeglGetVertexAttribiv (ind, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, &norm);
|
||||
qfeglGetVertexAttribiv (ind, GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING,
|
||||
&binding);
|
||||
qfglGetVertexAttribiv (ind, GL_CURRENT_VERTEX_ATTRIB, current);
|
||||
qfglGetVertexAttribPointerv (ind, GL_VERTEX_ATTRIB_ARRAY_POINTER,
|
||||
qfeglGetVertexAttribiv (ind, GL_CURRENT_VERTEX_ATTRIB, current);
|
||||
qfeglGetVertexAttribPointerv (ind, GL_VERTEX_ATTRIB_ARRAY_POINTER,
|
||||
&pointer);
|
||||
Sys_Printf (" %d %d '%s' %d %d (%d %d %d %d) %p\n", size, stride,
|
||||
type_name (type), norm, binding, QuatExpand (current),
|
||||
|
|
Loading…
Reference in a new issue