qglBindAttribLocation(programobject, GLSLATTRIB_TEXCOORD5, "Attrib_TexCoord5");
qglBindAttribLocation(programobject, GLSLATTRIB_TEXCOORD6, "Attrib_TexCoord6");
qglBindAttribLocation(programobject, GLSLATTRIB_TEXCOORD7, "Attrib_TexCoord7");
- if(qglBindFragDataLocation)
+ if(vid.support.gl20shaders130)
qglBindFragDataLocation(programobject, 0, "dp_FragColor");
if (vertexstrings_count && !GL_Backend_CompileShader(programobject, GL_VERTEX_SHADER, "vertex", vertexstrings_count, vertexstrings_list))
strlcat(permutationname, modeinfo->vertexfilename, sizeof(permutationname));
- // the first pretext is which type of shader to compile as
- // (later these will all be bound together as a program object)
- if(qglBindFragDataLocation && (permutation & SHADERPERMUTATION_OFFSETMAPPING)) // we use textureGrad() which is glsl 1.30
+ // if we can do #version 130, we should (this improves quality of offset/reliefmapping thanks to textureGrad)
+ if(vid.support.gl20shaders130)
{
vertstrings_list[vertstrings_count++] = "#version 130\n";
geomstrings_list[geomstrings_count++] = "#version 130\n";
typedef struct viddef_support_s
{
qboolean gl20shaders;
+ qboolean gl20shaders130;
qboolean amd_texture_texture4;
qboolean arb_depth_texture;
qboolean arb_draw_buffers;
Sys_Error("OpenGL 1.1.0 functions not found");
vid.support.gl20shaders = GL_CheckExtension("2.0", gl20shaderfuncs, "-noshaders", false);
- // this one is purely optional, needed for GLSL 1.3 support (#version 130), so we don't even check the return value of GL_CheckExtension
- GL_CheckExtension("2.0", glsl130funcs, "-noglsl130", false);
-
CHECKGLERROR
Con_DPrint("Checking OpenGL extensions...\n");
+ // this one is purely optional, needed for GLSL 1.3 support (#version 130), so we don't even check the return value of GL_CheckExtension
+ vid.support.gl20shaders130 = GL_CheckExtension("2.0", glsl130funcs, "-noglsl130", false);
+ if(vid.support.gl20shaders130)
+ {
+ char *s = (char *) qglGetString(GL_SHADING_LANGUAGE_VERSION);
+ if(!s || atof(s) < 1.30 - 0.00001)
+ vid.support.gl20shaders130 = 0;
+ }
+ if(vid.support.gl20shaders130)
+ Con_DPrintf("Using GLSL 1.30\n");
+ else
+ Con_DPrintf("Using GLSL 1.00\n");
+
vid.support.amd_texture_texture4 = GL_CheckExtension("GL_AMD_texture_texture4", NULL, "-notexture4", false);
vid.support.arb_depth_texture = GL_CheckExtension("GL_ARB_depth_texture", NULL, "-nodepthtexture", false);
vid.support.arb_draw_buffers = GL_CheckExtension("GL_ARB_draw_buffers", drawbuffersfuncs, "-nodrawbuffers", false);