PDA

View Full Version : Simple Register Combiner question



Ninja
07-26-2002, 03:29 AM
glCombinerOutputNV(GL_COMBINER0_NV, GL_RGB, GL_SPARE0_NV, GL_SPARE1_NV, GL_DISCARD_NV,
GL_NONE, GL_NONE, GL_TRUE, GL_TRUE, GL_FALSE);

This does spare0 = A.B and spare1 = C.D right?

But how do I do spare0 = A*B and spare1 = C*D? is that possible?

-Ninja

PH
07-26-2002, 03:46 AM
Like this,

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

kon
07-26-2002, 03:48 AM
By having the last three parameters set to GL_FALSE. Ninja, I would recommend you to read (actually watch) the paper registercombiners.pdf which you find at http://developer.nvidia.com/view.asp?IO=registercombiners ! This paper has good pictures of the different stages.

kon

Ninja
07-26-2002, 04:00 AM
Ok, I thought that was only for the muxsum.
But the spare0 and spare1 will also be filled with AB and CD?

-Ninja

Ninja
07-26-2002, 04:17 AM
Actually I have a texture with information that need to be scaled and biased, lika
C_new = (C_old - bias) * scale for each rgb.
I this possible to do in the register combiners?

-Ninja

vincoof
07-26-2002, 04:23 AM
No it's not possible because once you specify a bias, you have to set the scale to GL_NONE (or scale by 2) but you can't scale to 1/2 neither to 4.

[This message has been edited by vincoof (edited 07-26-2002).]

davepermen
07-26-2002, 04:30 AM
sure you can scale and bias. with wich values?

Ninja
07-26-2002, 04:51 AM
The values are different from texture to texture but the scales can med e.g. 100 and the bias 2.

Maybe I have to scale them or something. But when I want to read one value I can do like this:
(image[index]-bias) /255.0) * scale;

The values in the image are unsigned char so they varies from 0 to 255. Thats way a bias on 100 make sense.

Im not sure how this is done in RC though.

-Ninja

Ninja
07-26-2002, 04:53 AM
Sorry I mean bias 100 and scale 2

-Ninja

vincoof
07-26-2002, 05:15 AM
In RC, you can bias by either 0 or -1/2, and can scale by either 1/2, 1, 2 or 4.

PH
07-26-2002, 05:40 AM
If you only need to scale by 2 then you could use a constant register containing (100.0 / 255.0 ) and subtract that in a general combiner and scale the output by 2. It _should_ work, I haven't use RCs in a while.

The values read from a texture are always between 0.0 and 1.0.

Ninja
07-26-2002, 06:11 AM
How can I subtract with RC?
I've looked at NvParse and tried to use it, but I got alot of link errors like

vparse.lib(ps1.0_program.obj) : error LNK2001: unresolved external symbol "void (__stdcall* glActiveTextureARB)(unsigned int)" (?glActiveTextureARB@@3P6GXI@ZA)
nvparse.lib(ts1.0_inst_list.obj) : error LNK2001: unresolved external symbol "void (__stdcall* glActiveTextureARB)(unsigned int)" (?glActiveTextureARB@@3P6GXI@ZA)
nvparse.lib(vp1.0_impl.obj) : error LNK2001: unresolved external symbol _glh_init_extensions
nvparse.lib(vsp1.0_impl.obj) : error LNK2001: unresolved external symbol _glh_init_extensions

...


Anyone know whats wrong?

-Ninja

PH
07-26-2002, 06:34 AM
Use a negate or invert input mapping for the constant and use AB + CD with B and D set to 1.

I don't know about the nvParse linker errors.

Ninja
07-26-2002, 06:43 AM
Is it ok to set the constant to some negative value? Is that the same as using the negative mapping?

-Ninja

PH
07-26-2002, 07:40 AM
I knew you'd ask, the spec is rather long http://www.opengl.org/discussion_boards/ubb/smile.gif. Anyway, no the constant must be in the [0,1] range.

Ninja
07-26-2002, 08:07 AM
What happends if they are not?
Is there any way to debug these RC stuff?

-Ninja

Joel
07-26-2002, 01:33 PM
Originally posted by Ninja:
How can I subtract with RC?
I've looked at NvParse and tried to use it, but I got alot of link errors like

Anyone know whats wrong?

-Ninja
Taken from glh_extensions.h :



// Comments:
//
// The trick with GLH_EXT_SINGLE_FILE is that you need to have it defined in
// exactly one cpp file because it piggy-backs the function implementations in
// the header. You don't want multiple implementations defined or the linker
// gets mad, but one file must have the implementations in it or the linker
// gets mad for different reasons.
//
// The goal was to avoid having this helper require a separate cpp file. One
// thing you could do is just have a glh_extensions.cpp that did
//
// #define GLH_EXT_SINGLE_FILE
// #include <glh_extensions.h>
//
// and make it the only file that ever defines GLH_EXT_SINGLE_FILE.


you must have one and only one file that defines GLH_EXT_SINGLE_FILE.
I've got the same kind of errors if i remove it.
Think that should do the trick.

Joel.