views:

18

answers:

1

This NVIDIA video podcast (dated?) suggests bypassing OpenGL's matrix stack as a performance tip. It also suggets to bypass OpenGL's lighting, which implies that their intention is to actually transform the geometry manually. I happen to do this anyway for other reasons.

Ofcourse, it doesn't make sense that you'll actually benefit from this unless there's a way to have OpenGL disable it's own transformations. AFAIK there's no explicit way to do this, and the video doesn't give any hints about this either.

It can be logically done, ofcourse, by loading identity into gl's matrices. Should I expect a decent implementation to actually skip a transformation altogether if a matrix is identity?

A: 

Its referring to the fact that you can push and pop matrices on to the OpenGL stack. Avoid doing things like glTranslate and such like as well. This way you can do all your matrix multiplies etc yourself and it definitely won't be going through the floating point emulation. You then just set the matrix directly.

As for the lighting you do that by using glDisable. It looks like they are, purely, using texture lighting. Basically you paint the lights on to an environment map texture. This give you the effect of directional lights and you can add as many lights as you like and the only increased cost is in creating the environment map. Its quite complicated setting up the environment map though but its definitely doable and gives really nice results (You could use a similar trick to get diffuse DOT3 bump mapping as far back as DX6!)

They may be talking about doing the lighting yourself on your vertex data as you add it to the engine. ie Run through your normals and positions and perform the lighting calculation using fixed point before passing them to GLES with a glColorPointer. This is a VERY simple thing to do and to do directional vertex lighting is easy (N.L where N is the vertex normal and L is the light direction in model relative space).

Goz