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