GL_ARB_text_texture_env_combine...almost

does anyone have use for something like this?
i have made a simple tex-env-combine language to fill a hole in a larger project i am doing, but i can easily break it out into a separate lib. very much like nvparse RC1.0 syntax but even simpler…eg:

!!ARBcp1.0
{
rgb
{
tex0.rgb * primary.rgb;
}
alpha
{
primary.a;
}
}
{
constant = (1.0,0.0,1.0,1.0);
rgb
{
lerp(constant.rgb,invert(constant.rgb), previous.rgb);
}
alpha
{
previous.a;
scale_by_two();
}
}

(don’t take that program seriously)
i’ve found it very helpful if you have the app load (and reload, on demand) the programs from disk - no recompiling. useful for fallback shaders - can u buy an openGL card without tex-env-combine these days?

if anyone’s interested i’ll put a page up - or have u all already made your own?

Sorry, I’ve already done mine, and it’s a pleasure to reload a shader (that uses texture env combine) on the fly!

Arath

Does indeed sound interesting. Would be much easier to experiment with stuff like that than hacking the program code

I’ve also done something like this for my current project, but i found RC1.0 syntax a little overkill for something so simple. Mine also allows control over which texture unit to use. Your example setup in my syntax would be:

tex0 {
   out.rgb = texture.rgb * primary.rgb;
   out.a = primary.a;
}
tex1 {
   color(1,0,1,1);
   out.rgb = lerp(constant.rgb, inverse(constant.rgb), previous.rgb);
   out.a = scale_by_2(previous.a);
}

It also supports setting the actual env mode like:

tex0 {
   replace();
}

And, a program with no unit specifiers map to unit 0, and the last occuring rgb and alpha instructions are the ones used:

out.rgb = texture.rgb; //not used
out.rgb = add_signed(texture.rgb, primary.rgb);
out.a = primary.a;

It’ll also handle texture_env_dot3, texture_env_crossbar and nv_texture_env_combine4. It was fun to write. I did it mostly to give myself a crash course on lex/flex and yacc/bison, but it has since been proven to be a very valuable tool for all my projects. Who wants to type all that endless glTexEnv calls anyway? It can handle that as well As a command line switch it’ll generate C code for all the calls.

Mr Cookie - there is a temp page up at http://www.users.bigpond.net.au/impossiblybroadhorizons/arbcp.html if you want to try it out.

good to see another gl coder on this side of the world

fenris - despite your disavowal of RC1.0 syntax, i’ve gotta say what we’ve done looks pretty similar. not that there’s too many options doing something like this… wonder how many others have reinvented the same wheel in the same way?

fenris, could you put your stuff up on the web? It would be a great timesaver for our project as well (http://reaper3d.sf.net). It has all the features I am looking for.

(I have a very primitive thing working, but never finished it, got busy with other details instead.)