Fix some more typos in gl extension usage and new GLSL interface

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3226 dfc29bdd-3216-0410-991c-e03cc46cb475
master
hybrid 2010-02-16 19:55:47 +00:00
parent aee05c3199
commit 9c4bb40b6c
2 changed files with 34 additions and 22 deletions

View File

@ -170,8 +170,8 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
pGlGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC) wglGetProcAddress("glGetShaderInfoLog");
pGlGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC) wglGetProcAddress("glGetProgramInfoLog");
pGlGetObjectParameterivARB = (PFNGLGETOBJECTPARAMETERIVARBPROC) wglGetProcAddress("glGetObjectParameterivARB");
pGlGetShaderiv = (PFNGLGETSHADERIVPROC) wglGetProcAddress("glGetShader");
pGlGetProgramiv = (PFNGLGETPROGRAMIVPROC) wglGetProcAddress("glGetProgram");
pGlGetShaderiv = (PFNGLGETSHADERIVPROC) wglGetProcAddress("glGetShaderiv");
pGlGetProgramiv = (PFNGLGETPROGRAMIVPROC) wglGetProcAddress("glGetProgramiv");
pGlGetUniformLocationARB = (PFNGLGETUNIFORMLOCATIONARBPROC) wglGetProcAddress("glGetUniformLocationARB");
pGlGetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC) wglGetProcAddress("glGetUniformLocation");
pGlUniform4fvARB = (PFNGLUNIFORM4FVARBPROC) wglGetProcAddress("glUniform4fvARB");
@ -370,10 +370,10 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
IRR_OGL_LOAD_EXTENSION(reinterpret_cast<const GLubyte*>("glGetObjectParameterivARB"));
pGlGetShaderiv = (PFNGLGETSHADERIVPROC)
IRR_OGL_LOAD_EXTENSION(reinterpret_cast<const GLubyte*>("glGetShader"));
IRR_OGL_LOAD_EXTENSION(reinterpret_cast<const GLubyte*>("glGetShaderiv"));
pGlGetProgramiv = (PFNGLGETPROGRAMIVPROC)
IRR_OGL_LOAD_EXTENSION(reinterpret_cast<const GLubyte*>("glGetProgram"));
IRR_OGL_LOAD_EXTENSION(reinterpret_cast<const GLubyte*>("glGetProgramiv"));
pGlGetUniformLocationARB = (PFNGLGETUNIFORMLOCATIONARBPROC)
IRR_OGL_LOAD_EXTENSION(reinterpret_cast<const GLubyte*>("glGetUniformLocationARB"));

View File

@ -252,7 +252,7 @@ bool COpenGLSLMaterialRenderer::createShader(GLenum shaderType, const char* shad
if (Program2)
{
GLuint shaderHandle = Driver->extGlCreateShader(shaderType);
Driver->extGlShaderSource(Program2, 1, &shader, NULL);
Driver->extGlShaderSource(shaderHandle, 1, &shader, NULL);
Driver->extGlCompileShader(shaderHandle);
GLint status = 0;
@ -261,7 +261,7 @@ bool COpenGLSLMaterialRenderer::createShader(GLenum shaderType, const char* shad
Driver->extGlGetShaderiv(shaderHandle, GL_COMPILE_STATUS, &status);
#endif
if (!status)
if (status != GL_TRUE)
{
os::Printer::log("GLSL shader failed to compile", ELL_ERROR);
// check error message and log it
@ -271,10 +271,13 @@ bool COpenGLSLMaterialRenderer::createShader(GLenum shaderType, const char* shad
Driver->extGlGetShaderiv(shaderHandle, GL_INFO_LOG_LENGTH,
&maxLength);
#endif
GLchar *infoLog = new GLchar[maxLength];
Driver->extGlGetShaderInfoLog(shaderHandle, maxLength, &length, infoLog);
os::Printer::log(reinterpret_cast<const c8*>(infoLog), ELL_ERROR);
delete [] infoLog;
if (maxLength)
{
GLchar *infoLog = new GLchar[maxLength];
Driver->extGlGetShaderInfoLog(shaderHandle, maxLength, &length, infoLog);
os::Printer::log(reinterpret_cast<const c8*>(infoLog), ELL_ERROR);
delete [] infoLog;
}
return false;
}
@ -304,10 +307,13 @@ bool COpenGLSLMaterialRenderer::createShader(GLenum shaderType, const char* shad
Driver->extGlGetObjectParameteriv(shaderHandle,
GL_OBJECT_INFO_LOG_LENGTH_ARB, &maxLength);
#endif
GLcharARB *infoLog = new GLcharARB[maxLength];
Driver->extGlGetInfoLog(shaderHandle, maxLength, &length, infoLog);
os::Printer::log(reinterpret_cast<const c8*>(infoLog), ELL_ERROR);
delete [] infoLog;
if (maxLength)
{
GLcharARB *infoLog = new GLcharARB[maxLength];
Driver->extGlGetInfoLog(shaderHandle, maxLength, &length, infoLog);
os::Printer::log(reinterpret_cast<const c8*>(infoLog), ELL_ERROR);
delete [] infoLog;
}
return false;
}
@ -339,10 +345,13 @@ bool COpenGLSLMaterialRenderer::linkProgram()
#ifdef GL_VERSION_2_0
Driver->extGlGetProgramiv(Program2, GL_INFO_LOG_LENGTH, &maxLength);
#endif
GLchar *infoLog = new GLchar[maxLength];
Driver->extGlGetProgramInfoLog(Program2, maxLength, &length, infoLog);
os::Printer::log(reinterpret_cast<const c8*>(infoLog), ELL_ERROR);
delete [] infoLog;
if (maxLength)
{
GLchar *infoLog = new GLchar[maxLength];
Driver->extGlGetProgramInfoLog(Program2, maxLength, &length, infoLog);
os::Printer::log(reinterpret_cast<const c8*>(infoLog), ELL_ERROR);
delete [] infoLog;
}
return false;
}
@ -412,10 +421,13 @@ bool COpenGLSLMaterialRenderer::linkProgram()
Driver->extGlGetObjectParameteriv(Program,
GL_OBJECT_INFO_LOG_LENGTH_ARB, &maxLength);
#endif
GLcharARB *infoLog = new GLcharARB[maxLength];
Driver->extGlGetInfoLog(Program, maxLength, &length, infoLog);
os::Printer::log(reinterpret_cast<const c8*>(infoLog), ELL_ERROR);
delete [] infoLog;
if (maxLength)
{
GLcharARB *infoLog = new GLcharARB[maxLength];
Driver->extGlGetInfoLog(Program, maxLength, &length, infoLog);
os::Printer::log(reinterpret_cast<const c8*>(infoLog), ELL_ERROR);
delete [] infoLog;
}
return false;
}