Hi
I could imagine a following sample shader (for specular lit textured objects
shader spec_tex
{
parameter texture base;
register_combiner reg_comb // this will be send to nvparse or done by the shader
{
!!RC1.0
rgb
{
spare0=tex0*col0;
spare1=col0;
}
out.rgb=spare0+spare1;
}
};
implementation // nv_register_combiners
{
{
bindtexture(0,base);
primary_color=lighting(ambient,diffuse);
secondary_color=lighting(specular);
fragment_op=register_combiner(reg_comb);
}
}
implementation // with ext_separate_specular
{
// first and only pass
{
bindtexture(0,base);
primary_color=lighting(ambient,diffuse);
secondary_color=lighting(specular);
fragment_op=GL_MODULATE;// here could be also register_combiner …
}
}
implementation // gl 1.0
{
{// diffuse + ambient pass
bindtexture(0,base);
primary_color=lighting(ambient,diffuse);
fragment_op=modulate;
}
{// specular pass
// no textures specified, no texturing
depth_func=GL_EQUAL;
blend_func=GL_ONE,GL_ONE;
primary_color=lighting(specualar);
}
}
}
To us this in the app I would like to do following
class Texture tex;
tex.Load(“grass.tga”);
class GeoObject sphere; // an object that rendere geometry, in simple case it could be a glutSpherm but later there would be a vertex array
ShaderLib::LoadShader(filename);
ShaderLib::SelectShader(“spec_tex”);
ShaderLib::SetParameter(“base_tex”,tex);
ShaderLib::Render(sphere);
this are just thoughts, I think there will be the need of discussion what the language should be possible to do, how the style should be, wich tokens are necessary
I did not look into the ATI spec of ext_vertex shader, but perhaps it would be possible to write a parser that parses a NV_vertex_program?
Bye
ScottManDeath
[This message has been edited by ScottManDeath (edited 05-30-2002).]
[This message has been edited by ScottManDeath (edited 05-30-2002).]