Compare commits
No commits in common. "2802a83a2be5d889f458361660d374226c571f9b" and "8e0ae5c0ff3052cd27b2007a0917cb2c47c6bc61" have entirely different histories.
2802a83a2b
...
8e0ae5c0ff
7 changed files with 152 additions and 156 deletions
|
@ -496,8 +496,7 @@ void R_DrawWorldBumped() {
|
|||
R_DrawMeshBumped((mesh_t *)currentshadowlight->lightCmdsMesh[i].asVoid);
|
||||
}
|
||||
|
||||
if ( (msurface_t *)currentshadowlight->lightCmds[0].asVoid)
|
||||
lastShader = ((msurface_t *)currentshadowlight->lightCmds[0].asVoid)->shader->shader;
|
||||
lastShader = ((msurface_t *)currentshadowlight->lightCmds[0].asVoid)->shader->shader;
|
||||
freeIndex = 0;
|
||||
for (i=0; i<currentshadowlight->numlightcmds-1; i++) {
|
||||
s = (msurface_t *)currentshadowlight->lightCmds[i].asVoid;
|
||||
|
|
24
gl_bumpgl2.c
24
gl_bumpgl2.c
|
@ -162,8 +162,7 @@ typedef char GLcharARB;
|
|||
#define GL_ARB_vertex_shader 1
|
||||
|
||||
// Taken from ARB_vertex_program
|
||||
#ifndef GL_ARB_vertex_program
|
||||
#define GL_ARB_vertex_program 1
|
||||
#if !defined(__FreeBSD__)
|
||||
typedef void (APIENTRY * PFNGLVERTEXATTRIB4FVARBPROC) (GLuint index, const GLfloat *v);
|
||||
typedef void (APIENTRY * PFNGLVERTEXATTRIB3FVARBPROC) (GLuint index, const GLfloat *v);
|
||||
typedef void (APIENTRY * PFNGLVERTEXATTRIB2FVARBPROC) (GLuint index, const GLfloat *v);
|
||||
|
@ -207,12 +206,6 @@ typedef void (APIENTRY * PFNGLVERTEXATTRIB4NUIVARBPROC) (GLuint index, const GLu
|
|||
typedef void (APIENTRY * PFNGLVERTEXATTRIBPOINTERARBPROC) (GLuint index, GLint size, GLenum type, GLboolean normalize, GLsizei stride, const GLvoid *pointer);
|
||||
typedef void (APIENTRY * PFNGLENABLEVERTEXATTRIBARRAYARBPROC) (GLuint index);
|
||||
typedef void (APIENTRY * PFNGLDISABLEVERTEXATTRIBARRAYARBPROC) (GLuint index);
|
||||
|
||||
typedef void (APIENTRY * PFNGLGETVERTEXATTRIBPOINTERVARBPROC) (GLuint index, GLenum pname, void **pointer);
|
||||
typedef void (APIENTRY * PFNGLGETVERTEXATTRIBDVARBPROC) (GLuint index, GLenum pname, GLdouble *params);
|
||||
|
||||
typedef void (APIENTRY * PFNGLGETVERTEXATTRIBFVARBPROC) (GLuint index, GLenum pname, GLfloat *params);
|
||||
typedef void (APIENTRY * PFNGLGETVERTEXATTRIBIVARBPROC) (GLuint index, GLenum pname, GLint *params);
|
||||
#endif
|
||||
typedef void (APIENTRY * PFNGLBINDATTRIBLOCATIONARBPROC) (GLhandleARB programObj, GLuint index, const GLcharARB *name);
|
||||
typedef void (APIENTRY * PFNGLBINDARRAYGL2PROC) (GLhandleARB shaderObject, GLenum array, const GLcharARB *name, GLint length);
|
||||
|
@ -242,6 +235,8 @@ typedef void (APIENTRY * PFNGLUNIFORM2IARBPROC) (GLint location, GLint v0, GLint
|
|||
typedef void (APIENTRY * PFNGLUNIFORM3IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2);
|
||||
typedef void (APIENTRY * PFNGLUNIFORM4IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
|
||||
|
||||
|
||||
|
||||
typedef void (APIENTRY * PFNGLUNIFORM1FVARBPROC) (GLint location, GLsizei count, GLfloat *value);
|
||||
typedef void (APIENTRY * PFNGLUNIFORM2FVARBPROC) (GLint location, GLsizei count, GLfloat *value);
|
||||
typedef void (APIENTRY * PFNGLUNIFORM3FVARBPROC) (GLint location, GLsizei count, GLfloat *value);
|
||||
|
@ -252,6 +247,7 @@ typedef void (APIENTRY * PFNGLUNIFORM2IVARBPROC) (GLint location, GLsizei count,
|
|||
typedef void (APIENTRY * PFNGLUNIFORM3IVARBPROC) (GLint location, GLsizei count, GLint *value);
|
||||
typedef void (APIENTRY * PFNGLUNIFORM4IVARBPROC) (GLint location, GLsizei count, GLint *value);
|
||||
|
||||
|
||||
typedef void (APIENTRY * PFNGLUNIFORMMATRIX2FVARBPROC) (GLint location, GLuint count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (APIENTRY * PFNGLUNIFORMMATRIX3FVARBPROC) (GLint location, GLuint count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (APIENTRY * PFNGLUNIFORMMATRIX4FVARBPROC) (GLint location, GLuint count, GLboolean transpose, const GLfloat *value);
|
||||
|
@ -264,9 +260,17 @@ typedef void (APIENTRY * PFNGLGETUNIFORMFVARBPROC) (GLhandleARB programObj, GLin
|
|||
typedef void (APIENTRY * PFNGLGETUNIFORMIVARBPROC) (GLhandleARB programObj, GLint location, GLint *params);
|
||||
typedef void (APIENTRY * PFNGLGETATTRIBLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name);
|
||||
typedef void (APIENTRY * PFNGLVALIDATEPROGRAMARBPROC) (GLhandleARB programObj);
|
||||
#if !defined (__FreeBSD__)
|
||||
typedef void (APIENTRY * PFNGLGETVERTEXATTRIBPOINTERVARBPROC) (GLuint index, GLenum pname, void **pointer);
|
||||
#endif
|
||||
typedef void (APIENTRY * PFNGLGETOBJECTPARAMETERFVARBPROC)(GLhandleARB obj, GLenum pname, GLfloat *params);
|
||||
typedef void (APIENTRY * PFNGLGETOBJECTPARAMETERIVARBPROC)(GLhandleARB obj, GLenum pname, GLint *params);
|
||||
#if !defined (__FreeBSD__)
|
||||
typedef void (APIENTRY * PFNGLGETVERTEXATTRIBDVARBPROC) (GLuint index, GLenum pname, GLdouble *params);
|
||||
|
||||
typedef void (APIENTRY * PFNGLGETVERTEXATTRIBFVARBPROC) (GLuint index, GLenum pname, GLfloat *params);
|
||||
typedef void (APIENTRY * PFNGLGETVERTEXATTRIBIVARBPROC) (GLuint index, GLenum pname, GLint *params);
|
||||
#endif
|
||||
typedef GLhandleARB (APIENTRY * PFNGLGETHANDLEARBPROC) (GLenum pname);
|
||||
typedef GLhandleARB (APIENTRY * PFNGLCREATEVERTEXARRAYOBJECTGL2PROC) (GLhandleARB formatObject, GLsizei count);
|
||||
typedef void (APIENTRY * PFNGLLOADVERTEXARRAYDATAGL2PROC) (GLhandleARB object, GLuint start, GLsizei count, GLvoid *data, GLenum preserve);
|
||||
|
@ -475,7 +479,7 @@ void GL2_CreateShaders()
|
|||
}
|
||||
|
||||
len = strlen(shader);
|
||||
qglShaderSourceARB(vertex_shaders[i], 1, (const GLcharARB **)&shader, &len);
|
||||
qglShaderSourceARB(vertex_shaders[i], 1, &shader, &len);
|
||||
GL2_checkerror();
|
||||
|
||||
shader = COM_LoadTempFile(fragment_programs[i]);
|
||||
|
@ -485,7 +489,7 @@ void GL2_CreateShaders()
|
|||
Sys_Error("GL2: %s not found\n", fragment_programs[i]);
|
||||
}
|
||||
len = strlen(shader);
|
||||
qglShaderSourceARB(fragment_shaders[i], 1, (const GLcharARB **)&shader, &len);
|
||||
qglShaderSourceARB(fragment_shaders[i], 1, &shader, &len);
|
||||
GL2_checkerror();
|
||||
|
||||
qglCompileShaderARB(vertex_shaders[i]);
|
||||
|
|
123
gl_bumpnv3x.c
123
gl_bumpnv3x.c
|
@ -60,9 +60,9 @@ typedef void (APIENTRY * PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC) (GLuint id, GLsize
|
|||
typedef void (APIENTRY * PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat *params);
|
||||
typedef void (APIENTRY * PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble *params);
|
||||
|
||||
#endif
|
||||
typedef void (APIENTRY * glProgramLocalParameter4fARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
glProgramLocalParameter4fARBPROC qglProgramLocalParameter4fARB;
|
||||
#endif
|
||||
|
||||
static char bump_vertex_program[] =
|
||||
"!!VP1.1\n"
|
||||
|
@ -279,70 +279,67 @@ static char bump_fragment_program3_colored[] =
|
|||
"END";
|
||||
|
||||
static char delux_fragment_program[] =
|
||||
"!!FP1.0\n"
|
||||
"TEX R0.xyz, f[TEX1], TEX1, 2D;\n"
|
||||
"TEX R1, f[TEX0], TEX2, 2D;\n"
|
||||
"MADR R0.xyz, 2, R0, -1;\n"
|
||||
"DP3X H0.x, R0, f[TEX2];\n"
|
||||
"DP3X H0.y, R0, f[TEX3];\n"
|
||||
"DP3X H0.z, R0, f[TEX4];\n"
|
||||
"DP3H H0.w, H0, H0;\n"
|
||||
"RSQH H0.w, H0.w;\n"
|
||||
"MULH H0.xyz, H0.w, H0;\n"
|
||||
"MOVR H1.w, R1.w;\n"
|
||||
"MADX H2.xyz, 2, R1, -1;\n"
|
||||
"MOVX H1.xyz, H2;\n"
|
||||
"DP3H_SAT H0.w, H0, H1;\n"
|
||||
"ADDR R0.xyz, p[0], -f[TEX5];\n"
|
||||
"DP3R R1.x, R0, f[TEX2];\n"
|
||||
"DP3R R1.y, R0, f[TEX3];\n"
|
||||
"DP3R R1.z, R0, f[TEX4];\n"
|
||||
"DP3R R0.x, R1, R1.xyzx;\n"
|
||||
"RSQR R0.x, R0.x;\n"
|
||||
"MADR R0.xyz, R0.x, R1, H0;\n"
|
||||
"MULR R0.xyz, R0, 0.5;\n"
|
||||
"DP3H_SAT H0.x, R0, H1;\n"
|
||||
"POWH H0.x, H0.x, 16;\n"
|
||||
"MULH H0.x, H0.x, H1.w;\n"
|
||||
"TEX R0, f[TEX0], TEX3, 2D;\n"
|
||||
"TEX R1, f[TEX1], TEX0, 2D;\n"
|
||||
"MADH H0, R0, H0.w, H0.x;\n"
|
||||
"MULH o[COLR].xyz, H0, R1;\n"
|
||||
"MOVH o[COLR].w, R0.w;\n"
|
||||
"END";
|
||||
|
||||
"!!FP1.0\n"
|
||||
"TEX R0, f[TEX1], TEX1, 2D;\n"
|
||||
"TEX R1, f[TEX0], TEX2, 2D;\n"
|
||||
"MADR R0.xyz, R0, 2, -1;\n"
|
||||
"ADDR R3.xyz, p[0], -f[TEX5];\n"
|
||||
"DP3R R2.x, R0, f[TEX2];\n"
|
||||
"DP3R R2.y, R0, f[TEX3];\n"
|
||||
"DP3R R2.z, R0, f[TEX4];\n"
|
||||
"DP3R R4.x, R3, f[TEX2];\n"
|
||||
"DP3R R4.y, R3, f[TEX3];\n"
|
||||
"DP3R R4.z, R3, f[TEX4];\n"
|
||||
"DP3R R0.x, R2, R2;\n"
|
||||
"RSQR R0.x, R0.x;\n"
|
||||
"MULR R2.xyz, R0.x, R2;\n"
|
||||
"DP3R R0.x, R4, R4;\n"
|
||||
"RSQR R0.x, R0.x;\n"
|
||||
"MADR R4.xyz, R0.x, R4, R2;\n"
|
||||
"MULR R4.xyz, R4, 0.5;\n"
|
||||
"MOVR R0.w, R1.w;\n"
|
||||
"MADR R0.xyz, R1, 2, -1;\n"
|
||||
"DP3R_SAT R1.x, R4, R0;\n"
|
||||
"POWR R1.x, R1.x, 16;\n"
|
||||
"MULR R1.x, R1.x, R0.w;\n"
|
||||
"DP3R_SAT R0.x, R2, R0;\n"
|
||||
"TEX R2, f[TEX0], TEX3, 2D;\n"
|
||||
"TEX R3, f[TEX1], TEX0, 2D;\n"
|
||||
"MADR R0, R2, R0.x, R1.x;\n"
|
||||
"MULR o[COLR], R0, R3;\n"
|
||||
"END";
|
||||
|
||||
static char delux_fragment_program_colored[] =
|
||||
"!!FP1.0\n"
|
||||
"TEX R0, f[TEX1], TEX1, 2D;\n"
|
||||
"TEX R1, f[TEX0], TEX2, 2D;\n"
|
||||
"MADR R0.xyz, 2, R0, -1;\n"
|
||||
"MADX H0.xyz, 2, R1, -1;\n"
|
||||
"DP3X H1.x, R0, f[TEX2];\n"
|
||||
"DP3X H1.y, R0, f[TEX3];\n"
|
||||
"DP3X H1.z, R0, f[TEX4];\n"
|
||||
"DP3H H0.w, H1, H1;\n"
|
||||
"RSQH H0.w, H0.w;\n"
|
||||
"MULH H1.xyz, H0.w, H1;\n"
|
||||
"DP3H_SAT H0.w, H1, H0;\n"
|
||||
"ADDR R0.xyz, p[0], -f[TEX5];\n"
|
||||
"DP3R R1.x, R0, f[TEX2];\n"
|
||||
"DP3R R1.y, R0, f[TEX3];\n"
|
||||
"DP3R R1.z, R0, f[TEX4];\n"
|
||||
"DP3R R0.x, R1, R1;\n"
|
||||
"RSQR R0.x, R0.x;\n"
|
||||
"MADR R0.xyz, R0.x, R1, H1;\n"
|
||||
"MULR R0.xyz, R0, 0.5;\n"
|
||||
"DP3H_SAT H0.x, R0, H0;\n"
|
||||
"POWH H0.x, H0.x, 16;\n"
|
||||
"TEX R0, f[TEX0], TEX4, 2D;\n"
|
||||
"TEX R1, f[TEX0], TEX3, 2D;\n"
|
||||
"MULH H1, R0, H0.x;\n"
|
||||
"MADH H1, R1, H0.w, H1;\n"
|
||||
"TEX R0, f[TEX1], TEX0, 2D;\n"
|
||||
"MULH o[COLR].xyz, H1, R0;\n"
|
||||
"MOVH o[COLR].w, R1.w;\n"
|
||||
"END";
|
||||
"!!FP1.0\n"
|
||||
"TEX R0, f[TEX1], TEX1, 2D;\n"
|
||||
"TEX R1, f[TEX0], TEX2, 2D;\n"
|
||||
"MADR R0.xyz, R0, 2, -1;\n"
|
||||
"ADDR R3.xyz, p[0], -f[TEX5];\n"
|
||||
"DP3R R2.x, R0, f[TEX2];\n"
|
||||
"DP3R R2.y, R0, f[TEX3];\n"
|
||||
"DP3R R2.z, R0, f[TEX4];\n"
|
||||
"DP3R R4.x, R3, f[TEX2];\n"
|
||||
"DP3R R4.y, R3, f[TEX3];\n"
|
||||
"DP3R R4.z, R3, f[TEX4];\n"
|
||||
"DP3R R0.x, R2, R2;\n"
|
||||
"RSQR R0.x, R0.x;\n"
|
||||
"MULR R2.xyz, R0.x, R2;\n"
|
||||
"DP3R R0.x, R4, R4;\n"
|
||||
"RSQR R0.x, R0.x;\n"
|
||||
"MADR R4.xyz, R0.x, R4, R2;\n"
|
||||
"MULR R4.xyz, R4, 0.5;\n"
|
||||
"MOVR R0.w, R1.w;\n"
|
||||
"MADR R0.xyz, R1, 2, -1;\n"
|
||||
"DP3R_SAT R1.x, R4, R0;\n"
|
||||
"POWR R1.x, R1.x, 16;\n"
|
||||
"TEX R0, f[TEX0], TEX4, 2D;\n"
|
||||
"MULR R1, R1.x, R0;\n"
|
||||
"DP3R_SAT R0.x, R2, R0;\n"
|
||||
"TEX R2, f[TEX0], TEX3, 2D;\n"
|
||||
"TEX R3, f[TEX1], TEX0, 2D;\n"
|
||||
"MADR R0, R2, R0.x, R1;\n"
|
||||
"MULR o[COLR], R0, R3;\n"
|
||||
"END";
|
||||
|
||||
|
||||
typedef enum
|
||||
|
|
118
gl_common.c
118
gl_common.c
|
@ -46,12 +46,12 @@ GL3DFXSETPALETTEEXTPFN qgl3DfxSetPaletteEXT;
|
|||
|
||||
PFNBLENDCOLORPROC qglBlendColorEXT;
|
||||
|
||||
// EXT_stencil_two_side
|
||||
PFNGLACTIVESTENCILFACEEXTPROC qglActiveStencilFaceEXT;
|
||||
|
||||
// ATI_separate_stencil
|
||||
PFNGLSTENCILOPSEPARATEATIPROC qglStencilOpSeparateATI;
|
||||
PFNGLSTENCILFUNCSEPARATEATIPROC qglStencilFuncSeparateATI;
|
||||
// EXT_stencil_two_side
|
||||
PFNGLACTIVESTENCILFACEEXTPROC qglActiveStencilFaceEXT;
|
||||
|
||||
// ATI_separate_stencil
|
||||
PFNGLSTENCILOPSEPARATEATIPROC qglStencilOpSeparateATI;
|
||||
PFNGLSTENCILFUNCSEPARATEATIPROC qglStencilFuncSeparateATI;
|
||||
|
||||
|
||||
//int texture_mode = GL_NEAREST;
|
||||
|
@ -79,9 +79,9 @@ GLfloat gl_textureanisotropylevel = 2.0f;
|
|||
//cvar_t gl_anisotropic = { "gl_anisotropic", "0", 1 };
|
||||
|
||||
qboolean gl_occlusiontest = false;
|
||||
int occlusion_cut_meshes;
|
||||
int occlusion_cut_entities;
|
||||
int occlusion_cut_lights;
|
||||
occlusion_cut_meshes;
|
||||
occlusion_cut_entities;
|
||||
occlusion_cut_lights;
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
|
@ -406,74 +406,74 @@ void CheckGL2FragmentExtensions(void)
|
|||
void CheckAnisotropicExtension(void)
|
||||
{
|
||||
if (strstr(gl_extensions, "GL_EXT_texture_filter_anisotropic") &&
|
||||
( COM_CheckParm ("-anisotropic") || COM_CheckParm ("-anisotropy")) )
|
||||
( COM_CheckParm ("-anisotropic") || COM_CheckParm ("-anisotropy")) )
|
||||
{
|
||||
GLfloat maxanisotropy;
|
||||
GLfloat maxanisotropy;
|
||||
|
||||
if ( COM_CheckParm ("-anisotropy"))
|
||||
gl_textureanisotropylevel = Q_atoi(com_argv[COM_CheckParm("-anisotropy")+1]);
|
||||
if ( COM_CheckParm ("-anisotropy"))
|
||||
gl_textureanisotropylevel = Q_atoi(com_argv[COM_CheckParm("-anisotropy")+1]);
|
||||
|
||||
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maxanisotropy);
|
||||
if ( gl_textureanisotropylevel > maxanisotropy )
|
||||
gl_textureanisotropylevel = maxanisotropy;
|
||||
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maxanisotropy);
|
||||
if ( gl_textureanisotropylevel > maxanisotropy )
|
||||
gl_textureanisotropylevel = maxanisotropy;
|
||||
|
||||
if ( gl_textureanisotropylevel < 1.0f )
|
||||
gl_textureanisotropylevel = 1.0f;
|
||||
if ( gl_textureanisotropylevel < 1.0f )
|
||||
gl_textureanisotropylevel = 1.0f;
|
||||
|
||||
Con_Printf("Anisotropic texture filter level %.0f\n",
|
||||
gl_textureanisotropylevel);
|
||||
gl_texturefilteranisotropic = true;
|
||||
}
|
||||
Con_Printf("Anisotropic texture filter level %.0f\n",
|
||||
gl_textureanisotropylevel);
|
||||
gl_texturefilteranisotropic = true;
|
||||
}
|
||||
}
|
||||
|
||||
void CheckTextureCompressionExtension(void)
|
||||
{
|
||||
if (strstr(gl_extensions, "GL_ARB_texture_compression") )
|
||||
{
|
||||
Con_Printf("Texture compression available\n");
|
||||
gl_texcomp = true;
|
||||
}
|
||||
if (strstr(gl_extensions, "GL_ARB_texture_compression") )
|
||||
{
|
||||
Con_Printf("Texture compression available\n");
|
||||
gl_texcomp = true;
|
||||
}
|
||||
}
|
||||
|
||||
void CheckOcclusionTest(void)
|
||||
{
|
||||
if (strstr(gl_extensions, "GL_HP_occlusion_test") )
|
||||
{
|
||||
Con_Printf("Occlusion test available\n");
|
||||
gl_occlusiontest = true;
|
||||
}
|
||||
if (strstr(gl_extensions, "GL_HP_occlusion_test") )
|
||||
{
|
||||
Con_Printf("Occlusion test available\n");
|
||||
gl_occlusiontest = true;
|
||||
}
|
||||
}
|
||||
|
||||
void CheckMirrorOnce(void)
|
||||
{
|
||||
if (COM_CheckParm ("-nomirroronce")) return;
|
||||
if (COM_CheckParm ("-nomirroronce")) return;
|
||||
|
||||
if (strstr(gl_extensions, "GL_ATI_texture_mirror_once") )
|
||||
{
|
||||
Con_Printf("Mirror once available\n");
|
||||
gl_mirroronce = true;
|
||||
}
|
||||
if (strstr(gl_extensions, "GL_ATI_texture_mirror_once") )
|
||||
{
|
||||
Con_Printf("Mirror once available\n");
|
||||
gl_mirroronce = true;
|
||||
}
|
||||
}
|
||||
|
||||
void CheckTwoSidedStencil(void)
|
||||
{
|
||||
if (COM_CheckParm ("-notwosidedstencil"))
|
||||
return;
|
||||
|
||||
if (strstr(gl_extensions, "GL_EXT_stencil_two_side"))
|
||||
{
|
||||
SAFE_GET_PROC( qglActiveStencilFaceEXT, PFNGLACTIVESTENCILFACEEXTPROC, "glActiveStencilFaceEXT");
|
||||
gl_twosidedstencil = 1;
|
||||
Con_Printf("Using EXT_stencil_two_side\n");
|
||||
}
|
||||
else if (strstr(gl_extensions, "GL_ATI_separate_stencil"))
|
||||
{
|
||||
SAFE_GET_PROC( qglStencilOpSeparateATI, PFNGLSTENCILOPSEPARATEATIPROC, "glStencilOpSeparateATI");
|
||||
SAFE_GET_PROC( qglStencilFuncSeparateATI, PFNGLSTENCILFUNCSEPARATEATIPROC, "glStencilFuncSeparateATI");
|
||||
gl_twosidedstencil = 2;
|
||||
Con_Printf("Using ATI_separate_stencil\n");
|
||||
}
|
||||
}
|
||||
void CheckTwoSidedStencil(void)
|
||||
{
|
||||
if (COM_CheckParm ("-notwosidedstencil"))
|
||||
return;
|
||||
|
||||
if (strstr(gl_extensions, "GL_EXT_stencil_two_side"))
|
||||
{
|
||||
SAFE_GET_PROC( qglActiveStencilFaceEXT, PFNGLACTIVESTENCILFACEEXTPROC, "glActiveStencilFaceEXT");
|
||||
gl_twosidedstencil = 1;
|
||||
Con_Printf("Using EXT_stencil_two_side\n");
|
||||
}
|
||||
else if (strstr(gl_extensions, "GL_ATI_separate_stencil"))
|
||||
{
|
||||
SAFE_GET_PROC( qglStencilOpSeparateATI, PFNGLSTENCILOPSEPARATEATIPROC, "glStencilOpSeparateATI");
|
||||
SAFE_GET_PROC( qglStencilFuncSeparateATI, PFNGLSTENCILFUNCSEPARATEATIPROC, "glStencilFuncSeparateATI");
|
||||
gl_twosidedstencil = 2;
|
||||
Con_Printf("Using ATI_separate_stencil\n");
|
||||
}
|
||||
}
|
||||
|
||||
static int supportedTmu;
|
||||
/*
|
||||
|
@ -540,8 +540,8 @@ void GL_Init (void)
|
|||
CheckOcclusionTest();
|
||||
Con_Printf ("Checking MO\n");
|
||||
CheckMirrorOnce();
|
||||
Con_Printf ("Checking two-sided stencil\n");
|
||||
CheckTwoSidedStencil();
|
||||
Con_Printf ("Checking two-sided stencil\n");
|
||||
CheckTwoSidedStencil();
|
||||
|
||||
//if something goes wrong here throw an sys_error as we don't want to end up
|
||||
//having invalid function pointers called...
|
||||
|
|
15
gl_rmain.c
15
gl_rmain.c
|
@ -669,24 +669,23 @@ void R_DrawAliasSurfaceShadowVolume (aliashdr_t *paliashdr, aliasframeinstant_t
|
|||
case 1:
|
||||
// EXT_stencil_two_side
|
||||
glDisable(GL_CULL_FACE);
|
||||
glEnable(GL_STENCIL_TEST_TWO_SIDE_EXT);
|
||||
qglActiveStencilFaceEXT(GL_BACK);
|
||||
glStencilOp(GL_KEEP, GL_DECR_WRAP_EXT, GL_KEEP);
|
||||
glStencilOp(GL_KEEP, GL_INCR_WRAP_EXT, GL_KEEP);
|
||||
glStencilFunc(GL_ALWAYS, 0, ~0);
|
||||
qglActiveStencilFaceEXT(GL_FRONT);
|
||||
glStencilOp(GL_KEEP, GL_INCR_WRAP_EXT, GL_KEEP);
|
||||
glStencilOp(GL_KEEP, GL_DECR_WRAP_EXT, GL_KEEP);
|
||||
glStencilFunc(GL_ALWAYS, 0, ~0);
|
||||
R_DrawAliasFrameShadowVolume2 (paliashdr, aliasframeinstant);
|
||||
glEnable(GL_CULL_FACE);
|
||||
glDisable(GL_STENCIL_TEST_TWO_SIDE_EXT);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
// ATI_separate_stencil
|
||||
glDisable(GL_CULL_FACE);
|
||||
glStencilOp(GL_KEEP, GL_INCR_WRAP_EXT, GL_KEEP);
|
||||
qglStencilFuncSeparateATI(GL_ALWAYS, GL_ALWAYS, 0, ~0);
|
||||
qglStencilOpSeparateATI(GL_FRONT, GL_KEEP, GL_INCR_WRAP_EXT, GL_KEEP);
|
||||
qglStencilOpSeparateATI(GL_BACK, GL_KEEP, GL_DECR_WRAP_EXT, GL_KEEP);
|
||||
qglStencilOpSeparateATI(GL_FRONT, GL_KEEP, GL_DECR_WRAP_EXT, GL_KEEP);
|
||||
qglStencilOpSeparateATI(GL_BACK, GL_KEEP, GL_INCR_WRAP_EXT, GL_KEEP);
|
||||
R_DrawAliasFrameShadowVolume2 (paliashdr, aliasframeinstant);
|
||||
glEnable(GL_CULL_FACE);
|
||||
break;
|
||||
|
@ -2171,7 +2170,6 @@ void R_RenderScene (void)
|
|||
case 1:
|
||||
// EXT_stencil_two_side
|
||||
glDisable(GL_CULL_FACE);
|
||||
glEnable(GL_STENCIL_TEST_TWO_SIDE_EXT);
|
||||
qglActiveStencilFaceEXT(GL_BACK);
|
||||
glStencilOp(GL_KEEP, GL_INCR_WRAP_EXT, GL_KEEP);
|
||||
glStencilFunc(GL_ALWAYS, 0, ~0);
|
||||
|
@ -2184,12 +2182,13 @@ void R_RenderScene (void)
|
|||
//Pass 1 increase
|
||||
if (sh_entityshadows.value) R_DrawEntitiesShadowVolumes(mod_brush);
|
||||
glEnable(GL_CULL_FACE);
|
||||
glDisable(GL_STENCIL_TEST_TWO_SIDE_EXT);
|
||||
qglActiveStencilFaceEXT(GL_FRONT_AND_BACK);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
// ATI_separate_stencil
|
||||
glDisable(GL_CULL_FACE);
|
||||
glStencilOp(GL_KEEP, GL_INCR_WRAP_EXT, GL_KEEP);
|
||||
qglStencilFuncSeparateATI(GL_ALWAYS, GL_ALWAYS, 0, ~0);
|
||||
qglStencilOpSeparateATI(GL_FRONT, GL_KEEP, GL_DECR_WRAP_EXT, GL_KEEP);
|
||||
qglStencilOpSeparateATI(GL_BACK, GL_KEEP, GL_INCR_WRAP_EXT, GL_KEEP);
|
||||
|
|
|
@ -1986,8 +1986,7 @@ void StencilMeshVolumes()
|
|||
case 1:
|
||||
// EXT_stencil_two_side
|
||||
glDisable(GL_CULL_FACE);
|
||||
glEnable(GL_STENCIL_TEST_TWO_SIDE_EXT);
|
||||
qglActiveStencilFaceEXT(GL_BACK);
|
||||
qglActiveStencilFaceEXT(GL_BACK);
|
||||
glStencilOp(GL_KEEP, GL_INCR_WRAP_EXT, GL_KEEP);
|
||||
glStencilFunc(GL_ALWAYS, 0, ~0);
|
||||
qglActiveStencilFaceEXT(GL_FRONT);
|
||||
|
@ -1997,7 +1996,7 @@ void StencilMeshVolumes()
|
|||
for (i=0; i<currentshadowlight->numlightcmdsmesh-1; i++)
|
||||
StencilMeshVolume2((mesh_t *)currentshadowlight->lightCmdsMesh[i].asVoid);
|
||||
glEnable(GL_CULL_FACE);
|
||||
glDisable(GL_STENCIL_TEST_TWO_SIDE_EXT);
|
||||
qglActiveStencilFaceEXT(GL_FRONT_AND_BACK);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
|
20
glquake.h
20
glquake.h
|
@ -41,7 +41,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
func = (type) SDL_GL_GetProcAddress (name)
|
||||
#elif defined (__glx__)
|
||||
#define SAFE_GET_PROC( func, type, name) \
|
||||
func = (type)(unsigned long)glXGetProcAddressARB (name)
|
||||
func = (type) glXGetProcAddressARB (name)
|
||||
#else
|
||||
#define SAFE_GET_PROC( func, type, name) \
|
||||
func = (type) wglGetProcAddress(name); \
|
||||
|
@ -490,16 +490,17 @@ extern int occlusion_cut_lights;
|
|||
#define GL_DECR_WRAP_EXT 0x8508
|
||||
|
||||
#ifndef GL_EXT_stencil_two_side
|
||||
#define GL_EXT_stencil_two_side 1
|
||||
#define GL_STENCIL_TEST_TWO_SIDE_EXT 0x8910
|
||||
#define GL_ACTIVE_STENCIL_FACE_EXT 0x8911
|
||||
#endif
|
||||
|
||||
#ifndef GL_EXT_stencil_two_side
|
||||
#define GL_EXT_stencil_two_side 1
|
||||
typedef void (APIENTRY * PFNGLACTIVESTENCILFACEEXTPROC) (GLenum face);
|
||||
#endif
|
||||
extern PFNGLACTIVESTENCILFACEEXTPROC qglActiveStencilFaceEXT;
|
||||
|
||||
// ATI_separate_stencil
|
||||
#ifndef GL_ATI_separate_stencil
|
||||
#define GL_ATI_separate_stencil 1
|
||||
|
||||
// ATI_separate_stencil
|
||||
#define GL_STENCIL_BACK_FUNC_ATI 0x8800
|
||||
#define GL_STENCIL_BACK_FAIL_ATI 0x8801
|
||||
#define GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI 0x8802
|
||||
|
@ -507,7 +508,6 @@ extern PFNGLACTIVESTENCILFACEEXTPROC qglActiveStencilFaceEXT;
|
|||
|
||||
typedef void (APIENTRY *PFNGLSTENCILOPSEPARATEATIPROC)(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
|
||||
typedef void (APIENTRY *PFNGLSTENCILFUNCSEPARATEATIPROC)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);
|
||||
#endif
|
||||
|
||||
extern PFNGLSTENCILOPSEPARATEATIPROC qglStencilOpSeparateATI;
|
||||
extern PFNGLSTENCILFUNCSEPARATEATIPROC qglStencilFuncSeparateATI;
|
||||
|
@ -1005,8 +1005,7 @@ extern PFNGLVERTEXATTRIBS4SVNVPROC qglVertexAttribs4svNV ;
|
|||
extern PFNGLVERTEXATTRIBS4UBVNVPROC qglVertexAttribs4ubvNV ;
|
||||
|
||||
/* GL_ARB_vertex_buffer_object */
|
||||
#ifndef GL_ARB_vertex_buffer_object
|
||||
#define GL_ARB_vertex_buffer_object 1
|
||||
|
||||
#define GL_BUFFER_SIZE_ARB 0x8764
|
||||
#define GL_BUFFER_USAGE_ARB 0x8765
|
||||
#define GL_ARRAY_BUFFER_ARB 0x8892
|
||||
|
@ -1053,7 +1052,6 @@ typedef GLvoid* (APIENTRY * PFNGLMAPBUFFERARBPROC) (GLenum target, GLenum access
|
|||
typedef GLboolean (APIENTRY * PFNGLUNMAPBUFFERARBPROC) (GLenum target);
|
||||
typedef void (APIENTRY * PFNGLGETBUFFERPARAMETERIVARBPROC) (GLenum target, GLenum pname, GLint *params);
|
||||
typedef void (APIENTRY * PFNGLGETBUFFERPOINTERVARBPROC) (GLenum target, GLenum pname, GLvoid* *params);
|
||||
#endif
|
||||
|
||||
extern PFNGLBINDBUFFERARBPROC qglBindBufferARB;
|
||||
extern PFNGLDELETEBUFFERSARBPROC qglDeleteBuffersARB;
|
||||
|
@ -1077,7 +1075,7 @@ extern PFNGLGETBUFFERPOINTERVARBPROC qglGetBufferPointervARB;
|
|||
|
||||
extern qboolean gl_mtexable;
|
||||
extern qboolean gl_texturefilteranisotropic; // <AWE> true if anisotropic texture filtering available.
|
||||
extern int gl_twosidedstencil;
|
||||
extern int gl_twosidedstencil;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue