GLSL noob problem...

Discuss programming topics that involve the OpenGL API.
Zylyx_
Posts: 111
Joined: Wed Dec 05, 2007 6:52 pm
Location: scotland, uk

Post 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.
....noodle...
Sajt
Posts: 1215
Joined: Sat Oct 16, 2004 3:39 am

Post 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).
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.
Post Reply