I’ve generated a terrain using a *.raw file as a height map, calculated texture coordinates and it looks great. Its also multi-textured using glActiveTextureARB(), but I’ve come to light the thing and…
Oh what a surprise, nothing happens. If I don’t even turn ON lighting, you can see the whole terrain. I’ve mucked about with it for ages, but nothing seems to work.
What are the things I need to make lighting work?
Please help!
.wn
You have to enable lighting, enable at least 1 light, and set the parameters for the light, and provide material settings for the objects or enable color material
//example
glLightModel(…);//if you don’t like default
glLight(GL_LIGHT0, …);// etc, etc, etc
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
//DO THIS
glMaterial(…);
draw stuff…
//OR DO THIS
glColorMaterial(…);
glEnable(GL_COLOR_MATERIAL);
glColor(…);
draw stuff…
you also might want to consider declaring normals for all the poly’s in your terrain.
I did forget that part, didn’t I. Thanks for the perspective…