Commit cad8bd98 authored by hybrid's avatar hybrid

Fix problems with older compiler versions on OSX

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4440 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 186ee4a9
...@@ -106,8 +106,9 @@ COpenGLSLMaterialRenderer::~COpenGLSLMaterialRenderer() ...@@ -106,8 +106,9 @@ COpenGLSLMaterialRenderer::~COpenGLSLMaterialRenderer()
GLint count; GLint count;
Driver->extGlGetAttachedObjects(Program, 8, &count, shaders); Driver->extGlGetAttachedObjects(Program, 8, &count, shaders);
// avoid bugs in some drivers, which return larger numbers // avoid bugs in some drivers, which return larger numbers
count=core::min_(count,8); // use int variable to avoid compiler problems with template
for (GLint i=0; i<count; ++i) int mincount=core::min_((int)count,8);
for (int i=0; i<mincount; ++i)
Driver->extGlDeleteObject(shaders[i]); Driver->extGlDeleteObject(shaders[i]);
Driver->extGlDeleteObject(Program); Driver->extGlDeleteObject(Program);
Program = 0; Program = 0;
...@@ -119,8 +120,9 @@ COpenGLSLMaterialRenderer::~COpenGLSLMaterialRenderer() ...@@ -119,8 +120,9 @@ COpenGLSLMaterialRenderer::~COpenGLSLMaterialRenderer()
GLint count; GLint count;
Driver->extGlGetAttachedShaders(Program2, 8, &count, shaders); Driver->extGlGetAttachedShaders(Program2, 8, &count, shaders);
// avoid bugs in some drivers, which return larger numbers // avoid bugs in some drivers, which return larger numbers
count=core::min_(count,8); // use int variable to avoid compiler problems with template
for (GLint i=0; i<count; ++i) int mincount=core::min_((int)count,8);
for (int i=0; i<mincount; ++i)
Driver->extGlDeleteShader(shaders[i]); Driver->extGlDeleteShader(shaders[i]);
Driver->extGlDeleteProgram(Program2); Driver->extGlDeleteProgram(Program2);
Program2 = 0; Program2 = 0;
...@@ -583,7 +585,7 @@ bool COpenGLSLMaterialRenderer::setPixelShaderConstant(s32 index, const f32* flo ...@@ -583,7 +585,7 @@ bool COpenGLSLMaterialRenderer::setPixelShaderConstant(s32 index, const f32* flo
{ {
if(floats) if(floats)
{ {
const GLint id = *floats; const GLint id = static_cast<const GLint>(*floats);
Driver->extGlUniform1iv(UniformInfo[index].location, 1, &id); Driver->extGlUniform1iv(UniformInfo[index].location, 1, &id);
} }
else else
...@@ -612,19 +614,19 @@ bool COpenGLSLMaterialRenderer::setPixelShaderConstant(s32 index, const s32* int ...@@ -612,19 +614,19 @@ bool COpenGLSLMaterialRenderer::setPixelShaderConstant(s32 index, const s32* int
{ {
case GL_INT: case GL_INT:
case GL_BOOL: case GL_BOOL:
Driver->extGlUniform1iv(UniformInfo[index].location, count, ints); Driver->extGlUniform1iv(UniformInfo[index].location, count, reinterpret_cast<const GLint*>(ints));
break; break;
case GL_INT_VEC2: case GL_INT_VEC2:
case GL_BOOL_VEC2: case GL_BOOL_VEC2:
Driver->extGlUniform2iv(UniformInfo[index].location, count/2, ints); Driver->extGlUniform2iv(UniformInfo[index].location, count/2, reinterpret_cast<const GLint*>(ints));
break; break;
case GL_INT_VEC3: case GL_INT_VEC3:
case GL_BOOL_VEC3: case GL_BOOL_VEC3:
Driver->extGlUniform3iv(UniformInfo[index].location, count/3, ints); Driver->extGlUniform3iv(UniformInfo[index].location, count/3, reinterpret_cast<const GLint*>(ints));
break; break;
case GL_INT_VEC4: case GL_INT_VEC4:
case GL_BOOL_VEC4: case GL_BOOL_VEC4:
Driver->extGlUniform4iv(UniformInfo[index].location, count/4, ints); Driver->extGlUniform4iv(UniformInfo[index].location, count/4, reinterpret_cast<const GLint*>(ints));
break; break;
case GL_SAMPLER_1D: case GL_SAMPLER_1D:
case GL_SAMPLER_2D: case GL_SAMPLER_2D:
...@@ -632,7 +634,7 @@ bool COpenGLSLMaterialRenderer::setPixelShaderConstant(s32 index, const s32* int ...@@ -632,7 +634,7 @@ bool COpenGLSLMaterialRenderer::setPixelShaderConstant(s32 index, const s32* int
case GL_SAMPLER_CUBE: case GL_SAMPLER_CUBE:
case GL_SAMPLER_1D_SHADOW: case GL_SAMPLER_1D_SHADOW:
case GL_SAMPLER_2D_SHADOW: case GL_SAMPLER_2D_SHADOW:
Driver->extGlUniform1iv(UniformInfo[index].location, 1, ints); Driver->extGlUniform1iv(UniformInfo[index].location, 1, reinterpret_cast<const GLint*>(ints));
break; break;
default: default:
status = false; status = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment