tags:

views:

32

answers:

2

I have a problem with lighting in my OpenGL application. When one of the vertices of a drawn polygon goes outside the front clip plane (or has z<0, I'm not sure which), the polygon stops being lighted properly.

This however happens on only one machine I tested, with Intel GMA950 card. On nVidia and ATI cards everything looks fine.

I guess I am breaking some OpenGL rule here? How should I deal with it?

I'd try dividing the scene into smaller polygons, but I'm not sure if it guarantees the case is eliminated (all polygons stepping outside the clipping range are offscreen).

A: 

Ok, not sure you'll like this answer, but my options would be :

  • Stop using OpenGL on Intel card under Windows, use Direct3D instead
  • Give a try to Google's OpenGL ES to Direct3D driver
  • Use a vertex shader to do the lighting, you may be able to figure out what the problem is.

Cheers

rotoglup
A: 

Turns out the problem shows only when I use backface culling. The (ugly) workaround was to turn it off and render both sides of the polygons.

hmp