for (Iterator iterator = uniforms.keySet().iterator(); iterator .hasNext();) { ShaderUniform uniformVar = (ShaderUniform) uniforms .get((String) iterator.next());
for (int x = uniforms.size(); --x >= 0; ) { ShaderUniform uniformVar = (ShaderUniform) uniforms.get(x);
    public void apply() {        if (isSupported()) {            if (isEnabled()) {                if (programID != -1) {                    // Apply the shader...                    ARBShaderObjects.glUseProgramObjectARB(programID);                    // Assign uniforms...                    if (!uniforms.isEmpty()) {                        for (Iterator iterator = uniforms.keySet().iterator(); iterator                                .hasNext();) {                            ShaderUniform uniformVar = (ShaderUniform) uniforms                                    .get((String) iterator.next());                            switch (uniformVar.type) {                            case ShaderUniform.SU_INT:                                ARBShaderObjects.glUniform1iARB(                                        getUniLoc(uniformVar.name),                                        uniformVar.vint[0]);                                break;                            case ShaderUniform.SU_INT2:                                ARBShaderObjects.glUniform2iARB(                                        getUniLoc(uniformVar.name),                                        uniformVar.vint[0], uniformVar.vint[1]);                                break;                            case ShaderUniform.SU_INT3:                                ARBShaderObjects.glUniform3iARB(                                        getUniLoc(uniformVar.name),                                        uniformVar.vint[0], uniformVar.vint[1],                                        uniformVar.vint[2]);                                break;                            case ShaderUniform.SU_INT4:                                ARBShaderObjects.glUniform4iARB(                                        getUniLoc(uniformVar.name),                                        uniformVar.vint[0], uniformVar.vint[1],                                        uniformVar.vint[2], uniformVar.vint[3]);                                break;                            case ShaderUniform.SU_FLOAT:                                ARBShaderObjects.glUniform1fARB(                                        getUniLoc(uniformVar.name),                                        uniformVar.vfloat[0]);                                break;                            case ShaderUniform.SU_FLOAT2:                                ARBShaderObjects.glUniform2fARB(                                        getUniLoc(uniformVar.name),                                        uniformVar.vfloat[0],                                        uniformVar.vfloat[1]);                                break;                            case ShaderUniform.SU_FLOAT3:                                ARBShaderObjects.glUniform3fARB(                                        getUniLoc(uniformVar.name),                                        uniformVar.vfloat[0],                                        uniformVar.vfloat[1],                                        uniformVar.vfloat[2]);                                break;                            case ShaderUniform.SU_FLOAT4:                                ARBShaderObjects.glUniform4fARB(                                        getUniLoc(uniformVar.name),                                        uniformVar.vfloat[0],                                        uniformVar.vfloat[1],                                        uniformVar.vfloat[2],                                        uniformVar.vfloat[3]);                                break;                            case ShaderUniform.SU_MATRIX2:                                final java.nio.FloatBuffer matrix2f = org.lwjgl.BufferUtils                                        .createFloatBuffer(4);                                matrix2f.clear();                                matrix2f.put(uniformVar.matrix2f);                                matrix2f.rewind();                                ARBShaderObjects.glUniformMatrix2ARB(                                        getUniLoc(uniformVar.name),                                        uniformVar.transpose, matrix2f);                                break;                            case ShaderUniform.SU_MATRIX3:                                ARBShaderObjects.glUniformMatrix3ARB(                                        getUniLoc(uniformVar.name),                                        uniformVar.transpose,                                        uniformVar.matrix3f.toFloatBuffer());                                break;                            case ShaderUniform.SU_MATRIX4:                                ARBShaderObjects.glUniformMatrix4ARB(                                        getUniLoc(uniformVar.name),                                        uniformVar.transpose,                                        uniformVar.matrix4f.toFloatBuffer());                                break;                            default: // Sould never happen.                                break;                            }                        }                    }                }            } else {                ARBShaderObjects.glUseProgramObjectARB(0);            }        }    }