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

Thread: specular on texture

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2000
    Posts
    10

    specular on texture

    Before OpenGL1.2, it seems specular highlight does not work on object with texture applied.

    Before OpenGL1.2, is there way to get specular highlight on texture without using extension? (separate specular extension does not seem popular) Would someone give me code example?

    Thanks in advance.

    San

  2. #2
    Junior Member Newbie
    Join Date
    Jun 2000
    Posts
    9

    Re: specular on texture

    >Before OpenGL1.2, it seems specular highlight does not work on object with texture applied.

    I hope you are not joking. Specular on a textured mesh is very important for "realistic" look. Even Direct3DRM has automatically supported specular on textured mesh for years. Why isn't it supported by "high-end" OpenGL?

    Jim

  3. #3
    Advanced Member Frequent Contributor
    Join Date
    Feb 2000
    Posts
    569

    Re: specular on texture

    you just set a light model option:


    glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR).

  4. #4
    Advanced Member Frequent Contributor
    Join Date
    Feb 2000
    Location
    France
    Posts
    880

    Re: specular on texture

    Gorg, your method will work only if you have the extension GL_EXT_separate_specular_color available on your graphics card !

    Before this extension appeared, the method was the following one :

    1.
    Define the material with appropriate diffuse and ambient reflectance and zero for the specular reflectance coefficients.
    2.
    Define and enable lights.
    3.
    Define and enable texture to be combined with diffuse lighting.
    4.
    Define modulate texture environment.
    5.
    Draw lit, textured object into the color buffer.
    6.
    Define new material with appropriate specular and shininess and zero for diffuse and ambient reflectance.
    7.
    Disable texturing, enable blending, set the blend function to GL_ONE, GL_ONE.
    8.
    Draw the specular-lit, non-textured geometry.
    9.
    Disable blending.

    This has been taken from : http://reality.sgi.com/blythe/sig99/...s/node127.html

    With OpenGL, you can do almost everything without extensions ! The only problem is that, in this case, you're likely to draw your object several times (have a look at the "Per-Pixel Lighting with Unextended OpenGL!" technique).

    Cheers.

    Eric

  5. #5
    Junior Member Newbie
    Join Date
    Mar 2000
    Posts
    10

    Re: specular on texture

    Thnak you, Eric.
    That works!

    San

Posting Permissions

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