Simple Register Combiner question

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 = AB and spare1 = CD? is that possible?

-Ninja

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);

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

Ok, I thought that was only for the muxsum.
But the spare0 and spare1 will also be filled with AB and CD?

-Ninja

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

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).]

sure you can scale and bias. with wich values?

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

Sorry I mean bias 100 and scale 2

-Ninja

In RC, you can bias by either 0 or -1/2, and can scale by either 1/2, 1, 2 or 4.

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.

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

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.

Is it ok to set the constant to some negative value? Is that the same as using the negative mapping?

-Ninja

I knew you’d ask, the spec is rather long . Anyway, no the constant must be in the [0,1] range.

What happends if they are not?
Is there any way to debug these RC stuff?

-Ninja

Originally posted by Ninja:
[b]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[/b]

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.