Quote:Original post by d h k
Simple things first: I have no idea why that second image isn't showing up. I uploaded it to rapidshare just like I did with the first screen, and the first one works... Here is a new link that works!
Sorry, I should've been clearer. The link works, but the button 'free' in rapid share gives a missing/broken image symbol...
Quote:Original post by d h k
Here is more code, that you requested:
I initialize a light like this:
I notice two problems with the way you're using lighting. First, you don't use glMaterial to set the material properties, you use glColor. Although that is possible, it will only work if you call during your initialization:
glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE);glEnable(GL_COLOR_MATERIAL);
Furthermore, if you use white materials (glColor4f( 1.0f, 1.0f, 1.0f, 1.0f )) in combination with full out red ambient (ambient[] = { 1.0f, 0.0f, 0.0f, 1.0f };) everything will be fully red. I personally prefer debugging lighting with ambient set to black. Also, try setting specular or diffuse to black to find out which of the two causes the behaviour you're seeing. Check this page on my CG website to get more info on how the lighting calculation works.
Quote:Original post by d h k
Here is my object::draw ( ) function, that draws models from 3ds files:
I'm not sure if 3ds files guarantee a consistent CW or CCW triangle definition. There is a simple test to check if the models you use are:
1. disable culling if necessary (glDisable(GL_CULL_FACE);)
2. in your rendering function replace your glColor4f(1,1,1,1) call with:
const float red[] = {1,0,0,1};const float green[] = {0,1,0,1};glMaterialfv(GL_FRONT, GL_EMISSION, red);glMaterialfv(GL_BACK, GL_EMISSION, green);
3. run your app and check the output:
If your models that are consistent CW or CCW will be either completely red OR green on the outside, where inconsistent objects will have green AND red triangles on the outside.
Tom