OpenGL2: Use an OpenGL 3.2 core context if available.
This commit is contained in:
parent
51ca4d35ea
commit
d549b642bc
20 changed files with 313 additions and 349 deletions
|
@ -146,6 +146,8 @@ static uniformInfo_t uniformsInfo[] =
|
|||
{ "u_PrimaryLightRadius", GLSL_FLOAT },
|
||||
|
||||
{ "u_CubeMapInfo", GLSL_VEC4 },
|
||||
|
||||
{ "u_AlphaTest", GLSL_INT },
|
||||
};
|
||||
|
||||
typedef enum
|
||||
|
@ -239,7 +241,10 @@ static void GLSL_GetShaderHeader( GLenum shaderType, const GLchar *extra, char *
|
|||
// HACK: abuse the GLSL preprocessor to turn GLSL 1.20 shaders into 1.30 ones
|
||||
if(glRefConfig.glslMajorVersion > 1 || (glRefConfig.glslMajorVersion == 1 && glRefConfig.glslMinorVersion >= 30))
|
||||
{
|
||||
Q_strcat(dest, size, "#version 130\n");
|
||||
if (glRefConfig.glslMajorVersion > 1 || (glRefConfig.glslMajorVersion == 1 && glRefConfig.glslMinorVersion >= 50))
|
||||
Q_strcat(dest, size, "#version 150\n");
|
||||
else
|
||||
Q_strcat(dest, size, "#version 130\n");
|
||||
|
||||
if(shaderType == GL_VERTEX_SHADER)
|
||||
{
|
||||
|
@ -252,11 +257,15 @@ static void GLSL_GetShaderHeader( GLenum shaderType, const GLchar *extra, char *
|
|||
|
||||
Q_strcat(dest, size, "out vec4 out_Color;\n");
|
||||
Q_strcat(dest, size, "#define gl_FragColor out_Color\n");
|
||||
Q_strcat(dest, size, "#define texture2D texture\n");
|
||||
Q_strcat(dest, size, "#define textureCubeLod textureLod\n");
|
||||
Q_strcat(dest, size, "#define shadow2D texture\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Q_strcat(dest, size, "#version 120\n");
|
||||
Q_strcat(dest, size, "#define shadow2D(a,b) shadow2D(a,b).r \n");
|
||||
}
|
||||
|
||||
// HACK: add some macros to avoid extra uniforms and save speed and code maintenance
|
||||
|
@ -945,7 +954,7 @@ void GLSL_InitGPUShaders(void)
|
|||
|
||||
attribs = ATTR_POSITION | ATTR_TEXCOORD;
|
||||
|
||||
if (!GLSL_InitGPUShader(&tr.textureColorShader, "texturecolor", attribs, qtrue, NULL, qfalse, fallbackShader_texturecolor_vp, fallbackShader_texturecolor_fp))
|
||||
if (!GLSL_InitGPUShader(&tr.textureColorShader, "texturecolor", attribs, qtrue, extradefines, qtrue, fallbackShader_texturecolor_vp, fallbackShader_texturecolor_fp))
|
||||
{
|
||||
ri.Error(ERR_FATAL, "Could not load texturecolor shader!");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue