PDA

View Full Version : How to enable lighting in 3.1



torshie
05-23-2009, 09:06 PM
The 3.1 specification says glEnable's target GL_LIGHTING (page 297, paragraph 1)is deprecated. So, which is the recommended way to do lighting in 3.1?

btw: I think the specification should not only give a list of deprecated features but also give their recommended replacements.

Amikam
05-23-2009, 09:48 PM
I suppose you need to use shaders for lighting.

zeoverlord
05-24-2009, 04:33 AM
Pretty much everything is replaced by shaders, except for vertex transformations and other matrix manipulations, those you have to do yourself.

martinsm
05-24-2009, 05:37 AM
Vertex transformations? Aren't they also replaced by vertex shader?

zeoverlord
05-24-2009, 01:19 PM
Well, sure you have to apply them at the last stage there as usual, but you have to build the matrices yourself on the cpu.

Or in other words, glFrustum, glLoadIdentity, glLoadMatrix, glLoadTransposeMatrix, glMatrixMode, glMultMatrix, glMultTransposeMatrix, glOrtho, glPopMatrix, glPushMatrix, glRotate, glScale, and glTranslate and so on are no longer there.