|
|
|
@ -118,22 +118,25 @@ namespace NL3D
|
|
|
|
|
|
|
|
|
|
bool CDriverGL3::renderTriangles2( CMaterial &mat, uint32 startIndex, uint32 numTris )
|
|
|
|
|
{
|
|
|
|
|
if( !setupMaterial( mat ) )
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if( !setupProgram( mat ) )
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
//glDrawArrays( GL_TRIANGLES, startIndex * 3, numTris * 3 );
|
|
|
|
|
|
|
|
|
|
if( numTris )
|
|
|
|
|
{
|
|
|
|
|
if (_LastIB._Format == CIndexBuffer::Indices16)
|
|
|
|
|
{
|
|
|
|
|
glDrawElements(GL_TRIANGLES,3*numTris,GL_UNSIGNED_SHORT, ((uint16 *) _LastIB._Values)+startIndex);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
nlassert(_LastIB._Format == CIndexBuffer::Indices32);
|
|
|
|
|
glDrawElements(GL_TRIANGLES,3*numTris,GL_UNSIGNED_INT, ((uint32 *) _LastIB._Values)+startIndex);
|
|
|
|
|
}
|
|
|
|
|
if( numTris )
|
|
|
|
|
{
|
|
|
|
|
if (_LastIB._Format == CIndexBuffer::Indices16)
|
|
|
|
|
{
|
|
|
|
|
glDrawElements(GL_TRIANGLES,3*numTris,GL_UNSIGNED_SHORT, ((uint16 *) _LastIB._Values)+startIndex);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
nlassert(_LastIB._Format == CIndexBuffer::Indices32);
|
|
|
|
|
glDrawElements(GL_TRIANGLES,3*numTris,GL_UNSIGNED_INT, ((uint32 *) _LastIB._Values)+startIndex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
releaseProgram();
|
|
|
|
@ -186,9 +189,7 @@ namespace NL3D
|
|
|
|
|
p->attachPixelProgram( pp );
|
|
|
|
|
if( !p->link( log ) )
|
|
|
|
|
{
|
|
|
|
|
delete vp;
|
|
|
|
|
vp = NULL;
|
|
|
|
|
delete pp;
|
|
|
|
|
pp = NULL;
|
|
|
|
|
delete p;
|
|
|
|
|
p = NULL;
|
|
|
|
@ -206,6 +207,13 @@ namespace NL3D
|
|
|
|
|
setUniformMatrix4fv( mvpIndex, 1, false, mat.get() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch( mat.getShader() )
|
|
|
|
|
{
|
|
|
|
|
case CMaterial::Normal:
|
|
|
|
|
setupNormalPass();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|