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 4 of 4

Thread: glShadeModel and glLightModel with GLSL

  1. #1
    Junior Member Newbie Yezu666's Avatar
    Join Date
    Sep 2008
    Location
    Gdynia, Poland
    Posts
    15

    glShadeModel and glLightModel with GLSL

    Hi!
    I'm wondering if there's any point in using glShadeModel and glLightModel functions while using shaders?

    I've been looking through the docs and failed to get an answer.

    I'm asking about OGL 2.1 but I'd be interested if the same applies to the newer versions.

    thanks
    "In the arena of logic, I fight unarmed."
    Red Mage, Episode 835: Refining Moment

  2. #2
    Super Moderator OpenGL Guru
    Join Date
    Feb 2000
    Location
    Montreal, Canada
    Posts
    4,421

    Re: glShadeModel and glLightModel with GLSL

    Yes, glShadeModel has an effects since this controls how values are interpolated across a triangle.

    As for lighting, you are suppose to do the lighting yourself in a vertex shader or fragment shader. All glLight functions are irrelevant including glLightModel.
    ------------------------------
    Sig: http://glhlib.sourceforge.net
    an open source GLU replacement library. Much more modern than GLU.
    float matrix[16], inverse_matrix[16];
    glhLoadIdentityf2(matrix);
    glhTranslatef2(matrix, 0.0, 0.0, 5.0);
    glhRotateAboutXf2(matrix, angleInRadians);
    glhScalef2(matrix, 1.0, 1.0, -1.0);
    glhQuickInvertMatrixf2(matrix, inverse_matrix);
    glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
    glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

  3. #3
    Senior Member OpenGL Guru
    Join Date
    May 2009
    Posts
    4,723

    Re: glShadeModel and glLightModel with GLSL

    Yes, glShadeModel has an effects since this controls how values are interpolated across a triangle.
    When you don't explicitly state it in the shader, that is.

  4. #4
    Junior Member Newbie Yezu666's Avatar
    Join Date
    Sep 2008
    Location
    Gdynia, Poland
    Posts
    15

    Re: glShadeModel and glLightModel with GLSL

    Ok. I think I understand. Thanks a lot
    "In the arena of logic, I fight unarmed."
    Red Mage, Episode 835: Refining Moment

Posting Permissions

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