problem on specular highlights

Hi guys,

I want WHITE specular highlight on my textured black ball, hope this makes sense. But even when I set gl_specular to (1,1,1,1), the highlight still looks gray. Thanx so much for any suggestions.

You must apply the specular color after texturing. The default lighting model does not do that.

glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL_EXT, GL_SEPARATE_SPECULAR_COLOR_EXT) should work. Your driver must support the EXT_separate_specular_color extension. GL_SINGLE_COLOR_EXT will go back to the defaul model.

Can you still get specular highlighting on an object that has a texture without using an extension?

I’ve seen something about doing a two pass rendering. Would this work? If it would, I’d like to see some pseudocode.

I’m trying to avoid using any extensions in my code, if possible.

Thanks
Pat

EXT_separate_specular_color is no longer an extension, which I forgot in my first post, it’s a part of OpenGL 1.2 now.

It is possible to use a multipass technique, but since EXT_separate_specular_color is a core feature now, you don’t have to use any extensions.

Originally posted by Pat:
[b]Can you still get specular highlighting on an object that has a texture without using an extension?

I’ve seen something about doing a two pass rendering. Would this work? If it would, I’d like to see some pseudocode.

I’m trying to avoid using any extensions in my code, if possible.

Thanks
Pat[/b]

In fact I’ve obtained a WHITE specular highlight effect on my textured black ball using what you call it two pass rendering. It was described as constant color in the OpenGL SuperBible.

Here is the pseudocode:

glMaterialfv(gl_ambient,dark);
glMaterialfv(gl_diffust,dark);
glMaterialfv(gl_specular,bright);
glColor3f(1,1,1);
glutSolidSphere(…)

glBlendFunc(gl_one,gl_one);
glEnable(gl_blend);
glEnable(gl_texture_2D);
glMaterialfv(gl_ambient,normal);
glMaterialfv(gl_diffust,normal);
glMaterialfv(gl_specular,dark);
glutSolidSphere(…)

But that method is really eating the framerate. I post the first post seeking for a faster way.

Bob, I’ve tried EXT_ params but they don’t work for me. Maybe I need to update my OpenGL to version 1.2. But I’m afraid there are still a lot of people who have no OpenGL 1.2 and so that can not run my program, so what can we do without EXT_'s?

[This message has been edited by Dong Ke (edited 12-09-2001).]

My video card, ELSA ERAZOR II/PCI/SSE (1.2.0), supports the GL_EXT_separate_specular_color extension. I’ve never used the OpenGL extensions. Where are the constants for the extensions defined?

Thanks.

Download glext.h from SGI .