Archived

This topic is now archived and is closed to further replies.

edwinnie

Cg struct problem

Recommended Posts

ok anyone solved this problem yet? //using a struct doesnt seem to work:
struct Material
{
float4 ambient;
};

/*Cg vertex program*/
.... main(...
          Material material,
          ...)
//passing values explicitly works instead:
/*Cg vertex program*/
.... main(...
          uniform float4 material_ambient,
          ...)
anyone knows any solution to this? thx! Edwinz

Share this post


Link to post
Share on other sites
i think u have to specify an input array for AppIn structs

my Cg Shaders have:

struct appin {
float4 Position : POSITION;
float3 Tangent : COLOR;
float3 Normal : NORMAL;
float3 TCoords0 : TEXCOORD0;
};

PIXEL main(appin IN .. ) ...



maybe try:
float4 ambient: TEXCOORD1 and send the values
thru Tc array 1 ?

Share this post


Link to post
Share on other sites
yes, put in a uniform before the ''Material material''
also when you set the uniform values in your code, use ''Material.ambient'' as the name of the uniform, not just ''ambient''. (I think )

Share this post


Link to post
Share on other sites