Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: separate_specular_color

  1. #1
    Junior Member Newbie
    Join Date
    May 2001
    Location
    Paris, FRANCE
    Posts
    5

    separate_specular_color

    Hi,

    Do you know if there are some known issues about GL_SEPARATE_SPECULAR_COLOR and mac ?
    I have already searched the "mac-opengl" apple mailing list and other forums here....
    With a GL_MODULATE texture env., everything is displayed as if I had choosen GL_SINGLE_COLOR.
    ... please tell me it does not come from my code.

    JC.

  2. #2
    Advanced Member Frequent Contributor arekkusu's Avatar
    Join Date
    Nov 2003
    Posts
    676

    Re: separate_specular_color

    What hardware? EXT_separate_specular_color should work on any hardware renderer except for the Rage128. On the GeForce2MX/4MX, the extension was not exported on 10.2, but it is on 10.3.

  3. #3
    Junior Member Newbie
    Join Date
    May 2001
    Location
    Paris, FRANCE
    Posts
    5

    Re: separate_specular_color

    Thank you for the answer, I will try using EXT_separate_specular_color instead of GL_SEPARATE_SPECULAR_COLOR.
    My hardware is ATI Mobility Radeon 9200 (iBook G4) and OS 10.3.4.

    The code I wrote is:

    ...

    glClearColor ( 0.5f , 0.5f , 0.5f , 0.f );
    glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

    // la caméra
    glViewport ( 0 , 0 , _Width , _Height );

    glMatrixMode ( GL_PROJECTION );
    glLoadIdentity ();
    gluPerspective ( 60 , 1 , .01 , 10 );

    gluLookAt ( camPos[0] , camPos[1] , camPos[2] ,
    target[0] , target[1] , target[2] ,
    upVec[0] , upVec[1] , upVec[2] );

    glMatrixMode ( GL_MODELVIEW );
    glLoadIdentity ();

    glEnable ( GL_LIGHTING );
    glEnable ( GL_LIGHT0 );
    glEnable ( GL_DEPTH_TEST );
    glEnable ( GL_CULL_FACE );

    glLightfv ( GL_LIGHT0 , GL_POSITION , position );
    float white[4] = { 1.f , 1.f , 1.f , 1.f };
    glLightfv ( GL_LIGHT0 , GL_SPECULAR , white );

    float mAmbient[4] = { .4f , .4f , .4f , 1.f };
    glLightModelfv ( GL_LIGHT_MODEL_AMBIENT , mAmbient );

    glShadeModel ( GL_SMOOTH );

    glTexEnvi ( GL_TEXTURE_ENV , GL_TEXTURE_ENV_MODE , GL_MODULATE );

    glEnable ( GL_TEXTURE_2D );
    glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
    glTexGeni (GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
    glTexGeni (GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
    glEnable ( GL_TEXTURE_GEN_S );
    glEnable ( GL_TEXTURE_GEN_T );

    glBindTexture ( GL_TEXTURE_2D , tex -> _Name );

    glLightModeli ( GL_LIGHT_MODEL_COLOR_CONTROL ,
    GL_SEPARATE_SPECULAR_COLOR );

    float diffuse[4] = { _Material->_Diffuse.R , _Material->_Diffuse.G , _Material->_Diffuse.B , _Material->_Diffuse.A };
    glMaterialfv ( GL_FRONT , GL_DIFFUSE , diffuse );
    float ambient[4] = { _Material->_Ambient.R , _Material->_Ambient.G , _Material->_Ambient.B , _Material->_Ambient.A };
    glMaterialfv ( GL_FRONT , GL_AMBIENT , ambient );
    float emission[4] = { _Material->_Emission.R , _Material->_Emission.G , _Material->_Emission.B , _Material->_Emission.A };
    glMaterialfv ( GL_FRONT , GL_EMISSION , emission );

    float specular[4] = { _Material->_Specular.R , _Material->_Specular.G , _Material->_Specular.B , _Material->_Specular.A };
    glMaterialfv ( GL_FRONT , GL_SPECULAR , specular );
    glMateriali ( GL_FRONT , GL_SHININESS , _Material->_Shininess );

    GLUquadricObj * sphere = gluNewQuadric();
    gluQuadricDrawStyle ( sphere , GLU_FILL );
    gluQuadricNormals ( sphere , GLU_SMOOTH );
    gluSphere ( sphere , 3.f , 32 , 32 );

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •