Reproducing fixed-function behaviour in a shader

Hi,

Can anyone point me to a shader which reproduces the fixed-function (normal OpenGL) behaviour?

That is, transformation, clipping, culling, lighting… ?

I’m presuming someone has done this, since it would be a great test if nothing else.

The Developer Relations team at 3Dlabs has released a tool called ShaderGen that allows you to setup the fixed state and produces shaders on the fly to replicate it.

Originally posted by Daniel Faken:
[b]Hi,

Can anyone point me to a shader which reproduces the fixed-function (normal OpenGL) behaviour?

That is, transformation, clipping, culling, lighting… ?

I’m presuming someone has done this, since it would be a great test if nothing else.[/b]
Clipping and culling are not part of the vertex shader process…

Originally posted by 3DlabsDevRel:
The Developer Relations team at 3Dlabs has released a tool called ShaderGen that allows you to setup the fixed state and produces shaders on the fly to replicate it.
Thanks for this tip.

I have a question, though:
How can one guarantee to reproduce the fixed-function pipeline when things like glMaterialfv() within glBegin()/glEnd() are not guaranteed to work?

(see page 64 of the OGL 2.0 spec – its not guaranteed to update the Material-State fields (GLSL spec pg. 46) until glEnd() – which is apparently why they are declared uniform instead of attribute.

Interesting - I hadn’t seen that in the spec, but I had hit that problem in practice when rendering a tristrip. The fixed functionality pipeline picked up the material changes across the tristrip, but my shaders didn’t.
I guess you would have to resort to passing the material information through via your own uniforms - a bit like having to tell the shader which lights are active.

Peter

How can one guarantee to reproduce the fixed-function pipeline when things like glMaterialfv() within glBegin()/glEnd() are not guaranteed to work?
I’m not sure what you mean by this.

I thought glMaterialfv was flat out illegal inside a begin/end pair. And, since the spec told you that the results were not guarenteed (aka: undefined), you can’t expect defined output. Ergo, don’t do this.

Originally posted by Korval:
[b] [quote]How can one guarantee to reproduce the fixed-function pipeline when things like glMaterialfv() within glBegin()/glEnd() are not guaranteed to work?
I’m not sure what you mean by this.

I thought glMaterialfv was flat out illegal inside a begin/end pair. And, since the spec told you that the results were not guarenteed (aka: undefined), you can’t expect defined output. Ergo, don’t do this.[/b][/QUOTE]Nope; according to the OpenGL 2.0 spec, page 64, paragraph 3:

Material properties can be changed inside a Begin/End pair by calling Material. However, when a vertex shader is active such property changes are not guaranteed to update material parameters, defined in table 2.11, until the following End command.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.