Hi there, i am also using the ogl-es branch for an iPhone game and realized that ES2.0 does not work correctly like described in that post.
However commenting out useTexture[0] in the shaders is NOT the solution !
I guess it went unnoticed by many because the error message for the "Cannot find uniform" is a widestring and outputted garbled in the debugwindow.
The Problem lies deeper, it just does not get the uniforms correctly form the shader because arrays are represented by some drivers with an additional [0] to the name.
To find the uniform useTexture you have to look after useTexture and useTexture[0].
I fixed that (code below) and it renders just fine now, however the performance is really really bad.
30fps with 20k polys and GL ES 1.0 versus
5fps with GL ES 2.0 now
Anyone got an idea here ?!
Here is the hack to fix both issues :
In COGLES2SLMaterialRenderer.cpp replace the block beginning with:
Code: Select all
for ( int i = 0; i < UniformCount; ++i )
{
int j;
for ( j = 0; j < num; ++j )
{
if ( names[j] == UniformStringTable[i] )
break;
...
with :
Code: Select all
for ( int i = 0; i < UniformCount; ++i )
{
int j;
for ( j = 0; j < num; ++j )
{
if ( names[j] == UniformStringTable[i] )
break;
// XXX: hack, also search for name[0]
core::stringc tempname = UniformStringTable[i];
if ( names[j] == tempname + "[0]" )
break;
}
if ( j < num )
{
UniformInfo.push_back( uni[j] );
}
else
{
// XXX: hack
//wchar_t buf[512];
//swprintf( buf, 512, L"Unable to find uniform : %S", UniformStringTable[i] );
char buf[512];
sprintf( buf, "Unable to find uniform : %s", UniformStringTable[i] );
os::Printer::log( buf, ELL_WARNING );
SUniformInfo blank;
blank.location = -1;
blank.type = GL_INVALID_ENUM;
UniformInfo.push_back( blank );
}
}