Results 1 to 4 of 4

Thread: Purple Specular Lighting?!

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2001
    Posts
    24

    Purple Specular Lighting?!

    Hi, I have a serious problem with specular lighting. It turns purple on most machines, and on some green. Anyone had this problem, I cant seem to get rid of it. It does not turn into the color of a texture on any object, just PURPLE. Its driving me utterly mad.

    I use glColorMaterial and glColor on each vertex. Does that make a difference, and I do not set any color to purple.

    Please help anyone.

  2. #2
    Senior Member Regular Contributor
    Join Date
    Feb 2000
    Posts
    154

    Re: Purple Specular Lighting?!

    Im a newbie on opengl lighting, but try setting the specular color for the light and material (with glLight and glMaterial).

    Although I think the default setting is white, atleast for the first light.

  3. #3
    Senior Member Regular Contributor
    Join Date
    May 2000
    Location
    Oxford, England
    Posts
    472

    Re: Purple Specular Lighting?!

    be careful of how you are setting the material properties for the surface.

    enabling glColorMaterial will take over one of the material properties specified with the constants : GL_AMBIENT , GL_DIFFUSE , GL_SPECULAR & GL_EMISSION. Whenever you call glColor*() it will apply that colour as the material property of the verticies for which it affects.

    This does have a couple of uses, for example you could apply seperate grey-scales to various verticies and use it to create fake shadows.

    If you want all of your surface to have the same material properties, then I'd suggest not using glColorMaterial.

    instead create some material property colour values:

    GLfloat ambient[] = { 0.3 , 0.3 , 0.3 , 0.0 };
    GLfloat diffuse[] = { 0.6 , 0.6 , 0.6 , 0.6 };
    GLfloat specular[] = { 1.0 , 1.0 , 1.0 , 1.0 };

    and when drawing use something like :

    glPushMatrix();
    glMaterialfv( GL_FRONT , GL_AMBIENT , ambient );
    glMaterialfv( GL_FRONT , GL_DIFFUSE , diffuse );
    glMaterialfv( GL_FRONT , GL_SPECULAR , specular );
    drawObject();
    glPopMatrix();

    You could also compile a set of glMaterial*() calls as a display list. That way you could create a simple material library, and call the display list before drawing the object. Hope that's of some use.



    [This message has been edited by Rob The Bloke (edited 01-22-2001).]

  4. #4
    Junior Member Newbie
    Join Date
    Jan 2001
    Posts
    5

    Re: Purple Specular Lighting?!

    Originally posted by julius:
    Hi, I have a serious problem with specular lighting. It turns purple on most machines, and on some green. Anyone had this problem, I cant seem to get rid of it. It does not turn into the color of a texture on any object, just PURPLE. Its driving me utterly mad.

    I use glColorMaterial and glColor on each vertex. Does that make a difference, and I do not set any color to purple.

    Please help anyone.

    I had a similar problem and i solved it disabling the color material like this:

    glDisable (GL_COLOR_MATERIAL), but it affected to all the lighted surfaces (not onlu with specular light).

Similar Threads

  1. specular lighting
    By gl_Beginner in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 09-08-2012, 01:11 AM
  2. How to introduce Specular and Diffuse lighting into Bumped lighting
    By Liable in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 12-06-2004, 05:48 PM
  3. Specular Lighting
    By azcoder in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 05-11-2003, 09:18 AM
  4. Specular lighting
    By Old GLman in forum OpenGL: Advanced Coding
    Replies: 4
    Last Post: 11-27-2002, 01:12 PM
  5. Own specular lighting
    By in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 10-29-2002, 04:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean