From: havoc Date: Sun, 6 Feb 2011 02:14:51 +0000 (+0000) Subject: changed use of GL_ARB_fragment_shader and friends to the core GL 2.0 X-Git-Tag: xonotic-v0.5.0~438^2~33 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=3732bafde8584fef3be2bcdeaf5a4fcd40c1353f;p=xonotic%2Fdarkplaces.git changed use of GL_ARB_fragment_shader and friends to the core GL 2.0 functionality instead, for better GL ES 2.0 compatibility git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10808 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/gl_backend.c b/gl_backend.c index ae7cc27b..494e657e 100644 --- a/gl_backend.c +++ b/gl_backend.c @@ -2409,13 +2409,13 @@ qboolean GL_Backend_CompileShader(int programobject, GLenum shadertypeenum, cons int shaderobject; int shadercompiled; char compilelog[MAX_INPUTLINE]; - shaderobject = qglCreateShaderObjectARB(shadertypeenum);CHECKGLERROR + shaderobject = qglCreateShader(shadertypeenum);CHECKGLERROR if (!shaderobject) return false; - qglShaderSourceARB(shaderobject, numstrings, strings, NULL);CHECKGLERROR - qglCompileShaderARB(shaderobject);CHECKGLERROR - qglGetObjectParameterivARB(shaderobject, GL_OBJECT_COMPILE_STATUS_ARB, &shadercompiled);CHECKGLERROR - qglGetInfoLogARB(shaderobject, sizeof(compilelog), NULL, compilelog);CHECKGLERROR + qglShaderSource(shaderobject, numstrings, strings, NULL);CHECKGLERROR + qglCompileShader(shaderobject);CHECKGLERROR + qglGetShaderiv(shaderobject, GL_COMPILE_STATUS, &shadercompiled);CHECKGLERROR + qglGetShaderInfoLog(shaderobject, sizeof(compilelog), NULL, compilelog);CHECKGLERROR if (compilelog[0] && (strstr(compilelog, "error") || strstr(compilelog, "ERROR") || strstr(compilelog, "Error") || strstr(compilelog, "WARNING") || strstr(compilelog, "warning") || strstr(compilelog, "Warning"))) { int i, j, pretextlines = 0; @@ -2427,11 +2427,11 @@ qboolean GL_Backend_CompileShader(int programobject, GLenum shadertypeenum, cons } if (!shadercompiled) { - qglDeleteObjectARB(shaderobject);CHECKGLERROR + qglDeleteShader(shaderobject);CHECKGLERROR return false; } - qglAttachObjectARB(programobject, shaderobject);CHECKGLERROR - qglDeleteObjectARB(shaderobject);CHECKGLERROR + qglAttachShader(programobject, shaderobject);CHECKGLERROR + qglDeleteShader(shaderobject);CHECKGLERROR return true; } @@ -2442,24 +2442,24 @@ unsigned int GL_Backend_CompileProgram(int vertexstrings_count, const char **ver char linklog[MAX_INPUTLINE]; CHECKGLERROR - programobject = qglCreateProgramObjectARB();CHECKGLERROR + programobject = qglCreateProgram();CHECKGLERROR if (!programobject) return 0; - if (vertexstrings_count && !GL_Backend_CompileShader(programobject, GL_VERTEX_SHADER_ARB, "vertex", vertexstrings_count, vertexstrings_list)) + if (vertexstrings_count && !GL_Backend_CompileShader(programobject, GL_VERTEX_SHADER, "vertex", vertexstrings_count, vertexstrings_list)) goto cleanup; -#ifdef GL_GEOMETRY_SHADER_ARB - if (geometrystrings_count && !GL_Backend_CompileShader(programobject, GL_GEOMETRY_SHADER_ARB, "geometry", geometrystrings_count, geometrystrings_list)) +#ifdef GL_GEOMETRY_SHADER + if (geometrystrings_count && !GL_Backend_CompileShader(programobject, GL_GEOMETRY_SHADER, "geometry", geometrystrings_count, geometrystrings_list)) goto cleanup; #endif - if (fragmentstrings_count && !GL_Backend_CompileShader(programobject, GL_FRAGMENT_SHADER_ARB, "fragment", fragmentstrings_count, fragmentstrings_list)) + if (fragmentstrings_count && !GL_Backend_CompileShader(programobject, GL_FRAGMENT_SHADER, "fragment", fragmentstrings_count, fragmentstrings_list)) goto cleanup; - qglLinkProgramARB(programobject);CHECKGLERROR - qglGetObjectParameterivARB(programobject, GL_OBJECT_LINK_STATUS_ARB, &programlinked);CHECKGLERROR - qglGetInfoLogARB(programobject, sizeof(linklog), NULL, linklog);CHECKGLERROR + qglLinkProgram(programobject);CHECKGLERROR + qglGetProgramiv(programobject, GL_LINK_STATUS, &programlinked);CHECKGLERROR + qglGetProgramInfoLog(programobject, sizeof(linklog), NULL, linklog);CHECKGLERROR if (linklog[0]) { if (strstr(linklog, "error") || strstr(linklog, "ERROR") || strstr(linklog, "Error") || strstr(linklog, "WARNING") || strstr(linklog, "warning") || strstr(linklog, "Warning")) @@ -2477,14 +2477,14 @@ unsigned int GL_Backend_CompileProgram(int vertexstrings_count, const char **ver goto cleanup; return programobject; cleanup: - qglDeleteObjectARB(programobject);CHECKGLERROR + qglDeleteProgram(programobject);CHECKGLERROR return 0; } void GL_Backend_FreeProgram(unsigned int prog) { CHECKGLERROR - qglDeleteObjectARB(prog); + qglDeleteProgram(prog); CHECKGLERROR } diff --git a/gl_rmain.c b/gl_rmain.c index 184740a4..f3d2e6c2 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -3747,122 +3747,122 @@ static void R_GLSL_CompilePermutation(r_glsl_permutation_t *p, unsigned int mode if (p->program) { CHECKGLERROR - qglUseProgramObjectARB(p->program);CHECKGLERROR + qglUseProgram(p->program);CHECKGLERROR // look up all the uniform variable names we care about, so we don't // have to look them up every time we set them - p->loc_Texture_First = qglGetUniformLocationARB(p->program, "Texture_First"); - p->loc_Texture_Second = qglGetUniformLocationARB(p->program, "Texture_Second"); - p->loc_Texture_GammaRamps = qglGetUniformLocationARB(p->program, "Texture_GammaRamps"); - p->loc_Texture_Normal = qglGetUniformLocationARB(p->program, "Texture_Normal"); - p->loc_Texture_Color = qglGetUniformLocationARB(p->program, "Texture_Color"); - p->loc_Texture_Gloss = qglGetUniformLocationARB(p->program, "Texture_Gloss"); - p->loc_Texture_Glow = qglGetUniformLocationARB(p->program, "Texture_Glow"); - p->loc_Texture_SecondaryNormal = qglGetUniformLocationARB(p->program, "Texture_SecondaryNormal"); - p->loc_Texture_SecondaryColor = qglGetUniformLocationARB(p->program, "Texture_SecondaryColor"); - p->loc_Texture_SecondaryGloss = qglGetUniformLocationARB(p->program, "Texture_SecondaryGloss"); - p->loc_Texture_SecondaryGlow = qglGetUniformLocationARB(p->program, "Texture_SecondaryGlow"); - p->loc_Texture_Pants = qglGetUniformLocationARB(p->program, "Texture_Pants"); - p->loc_Texture_Shirt = qglGetUniformLocationARB(p->program, "Texture_Shirt"); - p->loc_Texture_FogHeightTexture = qglGetUniformLocationARB(p->program, "Texture_FogHeightTexture"); - p->loc_Texture_FogMask = qglGetUniformLocationARB(p->program, "Texture_FogMask"); - p->loc_Texture_Lightmap = qglGetUniformLocationARB(p->program, "Texture_Lightmap"); - p->loc_Texture_Deluxemap = qglGetUniformLocationARB(p->program, "Texture_Deluxemap"); - p->loc_Texture_Attenuation = qglGetUniformLocationARB(p->program, "Texture_Attenuation"); - p->loc_Texture_Cube = qglGetUniformLocationARB(p->program, "Texture_Cube"); - p->loc_Texture_Refraction = qglGetUniformLocationARB(p->program, "Texture_Refraction"); - p->loc_Texture_Reflection = qglGetUniformLocationARB(p->program, "Texture_Reflection"); - p->loc_Texture_ShadowMap2D = qglGetUniformLocationARB(p->program, "Texture_ShadowMap2D"); - p->loc_Texture_CubeProjection = qglGetUniformLocationARB(p->program, "Texture_CubeProjection"); - p->loc_Texture_ScreenDepth = qglGetUniformLocationARB(p->program, "Texture_ScreenDepth"); - p->loc_Texture_ScreenNormalMap = qglGetUniformLocationARB(p->program, "Texture_ScreenNormalMap"); - p->loc_Texture_ScreenDiffuse = qglGetUniformLocationARB(p->program, "Texture_ScreenDiffuse"); - p->loc_Texture_ScreenSpecular = qglGetUniformLocationARB(p->program, "Texture_ScreenSpecular"); - p->loc_Texture_ReflectMask = qglGetUniformLocationARB(p->program, "Texture_ReflectMask"); - p->loc_Texture_ReflectCube = qglGetUniformLocationARB(p->program, "Texture_ReflectCube"); - p->loc_Alpha = qglGetUniformLocationARB(p->program, "Alpha"); - p->loc_BloomBlur_Parameters = qglGetUniformLocationARB(p->program, "BloomBlur_Parameters"); - p->loc_ClientTime = qglGetUniformLocationARB(p->program, "ClientTime"); - p->loc_Color_Ambient = qglGetUniformLocationARB(p->program, "Color_Ambient"); - p->loc_Color_Diffuse = qglGetUniformLocationARB(p->program, "Color_Diffuse"); - p->loc_Color_Specular = qglGetUniformLocationARB(p->program, "Color_Specular"); - p->loc_Color_Glow = qglGetUniformLocationARB(p->program, "Color_Glow"); - p->loc_Color_Pants = qglGetUniformLocationARB(p->program, "Color_Pants"); - p->loc_Color_Shirt = qglGetUniformLocationARB(p->program, "Color_Shirt"); - p->loc_DeferredColor_Ambient = qglGetUniformLocationARB(p->program, "DeferredColor_Ambient"); - p->loc_DeferredColor_Diffuse = qglGetUniformLocationARB(p->program, "DeferredColor_Diffuse"); - p->loc_DeferredColor_Specular = qglGetUniformLocationARB(p->program, "DeferredColor_Specular"); - p->loc_DeferredMod_Diffuse = qglGetUniformLocationARB(p->program, "DeferredMod_Diffuse"); - p->loc_DeferredMod_Specular = qglGetUniformLocationARB(p->program, "DeferredMod_Specular"); - p->loc_DistortScaleRefractReflect = qglGetUniformLocationARB(p->program, "DistortScaleRefractReflect"); - p->loc_EyePosition = qglGetUniformLocationARB(p->program, "EyePosition"); - p->loc_FogColor = qglGetUniformLocationARB(p->program, "FogColor"); - p->loc_FogHeightFade = qglGetUniformLocationARB(p->program, "FogHeightFade"); - p->loc_FogPlane = qglGetUniformLocationARB(p->program, "FogPlane"); - p->loc_FogPlaneViewDist = qglGetUniformLocationARB(p->program, "FogPlaneViewDist"); - p->loc_FogRangeRecip = qglGetUniformLocationARB(p->program, "FogRangeRecip"); - p->loc_LightColor = qglGetUniformLocationARB(p->program, "LightColor"); - p->loc_LightDir = qglGetUniformLocationARB(p->program, "LightDir"); - p->loc_LightPosition = qglGetUniformLocationARB(p->program, "LightPosition"); - p->loc_OffsetMapping_Scale = qglGetUniformLocationARB(p->program, "OffsetMapping_Scale"); - p->loc_PixelSize = qglGetUniformLocationARB(p->program, "PixelSize"); - p->loc_ReflectColor = qglGetUniformLocationARB(p->program, "ReflectColor"); - p->loc_ReflectFactor = qglGetUniformLocationARB(p->program, "ReflectFactor"); - p->loc_ReflectOffset = qglGetUniformLocationARB(p->program, "ReflectOffset"); - p->loc_RefractColor = qglGetUniformLocationARB(p->program, "RefractColor"); - p->loc_Saturation = qglGetUniformLocationARB(p->program, "Saturation"); - p->loc_ScreenCenterRefractReflect = qglGetUniformLocationARB(p->program, "ScreenCenterRefractReflect"); - p->loc_ScreenScaleRefractReflect = qglGetUniformLocationARB(p->program, "ScreenScaleRefractReflect"); - p->loc_ScreenToDepth = qglGetUniformLocationARB(p->program, "ScreenToDepth"); - p->loc_ShadowMap_Parameters = qglGetUniformLocationARB(p->program, "ShadowMap_Parameters"); - p->loc_ShadowMap_TextureScale = qglGetUniformLocationARB(p->program, "ShadowMap_TextureScale"); - p->loc_SpecularPower = qglGetUniformLocationARB(p->program, "SpecularPower"); - p->loc_UserVec1 = qglGetUniformLocationARB(p->program, "UserVec1"); - p->loc_UserVec2 = qglGetUniformLocationARB(p->program, "UserVec2"); - p->loc_UserVec3 = qglGetUniformLocationARB(p->program, "UserVec3"); - p->loc_UserVec4 = qglGetUniformLocationARB(p->program, "UserVec4"); - p->loc_ViewTintColor = qglGetUniformLocationARB(p->program, "ViewTintColor"); - p->loc_ViewToLight = qglGetUniformLocationARB(p->program, "ViewToLight"); - p->loc_ModelToLight = qglGetUniformLocationARB(p->program, "ModelToLight"); - p->loc_TexMatrix = qglGetUniformLocationARB(p->program, "TexMatrix"); - p->loc_BackgroundTexMatrix = qglGetUniformLocationARB(p->program, "BackgroundTexMatrix"); - p->loc_ModelViewMatrix = qglGetUniformLocationARB(p->program, "ModelViewMatrix"); - p->loc_ModelViewProjectionMatrix = qglGetUniformLocationARB(p->program, "ModelViewProjectionMatrix"); - p->loc_PixelToScreenTexCoord = qglGetUniformLocationARB(p->program, "PixelToScreenTexCoord"); - p->loc_ModelToReflectCube = qglGetUniformLocationARB(p->program, "ModelToReflectCube"); - p->loc_ShadowMapMatrix = qglGetUniformLocationARB(p->program, "ShadowMapMatrix"); - p->loc_BloomColorSubtract = qglGetUniformLocationARB(p->program, "BloomColorSubtract"); - p->loc_NormalmapScrollBlend = qglGetUniformLocationARB(p->program, "NormalmapScrollBlend"); + p->loc_Texture_First = qglGetUniformLocation(p->program, "Texture_First"); + p->loc_Texture_Second = qglGetUniformLocation(p->program, "Texture_Second"); + p->loc_Texture_GammaRamps = qglGetUniformLocation(p->program, "Texture_GammaRamps"); + p->loc_Texture_Normal = qglGetUniformLocation(p->program, "Texture_Normal"); + p->loc_Texture_Color = qglGetUniformLocation(p->program, "Texture_Color"); + p->loc_Texture_Gloss = qglGetUniformLocation(p->program, "Texture_Gloss"); + p->loc_Texture_Glow = qglGetUniformLocation(p->program, "Texture_Glow"); + p->loc_Texture_SecondaryNormal = qglGetUniformLocation(p->program, "Texture_SecondaryNormal"); + p->loc_Texture_SecondaryColor = qglGetUniformLocation(p->program, "Texture_SecondaryColor"); + p->loc_Texture_SecondaryGloss = qglGetUniformLocation(p->program, "Texture_SecondaryGloss"); + p->loc_Texture_SecondaryGlow = qglGetUniformLocation(p->program, "Texture_SecondaryGlow"); + p->loc_Texture_Pants = qglGetUniformLocation(p->program, "Texture_Pants"); + p->loc_Texture_Shirt = qglGetUniformLocation(p->program, "Texture_Shirt"); + p->loc_Texture_FogHeightTexture = qglGetUniformLocation(p->program, "Texture_FogHeightTexture"); + p->loc_Texture_FogMask = qglGetUniformLocation(p->program, "Texture_FogMask"); + p->loc_Texture_Lightmap = qglGetUniformLocation(p->program, "Texture_Lightmap"); + p->loc_Texture_Deluxemap = qglGetUniformLocation(p->program, "Texture_Deluxemap"); + p->loc_Texture_Attenuation = qglGetUniformLocation(p->program, "Texture_Attenuation"); + p->loc_Texture_Cube = qglGetUniformLocation(p->program, "Texture_Cube"); + p->loc_Texture_Refraction = qglGetUniformLocation(p->program, "Texture_Refraction"); + p->loc_Texture_Reflection = qglGetUniformLocation(p->program, "Texture_Reflection"); + p->loc_Texture_ShadowMap2D = qglGetUniformLocation(p->program, "Texture_ShadowMap2D"); + p->loc_Texture_CubeProjection = qglGetUniformLocation(p->program, "Texture_CubeProjection"); + p->loc_Texture_ScreenDepth = qglGetUniformLocation(p->program, "Texture_ScreenDepth"); + p->loc_Texture_ScreenNormalMap = qglGetUniformLocation(p->program, "Texture_ScreenNormalMap"); + p->loc_Texture_ScreenDiffuse = qglGetUniformLocation(p->program, "Texture_ScreenDiffuse"); + p->loc_Texture_ScreenSpecular = qglGetUniformLocation(p->program, "Texture_ScreenSpecular"); + p->loc_Texture_ReflectMask = qglGetUniformLocation(p->program, "Texture_ReflectMask"); + p->loc_Texture_ReflectCube = qglGetUniformLocation(p->program, "Texture_ReflectCube"); + p->loc_Alpha = qglGetUniformLocation(p->program, "Alpha"); + p->loc_BloomBlur_Parameters = qglGetUniformLocation(p->program, "BloomBlur_Parameters"); + p->loc_ClientTime = qglGetUniformLocation(p->program, "ClientTime"); + p->loc_Color_Ambient = qglGetUniformLocation(p->program, "Color_Ambient"); + p->loc_Color_Diffuse = qglGetUniformLocation(p->program, "Color_Diffuse"); + p->loc_Color_Specular = qglGetUniformLocation(p->program, "Color_Specular"); + p->loc_Color_Glow = qglGetUniformLocation(p->program, "Color_Glow"); + p->loc_Color_Pants = qglGetUniformLocation(p->program, "Color_Pants"); + p->loc_Color_Shirt = qglGetUniformLocation(p->program, "Color_Shirt"); + p->loc_DeferredColor_Ambient = qglGetUniformLocation(p->program, "DeferredColor_Ambient"); + p->loc_DeferredColor_Diffuse = qglGetUniformLocation(p->program, "DeferredColor_Diffuse"); + p->loc_DeferredColor_Specular = qglGetUniformLocation(p->program, "DeferredColor_Specular"); + p->loc_DeferredMod_Diffuse = qglGetUniformLocation(p->program, "DeferredMod_Diffuse"); + p->loc_DeferredMod_Specular = qglGetUniformLocation(p->program, "DeferredMod_Specular"); + p->loc_DistortScaleRefractReflect = qglGetUniformLocation(p->program, "DistortScaleRefractReflect"); + p->loc_EyePosition = qglGetUniformLocation(p->program, "EyePosition"); + p->loc_FogColor = qglGetUniformLocation(p->program, "FogColor"); + p->loc_FogHeightFade = qglGetUniformLocation(p->program, "FogHeightFade"); + p->loc_FogPlane = qglGetUniformLocation(p->program, "FogPlane"); + p->loc_FogPlaneViewDist = qglGetUniformLocation(p->program, "FogPlaneViewDist"); + p->loc_FogRangeRecip = qglGetUniformLocation(p->program, "FogRangeRecip"); + p->loc_LightColor = qglGetUniformLocation(p->program, "LightColor"); + p->loc_LightDir = qglGetUniformLocation(p->program, "LightDir"); + p->loc_LightPosition = qglGetUniformLocation(p->program, "LightPosition"); + p->loc_OffsetMapping_Scale = qglGetUniformLocation(p->program, "OffsetMapping_Scale"); + p->loc_PixelSize = qglGetUniformLocation(p->program, "PixelSize"); + p->loc_ReflectColor = qglGetUniformLocation(p->program, "ReflectColor"); + p->loc_ReflectFactor = qglGetUniformLocation(p->program, "ReflectFactor"); + p->loc_ReflectOffset = qglGetUniformLocation(p->program, "ReflectOffset"); + p->loc_RefractColor = qglGetUniformLocation(p->program, "RefractColor"); + p->loc_Saturation = qglGetUniformLocation(p->program, "Saturation"); + p->loc_ScreenCenterRefractReflect = qglGetUniformLocation(p->program, "ScreenCenterRefractReflect"); + p->loc_ScreenScaleRefractReflect = qglGetUniformLocation(p->program, "ScreenScaleRefractReflect"); + p->loc_ScreenToDepth = qglGetUniformLocation(p->program, "ScreenToDepth"); + p->loc_ShadowMap_Parameters = qglGetUniformLocation(p->program, "ShadowMap_Parameters"); + p->loc_ShadowMap_TextureScale = qglGetUniformLocation(p->program, "ShadowMap_TextureScale"); + p->loc_SpecularPower = qglGetUniformLocation(p->program, "SpecularPower"); + p->loc_UserVec1 = qglGetUniformLocation(p->program, "UserVec1"); + p->loc_UserVec2 = qglGetUniformLocation(p->program, "UserVec2"); + p->loc_UserVec3 = qglGetUniformLocation(p->program, "UserVec3"); + p->loc_UserVec4 = qglGetUniformLocation(p->program, "UserVec4"); + p->loc_ViewTintColor = qglGetUniformLocation(p->program, "ViewTintColor"); + p->loc_ViewToLight = qglGetUniformLocation(p->program, "ViewToLight"); + p->loc_ModelToLight = qglGetUniformLocation(p->program, "ModelToLight"); + p->loc_TexMatrix = qglGetUniformLocation(p->program, "TexMatrix"); + p->loc_BackgroundTexMatrix = qglGetUniformLocation(p->program, "BackgroundTexMatrix"); + p->loc_ModelViewMatrix = qglGetUniformLocation(p->program, "ModelViewMatrix"); + p->loc_ModelViewProjectionMatrix = qglGetUniformLocation(p->program, "ModelViewProjectionMatrix"); + p->loc_PixelToScreenTexCoord = qglGetUniformLocation(p->program, "PixelToScreenTexCoord"); + p->loc_ModelToReflectCube = qglGetUniformLocation(p->program, "ModelToReflectCube"); + p->loc_ShadowMapMatrix = qglGetUniformLocation(p->program, "ShadowMapMatrix"); + p->loc_BloomColorSubtract = qglGetUniformLocation(p->program, "BloomColorSubtract"); + p->loc_NormalmapScrollBlend = qglGetUniformLocation(p->program, "NormalmapScrollBlend"); // initialize the samplers to refer to the texture units we use - if (p->loc_Texture_First >= 0) qglUniform1iARB(p->loc_Texture_First , GL20TU_FIRST); - if (p->loc_Texture_Second >= 0) qglUniform1iARB(p->loc_Texture_Second , GL20TU_SECOND); - if (p->loc_Texture_GammaRamps >= 0) qglUniform1iARB(p->loc_Texture_GammaRamps , GL20TU_GAMMARAMPS); - if (p->loc_Texture_Normal >= 0) qglUniform1iARB(p->loc_Texture_Normal , GL20TU_NORMAL); - if (p->loc_Texture_Color >= 0) qglUniform1iARB(p->loc_Texture_Color , GL20TU_COLOR); - if (p->loc_Texture_Gloss >= 0) qglUniform1iARB(p->loc_Texture_Gloss , GL20TU_GLOSS); - if (p->loc_Texture_Glow >= 0) qglUniform1iARB(p->loc_Texture_Glow , GL20TU_GLOW); - if (p->loc_Texture_SecondaryNormal >= 0) qglUniform1iARB(p->loc_Texture_SecondaryNormal, GL20TU_SECONDARY_NORMAL); - if (p->loc_Texture_SecondaryColor >= 0) qglUniform1iARB(p->loc_Texture_SecondaryColor , GL20TU_SECONDARY_COLOR); - if (p->loc_Texture_SecondaryGloss >= 0) qglUniform1iARB(p->loc_Texture_SecondaryGloss , GL20TU_SECONDARY_GLOSS); - if (p->loc_Texture_SecondaryGlow >= 0) qglUniform1iARB(p->loc_Texture_SecondaryGlow , GL20TU_SECONDARY_GLOW); - if (p->loc_Texture_Pants >= 0) qglUniform1iARB(p->loc_Texture_Pants , GL20TU_PANTS); - if (p->loc_Texture_Shirt >= 0) qglUniform1iARB(p->loc_Texture_Shirt , GL20TU_SHIRT); - if (p->loc_Texture_FogHeightTexture>= 0) qglUniform1iARB(p->loc_Texture_FogHeightTexture, GL20TU_FOGHEIGHTTEXTURE); - if (p->loc_Texture_FogMask >= 0) qglUniform1iARB(p->loc_Texture_FogMask , GL20TU_FOGMASK); - if (p->loc_Texture_Lightmap >= 0) qglUniform1iARB(p->loc_Texture_Lightmap , GL20TU_LIGHTMAP); - if (p->loc_Texture_Deluxemap >= 0) qglUniform1iARB(p->loc_Texture_Deluxemap , GL20TU_DELUXEMAP); - if (p->loc_Texture_Attenuation >= 0) qglUniform1iARB(p->loc_Texture_Attenuation , GL20TU_ATTENUATION); - if (p->loc_Texture_Cube >= 0) qglUniform1iARB(p->loc_Texture_Cube , GL20TU_CUBE); - if (p->loc_Texture_Refraction >= 0) qglUniform1iARB(p->loc_Texture_Refraction , GL20TU_REFRACTION); - if (p->loc_Texture_Reflection >= 0) qglUniform1iARB(p->loc_Texture_Reflection , GL20TU_REFLECTION); - if (p->loc_Texture_ShadowMap2D >= 0) qglUniform1iARB(p->loc_Texture_ShadowMap2D , GL20TU_SHADOWMAP2D); - if (p->loc_Texture_CubeProjection >= 0) qglUniform1iARB(p->loc_Texture_CubeProjection , GL20TU_CUBEPROJECTION); - if (p->loc_Texture_ScreenDepth >= 0) qglUniform1iARB(p->loc_Texture_ScreenDepth , GL20TU_SCREENDEPTH); - if (p->loc_Texture_ScreenNormalMap >= 0) qglUniform1iARB(p->loc_Texture_ScreenNormalMap, GL20TU_SCREENNORMALMAP); - if (p->loc_Texture_ScreenDiffuse >= 0) qglUniform1iARB(p->loc_Texture_ScreenDiffuse , GL20TU_SCREENDIFFUSE); - if (p->loc_Texture_ScreenSpecular >= 0) qglUniform1iARB(p->loc_Texture_ScreenSpecular , GL20TU_SCREENSPECULAR); - if (p->loc_Texture_ReflectMask >= 0) qglUniform1iARB(p->loc_Texture_ReflectMask , GL20TU_REFLECTMASK); - if (p->loc_Texture_ReflectCube >= 0) qglUniform1iARB(p->loc_Texture_ReflectCube , GL20TU_REFLECTCUBE); + if (p->loc_Texture_First >= 0) qglUniform1i(p->loc_Texture_First , GL20TU_FIRST); + if (p->loc_Texture_Second >= 0) qglUniform1i(p->loc_Texture_Second , GL20TU_SECOND); + if (p->loc_Texture_GammaRamps >= 0) qglUniform1i(p->loc_Texture_GammaRamps , GL20TU_GAMMARAMPS); + if (p->loc_Texture_Normal >= 0) qglUniform1i(p->loc_Texture_Normal , GL20TU_NORMAL); + if (p->loc_Texture_Color >= 0) qglUniform1i(p->loc_Texture_Color , GL20TU_COLOR); + if (p->loc_Texture_Gloss >= 0) qglUniform1i(p->loc_Texture_Gloss , GL20TU_GLOSS); + if (p->loc_Texture_Glow >= 0) qglUniform1i(p->loc_Texture_Glow , GL20TU_GLOW); + if (p->loc_Texture_SecondaryNormal >= 0) qglUniform1i(p->loc_Texture_SecondaryNormal, GL20TU_SECONDARY_NORMAL); + if (p->loc_Texture_SecondaryColor >= 0) qglUniform1i(p->loc_Texture_SecondaryColor , GL20TU_SECONDARY_COLOR); + if (p->loc_Texture_SecondaryGloss >= 0) qglUniform1i(p->loc_Texture_SecondaryGloss , GL20TU_SECONDARY_GLOSS); + if (p->loc_Texture_SecondaryGlow >= 0) qglUniform1i(p->loc_Texture_SecondaryGlow , GL20TU_SECONDARY_GLOW); + if (p->loc_Texture_Pants >= 0) qglUniform1i(p->loc_Texture_Pants , GL20TU_PANTS); + if (p->loc_Texture_Shirt >= 0) qglUniform1i(p->loc_Texture_Shirt , GL20TU_SHIRT); + if (p->loc_Texture_FogHeightTexture>= 0) qglUniform1i(p->loc_Texture_FogHeightTexture, GL20TU_FOGHEIGHTTEXTURE); + if (p->loc_Texture_FogMask >= 0) qglUniform1i(p->loc_Texture_FogMask , GL20TU_FOGMASK); + if (p->loc_Texture_Lightmap >= 0) qglUniform1i(p->loc_Texture_Lightmap , GL20TU_LIGHTMAP); + if (p->loc_Texture_Deluxemap >= 0) qglUniform1i(p->loc_Texture_Deluxemap , GL20TU_DELUXEMAP); + if (p->loc_Texture_Attenuation >= 0) qglUniform1i(p->loc_Texture_Attenuation , GL20TU_ATTENUATION); + if (p->loc_Texture_Cube >= 0) qglUniform1i(p->loc_Texture_Cube , GL20TU_CUBE); + if (p->loc_Texture_Refraction >= 0) qglUniform1i(p->loc_Texture_Refraction , GL20TU_REFRACTION); + if (p->loc_Texture_Reflection >= 0) qglUniform1i(p->loc_Texture_Reflection , GL20TU_REFLECTION); + if (p->loc_Texture_ShadowMap2D >= 0) qglUniform1i(p->loc_Texture_ShadowMap2D , GL20TU_SHADOWMAP2D); + if (p->loc_Texture_CubeProjection >= 0) qglUniform1i(p->loc_Texture_CubeProjection , GL20TU_CUBEPROJECTION); + if (p->loc_Texture_ScreenDepth >= 0) qglUniform1i(p->loc_Texture_ScreenDepth , GL20TU_SCREENDEPTH); + if (p->loc_Texture_ScreenNormalMap >= 0) qglUniform1i(p->loc_Texture_ScreenNormalMap, GL20TU_SCREENNORMALMAP); + if (p->loc_Texture_ScreenDiffuse >= 0) qglUniform1i(p->loc_Texture_ScreenDiffuse , GL20TU_SCREENDIFFUSE); + if (p->loc_Texture_ScreenSpecular >= 0) qglUniform1i(p->loc_Texture_ScreenSpecular , GL20TU_SCREENSPECULAR); + if (p->loc_Texture_ReflectMask >= 0) qglUniform1i(p->loc_Texture_ReflectMask , GL20TU_REFLECTMASK); + if (p->loc_Texture_ReflectCube >= 0) qglUniform1i(p->loc_Texture_ReflectCube , GL20TU_REFLECTCUBE); CHECKGLERROR Con_DPrintf("^5GLSL shader %s compiled.\n", permutationname); } @@ -3909,17 +3909,17 @@ void R_SetupShader_SetPermutationGLSL(unsigned int mode, unsigned int permutatio { //Con_Printf("Could not find a working OpenGL 2.0 shader for permutation %s %s\n", shadermodeinfo[mode].vertexfilename, shadermodeinfo[mode].pretext); r_glsl_permutation = R_GLSL_FindPermutation(mode, permutation); - qglUseProgramObjectARB(0);CHECKGLERROR + qglUseProgram(0);CHECKGLERROR return; // no bit left to clear, entire mode is broken } } } CHECKGLERROR - qglUseProgramObjectARB(r_glsl_permutation->program);CHECKGLERROR + qglUseProgram(r_glsl_permutation->program);CHECKGLERROR } - if (r_glsl_permutation->loc_ModelViewProjectionMatrix >= 0) qglUniformMatrix4fvARB(r_glsl_permutation->loc_ModelViewProjectionMatrix, 1, false, gl_modelviewprojection16f); - if (r_glsl_permutation->loc_ModelViewMatrix >= 0) qglUniformMatrix4fvARB(r_glsl_permutation->loc_ModelViewMatrix, 1, false, gl_modelview16f); - if (r_glsl_permutation->loc_ClientTime >= 0) qglUniform1fARB(r_glsl_permutation->loc_ClientTime, cl.time); + if (r_glsl_permutation->loc_ModelViewProjectionMatrix >= 0) qglUniformMatrix4fv(r_glsl_permutation->loc_ModelViewProjectionMatrix, 1, false, gl_modelviewprojection16f); + if (r_glsl_permutation->loc_ModelViewMatrix >= 0) qglUniformMatrix4fv(r_glsl_permutation->loc_ModelViewMatrix, 1, false, gl_modelview16f); + if (r_glsl_permutation->loc_ClientTime >= 0) qglUniform1f(r_glsl_permutation->loc_ClientTime, cl.time); } #ifdef SUPPORTCG @@ -5854,93 +5854,93 @@ void R_SetupShader_Surface(const vec3_t lightcolorbase, qboolean modellighting, R_Mesh_PrepareVertices_Mesh(rsurface.batchnumvertices, rsurface.batchvertexmesh, rsurface.batchvertexmeshbuffer); } R_SetupShader_SetPermutationGLSL(mode, permutation); - if (r_glsl_permutation->loc_ModelToReflectCube >= 0) {Matrix4x4_ToArrayFloatGL(&rsurface.matrix, m16f);qglUniformMatrix4fvARB(r_glsl_permutation->loc_ModelToReflectCube, 1, false, m16f);} + if (r_glsl_permutation->loc_ModelToReflectCube >= 0) {Matrix4x4_ToArrayFloatGL(&rsurface.matrix, m16f);qglUniformMatrix4fv(r_glsl_permutation->loc_ModelToReflectCube, 1, false, m16f);} if (mode == SHADERMODE_LIGHTSOURCE) { - if (r_glsl_permutation->loc_ModelToLight >= 0) {Matrix4x4_ToArrayFloatGL(&rsurface.entitytolight, m16f);qglUniformMatrix4fvARB(r_glsl_permutation->loc_ModelToLight, 1, false, m16f);} - if (r_glsl_permutation->loc_LightPosition >= 0) qglUniform3fARB(r_glsl_permutation->loc_LightPosition, rsurface.entitylightorigin[0], rsurface.entitylightorigin[1], rsurface.entitylightorigin[2]); - if (r_glsl_permutation->loc_LightColor >= 0) qglUniform3fARB(r_glsl_permutation->loc_LightColor, lightcolorbase[0], lightcolorbase[1], lightcolorbase[2]); - if (r_glsl_permutation->loc_Color_Ambient >= 0) qglUniform3fARB(r_glsl_permutation->loc_Color_Ambient, colormod[0] * ambientscale, colormod[1] * ambientscale, colormod[2] * ambientscale); - if (r_glsl_permutation->loc_Color_Diffuse >= 0) qglUniform3fARB(r_glsl_permutation->loc_Color_Diffuse, colormod[0] * diffusescale, colormod[1] * diffusescale, colormod[2] * diffusescale); - if (r_glsl_permutation->loc_Color_Specular >= 0) qglUniform3fARB(r_glsl_permutation->loc_Color_Specular, r_refdef.view.colorscale * specularscale, r_refdef.view.colorscale * specularscale, r_refdef.view.colorscale * specularscale); + if (r_glsl_permutation->loc_ModelToLight >= 0) {Matrix4x4_ToArrayFloatGL(&rsurface.entitytolight, m16f);qglUniformMatrix4fv(r_glsl_permutation->loc_ModelToLight, 1, false, m16f);} + if (r_glsl_permutation->loc_LightPosition >= 0) qglUniform3f(r_glsl_permutation->loc_LightPosition, rsurface.entitylightorigin[0], rsurface.entitylightorigin[1], rsurface.entitylightorigin[2]); + if (r_glsl_permutation->loc_LightColor >= 0) qglUniform3f(r_glsl_permutation->loc_LightColor, lightcolorbase[0], lightcolorbase[1], lightcolorbase[2]); + if (r_glsl_permutation->loc_Color_Ambient >= 0) qglUniform3f(r_glsl_permutation->loc_Color_Ambient, colormod[0] * ambientscale, colormod[1] * ambientscale, colormod[2] * ambientscale); + if (r_glsl_permutation->loc_Color_Diffuse >= 0) qglUniform3f(r_glsl_permutation->loc_Color_Diffuse, colormod[0] * diffusescale, colormod[1] * diffusescale, colormod[2] * diffusescale); + if (r_glsl_permutation->loc_Color_Specular >= 0) qglUniform3f(r_glsl_permutation->loc_Color_Specular, r_refdef.view.colorscale * specularscale, r_refdef.view.colorscale * specularscale, r_refdef.view.colorscale * specularscale); // additive passes are only darkened by fog, not tinted if (r_glsl_permutation->loc_FogColor >= 0) - qglUniform3fARB(r_glsl_permutation->loc_FogColor, 0, 0, 0); - if (r_glsl_permutation->loc_SpecularPower >= 0) qglUniform1fARB(r_glsl_permutation->loc_SpecularPower, rsurface.texture->specularpower * (r_shadow_glossexact.integer ? 0.25f : 1.0f)); + qglUniform3f(r_glsl_permutation->loc_FogColor, 0, 0, 0); + if (r_glsl_permutation->loc_SpecularPower >= 0) qglUniform1f(r_glsl_permutation->loc_SpecularPower, rsurface.texture->specularpower * (r_shadow_glossexact.integer ? 0.25f : 1.0f)); } else { if (mode == SHADERMODE_FLATCOLOR) { - if (r_glsl_permutation->loc_Color_Ambient >= 0) qglUniform3fARB(r_glsl_permutation->loc_Color_Ambient, colormod[0], colormod[1], colormod[2]); + if (r_glsl_permutation->loc_Color_Ambient >= 0) qglUniform3f(r_glsl_permutation->loc_Color_Ambient, colormod[0], colormod[1], colormod[2]); } else if (mode == SHADERMODE_LIGHTDIRECTION) { - if (r_glsl_permutation->loc_Color_Ambient >= 0) qglUniform3fARB(r_glsl_permutation->loc_Color_Ambient, (r_refdef.scene.ambient + rsurface.modellight_ambient[0] * r_refdef.lightmapintensity * r_refdef.scene.rtlightstylevalue[0]) * colormod[0], (r_refdef.scene.ambient + rsurface.modellight_ambient[1] * r_refdef.lightmapintensity * r_refdef.scene.rtlightstylevalue[0]) * colormod[1], (r_refdef.scene.ambient + rsurface.modellight_ambient[2] * r_refdef.lightmapintensity * r_refdef.scene.rtlightstylevalue[0]) * colormod[2]); - if (r_glsl_permutation->loc_Color_Diffuse >= 0) qglUniform3fARB(r_glsl_permutation->loc_Color_Diffuse, r_refdef.lightmapintensity * colormod[0], r_refdef.lightmapintensity * colormod[1], r_refdef.lightmapintensity * colormod[2]); - if (r_glsl_permutation->loc_Color_Specular >= 0) qglUniform3fARB(r_glsl_permutation->loc_Color_Specular, r_refdef.lightmapintensity * r_refdef.view.colorscale * specularscale, r_refdef.lightmapintensity * r_refdef.view.colorscale * specularscale, r_refdef.lightmapintensity * r_refdef.view.colorscale * specularscale); - if (r_glsl_permutation->loc_DeferredMod_Diffuse >= 0) qglUniform3fARB(r_glsl_permutation->loc_DeferredMod_Diffuse, colormod[0] * r_shadow_deferred_8bitrange.value, colormod[1] * r_shadow_deferred_8bitrange.value, colormod[2] * r_shadow_deferred_8bitrange.value); - if (r_glsl_permutation->loc_DeferredMod_Specular >= 0) qglUniform3fARB(r_glsl_permutation->loc_DeferredMod_Specular, specularscale * r_shadow_deferred_8bitrange.value, specularscale * r_shadow_deferred_8bitrange.value, specularscale * r_shadow_deferred_8bitrange.value); - if (r_glsl_permutation->loc_LightColor >= 0) qglUniform3fARB(r_glsl_permutation->loc_LightColor, rsurface.modellight_diffuse[0] * r_refdef.scene.rtlightstylevalue[0], rsurface.modellight_diffuse[1] * r_refdef.scene.rtlightstylevalue[0], rsurface.modellight_diffuse[2] * r_refdef.scene.rtlightstylevalue[0]); - if (r_glsl_permutation->loc_LightDir >= 0) qglUniform3fARB(r_glsl_permutation->loc_LightDir, rsurface.modellight_lightdir[0], rsurface.modellight_lightdir[1], rsurface.modellight_lightdir[2]); + if (r_glsl_permutation->loc_Color_Ambient >= 0) qglUniform3f(r_glsl_permutation->loc_Color_Ambient, (r_refdef.scene.ambient + rsurface.modellight_ambient[0] * r_refdef.lightmapintensity * r_refdef.scene.rtlightstylevalue[0]) * colormod[0], (r_refdef.scene.ambient + rsurface.modellight_ambient[1] * r_refdef.lightmapintensity * r_refdef.scene.rtlightstylevalue[0]) * colormod[1], (r_refdef.scene.ambient + rsurface.modellight_ambient[2] * r_refdef.lightmapintensity * r_refdef.scene.rtlightstylevalue[0]) * colormod[2]); + if (r_glsl_permutation->loc_Color_Diffuse >= 0) qglUniform3f(r_glsl_permutation->loc_Color_Diffuse, r_refdef.lightmapintensity * colormod[0], r_refdef.lightmapintensity * colormod[1], r_refdef.lightmapintensity * colormod[2]); + if (r_glsl_permutation->loc_Color_Specular >= 0) qglUniform3f(r_glsl_permutation->loc_Color_Specular, r_refdef.lightmapintensity * r_refdef.view.colorscale * specularscale, r_refdef.lightmapintensity * r_refdef.view.colorscale * specularscale, r_refdef.lightmapintensity * r_refdef.view.colorscale * specularscale); + if (r_glsl_permutation->loc_DeferredMod_Diffuse >= 0) qglUniform3f(r_glsl_permutation->loc_DeferredMod_Diffuse, colormod[0] * r_shadow_deferred_8bitrange.value, colormod[1] * r_shadow_deferred_8bitrange.value, colormod[2] * r_shadow_deferred_8bitrange.value); + if (r_glsl_permutation->loc_DeferredMod_Specular >= 0) qglUniform3f(r_glsl_permutation->loc_DeferredMod_Specular, specularscale * r_shadow_deferred_8bitrange.value, specularscale * r_shadow_deferred_8bitrange.value, specularscale * r_shadow_deferred_8bitrange.value); + if (r_glsl_permutation->loc_LightColor >= 0) qglUniform3f(r_glsl_permutation->loc_LightColor, rsurface.modellight_diffuse[0] * r_refdef.scene.rtlightstylevalue[0], rsurface.modellight_diffuse[1] * r_refdef.scene.rtlightstylevalue[0], rsurface.modellight_diffuse[2] * r_refdef.scene.rtlightstylevalue[0]); + if (r_glsl_permutation->loc_LightDir >= 0) qglUniform3f(r_glsl_permutation->loc_LightDir, rsurface.modellight_lightdir[0], rsurface.modellight_lightdir[1], rsurface.modellight_lightdir[2]); } else { - if (r_glsl_permutation->loc_Color_Ambient >= 0) qglUniform3fARB(r_glsl_permutation->loc_Color_Ambient, r_refdef.scene.ambient * colormod[0], r_refdef.scene.ambient * colormod[1], r_refdef.scene.ambient * colormod[2]); - if (r_glsl_permutation->loc_Color_Diffuse >= 0) qglUniform3fARB(r_glsl_permutation->loc_Color_Diffuse, rsurface.texture->lightmapcolor[0], rsurface.texture->lightmapcolor[1], rsurface.texture->lightmapcolor[2]); - if (r_glsl_permutation->loc_Color_Specular >= 0) qglUniform3fARB(r_glsl_permutation->loc_Color_Specular, r_refdef.lightmapintensity * r_refdef.view.colorscale * specularscale, r_refdef.lightmapintensity * r_refdef.view.colorscale * specularscale, r_refdef.lightmapintensity * r_refdef.view.colorscale * specularscale); - if (r_glsl_permutation->loc_DeferredMod_Diffuse >= 0) qglUniform3fARB(r_glsl_permutation->loc_DeferredMod_Diffuse, colormod[0] * diffusescale * r_shadow_deferred_8bitrange.value, colormod[1] * diffusescale * r_shadow_deferred_8bitrange.value, colormod[2] * diffusescale * r_shadow_deferred_8bitrange.value); - if (r_glsl_permutation->loc_DeferredMod_Specular >= 0) qglUniform3fARB(r_glsl_permutation->loc_DeferredMod_Specular, specularscale * r_shadow_deferred_8bitrange.value, specularscale * r_shadow_deferred_8bitrange.value, specularscale * r_shadow_deferred_8bitrange.value); + if (r_glsl_permutation->loc_Color_Ambient >= 0) qglUniform3f(r_glsl_permutation->loc_Color_Ambient, r_refdef.scene.ambient * colormod[0], r_refdef.scene.ambient * colormod[1], r_refdef.scene.ambient * colormod[2]); + if (r_glsl_permutation->loc_Color_Diffuse >= 0) qglUniform3f(r_glsl_permutation->loc_Color_Diffuse, rsurface.texture->lightmapcolor[0], rsurface.texture->lightmapcolor[1], rsurface.texture->lightmapcolor[2]); + if (r_glsl_permutation->loc_Color_Specular >= 0) qglUniform3f(r_glsl_permutation->loc_Color_Specular, r_refdef.lightmapintensity * r_refdef.view.colorscale * specularscale, r_refdef.lightmapintensity * r_refdef.view.colorscale * specularscale, r_refdef.lightmapintensity * r_refdef.view.colorscale * specularscale); + if (r_glsl_permutation->loc_DeferredMod_Diffuse >= 0) qglUniform3f(r_glsl_permutation->loc_DeferredMod_Diffuse, colormod[0] * diffusescale * r_shadow_deferred_8bitrange.value, colormod[1] * diffusescale * r_shadow_deferred_8bitrange.value, colormod[2] * diffusescale * r_shadow_deferred_8bitrange.value); + if (r_glsl_permutation->loc_DeferredMod_Specular >= 0) qglUniform3f(r_glsl_permutation->loc_DeferredMod_Specular, specularscale * r_shadow_deferred_8bitrange.value, specularscale * r_shadow_deferred_8bitrange.value, specularscale * r_shadow_deferred_8bitrange.value); } // additive passes are only darkened by fog, not tinted if (r_glsl_permutation->loc_FogColor >= 0) { if (rsurface.texture->currentmaterialflags & MATERIALFLAG_ADD) - qglUniform3fARB(r_glsl_permutation->loc_FogColor, 0, 0, 0); + qglUniform3f(r_glsl_permutation->loc_FogColor, 0, 0, 0); else - qglUniform3fARB(r_glsl_permutation->loc_FogColor, r_refdef.fogcolor[0], r_refdef.fogcolor[1], r_refdef.fogcolor[2]); + qglUniform3f(r_glsl_permutation->loc_FogColor, r_refdef.fogcolor[0], r_refdef.fogcolor[1], r_refdef.fogcolor[2]); } - if (r_glsl_permutation->loc_DistortScaleRefractReflect >= 0) qglUniform4fARB(r_glsl_permutation->loc_DistortScaleRefractReflect, r_water_refractdistort.value * rsurface.texture->refractfactor, r_water_refractdistort.value * rsurface.texture->refractfactor, r_water_reflectdistort.value * rsurface.texture->reflectfactor, r_water_reflectdistort.value * rsurface.texture->reflectfactor); - if (r_glsl_permutation->loc_ScreenScaleRefractReflect >= 0) qglUniform4fARB(r_glsl_permutation->loc_ScreenScaleRefractReflect, r_waterstate.screenscale[0], r_waterstate.screenscale[1], r_waterstate.screenscale[0], r_waterstate.screenscale[1]); - if (r_glsl_permutation->loc_ScreenCenterRefractReflect >= 0) qglUniform4fARB(r_glsl_permutation->loc_ScreenCenterRefractReflect, r_waterstate.screencenter[0], r_waterstate.screencenter[1], r_waterstate.screencenter[0], r_waterstate.screencenter[1]); - if (r_glsl_permutation->loc_RefractColor >= 0) qglUniform4fARB(r_glsl_permutation->loc_RefractColor, rsurface.texture->refractcolor4f[0], rsurface.texture->refractcolor4f[1], rsurface.texture->refractcolor4f[2], rsurface.texture->refractcolor4f[3] * rsurface.texture->lightmapcolor[3]); - if (r_glsl_permutation->loc_ReflectColor >= 0) qglUniform4fARB(r_glsl_permutation->loc_ReflectColor, rsurface.texture->reflectcolor4f[0], rsurface.texture->reflectcolor4f[1], rsurface.texture->reflectcolor4f[2], rsurface.texture->reflectcolor4f[3] * rsurface.texture->lightmapcolor[3]); - if (r_glsl_permutation->loc_ReflectFactor >= 0) qglUniform1fARB(r_glsl_permutation->loc_ReflectFactor, rsurface.texture->reflectmax - rsurface.texture->reflectmin); - if (r_glsl_permutation->loc_ReflectOffset >= 0) qglUniform1fARB(r_glsl_permutation->loc_ReflectOffset, rsurface.texture->reflectmin); - if (r_glsl_permutation->loc_SpecularPower >= 0) qglUniform1fARB(r_glsl_permutation->loc_SpecularPower, rsurface.texture->specularpower * (r_shadow_glossexact.integer ? 0.25f : 1.0f)); - if (r_glsl_permutation->loc_NormalmapScrollBlend >= 0) qglUniform2fARB(r_glsl_permutation->loc_NormalmapScrollBlend, rsurface.texture->r_water_waterscroll[0], rsurface.texture->r_water_waterscroll[1]); - } - if (r_glsl_permutation->loc_TexMatrix >= 0) {Matrix4x4_ToArrayFloatGL(&rsurface.texture->currenttexmatrix, m16f);qglUniformMatrix4fvARB(r_glsl_permutation->loc_TexMatrix, 1, false, m16f);} - if (r_glsl_permutation->loc_BackgroundTexMatrix >= 0) {Matrix4x4_ToArrayFloatGL(&rsurface.texture->currentbackgroundtexmatrix, m16f);qglUniformMatrix4fvARB(r_glsl_permutation->loc_BackgroundTexMatrix, 1, false, m16f);} - if (r_glsl_permutation->loc_ShadowMapMatrix >= 0) {Matrix4x4_ToArrayFloatGL(&r_shadow_shadowmapmatrix, m16f);qglUniformMatrix4fvARB(r_glsl_permutation->loc_ShadowMapMatrix, 1, false, m16f);} - if (r_glsl_permutation->loc_ShadowMap_TextureScale >= 0) qglUniform2fARB(r_glsl_permutation->loc_ShadowMap_TextureScale, r_shadow_shadowmap_texturescale[0], r_shadow_shadowmap_texturescale[1]); - if (r_glsl_permutation->loc_ShadowMap_Parameters >= 0) qglUniform4fARB(r_glsl_permutation->loc_ShadowMap_Parameters, r_shadow_shadowmap_parameters[0], r_shadow_shadowmap_parameters[1], r_shadow_shadowmap_parameters[2], r_shadow_shadowmap_parameters[3]); - - if (r_glsl_permutation->loc_Color_Glow >= 0) qglUniform3fARB(r_glsl_permutation->loc_Color_Glow, rsurface.glowmod[0], rsurface.glowmod[1], rsurface.glowmod[2]); - if (r_glsl_permutation->loc_Alpha >= 0) qglUniform1fARB(r_glsl_permutation->loc_Alpha, rsurface.texture->lightmapcolor[3] * ((rsurface.texture->basematerialflags & MATERIALFLAG_WATERSHADER && r_waterstate.enabled && !r_refdef.view.isoverlay) ? rsurface.texture->r_water_wateralpha : 1)); - if (r_glsl_permutation->loc_EyePosition >= 0) qglUniform3fARB(r_glsl_permutation->loc_EyePosition, rsurface.localvieworigin[0], rsurface.localvieworigin[1], rsurface.localvieworigin[2]); + if (r_glsl_permutation->loc_DistortScaleRefractReflect >= 0) qglUniform4f(r_glsl_permutation->loc_DistortScaleRefractReflect, r_water_refractdistort.value * rsurface.texture->refractfactor, r_water_refractdistort.value * rsurface.texture->refractfactor, r_water_reflectdistort.value * rsurface.texture->reflectfactor, r_water_reflectdistort.value * rsurface.texture->reflectfactor); + if (r_glsl_permutation->loc_ScreenScaleRefractReflect >= 0) qglUniform4f(r_glsl_permutation->loc_ScreenScaleRefractReflect, r_waterstate.screenscale[0], r_waterstate.screenscale[1], r_waterstate.screenscale[0], r_waterstate.screenscale[1]); + if (r_glsl_permutation->loc_ScreenCenterRefractReflect >= 0) qglUniform4f(r_glsl_permutation->loc_ScreenCenterRefractReflect, r_waterstate.screencenter[0], r_waterstate.screencenter[1], r_waterstate.screencenter[0], r_waterstate.screencenter[1]); + if (r_glsl_permutation->loc_RefractColor >= 0) qglUniform4f(r_glsl_permutation->loc_RefractColor, rsurface.texture->refractcolor4f[0], rsurface.texture->refractcolor4f[1], rsurface.texture->refractcolor4f[2], rsurface.texture->refractcolor4f[3] * rsurface.texture->lightmapcolor[3]); + if (r_glsl_permutation->loc_ReflectColor >= 0) qglUniform4f(r_glsl_permutation->loc_ReflectColor, rsurface.texture->reflectcolor4f[0], rsurface.texture->reflectcolor4f[1], rsurface.texture->reflectcolor4f[2], rsurface.texture->reflectcolor4f[3] * rsurface.texture->lightmapcolor[3]); + if (r_glsl_permutation->loc_ReflectFactor >= 0) qglUniform1f(r_glsl_permutation->loc_ReflectFactor, rsurface.texture->reflectmax - rsurface.texture->reflectmin); + if (r_glsl_permutation->loc_ReflectOffset >= 0) qglUniform1f(r_glsl_permutation->loc_ReflectOffset, rsurface.texture->reflectmin); + if (r_glsl_permutation->loc_SpecularPower >= 0) qglUniform1f(r_glsl_permutation->loc_SpecularPower, rsurface.texture->specularpower * (r_shadow_glossexact.integer ? 0.25f : 1.0f)); + if (r_glsl_permutation->loc_NormalmapScrollBlend >= 0) qglUniform2f(r_glsl_permutation->loc_NormalmapScrollBlend, rsurface.texture->r_water_waterscroll[0], rsurface.texture->r_water_waterscroll[1]); + } + if (r_glsl_permutation->loc_TexMatrix >= 0) {Matrix4x4_ToArrayFloatGL(&rsurface.texture->currenttexmatrix, m16f);qglUniformMatrix4fv(r_glsl_permutation->loc_TexMatrix, 1, false, m16f);} + if (r_glsl_permutation->loc_BackgroundTexMatrix >= 0) {Matrix4x4_ToArrayFloatGL(&rsurface.texture->currentbackgroundtexmatrix, m16f);qglUniformMatrix4fv(r_glsl_permutation->loc_BackgroundTexMatrix, 1, false, m16f);} + if (r_glsl_permutation->loc_ShadowMapMatrix >= 0) {Matrix4x4_ToArrayFloatGL(&r_shadow_shadowmapmatrix, m16f);qglUniformMatrix4fv(r_glsl_permutation->loc_ShadowMapMatrix, 1, false, m16f);} + if (r_glsl_permutation->loc_ShadowMap_TextureScale >= 0) qglUniform2f(r_glsl_permutation->loc_ShadowMap_TextureScale, r_shadow_shadowmap_texturescale[0], r_shadow_shadowmap_texturescale[1]); + if (r_glsl_permutation->loc_ShadowMap_Parameters >= 0) qglUniform4f(r_glsl_permutation->loc_ShadowMap_Parameters, r_shadow_shadowmap_parameters[0], r_shadow_shadowmap_parameters[1], r_shadow_shadowmap_parameters[2], r_shadow_shadowmap_parameters[3]); + + if (r_glsl_permutation->loc_Color_Glow >= 0) qglUniform3f(r_glsl_permutation->loc_Color_Glow, rsurface.glowmod[0], rsurface.glowmod[1], rsurface.glowmod[2]); + if (r_glsl_permutation->loc_Alpha >= 0) qglUniform1f(r_glsl_permutation->loc_Alpha, rsurface.texture->lightmapcolor[3] * ((rsurface.texture->basematerialflags & MATERIALFLAG_WATERSHADER && r_waterstate.enabled && !r_refdef.view.isoverlay) ? rsurface.texture->r_water_wateralpha : 1)); + if (r_glsl_permutation->loc_EyePosition >= 0) qglUniform3f(r_glsl_permutation->loc_EyePosition, rsurface.localvieworigin[0], rsurface.localvieworigin[1], rsurface.localvieworigin[2]); if (r_glsl_permutation->loc_Color_Pants >= 0) { if (rsurface.texture->pantstexture) - qglUniform3fARB(r_glsl_permutation->loc_Color_Pants, rsurface.colormap_pantscolor[0], rsurface.colormap_pantscolor[1], rsurface.colormap_pantscolor[2]); + qglUniform3f(r_glsl_permutation->loc_Color_Pants, rsurface.colormap_pantscolor[0], rsurface.colormap_pantscolor[1], rsurface.colormap_pantscolor[2]); else - qglUniform3fARB(r_glsl_permutation->loc_Color_Pants, 0, 0, 0); + qglUniform3f(r_glsl_permutation->loc_Color_Pants, 0, 0, 0); } if (r_glsl_permutation->loc_Color_Shirt >= 0) { if (rsurface.texture->shirttexture) - qglUniform3fARB(r_glsl_permutation->loc_Color_Shirt, rsurface.colormap_shirtcolor[0], rsurface.colormap_shirtcolor[1], rsurface.colormap_shirtcolor[2]); + qglUniform3f(r_glsl_permutation->loc_Color_Shirt, rsurface.colormap_shirtcolor[0], rsurface.colormap_shirtcolor[1], rsurface.colormap_shirtcolor[2]); else - qglUniform3fARB(r_glsl_permutation->loc_Color_Shirt, 0, 0, 0); + qglUniform3f(r_glsl_permutation->loc_Color_Shirt, 0, 0, 0); } - if (r_glsl_permutation->loc_FogPlane >= 0) qglUniform4fARB(r_glsl_permutation->loc_FogPlane, rsurface.fogplane[0], rsurface.fogplane[1], rsurface.fogplane[2], rsurface.fogplane[3]); - if (r_glsl_permutation->loc_FogPlaneViewDist >= 0) qglUniform1fARB(r_glsl_permutation->loc_FogPlaneViewDist, rsurface.fogplaneviewdist); - if (r_glsl_permutation->loc_FogRangeRecip >= 0) qglUniform1fARB(r_glsl_permutation->loc_FogRangeRecip, rsurface.fograngerecip); - if (r_glsl_permutation->loc_FogHeightFade >= 0) qglUniform1fARB(r_glsl_permutation->loc_FogHeightFade, rsurface.fogheightfade); - if (r_glsl_permutation->loc_OffsetMapping_Scale >= 0) qglUniform1fARB(r_glsl_permutation->loc_OffsetMapping_Scale, r_glsl_offsetmapping_scale.value*rsurface.texture->offsetscale); - if (r_glsl_permutation->loc_ScreenToDepth >= 0) qglUniform2fARB(r_glsl_permutation->loc_ScreenToDepth, r_refdef.view.viewport.screentodepth[0], r_refdef.view.viewport.screentodepth[1]); - if (r_glsl_permutation->loc_PixelToScreenTexCoord >= 0) qglUniform2fARB(r_glsl_permutation->loc_PixelToScreenTexCoord, 1.0f/vid.width, 1.0f/vid.height); + if (r_glsl_permutation->loc_FogPlane >= 0) qglUniform4f(r_glsl_permutation->loc_FogPlane, rsurface.fogplane[0], rsurface.fogplane[1], rsurface.fogplane[2], rsurface.fogplane[3]); + if (r_glsl_permutation->loc_FogPlaneViewDist >= 0) qglUniform1f(r_glsl_permutation->loc_FogPlaneViewDist, rsurface.fogplaneviewdist); + if (r_glsl_permutation->loc_FogRangeRecip >= 0) qglUniform1f(r_glsl_permutation->loc_FogRangeRecip, rsurface.fograngerecip); + if (r_glsl_permutation->loc_FogHeightFade >= 0) qglUniform1f(r_glsl_permutation->loc_FogHeightFade, rsurface.fogheightfade); + if (r_glsl_permutation->loc_OffsetMapping_Scale >= 0) qglUniform1f(r_glsl_permutation->loc_OffsetMapping_Scale, r_glsl_offsetmapping_scale.value*rsurface.texture->offsetscale); + if (r_glsl_permutation->loc_ScreenToDepth >= 0) qglUniform2f(r_glsl_permutation->loc_ScreenToDepth, r_refdef.view.viewport.screentodepth[0], r_refdef.view.viewport.screentodepth[1]); + if (r_glsl_permutation->loc_PixelToScreenTexCoord >= 0) qglUniform2f(r_glsl_permutation->loc_PixelToScreenTexCoord, 1.0f/vid.width, 1.0f/vid.height); // if (r_glsl_permutation->loc_Texture_First >= 0) R_Mesh_TexBind(GL20TU_FIRST , r_texture_white ); // if (r_glsl_permutation->loc_Texture_Second >= 0) R_Mesh_TexBind(GL20TU_SECOND , r_texture_white ); @@ -6368,16 +6368,16 @@ void R_SetupShader_DeferredLight(const rtlight_t *rtlight) break; case RENDERPATH_GL20: R_SetupShader_SetPermutationGLSL(mode, permutation); - if (r_glsl_permutation->loc_LightPosition >= 0) qglUniform3fARB( r_glsl_permutation->loc_LightPosition , viewlightorigin[0], viewlightorigin[1], viewlightorigin[2]); - if (r_glsl_permutation->loc_ViewToLight >= 0) qglUniformMatrix4fvARB(r_glsl_permutation->loc_ViewToLight , 1, false, viewtolight16f); - if (r_glsl_permutation->loc_DeferredColor_Ambient >= 0) qglUniform3fARB( r_glsl_permutation->loc_DeferredColor_Ambient , lightcolorbase[0] * ambientscale * range, lightcolorbase[1] * ambientscale * range, lightcolorbase[2] * ambientscale * range); - if (r_glsl_permutation->loc_DeferredColor_Diffuse >= 0) qglUniform3fARB( r_glsl_permutation->loc_DeferredColor_Diffuse , lightcolorbase[0] * diffusescale * range, lightcolorbase[1] * diffusescale * range, lightcolorbase[2] * diffusescale * range); - if (r_glsl_permutation->loc_DeferredColor_Specular >= 0) qglUniform3fARB( r_glsl_permutation->loc_DeferredColor_Specular , lightcolorbase[0] * specularscale * range, lightcolorbase[1] * specularscale * range, lightcolorbase[2] * specularscale * range); - if (r_glsl_permutation->loc_ShadowMap_TextureScale >= 0) qglUniform2fARB( r_glsl_permutation->loc_ShadowMap_TextureScale , r_shadow_shadowmap_texturescale[0], r_shadow_shadowmap_texturescale[1]); - if (r_glsl_permutation->loc_ShadowMap_Parameters >= 0) qglUniform4fARB( r_glsl_permutation->loc_ShadowMap_Parameters , r_shadow_shadowmap_parameters[0], r_shadow_shadowmap_parameters[1], r_shadow_shadowmap_parameters[2], r_shadow_shadowmap_parameters[3]); - if (r_glsl_permutation->loc_SpecularPower >= 0) qglUniform1fARB( r_glsl_permutation->loc_SpecularPower , (r_shadow_gloss.integer == 2 ? r_shadow_gloss2exponent.value : r_shadow_glossexponent.value) * (r_shadow_glossexact.integer ? 0.25f : 1.0f)); - if (r_glsl_permutation->loc_ScreenToDepth >= 0) qglUniform2fARB( r_glsl_permutation->loc_ScreenToDepth , r_refdef.view.viewport.screentodepth[0], r_refdef.view.viewport.screentodepth[1]); - if (r_glsl_permutation->loc_PixelToScreenTexCoord >= 0) qglUniform2fARB(r_glsl_permutation->loc_PixelToScreenTexCoord, 1.0f/vid.width, 1.0f/vid.height); + if (r_glsl_permutation->loc_LightPosition >= 0) qglUniform3f( r_glsl_permutation->loc_LightPosition , viewlightorigin[0], viewlightorigin[1], viewlightorigin[2]); + if (r_glsl_permutation->loc_ViewToLight >= 0) qglUniformMatrix4fv(r_glsl_permutation->loc_ViewToLight , 1, false, viewtolight16f); + if (r_glsl_permutation->loc_DeferredColor_Ambient >= 0) qglUniform3f( r_glsl_permutation->loc_DeferredColor_Ambient , lightcolorbase[0] * ambientscale * range, lightcolorbase[1] * ambientscale * range, lightcolorbase[2] * ambientscale * range); + if (r_glsl_permutation->loc_DeferredColor_Diffuse >= 0) qglUniform3f( r_glsl_permutation->loc_DeferredColor_Diffuse , lightcolorbase[0] * diffusescale * range, lightcolorbase[1] * diffusescale * range, lightcolorbase[2] * diffusescale * range); + if (r_glsl_permutation->loc_DeferredColor_Specular >= 0) qglUniform3f( r_glsl_permutation->loc_DeferredColor_Specular , lightcolorbase[0] * specularscale * range, lightcolorbase[1] * specularscale * range, lightcolorbase[2] * specularscale * range); + if (r_glsl_permutation->loc_ShadowMap_TextureScale >= 0) qglUniform2f( r_glsl_permutation->loc_ShadowMap_TextureScale , r_shadow_shadowmap_texturescale[0], r_shadow_shadowmap_texturescale[1]); + if (r_glsl_permutation->loc_ShadowMap_Parameters >= 0) qglUniform4f( r_glsl_permutation->loc_ShadowMap_Parameters , r_shadow_shadowmap_parameters[0], r_shadow_shadowmap_parameters[1], r_shadow_shadowmap_parameters[2], r_shadow_shadowmap_parameters[3]); + if (r_glsl_permutation->loc_SpecularPower >= 0) qglUniform1f( r_glsl_permutation->loc_SpecularPower , (r_shadow_gloss.integer == 2 ? r_shadow_gloss2exponent.value : r_shadow_glossexponent.value) * (r_shadow_glossexact.integer ? 0.25f : 1.0f)); + if (r_glsl_permutation->loc_ScreenToDepth >= 0) qglUniform2f( r_glsl_permutation->loc_ScreenToDepth , r_refdef.view.viewport.screentodepth[0], r_refdef.view.viewport.screentodepth[1]); + if (r_glsl_permutation->loc_PixelToScreenTexCoord >= 0) qglUniform2f(r_glsl_permutation->loc_PixelToScreenTexCoord, 1.0f/vid.width, 1.0f/vid.height); if (r_glsl_permutation->loc_Texture_Attenuation >= 0) R_Mesh_TexBind(GL20TU_ATTENUATION , r_shadow_attenuationgradienttexture ); if (r_glsl_permutation->loc_Texture_ScreenDepth >= 0) R_Mesh_TexBind(GL20TU_SCREENDEPTH , r_shadow_prepassgeometrydepthtexture ); @@ -8574,8 +8574,8 @@ void R_EntityMatrix(const matrix4x4_t *matrix) Con_DPrintf("FIXME D3D11 shader %s:%i\n", __FILE__, __LINE__); break; case RENDERPATH_GL20: - if (r_glsl_permutation && r_glsl_permutation->loc_ModelViewProjectionMatrix >= 0) qglUniformMatrix4fvARB(r_glsl_permutation->loc_ModelViewProjectionMatrix, 1, false, gl_modelviewprojection16f); - if (r_glsl_permutation && r_glsl_permutation->loc_ModelViewMatrix >= 0) qglUniformMatrix4fvARB(r_glsl_permutation->loc_ModelViewMatrix, 1, false, gl_modelview16f); + if (r_glsl_permutation && r_glsl_permutation->loc_ModelViewProjectionMatrix >= 0) qglUniformMatrix4fv(r_glsl_permutation->loc_ModelViewProjectionMatrix, 1, false, gl_modelviewprojection16f); + if (r_glsl_permutation && r_glsl_permutation->loc_ModelViewMatrix >= 0) qglUniformMatrix4fv(r_glsl_permutation->loc_ModelViewMatrix, 1, false, gl_modelview16f); qglLoadMatrixf(gl_modelview16f);CHECKGLERROR break; case RENDERPATH_CGGL: @@ -9519,15 +9519,15 @@ static void R_BlendView(void) if (r_glsl_permutation->loc_Texture_First >= 0) R_Mesh_TexBind(GL20TU_FIRST , r_bloomstate.texture_screen); if (r_glsl_permutation->loc_Texture_Second >= 0) R_Mesh_TexBind(GL20TU_SECOND , r_bloomstate.texture_bloom ); if (r_glsl_permutation->loc_Texture_GammaRamps >= 0) R_Mesh_TexBind(GL20TU_GAMMARAMPS, r_texture_gammaramps ); - if (r_glsl_permutation->loc_ViewTintColor >= 0) qglUniform4fARB(r_glsl_permutation->loc_ViewTintColor , r_refdef.viewblend[0], r_refdef.viewblend[1], r_refdef.viewblend[2], r_refdef.viewblend[3]); - if (r_glsl_permutation->loc_PixelSize >= 0) qglUniform2fARB(r_glsl_permutation->loc_PixelSize , 1.0/r_bloomstate.screentexturewidth, 1.0/r_bloomstate.screentextureheight); - if (r_glsl_permutation->loc_UserVec1 >= 0) qglUniform4fARB(r_glsl_permutation->loc_UserVec1 , uservecs[0][0], uservecs[0][1], uservecs[0][2], uservecs[0][3]); - if (r_glsl_permutation->loc_UserVec2 >= 0) qglUniform4fARB(r_glsl_permutation->loc_UserVec2 , uservecs[1][0], uservecs[1][1], uservecs[1][2], uservecs[1][3]); - if (r_glsl_permutation->loc_UserVec3 >= 0) qglUniform4fARB(r_glsl_permutation->loc_UserVec3 , uservecs[2][0], uservecs[2][1], uservecs[2][2], uservecs[2][3]); - if (r_glsl_permutation->loc_UserVec4 >= 0) qglUniform4fARB(r_glsl_permutation->loc_UserVec4 , uservecs[3][0], uservecs[3][1], uservecs[3][2], uservecs[3][3]); - if (r_glsl_permutation->loc_Saturation >= 0) qglUniform1fARB(r_glsl_permutation->loc_Saturation , r_glsl_saturation.value); - if (r_glsl_permutation->loc_PixelToScreenTexCoord >= 0) qglUniform2fARB(r_glsl_permutation->loc_PixelToScreenTexCoord, 1.0f/vid.width, 1.0f/vid.height); - if (r_glsl_permutation->loc_BloomColorSubtract >= 0) qglUniform4fARB(r_glsl_permutation->loc_BloomColorSubtract , r_bloom_colorsubtract.value, r_bloom_colorsubtract.value, r_bloom_colorsubtract.value, 0.0f); + if (r_glsl_permutation->loc_ViewTintColor >= 0) qglUniform4f(r_glsl_permutation->loc_ViewTintColor , r_refdef.viewblend[0], r_refdef.viewblend[1], r_refdef.viewblend[2], r_refdef.viewblend[3]); + if (r_glsl_permutation->loc_PixelSize >= 0) qglUniform2f(r_glsl_permutation->loc_PixelSize , 1.0/r_bloomstate.screentexturewidth, 1.0/r_bloomstate.screentextureheight); + if (r_glsl_permutation->loc_UserVec1 >= 0) qglUniform4f(r_glsl_permutation->loc_UserVec1 , uservecs[0][0], uservecs[0][1], uservecs[0][2], uservecs[0][3]); + if (r_glsl_permutation->loc_UserVec2 >= 0) qglUniform4f(r_glsl_permutation->loc_UserVec2 , uservecs[1][0], uservecs[1][1], uservecs[1][2], uservecs[1][3]); + if (r_glsl_permutation->loc_UserVec3 >= 0) qglUniform4f(r_glsl_permutation->loc_UserVec3 , uservecs[2][0], uservecs[2][1], uservecs[2][2], uservecs[2][3]); + if (r_glsl_permutation->loc_UserVec4 >= 0) qglUniform4f(r_glsl_permutation->loc_UserVec4 , uservecs[3][0], uservecs[3][1], uservecs[3][2], uservecs[3][3]); + if (r_glsl_permutation->loc_Saturation >= 0) qglUniform1f(r_glsl_permutation->loc_Saturation , r_glsl_saturation.value); + if (r_glsl_permutation->loc_PixelToScreenTexCoord >= 0) qglUniform2f(r_glsl_permutation->loc_PixelToScreenTexCoord, 1.0f/vid.width, 1.0f/vid.height); + if (r_glsl_permutation->loc_BloomColorSubtract >= 0) qglUniform4f(r_glsl_permutation->loc_BloomColorSubtract , r_bloom_colorsubtract.value, r_bloom_colorsubtract.value, r_bloom_colorsubtract.value, 0.0f); break; case RENDERPATH_CGGL: #ifdef SUPPORTCG diff --git a/glquake.h b/glquake.h index bb9220f4..258a5691 100644 --- a/glquake.h +++ b/glquake.h @@ -717,180 +717,181 @@ extern void (GLAPIENTRY *qglPolygonMode)(GLenum face, GLenum mode); extern void (GLAPIENTRY *qglLineWidth)(GLfloat width); extern void (GLAPIENTRY *qglPointSize)(GLfloat size); -// GL_ARB_shader_objects -#ifndef GL_PROGRAM_OBJECT_ARB +// GL 2.0 shader objects +#ifndef GL_PROGRAM_OBJECT // 1-byte character string -typedef char GLcharARB; -// 4-byte integer handle to a shader object or program object -typedef unsigned int GLhandleARB; -#endif -extern void (GLAPIENTRY *qglDeleteObjectARB)(GLhandleARB obj); -extern GLhandleARB (GLAPIENTRY *qglGetHandleARB)(GLenum pname); -extern void (GLAPIENTRY *qglDetachObjectARB)(GLhandleARB containerObj, GLhandleARB attachedObj); -extern GLhandleARB (GLAPIENTRY *qglCreateShaderObjectARB)(GLenum shaderType); -extern void (GLAPIENTRY *qglShaderSourceARB)(GLhandleARB shaderObj, GLsizei count, const GLcharARB **string, const GLint *length); -extern void (GLAPIENTRY *qglCompileShaderARB)(GLhandleARB shaderObj); -extern GLhandleARB (GLAPIENTRY *qglCreateProgramObjectARB)(void); -extern void (GLAPIENTRY *qglAttachObjectARB)(GLhandleARB containerObj, GLhandleARB obj); -extern void (GLAPIENTRY *qglLinkProgramARB)(GLhandleARB programObj); -extern void (GLAPIENTRY *qglUseProgramObjectARB)(GLhandleARB programObj); -extern void (GLAPIENTRY *qglValidateProgramARB)(GLhandleARB programObj); -extern void (GLAPIENTRY *qglUniform1fARB)(GLint location, GLfloat v0); -extern void (GLAPIENTRY *qglUniform2fARB)(GLint location, GLfloat v0, GLfloat v1); -extern void (GLAPIENTRY *qglUniform3fARB)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -extern void (GLAPIENTRY *qglUniform4fARB)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -extern void (GLAPIENTRY *qglUniform1iARB)(GLint location, GLint v0); -extern void (GLAPIENTRY *qglUniform2iARB)(GLint location, GLint v0, GLint v1); -extern void (GLAPIENTRY *qglUniform3iARB)(GLint location, GLint v0, GLint v1, GLint v2); -extern void (GLAPIENTRY *qglUniform4iARB)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -extern void (GLAPIENTRY *qglUniform1fvARB)(GLint location, GLsizei count, const GLfloat *value); -extern void (GLAPIENTRY *qglUniform2fvARB)(GLint location, GLsizei count, const GLfloat *value); -extern void (GLAPIENTRY *qglUniform3fvARB)(GLint location, GLsizei count, const GLfloat *value); -extern void (GLAPIENTRY *qglUniform4fvARB)(GLint location, GLsizei count, const GLfloat *value); -extern void (GLAPIENTRY *qglUniform1ivARB)(GLint location, GLsizei count, const GLint *value); -extern void (GLAPIENTRY *qglUniform2ivARB)(GLint location, GLsizei count, const GLint *value); -extern void (GLAPIENTRY *qglUniform3ivARB)(GLint location, GLsizei count, const GLint *value); -extern void (GLAPIENTRY *qglUniform4ivARB)(GLint location, GLsizei count, const GLint *value); -extern void (GLAPIENTRY *qglUniformMatrix2fvARB)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -extern void (GLAPIENTRY *qglUniformMatrix3fvARB)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -extern void (GLAPIENTRY *qglUniformMatrix4fvARB)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -extern void (GLAPIENTRY *qglGetObjectParameterfvARB)(GLhandleARB obj, GLenum pname, GLfloat *params); -extern void (GLAPIENTRY *qglGetObjectParameterivARB)(GLhandleARB obj, GLenum pname, GLint *params); -extern void (GLAPIENTRY *qglGetInfoLogARB)(GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog); -extern void (GLAPIENTRY *qglGetAttachedObjectsARB)(GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj); -extern GLint (GLAPIENTRY *qglGetUniformLocationARB)(GLhandleARB programObj, const GLcharARB *name); -extern void (GLAPIENTRY *qglGetActiveUniformARB)(GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); -extern void (GLAPIENTRY *qglGetUniformfvARB)(GLhandleARB programObj, GLint location, GLfloat *params); -extern void (GLAPIENTRY *qglGetUniformivARB)(GLhandleARB programObj, GLint location, GLint *params); -extern void (GLAPIENTRY *qglGetShaderSourceARB)(GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source); +typedef char GLchar; +#endif +extern void (GLAPIENTRY *qglDeleteShader)(GLuint obj); +extern void (GLAPIENTRY *qglDeleteProgram)(GLuint obj); +//extern GLuint (GLAPIENTRY *qglGetHandle)(GLenum pname); +extern void (GLAPIENTRY *qglDetachShader)(GLuint containerObj, GLuint attachedObj); +extern GLuint (GLAPIENTRY *qglCreateShader)(GLenum shaderType); +extern void (GLAPIENTRY *qglShaderSource)(GLuint shaderObj, GLsizei count, const GLchar **string, const GLint *length); +extern void (GLAPIENTRY *qglCompileShader)(GLuint shaderObj); +extern GLuint (GLAPIENTRY *qglCreateProgram)(void); +extern void (GLAPIENTRY *qglAttachShader)(GLuint containerObj, GLuint obj); +extern void (GLAPIENTRY *qglLinkProgram)(GLuint programObj); +extern void (GLAPIENTRY *qglUseProgram)(GLuint programObj); +extern void (GLAPIENTRY *qglValidateProgram)(GLuint programObj); +extern void (GLAPIENTRY *qglUniform1f)(GLint location, GLfloat v0); +extern void (GLAPIENTRY *qglUniform2f)(GLint location, GLfloat v0, GLfloat v1); +extern void (GLAPIENTRY *qglUniform3f)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +extern void (GLAPIENTRY *qglUniform4f)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +extern void (GLAPIENTRY *qglUniform1i)(GLint location, GLint v0); +extern void (GLAPIENTRY *qglUniform2i)(GLint location, GLint v0, GLint v1); +extern void (GLAPIENTRY *qglUniform3i)(GLint location, GLint v0, GLint v1, GLint v2); +extern void (GLAPIENTRY *qglUniform4i)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +extern void (GLAPIENTRY *qglUniform1fv)(GLint location, GLsizei count, const GLfloat *value); +extern void (GLAPIENTRY *qglUniform2fv)(GLint location, GLsizei count, const GLfloat *value); +extern void (GLAPIENTRY *qglUniform3fv)(GLint location, GLsizei count, const GLfloat *value); +extern void (GLAPIENTRY *qglUniform4fv)(GLint location, GLsizei count, const GLfloat *value); +extern void (GLAPIENTRY *qglUniform1iv)(GLint location, GLsizei count, const GLint *value); +extern void (GLAPIENTRY *qglUniform2iv)(GLint location, GLsizei count, const GLint *value); +extern void (GLAPIENTRY *qglUniform3iv)(GLint location, GLsizei count, const GLint *value); +extern void (GLAPIENTRY *qglUniform4iv)(GLint location, GLsizei count, const GLint *value); +extern void (GLAPIENTRY *qglUniformMatrix2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +extern void (GLAPIENTRY *qglUniformMatrix3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +extern void (GLAPIENTRY *qglUniformMatrix4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +extern void (GLAPIENTRY *qglGetShaderfv)(GLuint obj, GLenum pname, GLfloat *params); +extern void (GLAPIENTRY *qglGetShaderiv)(GLuint obj, GLenum pname, GLint *params); +extern void (GLAPIENTRY *qglGetProgramfv)(GLuint obj, GLenum pname, GLfloat *params); +extern void (GLAPIENTRY *qglGetProgramiv)(GLuint obj, GLenum pname, GLint *params); +extern void (GLAPIENTRY *qglGetShaderInfoLog)(GLuint obj, GLsizei maxLength, GLsizei *length, GLchar *infoLog); +extern void (GLAPIENTRY *qglGetProgramInfoLog)(GLuint obj, GLsizei maxLength, GLsizei *length, GLchar *infoLog); +extern void (GLAPIENTRY *qglGetAttachedShaders)(GLuint containerObj, GLsizei maxCount, GLsizei *count, GLuint *obj); +extern GLint (GLAPIENTRY *qglGetUniformLocation)(GLuint programObj, const GLchar *name); +extern void (GLAPIENTRY *qglGetActiveUniform)(GLuint programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +extern void (GLAPIENTRY *qglGetUniformfv)(GLuint programObj, GLint location, GLfloat *params); +extern void (GLAPIENTRY *qglGetUniformiv)(GLuint programObj, GLint location, GLint *params); +extern void (GLAPIENTRY *qglGetShaderSource)(GLuint obj, GLsizei maxLength, GLsizei *length, GLchar *source); extern void (GLAPIENTRY *qglPolygonStipple)(const GLubyte *mask); -#ifndef GL_PROGRAM_OBJECT_ARB -#define GL_PROGRAM_OBJECT_ARB 0x8B40 -#define GL_OBJECT_TYPE_ARB 0x8B4E -#define GL_OBJECT_SUBTYPE_ARB 0x8B4F -#define GL_OBJECT_DELETE_STATUS_ARB 0x8B80 -#define GL_OBJECT_COMPILE_STATUS_ARB 0x8B81 -#define GL_OBJECT_LINK_STATUS_ARB 0x8B82 -#define GL_OBJECT_VALIDATE_STATUS_ARB 0x8B83 -#define GL_OBJECT_INFO_LOG_LENGTH_ARB 0x8B84 -#define GL_OBJECT_ATTACHED_OBJECTS_ARB 0x8B85 -#define GL_OBJECT_ACTIVE_UNIFORMS_ARB 0x8B86 -#define GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB 0x8B87 -#define GL_OBJECT_SHADER_SOURCE_LENGTH_ARB 0x8B88 -#define GL_SHADER_OBJECT_ARB 0x8B48 +#ifndef GL_PROGRAM_OBJECT +#define GL_PROGRAM_OBJECT 0x8B40 +#define GL_DELETE_STATUS 0x8B80 +#define GL_COMPILE_STATUS 0x8B81 +#define GL_LINK_STATUS 0x8B82 +#define GL_VALIDATE_STATUS 0x8B83 +#define GL_INFO_LOG_LENGTH 0x8B84 +#define GL_ATTACHED_SHADERS 0x8B85 +#define GL_ACTIVE_UNIFORMS 0x8B86 +#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 +#define GL_SHADER_SOURCE_LENGTH 0x8B88 +#define GL_SHADER_OBJECT 0x8B48 +#define GL_SHADER_TYPE 0x8B4F +#define GL_FLOAT 0x1406 +#define GL_FLOAT_VEC2 0x8B50 +#define GL_FLOAT_VEC3 0x8B51 +#define GL_FLOAT_VEC4 0x8B52 +#define GL_INT 0x1404 +#define GL_INT_VEC2 0x8B53 +#define GL_INT_VEC3 0x8B54 +#define GL_INT_VEC4 0x8B55 +#define GL_BOOL 0x8B56 +#define GL_BOOL_VEC2 0x8B57 +#define GL_BOOL_VEC3 0x8B58 +#define GL_BOOL_VEC4 0x8B59 +#define GL_FLOAT_MAT2 0x8B5A +#define GL_FLOAT_MAT3 0x8B5B +#define GL_FLOAT_MAT4 0x8B5C +#define GL_SAMPLER_1D 0x8B5D +#define GL_SAMPLER_2D 0x8B5E +#define GL_SAMPLER_3D 0x8B5F +#define GL_SAMPLER_CUBE 0x8B60 +#define GL_SAMPLER_1D_SHADOW 0x8B61 +#define GL_SAMPLER_2D_SHADOW 0x8B62 +#define GL_SAMPLER_2D_RECT 0x8B63 +#define GL_SAMPLER_2D_RECT_SHADOW 0x8B64 +#endif + +// GL 2.0 vertex shader +extern void (GLAPIENTRY *qglVertexAttrib1f)(GLuint index, GLfloat v0); +extern void (GLAPIENTRY *qglVertexAttrib1s)(GLuint index, GLshort v0); +extern void (GLAPIENTRY *qglVertexAttrib1d)(GLuint index, GLdouble v0); +extern void (GLAPIENTRY *qglVertexAttrib2f)(GLuint index, GLfloat v0, GLfloat v1); +extern void (GLAPIENTRY *qglVertexAttrib2s)(GLuint index, GLshort v0, GLshort v1); +extern void (GLAPIENTRY *qglVertexAttrib2d)(GLuint index, GLdouble v0, GLdouble v1); +extern void (GLAPIENTRY *qglVertexAttrib3f)(GLuint index, GLfloat v0, GLfloat v1, GLfloat v2); +extern void (GLAPIENTRY *qglVertexAttrib3s)(GLuint index, GLshort v0, GLshort v1, GLshort v2); +extern void (GLAPIENTRY *qglVertexAttrib3d)(GLuint index, GLdouble v0, GLdouble v1, GLdouble v2); +extern void (GLAPIENTRY *qglVertexAttrib4f)(GLuint index, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +extern void (GLAPIENTRY *qglVertexAttrib4s)(GLuint index, GLshort v0, GLshort v1, GLshort v2, GLshort v3); +extern void (GLAPIENTRY *qglVertexAttrib4d)(GLuint index, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3); +extern void (GLAPIENTRY *qglVertexAttrib4Nub)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +extern void (GLAPIENTRY *qglVertexAttrib1fv)(GLuint index, const GLfloat *v); +extern void (GLAPIENTRY *qglVertexAttrib1sv)(GLuint index, const GLshort *v); +extern void (GLAPIENTRY *qglVertexAttrib1dv)(GLuint index, const GLdouble *v); +extern void (GLAPIENTRY *qglVertexAttrib2fv)(GLuint index, const GLfloat *v); +extern void (GLAPIENTRY *qglVertexAttrib2sv)(GLuint index, const GLshort *v); +extern void (GLAPIENTRY *qglVertexAttrib2dv)(GLuint index, const GLdouble *v); +extern void (GLAPIENTRY *qglVertexAttrib3fv)(GLuint index, const GLfloat *v); +extern void (GLAPIENTRY *qglVertexAttrib3sv)(GLuint index, const GLshort *v); +extern void (GLAPIENTRY *qglVertexAttrib3dv)(GLuint index, const GLdouble *v); +extern void (GLAPIENTRY *qglVertexAttrib4fv)(GLuint index, const GLfloat *v); +extern void (GLAPIENTRY *qglVertexAttrib4sv)(GLuint index, const GLshort *v); +extern void (GLAPIENTRY *qglVertexAttrib4dv)(GLuint index, const GLdouble *v); +extern void (GLAPIENTRY *qglVertexAttrib4iv)(GLuint index, const GLint *v); +extern void (GLAPIENTRY *qglVertexAttrib4bv)(GLuint index, const GLbyte *v); +extern void (GLAPIENTRY *qglVertexAttrib4ubv)(GLuint index, const GLubyte *v); +extern void (GLAPIENTRY *qglVertexAttrib4usv)(GLuint index, const GLushort *v); +extern void (GLAPIENTRY *qglVertexAttrib4uiv)(GLuint index, const GLuint *v); +extern void (GLAPIENTRY *qglVertexAttrib4Nbv)(GLuint index, const GLbyte *v); +extern void (GLAPIENTRY *qglVertexAttrib4Nsv)(GLuint index, const GLshort *v); +extern void (GLAPIENTRY *qglVertexAttrib4Niv)(GLuint index, const GLint *v); +extern void (GLAPIENTRY *qglVertexAttrib4Nubv)(GLuint index, const GLubyte *v); +extern void (GLAPIENTRY *qglVertexAttrib4Nusv)(GLuint index, const GLushort *v); +extern void (GLAPIENTRY *qglVertexAttrib4Nuiv)(GLuint index, const GLuint *v); +extern void (GLAPIENTRY *qglVertexAttribPointer)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); +extern void (GLAPIENTRY *qglEnableVertexAttribArray)(GLuint index); +extern void (GLAPIENTRY *qglDisableVertexAttribArray)(GLuint index); +extern void (GLAPIENTRY *qglBindAttribLocation)(GLuint programObj, GLuint index, const GLchar *name); +extern void (GLAPIENTRY *qglGetActiveAttrib)(GLuint programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +extern GLint (GLAPIENTRY *qglGetAttribLocation)(GLuint programObj, const GLchar *name); +extern void (GLAPIENTRY *qglGetVertexAttribdv)(GLuint index, GLenum pname, GLdouble *params); +extern void (GLAPIENTRY *qglGetVertexAttribfv)(GLuint index, GLenum pname, GLfloat *params); +extern void (GLAPIENTRY *qglGetVertexAttribiv)(GLuint index, GLenum pname, GLint *params); +extern void (GLAPIENTRY *qglGetVertexAttribPointerv)(GLuint index, GLenum pname, GLvoid **pointer); +#ifndef GL_VERTEX_SHADER +#define GL_VERTEX_SHADER 0x8B31 +#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A +#define GL_MAX_VARYING_FLOATS 0x8B4B +#define GL_MAX_VERTEX_ATTRIBS 0x8869 +#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C +#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D +#define GL_MAX_TEXTURE_COORDS 0x8871 +#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 +#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643 +#define GL_ACTIVE_ATTRIBUTES 0x8B89 +#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 +#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 +#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A +#define GL_CURRENT_VERTEX_ATTRIB 0x8626 +#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 #define GL_FLOAT 0x1406 -#define GL_FLOAT_VEC2_ARB 0x8B50 -#define GL_FLOAT_VEC3_ARB 0x8B51 -#define GL_FLOAT_VEC4_ARB 0x8B52 -#define GL_INT 0x1404 -#define GL_INT_VEC2_ARB 0x8B53 -#define GL_INT_VEC3_ARB 0x8B54 -#define GL_INT_VEC4_ARB 0x8B55 -#define GL_BOOL_ARB 0x8B56 -#define GL_BOOL_VEC2_ARB 0x8B57 -#define GL_BOOL_VEC3_ARB 0x8B58 -#define GL_BOOL_VEC4_ARB 0x8B59 -#define GL_FLOAT_MAT2_ARB 0x8B5A -#define GL_FLOAT_MAT3_ARB 0x8B5B -#define GL_FLOAT_MAT4_ARB 0x8B5C -#define GL_SAMPLER_1D_ARB 0x8B5D -#define GL_SAMPLER_2D_ARB 0x8B5E -#define GL_SAMPLER_3D_ARB 0x8B5F -#define GL_SAMPLER_CUBE_ARB 0x8B60 -#define GL_SAMPLER_1D_SHADOW_ARB 0x8B61 -#define GL_SAMPLER_2D_SHADOW_ARB 0x8B62 -#define GL_SAMPLER_2D_RECT_ARB 0x8B63 -#define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64 -#endif - -// GL_ARB_vertex_shader -//extern void (GLAPIENTRY *qglVertexAttrib1fARB)(GLuint index, GLfloat v0); -//extern void (GLAPIENTRY *qglVertexAttrib1sARB)(GLuint index, GLshort v0); -//extern void (GLAPIENTRY *qglVertexAttrib1dARB)(GLuint index, GLdouble v0); -//extern void (GLAPIENTRY *qglVertexAttrib2fARB)(GLuint index, GLfloat v0, GLfloat v1); -//extern void (GLAPIENTRY *qglVertexAttrib2sARB)(GLuint index, GLshort v0, GLshort v1); -//extern void (GLAPIENTRY *qglVertexAttrib2dARB)(GLuint index, GLdouble v0, GLdouble v1); -//extern void (GLAPIENTRY *qglVertexAttrib3fARB)(GLuint index, GLfloat v0, GLfloat v1, GLfloat v2); -//extern void (GLAPIENTRY *qglVertexAttrib3sARB)(GLuint index, GLshort v0, GLshort v1, GLshort v2); -//extern void (GLAPIENTRY *qglVertexAttrib3dARB)(GLuint index, GLdouble v0, GLdouble v1, GLdouble v2); -//extern void (GLAPIENTRY *qglVertexAttrib4fARB)(GLuint index, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -//extern void (GLAPIENTRY *qglVertexAttrib4sARB)(GLuint index, GLshort v0, GLshort v1, GLshort v2, GLshort v3); -//extern void (GLAPIENTRY *qglVertexAttrib4dARB)(GLuint index, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3); -//extern void (GLAPIENTRY *qglVertexAttrib4NubARB)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); -//extern void (GLAPIENTRY *qglVertexAttrib1fvARB)(GLuint index, const GLfloat *v); -//extern void (GLAPIENTRY *qglVertexAttrib1svARB)(GLuint index, const GLshort *v); -//extern void (GLAPIENTRY *qglVertexAttrib1dvARB)(GLuint index, const GLdouble *v); -//extern void (GLAPIENTRY *qglVertexAttrib2fvARB)(GLuint index, const GLfloat *v); -//extern void (GLAPIENTRY *qglVertexAttrib2svARB)(GLuint index, const GLshort *v); -//extern void (GLAPIENTRY *qglVertexAttrib2dvARB)(GLuint index, const GLdouble *v); -//extern void (GLAPIENTRY *qglVertexAttrib3fvARB)(GLuint index, const GLfloat *v); -//extern void (GLAPIENTRY *qglVertexAttrib3svARB)(GLuint index, const GLshort *v); -//extern void (GLAPIENTRY *qglVertexAttrib3dvARB)(GLuint index, const GLdouble *v); -//extern void (GLAPIENTRY *qglVertexAttrib4fvARB)(GLuint index, const GLfloat *v); -//extern void (GLAPIENTRY *qglVertexAttrib4svARB)(GLuint index, const GLshort *v); -//extern void (GLAPIENTRY *qglVertexAttrib4dvARB)(GLuint index, const GLdouble *v); -//extern void (GLAPIENTRY *qglVertexAttrib4ivARB)(GLuint index, const GLint *v); -//extern void (GLAPIENTRY *qglVertexAttrib4bvARB)(GLuint index, const GLbyte *v); -//extern void (GLAPIENTRY *qglVertexAttrib4ubvARB)(GLuint index, const GLubyte *v); -//extern void (GLAPIENTRY *qglVertexAttrib4usvARB)(GLuint index, const GLushort *v); -//extern void (GLAPIENTRY *qglVertexAttrib4uivARB)(GLuint index, const GLuint *v); -//extern void (GLAPIENTRY *qglVertexAttrib4NbvARB)(GLuint index, const GLbyte *v); -//extern void (GLAPIENTRY *qglVertexAttrib4NsvARB)(GLuint index, const GLshort *v); -//extern void (GLAPIENTRY *qglVertexAttrib4NivARB)(GLuint index, const GLint *v); -//extern void (GLAPIENTRY *qglVertexAttrib4NubvARB)(GLuint index, const GLubyte *v); -//extern void (GLAPIENTRY *qglVertexAttrib4NusvARB)(GLuint index, const GLushort *v); -//extern void (GLAPIENTRY *qglVertexAttrib4NuivARB)(GLuint index, const GLuint *v); -extern void (GLAPIENTRY *qglVertexAttribPointerARB)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); -extern void (GLAPIENTRY *qglEnableVertexAttribArrayARB)(GLuint index); -extern void (GLAPIENTRY *qglDisableVertexAttribArrayARB)(GLuint index); -extern void (GLAPIENTRY *qglBindAttribLocationARB)(GLhandleARB programObj, GLuint index, const GLcharARB *name); -extern void (GLAPIENTRY *qglGetActiveAttribARB)(GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); -extern GLint (GLAPIENTRY *qglGetAttribLocationARB)(GLhandleARB programObj, const GLcharARB *name); -//extern void (GLAPIENTRY *qglGetVertexAttribdvARB)(GLuint index, GLenum pname, GLdouble *params); -//extern void (GLAPIENTRY *qglGetVertexAttribfvARB)(GLuint index, GLenum pname, GLfloat *params); -//extern void (GLAPIENTRY *qglGetVertexAttribivARB)(GLuint index, GLenum pname, GLint *params); -//extern void (GLAPIENTRY *qglGetVertexAttribPointervARB)(GLuint index, GLenum pname, GLvoid **pointer); -#ifndef GL_VERTEX_SHADER_ARB -#define GL_VERTEX_SHADER_ARB 0x8B31 -#define GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB 0x8B4A -#define GL_MAX_VARYING_FLOATS_ARB 0x8B4B -#define GL_MAX_VERTEX_ATTRIBS_ARB 0x8869 -#define GL_MAX_TEXTURE_IMAGE_UNITS_ARB 0x8872 -#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8B4C -#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB 0x8B4D -#define GL_MAX_TEXTURE_COORDS_ARB 0x8871 -#define GL_VERTEX_PROGRAM_POINT_SIZE_ARB 0x8642 -#define GL_VERTEX_PROGRAM_TWO_SIDE_ARB 0x8643 -#define GL_OBJECT_ACTIVE_ATTRIBUTES_ARB 0x8B89 -#define GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB 0x8B8A -#define GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB 0x8622 -#define GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB 0x8623 -#define GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB 0x8624 -#define GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB 0x8625 -#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB 0x886A -#define GL_CURRENT_VERTEX_ATTRIB_ARB 0x8626 -#define GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB 0x8645 -#define GL_FLOAT 0x1406 -#define GL_FLOAT_VEC2_ARB 0x8B50 -#define GL_FLOAT_VEC3_ARB 0x8B51 -#define GL_FLOAT_VEC4_ARB 0x8B52 -#define GL_FLOAT_MAT2_ARB 0x8B5A -#define GL_FLOAT_MAT3_ARB 0x8B5B -#define GL_FLOAT_MAT4_ARB 0x8B5C -#endif - -// GL_ARB_fragment_shader -#ifndef GL_FRAGMENT_SHADER_ARB -#define GL_FRAGMENT_SHADER_ARB 0x8B30 -#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB 0x8B49 -#define GL_MAX_TEXTURE_COORDS_ARB 0x8871 -#define GL_MAX_TEXTURE_IMAGE_UNITS_ARB 0x8872 -#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB 0x8B8B -#endif - -// GL_ARB_shading_language_100 -#ifndef GL_SHADING_LANGUAGE_VERSION_ARB -#define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C +#define GL_FLOAT_VEC2 0x8B50 +#define GL_FLOAT_VEC3 0x8B51 +#define GL_FLOAT_VEC4 0x8B52 +#define GL_FLOAT_MAT2 0x8B5A +#define GL_FLOAT_MAT3 0x8B5B +#define GL_FLOAT_MAT4 0x8B5C +#endif + +// GL 2.0 fragment shader +#ifndef GL_FRAGMENT_SHADER +#define GL_FRAGMENT_SHADER 0x8B30 +#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 +#define GL_MAX_TEXTURE_COORDS 0x8871 +#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B +#endif + +// GL 2.0 shading language 100 +#ifndef GL_SHADING_LANGUAGE_VERSION +#define GL_SHADING_LANGUAGE_VERSION 0x8B8C #endif // GL_ARB_texture_compression diff --git a/vid.h b/vid.h index 569a6335..af084a68 100644 --- a/vid.h +++ b/vid.h @@ -43,14 +43,12 @@ renderpath_t; typedef struct viddef_support_s { + qboolean gl20shaders; qboolean amd_texture_texture4; qboolean arb_depth_texture; qboolean arb_draw_buffers; - qboolean arb_fragment_shader; qboolean arb_multitexture; qboolean arb_occlusion_query; - qboolean arb_shader_objects; - qboolean arb_shading_language_100; qboolean arb_shadow; qboolean arb_texture_compression; qboolean arb_texture_cube_map; @@ -58,7 +56,6 @@ typedef struct viddef_support_s qboolean arb_texture_gather; qboolean arb_texture_non_power_of_two; qboolean arb_vertex_buffer_object; - qboolean arb_vertex_shader; qboolean ati_separate_stencil; qboolean ext_blend_minmax; qboolean ext_blend_subtract; diff --git a/vid_sdl.c b/vid_sdl.c index e1210a64..59b1f3f5 100644 --- a/vid_sdl.c +++ b/vid_sdl.c @@ -673,12 +673,442 @@ void Sys_SendKeyEvents( void ) // Video system //// +#ifdef __IPHONEOS__ +//#include +#include + +GLboolean wrapglIsBuffer(GLuint buffer) {return glIsBuffer(buffer);} +GLboolean wrapglIsEnabled(GLenum cap) {return glIsEnabled(cap);} +GLboolean wrapglIsFramebuffer(GLuint framebuffer) {return glIsFramebuffer(framebuffer);} +//GLboolean wrapglIsQuery(GLuint qid) {return glIsQuery(qid);} +GLboolean wrapglIsRenderbuffer(GLuint renderbuffer) {return glIsRenderbuffer(renderbuffer);} +//GLboolean wrapglUnmapBuffer(GLenum target) {return glUnmapBuffer(target);} +GLenum wrapglCheckFramebufferStatus(GLenum target) {return glCheckFramebufferStatus(target);} +GLenum wrapglGetError(void) {return glGetError();} +GLuint wrapglCreateProgram(void) {return glCreateProgram();} +GLuint wrapglCreateShader(GLenum shaderType) {return glCreateShader(shaderType);} +//GLuint wrapglGetHandle(GLenum pname) {return glGetHandle(pname);} +GLint wrapglGetAttribLocation(GLuint programObj, const GLchar *name) {return glGetAttribLocation(programObj, name);} +GLint wrapglGetUniformLocation(GLuint programObj, const GLchar *name) {return glGetUniformLocation(programObj, name);} +//GLvoid* wrapglMapBuffer(GLenum target, GLenum access) {return glMapBuffer(target, access);} +const GLubyte* wrapglGetString(GLenum name) {return glGetString(name);} +//void wrapglActiveStencilFace(GLenum e) {glActiveStencilFace(e);} +void wrapglActiveTexture(GLenum e) {glActiveTexture(e);} +//void wrapglAlphaFunc(GLenum func, GLclampf ref) {glAlphaFunc(func, ref);} +//void wrapglArrayElement(GLint i) {glArrayElement(i);} +void wrapglAttachShader(GLuint containerObj, GLuint obj) {glAttachShader(containerObj, obj);} +//void wrapglBegin(GLenum mode) {glBegin(mode);} +//void wrapglBeginQuery(GLenum target, GLuint qid) {glBeginQuery(target, qid);} +void wrapglBindAttribLocation(GLuint programObj, GLuint index, const GLchar *name) {glBindAttribLocation(programObj, index, name);} +void wrapglBindBuffer(GLenum target, GLuint buffer) {glBindBuffer(target, buffer);} +void wrapglBindFramebuffer(GLenum target, GLuint framebuffer) {glBindFramebuffer(target, framebuffer);} +void wrapglBindRenderbuffer(GLenum target, GLuint renderbuffer) {glBindRenderbuffer(target, renderbuffer);} +void wrapglBindTexture(GLenum target, GLuint texture) {glBindTexture(target, texture);} +void wrapglBlendEquation(GLenum e) {glBlendEquation(e);} +void wrapglBlendFunc(GLenum sfactor, GLenum dfactor) {glBlendFunc(sfactor, dfactor);} +void wrapglBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage) {glBufferData(target, size, data, usage);} +void wrapglBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data) {glBufferSubData(target, offset, size, data);} +void wrapglClear(GLbitfield mask) {glClear(mask);} +void wrapglClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) {glClearColor(red, green, blue, alpha);} +void wrapglClearDepth(GLclampd depth) {glClearDepthf((float)depth);} +void wrapglClearStencil(GLint s) {glClearStencil(s);} +void wrapglClientActiveTexture(GLenum target) {Con_Printf("glClientActiveTexture(target)\n");} +void wrapglColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) {Con_Printf("glColor4f(red, green, blue, alpha)\n");} +void wrapglColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) {Con_Printf("glColor4ub(red, green, blue, alpha)\n");} +void wrapglColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) {Con_Printf("glColorMask(red, green, blue, alpha)\n");} +void wrapglColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) {Con_Printf("glColorPointer(size, type, stride, ptr)\n");} +void wrapglCompileShader(GLuint shaderObj) {glCompileShader(shaderObj);} +void wrapglCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data) {glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);} +//void wrapglCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data) {glCompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data);} +void wrapglCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data) {glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);} +//void wrapglCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data) {glCompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);} +void wrapglCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) {glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);} +void wrapglCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) {glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);} +//void wrapglCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) {glCopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);} +void wrapglCullFace(GLenum mode) {glCullFace(mode);} +void wrapglDeleteBuffers(GLsizei n, const GLuint *buffers) {glDeleteBuffers(n, buffers);} +void wrapglDeleteFramebuffers(GLsizei n, const GLuint *framebuffers) {glDeleteFramebuffers(n, framebuffers);} +void wrapglDeleteShader(GLuint obj) {glDeleteShader(obj);} +void wrapglDeleteProgram(GLuint obj) {glDeleteProgram(obj);} +//void wrapglDeleteQueries(GLsizei n, const GLuint *ids) {glDeleteQueries(n, ids);} +void wrapglDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers) {glDeleteRenderbuffers(n, renderbuffers);} +void wrapglDeleteTextures(GLsizei n, const GLuint *textures) {glDeleteTextures(n, textures);} +void wrapglDepthFunc(GLenum func) {glDepthFunc(func);} +void wrapglDepthMask(GLboolean flag) {glDepthMask(flag);} +void wrapglDepthRange(GLclampd near_val, GLclampd far_val) {glDepthRangef((float)near_val, (float)far_val);} +void wrapglDetachShader(GLuint containerObj, GLuint attachedObj) {glDetachShader(containerObj, attachedObj);} +void wrapglDisable(GLenum cap) {glDisable(cap);} +void wrapglDisableClientState(GLenum cap) {Con_Printf("glDisableClientState(cap)\n");} +void wrapglDisableVertexAttribArray(GLuint index) {glDisableVertexAttribArray(index);} +void wrapglDrawArrays(GLenum mode, GLint first, GLsizei count) {glDrawArrays(mode, first, count);} +//void wrapglDrawBuffer(GLenum mode) {glDrawBuffer(mode);} +//void wrapglDrawBuffers(GLsizei n, const GLenum *bufs) {glDrawBuffers(n, bufs);} +void wrapglDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices) {glDrawElements(mode, count, type, indices);} +//void wrapglDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices) {glDrawRangeElements(mode, start, end, count, type, indices);} +//void wrapglDrawRangeElementsEXT(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices) {glDrawRangeElements(mode, start, end, count, type, indices);} +void wrapglEnable(GLenum cap) {glEnable(cap);} +void wrapglEnableClientState(GLenum cap) {Con_Printf("glEnableClientState(cap)\n");} +void wrapglEnableVertexAttribArray(GLuint index) {glEnableVertexAttribArray(index);} +//void wrapglEnd(void) {glEnd();} +//void wrapglEndQuery(GLenum target) {glEndQuery(target);} +void wrapglFinish(void) {glFinish();} +void wrapglFlush(void) {glFlush();} +void wrapglFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) {glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);} +void wrapglFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) {glFramebufferTexture2D(target, attachment, textarget, texture, level);} +//void wrapglFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset) {glFramebufferTexture3D();} +void wrapglGenBuffers(GLsizei n, GLuint *buffers) {glGenBuffers(n, buffers);} +void wrapglGenFramebuffers(GLsizei n, GLuint *framebuffers) {glGenFramebuffers(n, framebuffers);} +//void wrapglGenQueries(GLsizei n, GLuint *ids) {glGenQueries(n, ids);} +void wrapglGenRenderbuffers(GLsizei n, GLuint *renderbuffers) {glGenRenderbuffers(n, renderbuffers);} +void wrapglGenTextures(GLsizei n, GLuint *textures) {glGenTextures(n, textures);} +void wrapglGenerateMipmap(GLenum target) {glGenerateMipmap(target);} +void wrapglGetActiveAttrib(GLuint programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLchar *name) {glGetActiveAttrib(programObj, index, maxLength, length, size, type, name);} +void wrapglGetActiveUniform(GLuint programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLchar *name) {glGetActiveUniform(programObj, index, maxLength, length, size, type, name);} +void wrapglGetAttachedShaders(GLuint containerObj, GLsizei maxCount, GLsizei *count, GLuint *obj) {glGetAttachedShaders(containerObj, maxCount, count, obj);} +void wrapglGetBooleanv(GLenum pname, GLboolean *params) {glGetBooleanv(pname, params);} +//void wrapglGetCompressedTexImage(GLenum target, GLint lod, void *img) {glGetCompressedTexImage(target, lod, img);} +//void wrapglGetDoublev(GLenum pname, GLdouble *params) {glGetDoublev(pname, params);} +void wrapglGetFloatv(GLenum pname, GLfloat *params) {glGetFloatv(pname, params);} +void wrapglGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params) {glGetFramebufferAttachmentParameteriv(target, attachment, pname, params);} +void wrapglGetShaderInfoLog(GLuint obj, GLsizei maxLength, GLsizei *length, GLchar *infoLog) {glGetShaderInfoLog(obj, maxLength, length, infoLog);} +void wrapglGetProgramInfoLog(GLuint obj, GLsizei maxLength, GLsizei *length, GLchar *infoLog) {glGetProgramInfoLog(obj, maxLength, length, infoLog);} +void wrapglGetIntegerv(GLenum pname, GLint *params) {glGetIntegerv(pname, params);} +void wrapglGetShaderiv(GLuint obj, GLenum pname, GLint *params) {glGetShaderiv(obj, pname, params);} +void wrapglGetProgramiv(GLuint obj, GLenum pname, GLint *params) {glGetProgramiv(obj, pname, params);} +//void wrapglGetQueryObjectiv(GLuint qid, GLenum pname, GLint *params) {glGetQueryObjectiv(qid, pname, params);} +//void wrapglGetQueryObjectuiv(GLuint qid, GLenum pname, GLuint *params) {glGetQueryObjectuiv(qid, pname, params);} +//void wrapglGetQueryiv(GLenum target, GLenum pname, GLint *params) {glGetQueryiv(target, pname, params);} +void wrapglGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params) {glGetRenderbufferParameteriv(target, pname, params);} +void wrapglGetShaderSource(GLuint obj, GLsizei maxLength, GLsizei *length, GLchar *source) {glGetShaderSource(obj, maxLength, length, source);} +//void wrapglGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels) {glGetTexImage(target, level, format, type, pixels);} +//void wrapglGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params) {glGetTexLevelParameterfv(target, level, pname, params);} +//void wrapglGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params) {glGetTexLevelParameteriv(target, level, pname, params);} +void wrapglGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params) {glGetTexParameterfv(target, pname, params);} +void wrapglGetTexParameteriv(GLenum target, GLenum pname, GLint *params) {glGetTexParameteriv(target, pname, params);} +void wrapglGetUniformfv(GLuint programObj, GLint location, GLfloat *params) {glGetUniformfv(programObj, location, params);} +void wrapglGetUniformiv(GLuint programObj, GLint location, GLint *params) {glGetUniformiv(programObj, location, params);} +void wrapglHint(GLenum target, GLenum mode) {glHint(target, mode);} +void wrapglLineWidth(GLfloat width) {glLineWidth(width);} +void wrapglLinkProgram(GLuint programObj) {glLinkProgram(programObj);} +void wrapglLoadIdentity(void) {Con_Printf("glLoadIdentity()\n");} +void wrapglLoadMatrixf(const GLfloat *m) {Con_Printf("glLoadMatrixf(m)\n");} +void wrapglMatrixMode(GLenum mode) {Con_Printf("glMatrixMode(mode)\n");} +void wrapglMultiTexCoord1f(GLenum target, GLfloat s) {Con_Printf("glMultiTexCoord1f(target, s)\n");} +void wrapglMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t) {Con_Printf("glMultiTexCoord2f(target, s, t)\n");} +void wrapglMultiTexCoord3f(GLenum target, GLfloat s, GLfloat t, GLfloat r) {Con_Printf("glMultiTexCoord3f(target, s, t, r)\n");} +void wrapglMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) {Con_Printf("glMultiTexCoord4f(target, s, t, r, q)\n");} +void wrapglNormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr) {Con_Printf("glNormalPointer(type, stride, ptr)\n");} +void wrapglPixelStorei(GLenum pname, GLint param) {glPixelStorei(pname, param);} +//void wrapglPointSize(GLfloat size) {glPointSize(size);} +void wrapglPolygonMode(GLenum face, GLenum mode) {Con_Printf("glPolygonMode(face, mode)\n");} +void wrapglPolygonOffset(GLfloat factor, GLfloat units) {Con_Printf("glPolygonOffset(factor, units)\n");} +void wrapglPolygonStipple(const GLubyte *mask) {Con_Printf("glPolygonStipple(mask)\n");} +void wrapglReadBuffer(GLenum mode) {Con_Printf("glReadBuffer(mode)\n");} +void wrapglReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels) {glReadPixels(x, y, width, height, format, type, pixels);} +void wrapglRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) {glRenderbufferStorage(target, internalformat, width, height);} +void wrapglScissor(GLint x, GLint y, GLsizei width, GLsizei height) {glScissor(x, y, width, height);} +void wrapglShaderSource(GLuint shaderObj, GLsizei count, const GLchar **string, const GLint *length) {glShaderSource(shaderObj, count, string, length);} +void wrapglStencilFunc(GLenum func, GLint ref, GLuint mask) {glStencilFunc(func, ref, mask);} +void wrapglStencilFuncSeparate(GLenum func1, GLenum func2, GLint ref, GLuint mask) {glStencilFuncSeparate(func1, func2, ref, mask);} +void wrapglStencilMask(GLuint mask) {glStencilMask(mask);} +void wrapglStencilOp(GLenum fail, GLenum zfail, GLenum zpass) {glStencilOp(fail, zfail, zpass);} +void wrapglStencilOpSeparate(GLenum e1, GLenum e2, GLenum e3, GLenum e4) {glStencilOpSeparate(e1, e2, e3, e4);} +//void wrapglTexCoord1f(GLfloat s) {glTexCoord1f(s);} +//void wrapglTexCoord2f(GLfloat s, GLfloat t) {glTexCoord2f(s, t);} +//void wrapglTexCoord3f(GLfloat s, GLfloat t, GLfloat r) {glTexCoord3f(s, t, r);} +//void wrapglTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q) {glTexCoord4f(s, t, r, q);} +//void wrapglTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) {glTexCoordPointer(size, type, stride, ptr);} +//void wrapglTexEnvf(GLenum target, GLenum pname, GLfloat param) {glTexEnvf(target, pname, param);} +//void wrapglTexEnvfv(GLenum target, GLenum pname, const GLfloat *params) {glTexEnvfv(target, pname, params);} +//void wrapglTexEnvi(GLenum target, GLenum pname, GLint param) {glTexEnvi(target, pname, param);} +void wrapglTexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels) {glTexImage2D(target, level, internalFormat, width, height, border, format, type, pixels);} +//void wrapglTexImage3D(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels) {glTexImage3D(target, level, internalformat, width, height, depth, border, format, type, pixels);} +void wrapglTexParameterf(GLenum target, GLenum pname, GLfloat param) {glTexParameterf(target, pname, param);} +void wrapglTexParameterfv(GLenum target, GLenum pname, GLfloat *params) {glTexParameterfv(target, pname, params);} +void wrapglTexParameteri(GLenum target, GLenum pname, GLint param) {glTexParameteri(target, pname, param);} +void wrapglTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels) {glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);} +//void wrapglTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels) {glTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);} +void wrapglUniform1f(GLint location, GLfloat v0) {glUniform1f(location, v0);} +void wrapglUniform1fv(GLint location, GLsizei count, const GLfloat *value) {glUniform1fv(location, count, value);} +void wrapglUniform1i(GLint location, GLint v0) {glUniform1i(location, v0);} +void wrapglUniform1iv(GLint location, GLsizei count, const GLint *value) {glUniform1iv(location, count, value);} +void wrapglUniform2f(GLint location, GLfloat v0, GLfloat v1) {glUniform2f(location, v0, v1);} +void wrapglUniform2fv(GLint location, GLsizei count, const GLfloat *value) {glUniform2fv(location, count, value);} +void wrapglUniform2i(GLint location, GLint v0, GLint v1) {glUniform2i(location, v0, v1);} +void wrapglUniform2iv(GLint location, GLsizei count, const GLint *value) {glUniform2iv(location, count, value);} +void wrapglUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2) {glUniform3f(location, v0, v1, v2);} +void wrapglUniform3fv(GLint location, GLsizei count, const GLfloat *value) {glUniform3fv(location, count, value);} +void wrapglUniform3i(GLint location, GLint v0, GLint v1, GLint v2) {glUniform3i(location, v0, v1, v2);} +void wrapglUniform3iv(GLint location, GLsizei count, const GLint *value) {glUniform3iv(location, count, value);} +void wrapglUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) {glUniform4f(location, v0, v1, v2, v3);} +void wrapglUniform4fv(GLint location, GLsizei count, const GLfloat *value) {glUniform4fv(location, count, value);} +void wrapglUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3) {glUniform4i(location, v0, v1, v2, v3);} +void wrapglUniform4iv(GLint location, GLsizei count, const GLint *value) {glUniform4iv(location, count, value);} +void wrapglUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) {glUniformMatrix2fv(location, count, transpose, value);} +void wrapglUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) {glUniformMatrix3fv(location, count, transpose, value);} +void wrapglUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) {glUniformMatrix4fv(location, count, transpose, value);} +void wrapglUseProgram(GLuint programObj) {glUseProgram(programObj);} +void wrapglValidateProgram(GLuint programObj) {glValidateProgram(programObj);} +//void wrapglVertex2f(GLfloat x, GLfloat y) {glVertex2f(x, y);} +//void wrapglVertex3f(GLfloat x, GLfloat y, GLfloat z) {glVertex3f(x, y, z);} +//void wrapglVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) {glVertex4f(x, y, z, w);} +void wrapglVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer) {glVertexAttribPointer(index, size, type, normalized, stride, pointer);} +void wrapglVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) {Con_Printf("glVertexPointer(size, type, stride, ptr)\n");} +void wrapglViewport(GLint x, GLint y, GLsizei width, GLsizei height) {glViewport(x, y, width, height);} + +void GLES_Init(void) +{ + qglIsBufferARB = wrapglIsBuffer; + qglIsEnabled = wrapglIsEnabled; + qglIsFramebufferEXT = wrapglIsFramebuffer; +// qglIsQueryARB = wrapglIsQuery; + qglIsRenderbufferEXT = wrapglIsRenderbuffer; +// qglUnmapBufferARB = wrapglUnmapBuffer; + qglCheckFramebufferStatusEXT = wrapglCheckFramebufferStatus; + qglGetError = wrapglGetError; + qglCreateProgram = wrapglCreateProgram; + qglCreateShader = wrapglCreateShader; +// qglGetHandleARB = wrapglGetHandle; + qglGetAttribLocation = wrapglGetAttribLocation; + qglGetUniformLocation = wrapglGetUniformLocation; +// qglMapBufferARB = wrapglMapBuffer; + qglGetString = wrapglGetString; +// qglActiveStencilFaceEXT = wrapglActiveStencilFace; + qglActiveTexture = wrapglActiveTexture; +// qglAlphaFunc = wrapglAlphaFunc; +// qglArrayElement = wrapglArrayElement; + qglAttachShader = wrapglAttachShader; +// qglBegin = wrapglBegin; +// qglBeginQueryARB = wrapglBeginQuery; + qglBindAttribLocationARB = wrapglBindAttribLocation; + qglBindBufferARB = wrapglBindBuffer; + qglBindFramebufferEXT = wrapglBindFramebuffer; + qglBindRenderbufferEXT = wrapglBindRenderbuffer; + qglBindTexture = wrapglBindTexture; + qglBlendEquationEXT = wrapglBlendEquation; + qglBlendFunc = wrapglBlendFunc; + qglBufferDataARB = wrapglBufferData; + qglBufferSubDataARB = wrapglBufferSubData; + qglClear = wrapglClear; + qglClearColor = wrapglClearColor; + qglClearDepth = wrapglClearDepth; + qglClearStencil = wrapglClearStencil; + qglClientActiveTexture = wrapglClientActiveTexture; + qglColor4f = wrapglColor4f; + qglColor4ub = wrapglColor4ub; + qglColorMask = wrapglColorMask; + qglColorPointer = wrapglColorPointer; + qglCompileShaderARB = wrapglCompileShader; + qglCompressedTexImage2DARB = wrapglCompressedTexImage2D; +// qglCompressedTexImage3DARB = wrapglCompressedTexImage3D; + qglCompressedTexSubImage2DARB = wrapglCompressedTexSubImage2D; +// qglCompressedTexSubImage3DARB = wrapglCompressedTexSubImage3D; + qglCopyTexImage2D = wrapglCopyTexImage2D; + qglCopyTexSubImage2D = wrapglCopyTexSubImage2D; +// qglCopyTexSubImage3D = wrapglCopyTexSubImage3D; + qglCullFace = wrapglCullFace; + qglDeleteBuffersARB = wrapglDeleteBuffers; + qglDeleteFramebuffersEXT = wrapglDeleteFramebuffers; + qglDeleteProgram = wrapglDeleteProgram; + qglDeleteShader = wrapglDeleteShader; +// qglDeleteQueriesARB = wrapglDeleteQueries; + qglDeleteRenderbuffersEXT = wrapglDeleteRenderbuffers; + qglDeleteTextures = wrapglDeleteTextures; + qglDepthFunc = wrapglDepthFunc; + qglDepthMask = wrapglDepthMask; + qglDepthRange = wrapglDepthRange; + qglDetachShader = wrapglDetachShader; + qglDisable = wrapglDisable; + qglDisableClientState = wrapglDisableClientState; + qglDisableVertexAttribArrayARB = wrapglDisableVertexAttribArray; + qglDrawArrays = wrapglDrawArrays; +// qglDrawBuffer = wrapglDrawBuffer; +// qglDrawBuffersARB = wrapglDrawBuffers; + qglDrawElements = wrapglDrawElements; +// qglDrawRangeElements = wrapglDrawRangeElements; + qglEnable = wrapglEnable; + qglEnableClientState = wrapglEnableClientState; + qglEnableVertexAttribArrayARB = wrapglEnableVertexAttribArray; +// qglEnd = wrapglEnd; +// qglEndQueryARB = wrapglEndQuery; + qglFinish = wrapglFinish; + qglFlush = wrapglFlush; + qglFramebufferRenderbufferEXT = wrapglFramebufferRenderbuffer; + qglFramebufferTexture2DEXT = wrapglFramebufferTexture2D; +// qglFramebufferTexture3DEXT = wrapglFramebufferTexture3D; + qglGenBuffersARB = wrapglGenBuffers; + qglGenFramebuffersEXT = wrapglGenFramebuffers; +// qglGenQueriesARB = wrapglGenQueries; + qglGenRenderbuffersEXT = wrapglGenRenderbuffers; + qglGenTextures = wrapglGenTextures; + qglGenerateMipmapEXT = wrapglGenerateMipmap; + qglGetActiveAttrib = wrapglGetActiveAttrib; + qglGetActiveUniform = wrapglGetActiveUniform; + qglGetAttachedShaders = wrapglGetAttachedShaders; + qglGetBooleanv = wrapglGetBooleanv; +// qglGetCompressedTexImageARB = wrapglGetCompressedTexImage; +// qglGetDoublev = wrapglGetDoublev; + qglGetFloatv = wrapglGetFloatv; + qglGetFramebufferAttachmentParameterivEXT = wrapglGetFramebufferAttachmentParameteriv; + qglGetProgramInfoLog = wrapglGetProgramInfoLog; + qglGetShaderInfoLog = wrapglGetShaderInfoLog; + qglGetIntegerv = wrapglGetIntegerv; + qglGetShaderiv = wrapglGetShaderiv; + qglGetProgramiv = wrapglGetProgramiv; +// qglGetQueryObjectivARB = wrapglGetQueryObjectiv; +// qglGetQueryObjectuivARB = wrapglGetQueryObjectuiv; +// qglGetQueryivARB = wrapglGetQueryiv; + qglGetRenderbufferParameterivEXT = wrapglGetRenderbufferParameteriv; + qglGetShaderSource = wrapglGetShaderSource; +// qglGetTexImage = wrapglGetTexImage; +// qglGetTexLevelParameterfv = wrapglGetTexLevelParameterfv; +// qglGetTexLevelParameteriv = wrapglGetTexLevelParameteriv; + qglGetTexParameterfv = wrapglGetTexParameterfv; + qglGetTexParameteriv = wrapglGetTexParameteriv; + qglGetUniformfv = wrapglGetUniformfv; + qglGetUniformiv = wrapglGetUniformiv; + qglHint = wrapglHint; + qglLineWidth = wrapglLineWidth; + qglLinkProgram = wrapglLinkProgram; + qglLoadIdentity = wrapglLoadIdentity; + qglLoadMatrixf = wrapglLoadMatrixf; + qglMatrixMode = wrapglMatrixMode; + qglMultiTexCoord1f = wrapglMultiTexCoord1f; + qglMultiTexCoord2f = wrapglMultiTexCoord2f; + qglMultiTexCoord3f = wrapglMultiTexCoord3f; + qglMultiTexCoord4f = wrapglMultiTexCoord4f; + qglNormalPointer = wrapglNormalPointer; + qglPixelStorei = wrapglPixelStorei; +// qglPointSize = wrapglPointSize; + qglPolygonMode = wrapglPolygonMode; + qglPolygonOffset = wrapglPolygonOffset; + qglPolygonStipple = wrapglPolygonStipple; + qglReadBuffer = wrapglReadBuffer; + qglReadPixels = wrapglReadPixels; + qglRenderbufferStorageEXT = wrapglRenderbufferStorage; + qglScissor = wrapglScissor; + qglShaderSource = wrapglShaderSource; + qglStencilFunc = wrapglStencilFunc; + qglStencilFuncSeparate = wrapglStencilFuncSeparate; + qglStencilMask = wrapglStencilMask; + qglStencilOp = wrapglStencilOp; + qglStencilOpSeparate = wrapglStencilOpSeparate; +// qglTexCoord1f = wrapglTexCoord1f; +// qglTexCoord2f = wrapglTexCoord2f; +// qglTexCoord3f = wrapglTexCoord3f; +// qglTexCoord4f = wrapglTexCoord4f; +// qglTexCoordPointer = wrapglTexCoordPointer; +// qglTexEnvf = wrapglTexEnvf; +// qglTexEnvfv = wrapglTexEnvfv; +// qglTexEnvi = wrapglTexEnvi; + qglTexImage2D = wrapglTexImage2D; +// qglTexImage3D = wrapglTexImage3D; + qglTexParameterf = wrapglTexParameterf; + qglTexParameterfv = wrapglTexParameterfv; + qglTexParameteri = wrapglTexParameteri; + qglTexSubImage2D = wrapglTexSubImage2D; +// qglTexSubImage3D = wrapglTexSubImage3D; + qglUniform1f = wrapglUniform1f; + qglUniform1fv = wrapglUniform1fv; + qglUniform1i = wrapglUniform1i; + qglUniform1iv = wrapglUniform1iv; + qglUniform2f = wrapglUniform2f; + qglUniform2fv = wrapglUniform2fv; + qglUniform2i = wrapglUniform2i; + qglUniform2iv = wrapglUniform2iv; + qglUniform3f = wrapglUniform3f; + qglUniform3fv = wrapglUniform3fv; + qglUniform3i = wrapglUniform3i; + qglUniform3iv = wrapglUniform3iv; + qglUniform4f = wrapglUniform4f; + qglUniform4fv = wrapglUniform4fv; + qglUniform4i = wrapglUniform4i; + qglUniform4iv = wrapglUniform4iv; + qglUniformMatrix2fv = wrapglUniformMatrix2fv; + qglUniformMatrix3fv = wrapglUniformMatrix3fv; + qglUniformMatrix4fv = wrapglUniformMatrix4fv; + qglUseProgram = wrapglUseProgram; + qglValidateProgram = wrapglValidateProgram; +// qglVertex2f = wrapglVertex2f; +// qglVertex3f = wrapglVertex3f; +// qglVertex4f = wrapglVertex4f; + qglVertexAttribPointer = wrapglVertexAttribPointer; + qglVertexPointer = wrapglVertexPointer; + qglViewport = wrapglViewport; + + vid.support.amd_texture_texture4 = false; + vid.support.arb_depth_texture = false; + vid.support.arb_draw_buffers = false; + vid.support.arb_fragment_shader = true; + vid.support.arb_multitexture = false; + vid.support.arb_occlusion_query = false; + vid.support.arb_shader_objects = true; + vid.support.arb_shading_language_100 = true; + vid.support.arb_shadow = false; + vid.support.arb_texture_compression = false; // different (vendor-specific) formats than on desktop OpenGL... + vid.support.arb_texture_cube_map = true; + vid.support.arb_texture_env_combine = false; + vid.support.arb_texture_gather = false; + vid.support.arb_texture_non_power_of_two = SDL_GL_ExtensionSupported("GL_OES_texture_npot"); + vid.support.arb_vertex_buffer_object = true; + vid.support.arb_vertex_shader = true; + vid.support.ati_separate_stencil = false; + vid.support.ext_blend_minmax = false; + vid.support.ext_blend_subtract = true; + vid.support.ext_draw_range_elements = true; + vid.support.ext_framebuffer_object = true; + vid.support.ext_stencil_two_side = false; + vid.support.ext_texture_3d = false;//SDL_GL_ExtensionSupported("GL_OES_texture_3D"); // iPhoneOS does not support 3D textures, odd... + vid.support.ext_texture_compression_s3tc = false; + vid.support.ext_texture_edge_clamp = true; + vid.support.ext_texture_filter_anisotropic = false; // probably don't want to use it... + + qglGetIntegerv(GL_MAX_TEXTURE_SIZE, (GLint*)&vid.maxtexturesize_2d); + if (vid.support.ext_texture_filter_anisotropic) + qglGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, (GLint*)&vid.max_anisotropy); + if (vid.support.arb_texture_cube_map) + qglGetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB, (GLint*)&vid.maxtexturesize_cubemap); + if (vid.support.ext_texture_3d) + qglGetIntegerv(GL_MAX_3D_TEXTURE_SIZE, (GLint*)&vid.maxtexturesize_3d); + + // verify that 3d textures are really supported + if (vid.support.ext_texture_3d && vid.maxtexturesize_3d < 32) + { + vid.support.ext_texture_3d = false; + Con_Printf("GL_OES_texture_3d reported bogus GL_MAX_3D_TEXTURE_SIZE, disabled\n"); + } + + vid.texunits = vid.teximageunits = vid.texarrayunits = 1; + qglGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, (GLint*)&vid.texunits); + qglGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, (int *)&vid.teximageunits);CHECKGLERROR + qglGetIntegerv(GL_MAX_TEXTURE_COORDS_ARB, (int *)&vid.texarrayunits);CHECKGLERROR + vid.texunits = bound(1, vid.texunits, MAX_TEXTUREUNITS); + vid.teximageunits = bound(1, vid.teximageunits, MAX_TEXTUREUNITS); + vid.texarrayunits = bound(1, vid.texarrayunits, MAX_TEXTUREUNITS); + Con_DPrintf("Using GLES2.0 rendering path - %i texture matrix, %i texture images, %i texcoords%s\n", vid.texunits, vid.teximageunits, vid.texarrayunits, vid.support.ext_framebuffer_object ? ", shadowmapping supported" : ""); + vid.renderpath = RENDERPATH_GL20; + vid.useinterleavedarrays = false; + + // VorteX: set other info (maybe place them in VID_InitMode?) + extern cvar_t gl_info_vendor; + extern cvar_t gl_info_renderer; + extern cvar_t gl_info_version; + extern cvar_t gl_info_platform; + extern cvar_t gl_info_driver; + Cvar_SetQuick(&gl_info_vendor, gl_vendor); + Cvar_SetQuick(&gl_info_renderer, gl_renderer); + Cvar_SetQuick(&gl_info_version, gl_version); + Cvar_SetQuick(&gl_info_platform, gl_platform ? gl_platform : ""); + Cvar_SetQuick(&gl_info_driver, gl_driver); +} +#else void *GL_GetProcAddress(const char *name) { void *p = NULL; p = SDL_GL_GetProcAddress(name); return p; } +#endif #if SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION == 2 static int Sys_EventFilter( SDL_Event *event ); @@ -1123,7 +1553,11 @@ qboolean VID_InitModeGL(viddef_mode_t *mode) gl_platform = "SDL"; gl_platformextensions = ""; +#ifdef __IPHONEOS__ + GLES_Init(); +#else GL_Init(); +#endif vid_numjoysticks = SDL_NumJoysticks(); vid_numjoysticks = bound(0, vid_numjoysticks, MAX_JOYSTICKS); diff --git a/vid_shared.c b/vid_shared.c index 164c5285..51737128 100644 --- a/vid_shared.c +++ b/vid_shared.c @@ -259,92 +259,94 @@ void (GLAPIENTRY *qglStencilOpSeparate)(GLenum, GLenum, GLenum, GLenum); void (GLAPIENTRY *qglStencilFuncSeparate)(GLenum, GLenum, GLint, GLuint); void (GLAPIENTRY *qglActiveStencilFaceEXT)(GLenum); -void (GLAPIENTRY *qglDeleteObjectARB)(GLhandleARB obj); -GLhandleARB (GLAPIENTRY *qglGetHandleARB)(GLenum pname); -void (GLAPIENTRY *qglDetachObjectARB)(GLhandleARB containerObj, GLhandleARB attachedObj); -GLhandleARB (GLAPIENTRY *qglCreateShaderObjectARB)(GLenum shaderType); -void (GLAPIENTRY *qglShaderSourceARB)(GLhandleARB shaderObj, GLsizei count, const GLcharARB **string, const GLint *length); -void (GLAPIENTRY *qglCompileShaderARB)(GLhandleARB shaderObj); -GLhandleARB (GLAPIENTRY *qglCreateProgramObjectARB)(void); -void (GLAPIENTRY *qglAttachObjectARB)(GLhandleARB containerObj, GLhandleARB obj); -void (GLAPIENTRY *qglLinkProgramARB)(GLhandleARB programObj); -void (GLAPIENTRY *qglUseProgramObjectARB)(GLhandleARB programObj); -void (GLAPIENTRY *qglValidateProgramARB)(GLhandleARB programObj); -void (GLAPIENTRY *qglUniform1fARB)(GLint location, GLfloat v0); -void (GLAPIENTRY *qglUniform2fARB)(GLint location, GLfloat v0, GLfloat v1); -void (GLAPIENTRY *qglUniform3fARB)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -void (GLAPIENTRY *qglUniform4fARB)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -void (GLAPIENTRY *qglUniform1iARB)(GLint location, GLint v0); -void (GLAPIENTRY *qglUniform2iARB)(GLint location, GLint v0, GLint v1); -void (GLAPIENTRY *qglUniform3iARB)(GLint location, GLint v0, GLint v1, GLint v2); -void (GLAPIENTRY *qglUniform4iARB)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -void (GLAPIENTRY *qglUniform1fvARB)(GLint location, GLsizei count, const GLfloat *value); -void (GLAPIENTRY *qglUniform2fvARB)(GLint location, GLsizei count, const GLfloat *value); -void (GLAPIENTRY *qglUniform3fvARB)(GLint location, GLsizei count, const GLfloat *value); -void (GLAPIENTRY *qglUniform4fvARB)(GLint location, GLsizei count, const GLfloat *value); -void (GLAPIENTRY *qglUniform1ivARB)(GLint location, GLsizei count, const GLint *value); -void (GLAPIENTRY *qglUniform2ivARB)(GLint location, GLsizei count, const GLint *value); -void (GLAPIENTRY *qglUniform3ivARB)(GLint location, GLsizei count, const GLint *value); -void (GLAPIENTRY *qglUniform4ivARB)(GLint location, GLsizei count, const GLint *value); -void (GLAPIENTRY *qglUniformMatrix2fvARB)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -void (GLAPIENTRY *qglUniformMatrix3fvARB)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -void (GLAPIENTRY *qglUniformMatrix4fvARB)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -void (GLAPIENTRY *qglGetObjectParameterfvARB)(GLhandleARB obj, GLenum pname, GLfloat *params); -void (GLAPIENTRY *qglGetObjectParameterivARB)(GLhandleARB obj, GLenum pname, GLint *params); -void (GLAPIENTRY *qglGetInfoLogARB)(GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog); -void (GLAPIENTRY *qglGetAttachedObjectsARB)(GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj); -GLint (GLAPIENTRY *qglGetUniformLocationARB)(GLhandleARB programObj, const GLcharARB *name); -void (GLAPIENTRY *qglGetActiveUniformARB)(GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); -void (GLAPIENTRY *qglGetUniformfvARB)(GLhandleARB programObj, GLint location, GLfloat *params); -void (GLAPIENTRY *qglGetUniformivARB)(GLhandleARB programObj, GLint location, GLint *params); -void (GLAPIENTRY *qglGetShaderSourceARB)(GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source); - -//void (GLAPIENTRY *qglVertexAttrib1fARB)(GLuint index, GLfloat v0); -//void (GLAPIENTRY *qglVertexAttrib1sARB)(GLuint index, GLshort v0); -//void (GLAPIENTRY *qglVertexAttrib1dARB)(GLuint index, GLdouble v0); -//void (GLAPIENTRY *qglVertexAttrib2fARB)(GLuint index, GLfloat v0, GLfloat v1); -//void (GLAPIENTRY *qglVertexAttrib2sARB)(GLuint index, GLshort v0, GLshort v1); -//void (GLAPIENTRY *qglVertexAttrib2dARB)(GLuint index, GLdouble v0, GLdouble v1); -//void (GLAPIENTRY *qglVertexAttrib3fARB)(GLuint index, GLfloat v0, GLfloat v1, GLfloat v2); -//void (GLAPIENTRY *qglVertexAttrib3sARB)(GLuint index, GLshort v0, GLshort v1, GLshort v2); -//void (GLAPIENTRY *qglVertexAttrib3dARB)(GLuint index, GLdouble v0, GLdouble v1, GLdouble v2); -//void (GLAPIENTRY *qglVertexAttrib4fARB)(GLuint index, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -//void (GLAPIENTRY *qglVertexAttrib4sARB)(GLuint index, GLshort v0, GLshort v1, GLshort v2, GLshort v3); -//void (GLAPIENTRY *qglVertexAttrib4dARB)(GLuint index, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3); -//void (GLAPIENTRY *qglVertexAttrib4NubARB)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); -//void (GLAPIENTRY *qglVertexAttrib1fvARB)(GLuint index, const GLfloat *v); -//void (GLAPIENTRY *qglVertexAttrib1svARB)(GLuint index, const GLshort *v); -//void (GLAPIENTRY *qglVertexAttrib1dvARB)(GLuint index, const GLdouble *v); -//void (GLAPIENTRY *qglVertexAttrib2fvARB)(GLuint index, const GLfloat *v); -//void (GLAPIENTRY *qglVertexAttrib2svARB)(GLuint index, const GLshort *v); -//void (GLAPIENTRY *qglVertexAttrib2dvARB)(GLuint index, const GLdouble *v); -//void (GLAPIENTRY *qglVertexAttrib3fvARB)(GLuint index, const GLfloat *v); -//void (GLAPIENTRY *qglVertexAttrib3svARB)(GLuint index, const GLshort *v); -//void (GLAPIENTRY *qglVertexAttrib3dvARB)(GLuint index, const GLdouble *v); -//void (GLAPIENTRY *qglVertexAttrib4fvARB)(GLuint index, const GLfloat *v); -//void (GLAPIENTRY *qglVertexAttrib4svARB)(GLuint index, const GLshort *v); -//void (GLAPIENTRY *qglVertexAttrib4dvARB)(GLuint index, const GLdouble *v); -//void (GLAPIENTRY *qglVertexAttrib4ivARB)(GLuint index, const GLint *v); -//void (GLAPIENTRY *qglVertexAttrib4bvARB)(GLuint index, const GLbyte *v); -//void (GLAPIENTRY *qglVertexAttrib4ubvARB)(GLuint index, const GLubyte *v); -//void (GLAPIENTRY *qglVertexAttrib4usvARB)(GLuint index, const GLushort *v); -//void (GLAPIENTRY *qglVertexAttrib4uivARB)(GLuint index, const GLuint *v); -//void (GLAPIENTRY *qglVertexAttrib4NbvARB)(GLuint index, const GLbyte *v); -//void (GLAPIENTRY *qglVertexAttrib4NsvARB)(GLuint index, const GLshort *v); -//void (GLAPIENTRY *qglVertexAttrib4NivARB)(GLuint index, const GLint *v); -//void (GLAPIENTRY *qglVertexAttrib4NubvARB)(GLuint index, const GLubyte *v); -//void (GLAPIENTRY *qglVertexAttrib4NusvARB)(GLuint index, const GLushort *v); -//void (GLAPIENTRY *qglVertexAttrib4NuivARB)(GLuint index, const GLuint *v); -void (GLAPIENTRY *qglVertexAttribPointerARB)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); -void (GLAPIENTRY *qglEnableVertexAttribArrayARB)(GLuint index); -void (GLAPIENTRY *qglDisableVertexAttribArrayARB)(GLuint index); -void (GLAPIENTRY *qglBindAttribLocationARB)(GLhandleARB programObj, GLuint index, const GLcharARB *name); -void (GLAPIENTRY *qglGetActiveAttribARB)(GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); -GLint (GLAPIENTRY *qglGetAttribLocationARB)(GLhandleARB programObj, const GLcharARB *name); -//void (GLAPIENTRY *qglGetVertexAttribdvARB)(GLuint index, GLenum pname, GLdouble *params); -//void (GLAPIENTRY *qglGetVertexAttribfvARB)(GLuint index, GLenum pname, GLfloat *params); -//void (GLAPIENTRY *qglGetVertexAttribivARB)(GLuint index, GLenum pname, GLint *params); -//void (GLAPIENTRY *qglGetVertexAttribPointervARB)(GLuint index, GLenum pname, GLvoid **pointer); +void (GLAPIENTRY *qglDeleteShader)(GLuint obj); +void (GLAPIENTRY *qglDeleteProgram)(GLuint obj); +GLuint (GLAPIENTRY *qglGetHandle)(GLenum pname); +void (GLAPIENTRY *qglDetachShader)(GLuint containerObj, GLuint attachedObj); +GLuint (GLAPIENTRY *qglCreateShader)(GLenum shaderType); +void (GLAPIENTRY *qglShaderSource)(GLuint shaderObj, GLsizei count, const GLchar **string, const GLint *length); +void (GLAPIENTRY *qglCompileShader)(GLuint shaderObj); +GLuint (GLAPIENTRY *qglCreateProgram)(void); +void (GLAPIENTRY *qglAttachShader)(GLuint containerObj, GLuint obj); +void (GLAPIENTRY *qglLinkProgram)(GLuint programObj); +void (GLAPIENTRY *qglUseProgram)(GLuint programObj); +void (GLAPIENTRY *qglValidateProgram)(GLuint programObj); +void (GLAPIENTRY *qglUniform1f)(GLint location, GLfloat v0); +void (GLAPIENTRY *qglUniform2f)(GLint location, GLfloat v0, GLfloat v1); +void (GLAPIENTRY *qglUniform3f)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +void (GLAPIENTRY *qglUniform4f)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +void (GLAPIENTRY *qglUniform1i)(GLint location, GLint v0); +void (GLAPIENTRY *qglUniform2i)(GLint location, GLint v0, GLint v1); +void (GLAPIENTRY *qglUniform3i)(GLint location, GLint v0, GLint v1, GLint v2); +void (GLAPIENTRY *qglUniform4i)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +void (GLAPIENTRY *qglUniform1fv)(GLint location, GLsizei count, const GLfloat *value); +void (GLAPIENTRY *qglUniform2fv)(GLint location, GLsizei count, const GLfloat *value); +void (GLAPIENTRY *qglUniform3fv)(GLint location, GLsizei count, const GLfloat *value); +void (GLAPIENTRY *qglUniform4fv)(GLint location, GLsizei count, const GLfloat *value); +void (GLAPIENTRY *qglUniform1iv)(GLint location, GLsizei count, const GLint *value); +void (GLAPIENTRY *qglUniform2iv)(GLint location, GLsizei count, const GLint *value); +void (GLAPIENTRY *qglUniform3iv)(GLint location, GLsizei count, const GLint *value); +void (GLAPIENTRY *qglUniform4iv)(GLint location, GLsizei count, const GLint *value); +void (GLAPIENTRY *qglUniformMatrix2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +void (GLAPIENTRY *qglUniformMatrix3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +void (GLAPIENTRY *qglUniformMatrix4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +void (GLAPIENTRY *qglGetShaderiv)(GLuint obj, GLenum pname, GLint *params); +void (GLAPIENTRY *qglGetProgramiv)(GLuint obj, GLenum pname, GLint *params); +void (GLAPIENTRY *qglGetShaderInfoLog)(GLuint obj, GLsizei maxLength, GLsizei *length, GLchar *infoLog); +void (GLAPIENTRY *qglGetProgramInfoLog)(GLuint obj, GLsizei maxLength, GLsizei *length, GLchar *infoLog); +void (GLAPIENTRY *qglGetAttachedShaders)(GLuint containerObj, GLsizei maxCount, GLsizei *count, GLuint *obj); +GLint (GLAPIENTRY *qglGetUniformLocation)(GLuint programObj, const GLchar *name); +void (GLAPIENTRY *qglGetActiveUniform)(GLuint programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +void (GLAPIENTRY *qglGetUniformfv)(GLuint programObj, GLint location, GLfloat *params); +void (GLAPIENTRY *qglGetUniformiv)(GLuint programObj, GLint location, GLint *params); +void (GLAPIENTRY *qglGetShaderSource)(GLuint obj, GLsizei maxLength, GLsizei *length, GLchar *source); + +void (GLAPIENTRY *qglVertexAttrib1f)(GLuint index, GLfloat v0); +void (GLAPIENTRY *qglVertexAttrib1s)(GLuint index, GLshort v0); +void (GLAPIENTRY *qglVertexAttrib1d)(GLuint index, GLdouble v0); +void (GLAPIENTRY *qglVertexAttrib2f)(GLuint index, GLfloat v0, GLfloat v1); +void (GLAPIENTRY *qglVertexAttrib2s)(GLuint index, GLshort v0, GLshort v1); +void (GLAPIENTRY *qglVertexAttrib2d)(GLuint index, GLdouble v0, GLdouble v1); +void (GLAPIENTRY *qglVertexAttrib3f)(GLuint index, GLfloat v0, GLfloat v1, GLfloat v2); +void (GLAPIENTRY *qglVertexAttrib3s)(GLuint index, GLshort v0, GLshort v1, GLshort v2); +void (GLAPIENTRY *qglVertexAttrib3d)(GLuint index, GLdouble v0, GLdouble v1, GLdouble v2); +void (GLAPIENTRY *qglVertexAttrib4f)(GLuint index, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +void (GLAPIENTRY *qglVertexAttrib4s)(GLuint index, GLshort v0, GLshort v1, GLshort v2, GLshort v3); +void (GLAPIENTRY *qglVertexAttrib4d)(GLuint index, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3); +void (GLAPIENTRY *qglVertexAttrib4Nub)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +void (GLAPIENTRY *qglVertexAttrib1fv)(GLuint index, const GLfloat *v); +void (GLAPIENTRY *qglVertexAttrib1sv)(GLuint index, const GLshort *v); +void (GLAPIENTRY *qglVertexAttrib1dv)(GLuint index, const GLdouble *v); +void (GLAPIENTRY *qglVertexAttrib2fv)(GLuint index, const GLfloat *v); +void (GLAPIENTRY *qglVertexAttrib2sv)(GLuint index, const GLshort *v); +void (GLAPIENTRY *qglVertexAttrib2dv)(GLuint index, const GLdouble *v); +void (GLAPIENTRY *qglVertexAttrib3fv)(GLuint index, const GLfloat *v); +void (GLAPIENTRY *qglVertexAttrib3sv)(GLuint index, const GLshort *v); +void (GLAPIENTRY *qglVertexAttrib3dv)(GLuint index, const GLdouble *v); +void (GLAPIENTRY *qglVertexAttrib4fv)(GLuint index, const GLfloat *v); +void (GLAPIENTRY *qglVertexAttrib4sv)(GLuint index, const GLshort *v); +void (GLAPIENTRY *qglVertexAttrib4dv)(GLuint index, const GLdouble *v); +void (GLAPIENTRY *qglVertexAttrib4iv)(GLuint index, const GLint *v); +void (GLAPIENTRY *qglVertexAttrib4bv)(GLuint index, const GLbyte *v); +void (GLAPIENTRY *qglVertexAttrib4ubv)(GLuint index, const GLubyte *v); +void (GLAPIENTRY *qglVertexAttrib4usv)(GLuint index, const GLushort *v); +void (GLAPIENTRY *qglVertexAttrib4uiv)(GLuint index, const GLuint *v); +void (GLAPIENTRY *qglVertexAttrib4Nbv)(GLuint index, const GLbyte *v); +void (GLAPIENTRY *qglVertexAttrib4Nsv)(GLuint index, const GLshort *v); +void (GLAPIENTRY *qglVertexAttrib4Niv)(GLuint index, const GLint *v); +void (GLAPIENTRY *qglVertexAttrib4Nubv)(GLuint index, const GLubyte *v); +void (GLAPIENTRY *qglVertexAttrib4Nusv)(GLuint index, const GLushort *v); +void (GLAPIENTRY *qglVertexAttrib4Nuiv)(GLuint index, const GLuint *v); +void (GLAPIENTRY *qglVertexAttribPointer)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); +void (GLAPIENTRY *qglEnableVertexAttribArray)(GLuint index); +void (GLAPIENTRY *qglDisableVertexAttribArray)(GLuint index); +void (GLAPIENTRY *qglBindAttribLocation)(GLuint programObj, GLuint index, const GLchar *name); +void (GLAPIENTRY *qglGetActiveAttrib)(GLuint programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +GLint (GLAPIENTRY *qglGetAttribLocation)(GLuint programObj, const GLchar *name); +void (GLAPIENTRY *qglGetVertexAttribdv)(GLuint index, GLenum pname, GLdouble *params); +void (GLAPIENTRY *qglGetVertexAttribfv)(GLuint index, GLenum pname, GLfloat *params); +void (GLAPIENTRY *qglGetVertexAttribiv)(GLuint index, GLenum pname, GLint *params); +void (GLAPIENTRY *qglGetVertexAttribPointerv)(GLuint index, GLenum pname, GLvoid **pointer); //GL_ARB_vertex_buffer_object void (GLAPIENTRY *qglBindBufferARB) (GLenum target, GLuint buffer); @@ -638,98 +640,95 @@ static dllfunction_t blendequationfuncs[] = {NULL, NULL} }; -static dllfunction_t shaderobjectsfuncs[] = +static dllfunction_t gl20shaderfuncs[] = { - {"glDeleteObjectARB", (void **) &qglDeleteObjectARB}, - {"glGetHandleARB", (void **) &qglGetHandleARB}, - {"glDetachObjectARB", (void **) &qglDetachObjectARB}, - {"glCreateShaderObjectARB", (void **) &qglCreateShaderObjectARB}, - {"glShaderSourceARB", (void **) &qglShaderSourceARB}, - {"glCompileShaderARB", (void **) &qglCompileShaderARB}, - {"glCreateProgramObjectARB", (void **) &qglCreateProgramObjectARB}, - {"glAttachObjectARB", (void **) &qglAttachObjectARB}, - {"glLinkProgramARB", (void **) &qglLinkProgramARB}, - {"glUseProgramObjectARB", (void **) &qglUseProgramObjectARB}, - {"glValidateProgramARB", (void **) &qglValidateProgramARB}, - {"glUniform1fARB", (void **) &qglUniform1fARB}, - {"glUniform2fARB", (void **) &qglUniform2fARB}, - {"glUniform3fARB", (void **) &qglUniform3fARB}, - {"glUniform4fARB", (void **) &qglUniform4fARB}, - {"glUniform1iARB", (void **) &qglUniform1iARB}, - {"glUniform2iARB", (void **) &qglUniform2iARB}, - {"glUniform3iARB", (void **) &qglUniform3iARB}, - {"glUniform4iARB", (void **) &qglUniform4iARB}, - {"glUniform1fvARB", (void **) &qglUniform1fvARB}, - {"glUniform2fvARB", (void **) &qglUniform2fvARB}, - {"glUniform3fvARB", (void **) &qglUniform3fvARB}, - {"glUniform4fvARB", (void **) &qglUniform4fvARB}, - {"glUniform1ivARB", (void **) &qglUniform1ivARB}, - {"glUniform2ivARB", (void **) &qglUniform2ivARB}, - {"glUniform3ivARB", (void **) &qglUniform3ivARB}, - {"glUniform4ivARB", (void **) &qglUniform4ivARB}, - {"glUniformMatrix2fvARB", (void **) &qglUniformMatrix2fvARB}, - {"glUniformMatrix3fvARB", (void **) &qglUniformMatrix3fvARB}, - {"glUniformMatrix4fvARB", (void **) &qglUniformMatrix4fvARB}, - {"glGetObjectParameterfvARB", (void **) &qglGetObjectParameterfvARB}, - {"glGetObjectParameterivARB", (void **) &qglGetObjectParameterivARB}, - {"glGetInfoLogARB", (void **) &qglGetInfoLogARB}, - {"glGetAttachedObjectsARB", (void **) &qglGetAttachedObjectsARB}, - {"glGetUniformLocationARB", (void **) &qglGetUniformLocationARB}, - {"glGetActiveUniformARB", (void **) &qglGetActiveUniformARB}, - {"glGetUniformfvARB", (void **) &qglGetUniformfvARB}, - {"glGetUniformivARB", (void **) &qglGetUniformivARB}, - {"glGetShaderSourceARB", (void **) &qglGetShaderSourceARB}, - {NULL, NULL} -}; - -static dllfunction_t vertexshaderfuncs[] = -{ -// {"glVertexAttrib1fARB", (void **) &qglVertexAttrib1fARB}, -// {"glVertexAttrib1sARB", (void **) &qglVertexAttrib1sARB}, -// {"glVertexAttrib1dARB", (void **) &qglVertexAttrib1dARB}, -// {"glVertexAttrib2fARB", (void **) &qglVertexAttrib2fARB}, -// {"glVertexAttrib2sARB", (void **) &qglVertexAttrib2sARB}, -// {"glVertexAttrib2dARB", (void **) &qglVertexAttrib2dARB}, -// {"glVertexAttrib3fARB", (void **) &qglVertexAttrib3fARB}, -// {"glVertexAttrib3sARB", (void **) &qglVertexAttrib3sARB}, -// {"glVertexAttrib3dARB", (void **) &qglVertexAttrib3dARB}, -// {"glVertexAttrib4fARB", (void **) &qglVertexAttrib4fARB}, -// {"glVertexAttrib4sARB", (void **) &qglVertexAttrib4sARB}, -// {"glVertexAttrib4dARB", (void **) &qglVertexAttrib4dARB}, -// {"glVertexAttrib4NubARB", (void **) &qglVertexAttrib4NubARB}, -// {"glVertexAttrib1fvARB", (void **) &qglVertexAttrib1fvARB}, -// {"glVertexAttrib1svARB", (void **) &qglVertexAttrib1svARB}, -// {"glVertexAttrib1dvARB", (void **) &qglVertexAttrib1dvARB}, -// {"glVertexAttrib2fvARB", (void **) &qglVertexAttrib1fvARB}, -// {"glVertexAttrib2svARB", (void **) &qglVertexAttrib1svARB}, -// {"glVertexAttrib2dvARB", (void **) &qglVertexAttrib1dvARB}, -// {"glVertexAttrib3fvARB", (void **) &qglVertexAttrib1fvARB}, -// {"glVertexAttrib3svARB", (void **) &qglVertexAttrib1svARB}, -// {"glVertexAttrib3dvARB", (void **) &qglVertexAttrib1dvARB}, -// {"glVertexAttrib4fvARB", (void **) &qglVertexAttrib1fvARB}, -// {"glVertexAttrib4svARB", (void **) &qglVertexAttrib1svARB}, -// {"glVertexAttrib4dvARB", (void **) &qglVertexAttrib1dvARB}, -// {"glVertexAttrib4ivARB", (void **) &qglVertexAttrib1ivARB}, -// {"glVertexAttrib4bvARB", (void **) &qglVertexAttrib1bvARB}, -// {"glVertexAttrib4ubvARB", (void **) &qglVertexAttrib1ubvARB}, -// {"glVertexAttrib4usvARB", (void **) &qglVertexAttrib1usvARB}, -// {"glVertexAttrib4uivARB", (void **) &qglVertexAttrib1uivARB}, -// {"glVertexAttrib4NbvARB", (void **) &qglVertexAttrib1NbvARB}, -// {"glVertexAttrib4NsvARB", (void **) &qglVertexAttrib1NsvARB}, -// {"glVertexAttrib4NivARB", (void **) &qglVertexAttrib1NivARB}, -// {"glVertexAttrib4NubvARB", (void **) &qglVertexAttrib1NubvARB}, -// {"glVertexAttrib4NusvARB", (void **) &qglVertexAttrib1NusvARB}, -// {"glVertexAttrib4NuivARB", (void **) &qglVertexAttrib1NuivARB}, - {"glVertexAttribPointerARB", (void **) &qglVertexAttribPointerARB}, - {"glEnableVertexAttribArrayARB", (void **) &qglEnableVertexAttribArrayARB}, - {"glDisableVertexAttribArrayARB", (void **) &qglDisableVertexAttribArrayARB}, - {"glBindAttribLocationARB", (void **) &qglBindAttribLocationARB}, - {"glGetActiveAttribARB", (void **) &qglGetActiveAttribARB}, - {"glGetAttribLocationARB", (void **) &qglGetAttribLocationARB}, -// {"glGetVertexAttribdvARB", (void **) &qglGetVertexAttribdvARB}, -// {"glGetVertexAttribfvARB", (void **) &qglGetVertexAttribfvARB}, -// {"glGetVertexAttribivARB", (void **) &qglGetVertexAttribivARB}, -// {"glGetVertexAttribPointervARB", (void **) &qglGetVertexAttribPointervARB}, + {"glDeleteShader", (void **) &qglDeleteShader}, + {"glDeleteProgram", (void **) &qglDeleteProgram}, + {"glGetHandle", (void **) &qglGetHandle}, + {"glDetachShader", (void **) &qglDetachShader}, + {"glCreateShader", (void **) &qglCreateShader}, + {"glShaderSource", (void **) &qglShaderSource}, + {"glCompileShader", (void **) &qglCompileShader}, + {"glCreateProgram", (void **) &qglCreateProgram}, + {"glAttachShader", (void **) &qglAttachShader}, + {"glLinkProgram", (void **) &qglLinkProgram}, + {"glUseProgram", (void **) &qglUseProgram}, + {"glValidateProgram", (void **) &qglValidateProgram}, + {"glUniform1f", (void **) &qglUniform1f}, + {"glUniform2f", (void **) &qglUniform2f}, + {"glUniform3f", (void **) &qglUniform3f}, + {"glUniform4f", (void **) &qglUniform4f}, + {"glUniform1i", (void **) &qglUniform1i}, + {"glUniform2i", (void **) &qglUniform2i}, + {"glUniform3i", (void **) &qglUniform3i}, + {"glUniform4i", (void **) &qglUniform4i}, + {"glUniform1fv", (void **) &qglUniform1fv}, + {"glUniform2fv", (void **) &qglUniform2fv}, + {"glUniform3fv", (void **) &qglUniform3fv}, + {"glUniform4fv", (void **) &qglUniform4fv}, + {"glUniform1iv", (void **) &qglUniform1iv}, + {"glUniform2iv", (void **) &qglUniform2iv}, + {"glUniform3iv", (void **) &qglUniform3iv}, + {"glUniform4iv", (void **) &qglUniform4iv}, + {"glUniformMatrix2fv", (void **) &qglUniformMatrix2fv}, + {"glUniformMatrix3fv", (void **) &qglUniformMatrix3fv}, + {"glUniformMatrix4fv", (void **) &qglUniformMatrix4fv}, + {"glGetShaderiv", (void **) &qglGetShaderiv}, + {"glGetProgramiv", (void **) &qglGetProgramiv}, + {"glGetShaderInfoLog", (void **) &qglGetShaderInfoLog}, + {"glGetProgramInfoLog", (void **) &qglGetProgramInfoLog}, + {"glGetAttachedShaders", (void **) &qglGetAttachedShaders}, + {"glGetUniformLocation", (void **) &qglGetUniformLocation}, + {"glGetActiveUniform", (void **) &qglGetActiveUniform}, + {"glGetUniformfv", (void **) &qglGetUniformfv}, + {"glGetUniformiv", (void **) &qglGetUniformiv}, + {"glGetShaderSource", (void **) &qglGetShaderSource}, + {"glVertexAttrib1f", (void **) &qglVertexAttrib1f}, + {"glVertexAttrib1s", (void **) &qglVertexAttrib1s}, + {"glVertexAttrib1d", (void **) &qglVertexAttrib1d}, + {"glVertexAttrib2f", (void **) &qglVertexAttrib2f}, + {"glVertexAttrib2s", (void **) &qglVertexAttrib2s}, + {"glVertexAttrib2d", (void **) &qglVertexAttrib2d}, + {"glVertexAttrib3f", (void **) &qglVertexAttrib3f}, + {"glVertexAttrib3s", (void **) &qglVertexAttrib3s}, + {"glVertexAttrib3d", (void **) &qglVertexAttrib3d}, + {"glVertexAttrib4f", (void **) &qglVertexAttrib4f}, + {"glVertexAttrib4s", (void **) &qglVertexAttrib4s}, + {"glVertexAttrib4d", (void **) &qglVertexAttrib4d}, + {"glVertexAttrib4Nub", (void **) &qglVertexAttrib4Nub}, + {"glVertexAttrib1fv", (void **) &qglVertexAttrib1fv}, + {"glVertexAttrib1sv", (void **) &qglVertexAttrib1sv}, + {"glVertexAttrib1dv", (void **) &qglVertexAttrib1dv}, + {"glVertexAttrib2fv", (void **) &qglVertexAttrib1fv}, + {"glVertexAttrib2sv", (void **) &qglVertexAttrib1sv}, + {"glVertexAttrib2dv", (void **) &qglVertexAttrib1dv}, + {"glVertexAttrib3fv", (void **) &qglVertexAttrib1fv}, + {"glVertexAttrib3sv", (void **) &qglVertexAttrib1sv}, + {"glVertexAttrib3dv", (void **) &qglVertexAttrib1dv}, + {"glVertexAttrib4fv", (void **) &qglVertexAttrib1fv}, + {"glVertexAttrib4sv", (void **) &qglVertexAttrib1sv}, + {"glVertexAttrib4dv", (void **) &qglVertexAttrib1dv}, +// {"glVertexAttrib4iv", (void **) &qglVertexAttrib1iv}, +// {"glVertexAttrib4bv", (void **) &qglVertexAttrib1bv}, +// {"glVertexAttrib4ubv", (void **) &qglVertexAttrib1ubv}, +// {"glVertexAttrib4usv", (void **) &qglVertexAttrib1usv}, +// {"glVertexAttrib4uiv", (void **) &qglVertexAttrib1uiv}, +// {"glVertexAttrib4Nbv", (void **) &qglVertexAttrib1Nbv}, +// {"glVertexAttrib4Nsv", (void **) &qglVertexAttrib1Nsv}, +// {"glVertexAttrib4Niv", (void **) &qglVertexAttrib1Niv}, +// {"glVertexAttrib4Nubv", (void **) &qglVertexAttrib1Nubv}, +// {"glVertexAttrib4Nusv", (void **) &qglVertexAttrib1Nusv}, +// {"glVertexAttrib4Nuiv", (void **) &qglVertexAttrib1Nuiv}, + {"glVertexAttribPointer", (void **) &qglVertexAttribPointer}, + {"glEnableVertexAttribArray", (void **) &qglEnableVertexAttribArray}, + {"glDisableVertexAttribArray", (void **) &qglDisableVertexAttribArray}, + {"glBindAttribLocation", (void **) &qglBindAttribLocation}, + {"glGetActiveAttrib", (void **) &qglGetActiveAttrib}, + {"glGetAttribLocation", (void **) &qglGetAttribLocation}, + {"glGetVertexAttribdv", (void **) &qglGetVertexAttribdv}, + {"glGetVertexAttribfv", (void **) &qglGetVertexAttribfv}, + {"glGetVertexAttribiv", (void **) &qglGetVertexAttribiv}, + {"glGetVertexAttribPointerv", (void **) &qglGetVertexAttribPointerv}, {NULL, NULL} }; @@ -833,6 +832,7 @@ void VID_CheckExtensions(void) { if (!GL_CheckExtension("1.1", opengl110funcs, NULL, false)) Sys_Error("OpenGL 1.1.0 functions not found"); + vid.support.gl20shaders = GL_CheckExtension("2.0", gl20shaderfuncs, "-noshaders", false); CHECKGLERROR @@ -841,11 +841,8 @@ void VID_CheckExtensions(void) 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); - vid.support.arb_fragment_shader = GL_CheckExtension("GL_ARB_fragment_shader", NULL, "-nofragmentshader", false); vid.support.arb_multitexture = GL_CheckExtension("GL_ARB_multitexture", multitexturefuncs, "-nomtex", false); vid.support.arb_occlusion_query = GL_CheckExtension("GL_ARB_occlusion_query", occlusionqueryfuncs, "-noocclusionquery", false); - vid.support.arb_shader_objects = GL_CheckExtension("GL_ARB_shader_objects", shaderobjectsfuncs, "-noshaderobjects", false); - vid.support.arb_shading_language_100 = GL_CheckExtension("GL_ARB_shading_language_100", NULL, "-noshadinglanguage100", false); vid.support.arb_shadow = GL_CheckExtension("GL_ARB_shadow", NULL, "-noshadow", false); vid.support.arb_texture_compression = GL_CheckExtension("GL_ARB_texture_compression", texturecompressionfuncs, "-notexturecompression", false); vid.support.arb_texture_cube_map = GL_CheckExtension("GL_ARB_texture_cube_map", NULL, "-nocubemap", false); @@ -853,7 +850,6 @@ void VID_CheckExtensions(void) vid.support.arb_texture_gather = GL_CheckExtension("GL_ARB_texture_gather", NULL, "-notexturegather", false); vid.support.arb_texture_non_power_of_two = GL_CheckExtension("GL_ARB_texture_non_power_of_two", NULL, "-notexturenonpoweroftwo", false); vid.support.arb_vertex_buffer_object = GL_CheckExtension("GL_ARB_vertex_buffer_object", vbofuncs, "-novbo", false); - vid.support.arb_vertex_shader = GL_CheckExtension("GL_ARB_vertex_shader", vertexshaderfuncs, "-novertexshader", false); vid.support.ati_separate_stencil = GL_CheckExtension("2.0", gl2separatestencilfuncs, "-noseparatestencil", true) || GL_CheckExtension("GL_ATI_separate_stencil", atiseparatestencilfuncs, "-noseparatestencil", false); vid.support.ext_blend_minmax = GL_CheckExtension("GL_EXT_blend_minmax", blendequationfuncs, "-noblendminmax", false); vid.support.ext_blend_subtract = GL_CheckExtension("GL_EXT_blend_subtract", blendequationfuncs, "-noblendsubtract", false); @@ -864,6 +860,7 @@ void VID_CheckExtensions(void) vid.support.ext_texture_compression_s3tc = GL_CheckExtension("GL_EXT_texture_compression_s3tc", NULL, "-nos3tc", false); vid.support.ext_texture_edge_clamp = GL_CheckExtension("GL_EXT_texture_edge_clamp", NULL, "-noedgeclamp", false) || GL_CheckExtension("GL_SGIS_texture_edge_clamp", NULL, "-noedgeclamp", false); vid.support.ext_texture_filter_anisotropic = GL_CheckExtension("GL_EXT_texture_filter_anisotropic", NULL, "-noanisotropy", false); +// COMMANDLINEOPTION: GL: -noshaders disables use of OpenGL 2.0 shaders (which allow pixel shader effects, can improve per pixel lighting performance and capabilities) // COMMANDLINEOPTION: GL: -noanisotropy disables GL_EXT_texture_filter_anisotropic (allows higher quality texturing) // COMMANDLINEOPTION: GL: -noblendminmax disables GL_EXT_blend_minmax // COMMANDLINEOPTION: GL: -noblendsubtract disables GL_EXT_blend_subtract @@ -874,13 +871,10 @@ void VID_CheckExtensions(void) // COMMANDLINEOPTION: GL: -nodrawrangeelements disables GL_EXT_draw_range_elements (renders faster) // COMMANDLINEOPTION: GL: -noedgeclamp disables GL_EXT_texture_edge_clamp or GL_SGIS_texture_edge_clamp (recommended, some cards do not support the other texture clamp method) // COMMANDLINEOPTION: GL: -nofbo disables GL_EXT_framebuffer_object (which accelerates rendering), only used if GL_ARB_fragment_shader is also available -// COMMANDLINEOPTION: GL: -nofragmentshader disables GL_ARB_fragment_shader (allows pixel shader effects, can improve per pixel lighting performance and capabilities) // COMMANDLINEOPTION: GL: -nomtex disables GL_ARB_multitexture (required for faster map rendering) // COMMANDLINEOPTION: GL: -noocclusionquery disables GL_ARB_occlusion_query (which allows coronas to fade according to visibility, and potentially used for rendering optimizations) // COMMANDLINEOPTION: GL: -nos3tc disables GL_EXT_texture_compression_s3tc (which allows use of .dds texture caching) // COMMANDLINEOPTION: GL: -noseparatestencil disables use of OpenGL2.0 glStencilOpSeparate and GL_ATI_separate_stencil extensions (which accelerate shadow rendering) -// COMMANDLINEOPTION: GL: -noshaderobjects disables GL_ARB_shader_objects (required for vertex shader and fragment shader) -// COMMANDLINEOPTION: GL: -noshadinglanguage100 disables GL_ARB_shading_language_100 (required for vertex shader and fragment shader) // COMMANDLINEOPTION: GL: -noshadow disables use of GL_ARB_shadow (required for hardware shadowmap filtering) // COMMANDLINEOPTION: GL: -nostenciltwoside disables GL_EXT_stencil_two_side (which accelerate shadow rendering) // COMMANDLINEOPTION: GL: -notexture3d disables GL_EXT_texture3D (required for spherical lights, otherwise they render as a column) @@ -889,18 +883,16 @@ void VID_CheckExtensions(void) // COMMANDLINEOPTION: GL: -notexturegather disables GL_ARB_texture_gather (which provides fetch4 sampling) // COMMANDLINEOPTION: GL: -notexturenonpoweroftwo disables GL_ARB_texture_non_power_of_two (which saves video memory if it is supported, but crashes on some buggy drivers) // COMMANDLINEOPTION: GL: -novbo disables GL_ARB_vertex_buffer_object (which accelerates rendering) -// COMMANDLINEOPTION: GL: -novertexshader disables GL_ARB_vertex_shader (allows vertex shader effects) if (vid.support.arb_draw_buffers) qglGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, (GLint*)&vid.maxdrawbuffers); // disable non-power-of-two textures on Radeon X1600 and other cards that do not accelerate it with some filtering modes / repeat modes that we use // we detect these cards by checking if the hardware supports vertex texture fetch (Geforce6 does, Radeon X1600 does not, all GL3-class hardware does) - if(vid.support.arb_texture_non_power_of_two) + if(vid.support.arb_texture_non_power_of_two && vid.support.gl20shaders) { int val = 0; - if (vid.support.arb_vertex_shader) - qglGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB, &val);CHECKGLERROR + qglGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &val);CHECKGLERROR if (val < 1) vid.support.arb_texture_non_power_of_two = false; } @@ -927,11 +919,11 @@ void VID_CheckExtensions(void) vid.texunits = vid.teximageunits = vid.texarrayunits = 1; if (vid.support.arb_multitexture) qglGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, (GLint*)&vid.texunits); - if (vid_gl20.integer && vid.support.arb_fragment_shader && vid.support.arb_vertex_shader && vid.support.arb_shader_objects) + if (vid_gl20.integer && vid.support.gl20shaders) { qglGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, (GLint*)&vid.texunits); - qglGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, (int *)&vid.teximageunits);CHECKGLERROR - qglGetIntegerv(GL_MAX_TEXTURE_COORDS_ARB, (int *)&vid.texarrayunits);CHECKGLERROR + qglGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, (int *)&vid.teximageunits);CHECKGLERROR + qglGetIntegerv(GL_MAX_TEXTURE_COORDS, (int *)&vid.texarrayunits);CHECKGLERROR vid.texunits = bound(4, vid.texunits, MAX_TEXTUREUNITS); vid.teximageunits = bound(16, vid.teximageunits, MAX_TEXTUREUNITS); vid.texarrayunits = bound(8, vid.texarrayunits, MAX_TEXTUREUNITS);