mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-09 01:01:07 +00:00
GLAlias_GetUniformLocation: refactor to GL_GetUniformLocation, take program as an argument
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1154 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
c31fb37b20
commit
6970b01052
3 changed files with 28 additions and 24 deletions
|
@ -363,6 +363,26 @@ static qboolean GL_CheckProgram (GLuint program)
|
|||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
GL_GetUniformLocation
|
||||
=============
|
||||
*/
|
||||
GLint GL_GetUniformLocation (GLuint *programPtr, const char *name)
|
||||
{
|
||||
GLint location;
|
||||
|
||||
if (!programPtr)
|
||||
return -1;
|
||||
|
||||
location = GL_GetUniformLocationFunc(*programPtr, name);
|
||||
if (location == -1)
|
||||
{
|
||||
Con_Warning("GL_GetUniformLocationFunc %s failed\n", name);
|
||||
*programPtr = 0;
|
||||
}
|
||||
return location;
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
|
|
|
@ -349,6 +349,7 @@ void R_DrawBrushModel_ShowTris (entity_t *e);
|
|||
void R_DrawAliasModel_ShowTris (entity_t *e);
|
||||
void R_DrawParticles_ShowTris (void);
|
||||
|
||||
GLint GL_GetUniformLocation (GLuint *programPtr, const char *name);
|
||||
GLuint GL_CreateProgram (const GLchar *vertSource, const GLchar *fragSource, int numbindings, const glsl_attrib_binding_t *bindings);
|
||||
void R_DeleteShaders (void);
|
||||
|
||||
|
|
|
@ -131,23 +131,6 @@ qboolean GLAlias_SupportsShaders (void)
|
|||
return gl_glsl_able && gl_vbo_able && gl_max_texture_units >= 3;
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
GLAlias_GetUniformLocation
|
||||
=============
|
||||
*/
|
||||
static GLint GLAlias_GetUniformLocation (const char *name)
|
||||
{
|
||||
GLint location;
|
||||
location = GL_GetUniformLocationFunc(r_alias_program, name);
|
||||
if (location == -1)
|
||||
{
|
||||
Con_Warning("GL_GetUniformLocationFunc %s failed", name);
|
||||
r_alias_program = 0;
|
||||
}
|
||||
return location;
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
GLAlias_CreateShaders
|
||||
|
@ -227,13 +210,13 @@ void GLAlias_CreateShaders (void)
|
|||
if (r_alias_program != 0)
|
||||
{
|
||||
// get uniform locations
|
||||
blendLoc = GLAlias_GetUniformLocation ("Blend");
|
||||
shadevectorLoc = GLAlias_GetUniformLocation ("ShadeVector");
|
||||
lightColorLoc = GLAlias_GetUniformLocation ("LightColor");
|
||||
texLoc = GLAlias_GetUniformLocation("Tex");
|
||||
fullbrightTexLoc = GLAlias_GetUniformLocation("FullbrightTex");
|
||||
useFullbrightTexLoc = GLAlias_GetUniformLocation("UseFullbrightTex");
|
||||
useOverbrightLoc = GLAlias_GetUniformLocation("UseOverbright");
|
||||
blendLoc = GL_GetUniformLocation (&r_alias_program, "Blend");
|
||||
shadevectorLoc = GL_GetUniformLocation (&r_alias_program, "ShadeVector");
|
||||
lightColorLoc = GL_GetUniformLocation (&r_alias_program, "LightColor");
|
||||
texLoc = GL_GetUniformLocation (&r_alias_program, "Tex");
|
||||
fullbrightTexLoc = GL_GetUniformLocation (&r_alias_program, "FullbrightTex");
|
||||
useFullbrightTexLoc = GL_GetUniformLocation (&r_alias_program, "UseFullbrightTex");
|
||||
useOverbrightLoc = GL_GetUniformLocation (&r_alias_program, "UseOverbright");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue