PDA

View Full Version : convert cg 1.2.1 to 1.4 compiler



duck bong
05-22-2006, 09:09 PM
Hi! I am facing a difficulty.
I removed the cg 1.2.1 compiler and installed the cg 1.4 compiler. Is there any changes in cg 1.4 compared with cg 1.2.1? I think that I should change the grammar or some other syntax in cg code.

The code in the cg 1.2.1, as follows.

//**********************************************
// Input variables

struct appdata {
float4 position : POSITION;
float4 color : COLOR0;
float4 texcoord : TEXCOORD0;
};

// Output variables

struct v2f {
float4 position : POSITION;
float4 color0 : COLOR0;
float pointsize : PSIZE;
};

//################################################## ######################
// scrPar encodes UNIFORM 4 parameters used to calculate the screen size
// of a splat: { nearplane, height/height of nearplane, (f+n)/(f-n), -2fn/(f-n)}
//

v2f main(appdata I, uniform float4 scrPar)
{
v2f O;

float4 P = mul(glstate.matrix.modelview[0], I.position);

O.position = mul(glstate.matrix.mvp, I.position);
O.color0 = I.color;
O.pointsize = max(1.0, I.texcoord.x*scrPar.y/abs(P.z));

return O;
} // main

//**************************************

If using the cg 1.4 compiler, there is no compiling error or linking error. However, I can not get anticipated results.
In the rendering stage, I want to see the resizeable point. but i just could see glPoint.

But using the cg 1.2.1 compiler, there is no problem.

Many thanks in advance.

Best Regards,
DB

castano
05-23-2006, 12:30 AM
Are you using the same profile in both cases? Could you submit the resulting code after compilation with both Cg 1.2 and Cg 1.4? It might also be a good idea to try the Cg 1.5 beta:

http://developer.nvidia.com/object/cg-toolkit-15beta.html