-fixed a bug in setting shader constants.
passing arrays were not working, can an openGL programmer check this is now right? -let the user add a shader without a pixel or vertex shader, as docs state. git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1080 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
29b968088a
commit
1abb464b49
|
@ -102,11 +102,14 @@ void COpenGLSLMaterialRenderer::init(s32& outMaterialTypeNr,
|
|||
return;
|
||||
|
||||
#if defined(GL_ARB_vertex_shader) && defined (GL_ARB_fragment_shader)
|
||||
if (!createShader(GL_VERTEX_SHADER_ARB, vertexShaderProgram))
|
||||
return;
|
||||
if (vertexShaderProgram)
|
||||
if (!createShader(GL_VERTEX_SHADER_ARB, vertexShaderProgram))
|
||||
return;
|
||||
|
||||
if (!createShader(GL_FRAGMENT_SHADER_ARB, pixelShaderProgram))
|
||||
return;
|
||||
|
||||
if (pixelShaderProgram)
|
||||
if (!createShader(GL_FRAGMENT_SHADER_ARB, pixelShaderProgram))
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (!linkProgram())
|
||||
|
@ -317,31 +320,33 @@ bool COpenGLSLMaterialRenderer::setPixelShaderConstant(const c8* name, const f32
|
|||
return false;
|
||||
|
||||
#ifdef GL_ARB_shader_objects
|
||||
GLint Location=Driver->extGlGetUniformLocation(Program,name);
|
||||
|
||||
switch (UniformInfo[i].type)
|
||||
{
|
||||
case GL_FLOAT:
|
||||
Driver->extGlUniform1fv(i, count, floats);
|
||||
Driver->extGlUniform1fv(Location, count, floats);
|
||||
break;
|
||||
case GL_FLOAT_VEC2_ARB:
|
||||
Driver->extGlUniform2fv(i, count/2, floats);
|
||||
Driver->extGlUniform2fv(Location, count/2, floats);
|
||||
break;
|
||||
case GL_FLOAT_VEC3_ARB:
|
||||
Driver->extGlUniform3fv(i, count/3, floats);
|
||||
Driver->extGlUniform3fv(Location, count/3, floats);
|
||||
break;
|
||||
case GL_FLOAT_VEC4_ARB:
|
||||
Driver->extGlUniform4fv(i, count/4, floats);
|
||||
Driver->extGlUniform4fv(Location, count/4, floats);
|
||||
break;
|
||||
case GL_FLOAT_MAT2_ARB:
|
||||
Driver->extGlUniformMatrix2fv(i, count/4, false, floats);
|
||||
Driver->extGlUniformMatrix2fv(Location, count/4, false, floats);
|
||||
break;
|
||||
case GL_FLOAT_MAT3_ARB:
|
||||
Driver->extGlUniformMatrix3fv(i, count/9, false, floats);
|
||||
Driver->extGlUniformMatrix3fv(Location, count/9, false, floats);
|
||||
break;
|
||||
case GL_FLOAT_MAT4_ARB:
|
||||
Driver->extGlUniformMatrix4fv(i, count/16, false, floats);
|
||||
Driver->extGlUniformMatrix4fv(Location, count/16, false, floats);
|
||||
break;
|
||||
default:
|
||||
Driver->extGlUniform1iv(i, count, reinterpret_cast<const GLint*>(floats));
|
||||
Driver->extGlUniform1iv(Location, count, reinterpret_cast<const GLint*>(floats));
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue