PDA

View Full Version : vertex program only



dronus
11-08-2005, 01:52 PM
hello.
if i use a vertex program only but gl's fixed function fragment pipeline, is this possible, and what values do i have to set (whith which variable names / bindings) to fully emulate the behaveiour? (eg. color, tex-coords, normals?)
is it needed to define the varying attributes outside of glsl then?

thanks
Paul

canuckle
11-08-2005, 09:12 PM
I'm guessing you already know this, but to use a programmable vertex program with a fixed fragment program, all you need to do is compile and link the vertex program without ever specifying a fixed fragment program.

All you need to do is write to gl_Position and gl_FrontColor in your vertex shader. They're both calculated however you want, but gl_Position is usually calculated calling ftransform() and gl_FrontColor is usually calculated using the phong lighting equation.

You can check out 3DLabs' ShaderGen, which generates vertex and fragment shaders, or some other lighting tutorials like this one:
http://www.gametutorials.com/gtstore/pc-308-1-vertex-lighting-with-glsl.aspx

PS: Apparently there are some issues with using the built-in lighting uniforms, so you might want to use user-defined uniforms instead...

dronus
11-10-2005, 04:44 PM
thanks

shadergen helped much...

i looked at ligthing examples of RenderMonkey before..
...but these guys don't use the gl-conventions...
defining their own, slightly different names for tex-coords, color etc. so these don't interoperate with fixed function.
the shadergen ones actually match the specs :-)
this program is a really good tutorial

thanks much
Paul