开发者

OpenGL - lighting of vertices outside clip range

I have a problem with lighting in my OpenGL applicat开发者_StackOverflow中文版ion. 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).


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜