Unsized uniform arrays in Cg?

This topic is 3076 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Does anybody know any example that shows the use of unsized uniform arrays in Cg? My program is compiling but it doesnt work. Here is my program:

void light_particle(	float3 position : POSITION,				float2 texCoord : TEXCOORD0,				out float4 oPosition : POSITION,				out float4 oColor    : COLOR0,				out float2 oTexCoord0 : TEXCOORD0,				uniform float4 ambientLight,				uniform float3 lightPos[],				uniform float3 lightColor[],				uniform float lightRange[]){	float4 outPos = transformSprite(position);	oPosition = outPos;	float2 coord = transformCoord(texCoord);	oTexCoord0 = coord;	float4 outColor = ambientLight;	for (int t=0; t<lightPos.length; t++)	{		float3 diff = outPos.xyz-lightPos[t];		float squaredDist = dot(diff,diff);		float squaredRange = lightRange[t]*lightRange[t];		squaredRange = max(squaredDist, squaredRange);		float attenBias = 1-(squaredDist/squaredRange);		outColor += float4(lightColor[t],0)*attenBias;	}	oColor = color0*outColor;}

The loop ins't running even once, I don't know if I'm sending the data correctly.

This is what I do:

D3DXVECTOR3 pos[nLights];
...
cgD3D9SetUniformArray(lightPosParam, 0, nLights, pParam);

1. 1
2. 2
Rutin
19
3. 3
khawk
15
4. 4
5. 5
A4L
13

• 13
• 26
• 10
• 11
• 44
• Forum Statistics

• Total Topics
633744
• Total Posts
3013651
×