PDA

View Full Version : number of general combiner stages?



Yangshu
06-18-2002, 12:52 PM
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?

Omaha
06-18-2002, 01:26 PM
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.

Yangshu
06-18-2002, 01:44 PM
Thanks Omaha!
Your suggestion is a great help for me.

Omaha
06-18-2002, 03:48 PM
Actually, I don't even think that parameter means anything if you use the nvparse road instead of the "inline with your program" approach.

LordKronos
06-18-2002, 04:47 PM
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

PH
06-18-2002, 07:23 PM
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 ).

Omaha
06-18-2002, 08:49 PM
and yet if you write an empty stage and pass it through nvparse, it chokes. Alriiiight!

davepermen
06-18-2002, 10:29 PM
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.

kon
06-18-2002, 11:25 PM
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

davepermen
06-18-2002, 11:34 PM
dunno. it worked here.. http://www.opengl.org/discussion_boards/ubb/smile.gif

Yangshu
06-19-2002, 07:23 AM
Originally posted by davepermen:
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.

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

PH
06-19-2002, 07:53 AM
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.

davepermen
06-20-2002, 12:11 AM
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.