PDA

View Full Version : specular on texture



Toriton
03-07-2000, 12:56 PM
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

Jim
03-07-2000, 01:11 PM
>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

Gorg
03-07-2000, 10:13 PM
you just set a light model option:


glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR).

Eric
03-07-2000, 10:44 PM
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/advanced99/notes/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

Toriton
03-08-2000, 05:25 AM
Thnak you, Eric.
That works!

San