PDA

View Full Version : How to disable DIFFUSE after enabling it?



c0dehunter
11-01-2011, 06:28 AM
Hello, I have enabled DIFFUSE (actually ambient and specular too) for my object in this way:

glMaterialfv(GL_FRONT,GL_DIFFUSE,diffuseMaterial);
glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuseLight);

Now I don't know how to disable it in a manner that I will only see the effects of LIGHT0 withouth these additional effects?

So basically to make the light how it was after

glEnable(GL_LIGHTING);
glEnable(GL_COLOR_MATERIAL);
glEnable(GL_LIGHT0);
[/CODE]

_arts_
11-01-2011, 07:08 AM
Simply diffuse black components.

Do you use the glColorMaterial function ? If so, how ? If you don't specify it, by default it will use color as ambient and diffuse components for lighting. But as you also seem to use material, then it is redundant. Choose one or another but not both. I suggest not to use color material.

c0dehunter
11-01-2011, 07:25 AM
_arts_, i've managed to "disable" diffuse with setting material R,G and B to 0 while light's R,G and B components are all 1.

Concerning the GL_COLOR_MATERIAL - I don't use glColorMaterial function, but I need this enabled so I can see the color of my object. Otherwise it is gray.

On the other hand I don't use any material in a sense of texture or something.