Esempio n. 1
0
File: g_render.c Progetto: aosm/X11
void __glXDisp_LightModeliv(GLbyte *pc)
{
	glLightModeliv( 
		*(GLenum   *)(pc + 0),
		(GLint    *)(pc + 4)
	);
}
Esempio n. 2
0
  void StandardMaterial::begin ()
  {
    Material::begin ();

    Shader *shader = Kernel::GetInstance()->getRenderer()->getCurrentShader();
    if (!gotUniforms)
    {
      uLuminosity = shader->getUniformID( "uLuminosity" );
      uSpecularity = shader->getUniformID( "uSpecularity" );
      uCellShading = shader->getUniformID( "uCellShading" );
      gotUniforms = true;
    }

    //We will set material color manually (not via glColor)
    glDisable (GL_COLOR_MATERIAL);

    //Luminosity
    glUniform1f( uLuminosity, luminosity );
    
    //Ambient color
    Vector4 ambient = ambientColor.xyz (1.0f);
    glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT, (Float*) &ambient );
    
    //Diffuse color
    Vector4 diffuse = diffuseColor.xyz (opacity);
    glMaterialfv( GL_FRONT_AND_BACK, GL_DIFFUSE, (Float*) &diffuse );

    //We want specularity to be aplied to texture colors too
    GLint param = GL_SEPARATE_SPECULAR_COLOR;
    glLightModeliv( GL_LIGHT_MODEL_COLOR_CONTROL, &param );     

    //Specularity
    glUniform1f( uSpecularity, specularity );
      
    //Specular color
    Vector4 spec = (specularColor).xyz(1);
    glMaterialfv( GL_FRONT_AND_BACK, GL_SPECULAR, (Float*) &spec );
    
    //GL uses an integer value for maximum glossiness
    int shininess = (int)(glossiness * _GL_MAX_SHININESS);
    glMateriali( GL_FRONT_AND_BACK, GL_SHININESS, shininess );
    
    /*
    //Blending
    bool blend = false;
    
    if (opacity < 1.0f)
      blend = true;
    
    if (blend) {
      glEnable (GL_BLEND);
      glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    }else glDisable (GL_BLEND);
    */

    /*
    //Lighting
    if (lighting)
      glEnable (GL_LIGHTING);
    else
      glDisable (GL_LIGHTING);
    */

    //Back-face culling
    if(culling) {
      glEnable (GL_CULL_FACE);
    }else glDisable (GL_CULL_FACE);

    //Wireframe
    if (wire)
      glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
    
    //Normalize all normals so
    //we can freely scale actors
    glEnable( GL_NORMALIZE );

    //Lighting model
    glUniform1f( uCellShading, cell ? 1.0f : 0.0f );
  }
Esempio n. 3
0
M(void, glLightModeliv, jint pname, jobject params) {
	glLightModeliv(pname, BUFF(GLint, params));
}