Page 2 of 2

Posted: Tue May 25, 2010 11:08 am
by Zylyx_
Cool, I'll keep that in mind. From what I know is that you cant render scene elements using the FFP and GLSL at the same time, but they have to change between them every frame. Anyways, I plan on using shaders pretty much 100% from now on.

Posted: Tue May 25, 2010 8:43 pm
by Sajt
You can change shader (or disable it) as often as you can change texture (or disable it). You can draw one model using fixed-function rendering, another model using a shader, and another using a different shader in the same scene. You can even draw a model in several passes, one using fixed-function and another using a shader. This is where ftransform() comes in. You want to make sure that the shader calculates the depth value for a fragment the same way the fixed-function pipeline does. The FFP will probably be doing something slightly different than "gl_ModelViewProjectionMatrix * gl_Vertex", probably something a little optimized or whatever, and ftransform() emulates that exactly. So if you don't use ftransform() you'll end up with a model horribly "depth-fighting" itself. (You could try it to see, it's very obvious.)

Of course, nowadays a next-gen game is supposed to use shaders for everything as drivers hope to obsolete the fixed-function pipeline completely. If you are doing 100% shaders then you can use "gl_ModelViewProjectionMatrix * gl_Vertex" or whatever else (as I understand it "ftransform" will be obsoleted in the future as well in OpenGL 3/4/5/whatever).