Example #1
0
void GLColor4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a)
{
    if( gRenderer->openGL2() )
    {
        CCSetUniformVector4( UNIFORM_MODELCOLOUR, r, g, b, a );
    }
    else
    {
#ifdef IOS
        glColor4f( r, g, b, a );
#endif
    }

//    What if we wanted to modify the vertex colours?
//    const int verts = 1024;
//    static GLfloat colours[verts*4];
//    for( int i=0; i<verts; ++i )
//    {
//        colours[i*4+0] = r;
//        colours[i*4+1] = g;
//        colours[i*4+2] = b;
//        colours[i*4+3] = a;
//    }
//    GLVertexAttribPointer( ATTRIB_COLOUR, 4, GL_FLOAT, true, 0, colours );
}
Example #2
0
void CCRefreshRenderAttributes()
{
    GLColor4f( currentColour.red, currentColour.green, currentColour.blue, currentColour.alpha );
    GLTexCoordPointer( 2, GL_FLOAT, 0, currentUVs );
    
    CCSetUniformVector3( UNIFORM_LIGHTPOSITION, 0.0f, 0.0f, 1.0f );
    CCSetUniformVector4( UNIFORM_LIGHTDIFFUSE, 1.0f, 1.0f, 1.0f, 1.0f );
}