I am currently using nvparse and register combiners with four texture
units in my openGL code running on a GeForce3 card (in Windows XP
MSVC++ 6.0 environment). I want to use more than four texture units
and know that I must upgrade to a GeForce FX card and that is fine.
However, it is not clear to me if I can keep the same code structure or
if I have to learn how to use Cg (I would rather not at the start, I
just want to get my current program working with some minor
modifications). Here is the code structure I am using now:
nvparse("!!RC1.0
"
"{
"
" rgb
"
" {
"
" discard = tex0;
"
" discard = tex1;
"
" spare0 = sum();
"
" }
"
"}
"
"{
"
" rgb
"
" {
"
" discard = tex2;
"
" discard = tex3;
"
" spare1 = sum();
"
" }
"
"}
"
"{
"
" rgb
"
" {
"
" discard = spare0;
"
" discard = spare1;
"
" spare0 = sum();
"
" }
"
"}
"
"out.rgb = spare0.rgb;
"
"out.a = unsigned_invert(zero);
");
for (errors = nvparse_get_errors(); *errors; errors++)
{ fprintf(stderr, *errors);
cout<<endl;
}
glEnable(GL_REGISTER_COMBINERS_NV);
nvparse("!!TS1.0
"
"texture_2d();
"
"texture_2d();
"
"texture_2d();
"
"texture_2d();
");
glEnable(GL_TEXTURE_SHADER_NV);
glActiveTextureARB(GL_TEXTURE0_ARB);
glBindTexture(GL_TEXTURE_2D, iOutputTextureID_0);
glActiveTextureARB(GL_TEXTURE1_ARB);
glBindTexture(GL_TEXTURE_2D, iOutputTextureID_1);
glActiveTextureARB(GL_TEXTURE2_ARB);
glBindTexture(GL_TEXTURE_2D, iOutputTextureID_2);
glActiveTextureARB(GL_TEXTURE3_ARB);
glBindTexture(GL_TEXTURE_2D, iOutputTextureID_3);
RenderQuad(PASS_DISPLAY); // calls the function that does glBegin()
etc.
I fully realize my register combiner code isn’t doing anything
interesting. Can I do the same thing but with 12 textures on my
GeForce FX5900 without getting into Cg? My application is a scientific
simulation so I am not really a graphics guy - sorry. I am
experimenting to see if my GPU runs the simulation faster than the CPU
(just very boring number crunching).
One final point: In addition to using more than one texture, I want to use what I think is called swizzling. I have used this with position coordinates in a vertex program (ADD R6.xyzw, R2.yzxw, -R3.yzxw;)
and I would like to do the analogous thing with colors in a register combiner. For example,
"{
"
" rgb
"
" {
"
" spare0.rgb = tex2.gbr;
"
" spare1.rgb = tex3.rgg;
"
" spare0 = sum();
"
" }
"
"}
"
Any guidance (or outright hand holding) would be greatly appreciated!
Sean.