diff --git a/src/graphics/opengl/glutil.cpp b/src/graphics/opengl/glutil.cpp index 97ccdd4c..3c812ed9 100644 --- a/src/graphics/opengl/glutil.cpp +++ b/src/graphics/opengl/glutil.cpp @@ -471,9 +471,12 @@ GLint LoadShader(GLint type, const char* filename) return 0; } - GLchar source[65536]; - GLchar *sources[] = { source }; - int length = PHYSFS_read(file, source, 1, 65536); + size_t len = PHYSFS_fileLength(file); + + std::vector source(len + 1); + + GLchar *sources[] = { source.data() }; + size_t length = PHYSFS_read(file, source.data(), 1, len); source[length] = '\0'; PHYSFS_close(file); @@ -503,7 +506,7 @@ GLint LoadShader(GLint type, const char* filename) return shader; } -GLint LinkProgram(int count, GLint shaders[]) +GLint LinkProgram(int count, const GLint* shaders) { GLint program = glCreateProgram(); diff --git a/src/graphics/opengl/glutil.h b/src/graphics/opengl/glutil.h index f92888a4..c205a0cc 100644 --- a/src/graphics/opengl/glutil.h +++ b/src/graphics/opengl/glutil.h @@ -99,7 +99,7 @@ std::string GetLastShaderError(); GLint LoadShader(GLint type, const char* filename); -GLint LinkProgram(int count, GLint shaders[]); +GLint LinkProgram(int count, const GLint* shaders); // TODO: Moved this here temporarily only to remove code duplication in CGLDeviceXX struct PreparedTextureData