Cg questions

The new version of Cg (2.0) is out in May. Does Panda support it?
Since it seems I can’t avoid learning Cg, what would you recommend to start with? Some books maybe? Online articles?
I have already printed the whole Cg Tutorial book (quite a big pile of paper, I can say). What could you say about it?
PS: I haven’t ever touched either any kind of C or any shading language before.

Welcome to a new world of 3D graphics!
I don’t think Panda3D supports Cg 2.0. You need to keep in mind that the actual shader structure as mentioned in the Cg tutorial won’t directly work with Panda3D – the language and shader body itself are well supported by Panda3D, but the way you define your shader is a little different than is used in most cases.
Take a look at the shaders in the sample programs to see what I mean, also consult the Shaders section at the manual. That was how I started learning Cg.

About the Cg tutorial you mentioned: It looks quite promising and interesting. Note that it also might explain how to compile your shaders, though with Panda3D you don’t need to compile them yourself, Panda3D takes care of that.

Let me explain how the structure as you define it is different.
This is the first example from the Cg tutorial:

struct C2E1v_Output {
  float4 position : POSITION;
  float4 color    : COLOR;
};
C2E1v_Output C2E1v_green(float2 position : POSITION)
{
  C2E1v_Output OUT;
  OUT.position = float4(position, 0, 1);
  OUT.color    = float4(0, 1, 0, 1);  // RGBA green
  return OUT;
}

In Panda3D, that becomes:

//Cg
void vshader(
  float4 vtx_position : POSITION,
  float4 vtx_color: COLOR,
  out float4 l_position : POSITION,
  out float4 l_color : COLOR
)
{
  l_position = float4(vtx_position, 0, 1);
  l_color    = float4(0, 1, 0, 1);  // RGBA green
}

Usually, the inputs for the vertex shader are marked with vtx_, the outputs for the vertex shader (which are the inputs for the fragment shader) are marked l_, and the fragment shader final outputs are marked with o_.
What variables to use etc. etc. is everything explained on the manual, at the Shaders section. If you have any questions, just ask them.
Hope this helps you a bit.

Thank you, pro-rsoft!
I can’t say I understood much from the examples… he-he… anyway, I hope, after the book I will understand more.