Lighting transparent Polys

Can transparent polygons be lit? I mean non textured just with a alpha colour.

I tryed it, and with glEnable(GL_LIGHTING); they were drawn solid.

What I am trying to do is get a specular effect on a transparent curved surface (made up of polys that is).

What about an object with a transparent texture?

Thanks

If you want to assign a color to a polygon when lightning is on, you either have to pass the color with glMaterial, or enable color material which takes the current collor set with glColor and assign it to one of the polygon’s color parameters.

Second suggestion is done like this:

glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
glEnable(GL_COLOR_MATERIAL);

This will cause the lighning engine to grab the current color and use it as diffuse material color for both front and back facing polygons.

You need to use these functions to set color, which includes the alpha value which you loose due to the lightning.

I think that if you’re using lights, you have to call glNormals in your rendering method. If you just want flat shading call it once per face with the face normal, but if you want s;ooth shading you’ll have to call it for each vertex. And that mean that you have calculated them somewhere in your initializing method.

[This message has been edited by julien (edited 10-26-2000).]

Thanks Bob, I was doing the ColorMaterial thing already, but only GL_AMBIENT, adding DIFFUSE did the trick!

Thanks alot