number of general combiner stages?

Hi you all,

Can I set GL_NUM_GENERAL_COMBINERS_NV to 0?
It might look stupid. But what I am trying to do is
“texture0 - texture1”, and the reason why I decided to use register-combiners is that the numeric range of combiner computations is [-1, 1].
Since the computation can be done in the final combiner stage, do I have to use any general combiner stage at all?

Any suggestions?

Yes, I just did a test and that seems to work. Just omit the RGB and alpha sections altogether, as such:

!!RC1.0
out.rgb=tex0;
out.a=tex0.a;

Of course you’ll need to fill in the function you want. This works, but whether or not it’s kosher–I dunno. I asked a question in the other forum about register combiners and no one has replied. People here seem very selective about whom they answer; the person who asks why Direct3D is more popular than OpenGL or any other question done to death gets 80 replies, the 14 year old who says “hi I don’t know any programming lol but I wanna make a game like quake but better gfx with my friends ;D who can help us lol” gets 100, and yet most of the questions I’ve ever asked (including those under other names while I was in class) have gone unanswered.

I hope my suggestion helps.

Thanks Omaha!
Your suggestion is a great help for me.

Actually, I don’t even think that parameter means anything if you use the nvparse road instead of the “inline with your program” approach.

I guess Omaha answered it for you, but just for reference, there is no performance hit for using one combiner on any card.

Now, to the more important part…what good does the [-1,1] range do you? I believe the value gets clamped [0,1] on its way out the back end anyway

I tried using 0 general combiners a long time ago but it didn’t work. If you use nvparse, an empty stage is automatically inserted ( I think ).

and yet if you write an empty stage and pass it through nvparse, it chokes. Alriiiight!

0 general combiners works. i’ve used this yet.

but your idea of subtracting will not work, because teh final combiners is ab + (1-a)c + d, and all clamped to range 0,1. so its essencially the same as using simple multitexture for doing this.

No, calling

glCombinerParameteriNV(GL_NUM_GENERAL_COMBINERS_NV, 0);

generates an error (as it says in the spec)! You need to have at least one, even if you don’t use it.

kon

dunno. it worked here…

Originally posted by davepermen:
[b]0 general combiners works. i’ve used this yet.

but your idea of subtracting will not work, because teh final combiners is ab + (1-a)c + d, and all clamped to range 0,1. so its essencially the same as using simple multitexture for doing this.[/b]

How about the speed? Which one works faster, register_combiner, multitexturing or something else?

Originally posted by Omaha:
and yet if you write an empty stage and pass it through nvparse, it chokes. Alriiiight!

I meant an “empty stage” in the following sense,

glCombinerOutputNV( GL_COMBINER0_NV, GL_RGB, GL_DISCARD_NV, GL_DISCARD_NV, GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE );

glCombinerOutputNV( GL_COMBINER0_NV, GL_ALPHA, GL_DISCARD_NV, GL_DISCARD_NV, GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE );

And kon is absolutely correct about the error/specs. Something like this is automatically inserted by nvparse if you don’t use a general combiner stage.

Originally posted by Yangshu:
How about the speed? Which one works faster, register_combiner, multitexturing or something else?

if there is a fastest, then its always the rc’s.