From: Mikko Rasa Date: Wed, 25 Jul 2012 19:48:44 +0000 (+0300) Subject: Fix compiler warnings X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=48fc090a59a5ff5c3f06ffe1acfe77b06dad2a86;p=libs%2Fgl.git Fix compiler warnings --- diff --git a/source/pixelformat.h b/source/pixelformat.h index dfe632b6..145e2a38 100644 --- a/source/pixelformat.h +++ b/source/pixelformat.h @@ -35,7 +35,7 @@ enum PixelFormat LUMINANCE_ALPHA = GL_LUMINANCE_ALPHA, LUMINANCE_ALPHA8 = GL_LUMINANCE8_ALPHA8, LUMINANCE_ALPHA16F = GL_LUMINANCE_ALPHA16F_ARB, - LUMINANCE_ALPHA32F = GL_LUMINANCE_ALPHA32F_ARB, + LUMINANCE_ALPHA32F = GL_LUMINANCE_ALPHA32F_ARB }; void operator>>(const LexicalConverter &, PixelFormat &); diff --git a/source/program.cpp b/source/program.cpp index 8511b8c1..f6eaed1e 100644 --- a/source/program.cpp +++ b/source/program.cpp @@ -240,9 +240,11 @@ string Program::get_info_log() const { GLsizei len = 0; glGetObjectParameterivARB(id, GL_OBJECT_INFO_LOG_LENGTH_ARB, &len); - char log[len+1]; - glGetInfoLogARB(id, len+1, &len, log); - return string(log, len); + char *buf = new char[len+1]; + glGetInfoLogARB(id, len+1, &len, buf); + string log(buf, len); + delete[] buf; + return log; } void Program::bind() const diff --git a/source/shader.cpp b/source/shader.cpp index 0f60edcd..cdb50c96 100644 --- a/source/shader.cpp +++ b/source/shader.cpp @@ -66,9 +66,11 @@ string Shader::get_info_log() const { GLsizei len = 0; glGetObjectParameterivARB(id, GL_OBJECT_INFO_LOG_LENGTH_ARB, &len); - char log[len+1]; - glGetInfoLogARB(id, len+1, &len, log); - return string(log, len); + char *buf = new char[len+1]; + glGetInfoLogARB(id, len+1, &len, buf); + string log(buf, len); + delete[] buf; + return log; } } // namespace GL diff --git a/source/shadowmap.cpp b/source/shadowmap.cpp index 42e636a3..11403c6d 100644 --- a/source/shadowmap.cpp +++ b/source/shadowmap.cpp @@ -102,9 +102,9 @@ void ShadowMap::prepare() depth_buf.bind_to(unit); float diam = radius*2; - float s_eq[4] = { matrix[0]/diam, matrix[4]/diam, matrix[8]/diam, matrix[12]/diam+0.5 }; - float t_eq[4] = { matrix[1]/diam, matrix[5]/diam, matrix[9]/diam, matrix[13]/diam+0.5 }; - float r_eq[4] = { -matrix[2]/diam, -matrix[6]/diam, -matrix[10]/diam, 0.5-matrix[14]/diam-4.0/size }; + float s_eq[4] = { matrix[0]/diam, matrix[4]/diam, matrix[8]/diam, matrix[12]/diam+0.5f }; + float t_eq[4] = { matrix[1]/diam, matrix[5]/diam, matrix[9]/diam, matrix[13]/diam+0.5f }; + float r_eq[4] = { -matrix[2]/diam, -matrix[6]/diam, -matrix[10]/diam, 0.5f-matrix[14]/diam-4.0f/size }; glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); glTexGenfv(GL_S, GL_EYE_PLANE, s_eq); enable(GL_TEXTURE_GEN_S);