Correct Specularity with Texturing

Hello friends,

I’m using texture mapping on some of my objects in openGl. I want to display correct specularity with texturing using Blending (GL_BLIND). I’m not sure how that is done and hope you can help.

Ali

Define what you mean by “correct specularity” ?

If you’re doing old-fashioned, basic, OpenGL (like me), you can show specular highlights on textured objects by doing a simple, two-pass, rendering. It’s discussed on page 296 of the OpenGL SuperBible. I have the 2nd Edition. The page # might be different in later editions. I’ve coded up this technique and find that it works quite well.

Need to know what you think “correct” means, but if you mean having specular highlights that have a distinct color and are applied after diffuse texturing, check out GL_SEPARATE_SPECULAR_COLOR (if using fixed-function pipe). If using GLSL, you can emulate this.

Hello,

Thanks for the replies.

When I apply texture mapping on my object, the light specularity changes. I’m using a solid sphere as my light source. When applying the texture mapping, the solid sphere (my light) color changes to the same color as that for the texture? I don’t want that to happen.

Have you checked the OpenGL SuperBible p. 296 yet?
There’s a one paragraph discussion of your problem and some code that shows you how to fix it.

Hi MaxH, Can you tell what chapter I can found this paragraph?

Also, I want to point out that I want to correct specularity using GL_BLEND.

In the OpenGL SuperBible Second Edition, it’s in Chapter 8 “Texture Mapping” on page 296.
There’s a section called “Lighting with Textures” with a page titled “Rendering Specular Highlights”.

Thanks MaxH. unfortunately the edition I downloaded for Opengl super Bible no longer contain this section.

Google ‘OpenGL SuperBible Second Edition’. Looks like you can download it for free.