# Unsized uniform arrays in Cg?

This topic is 3385 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);

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 9
• 11
• 15
• 21
• 26