structs in shaders

Hi buddies

May i use structs in my panda CG shaders? If yes i need pass my vshader out to fshader in ? I try but the things goes wrong…


Yes, you can use structs in Cg shaders. What specific problems are you running into?


My version of CG from cg tutorial3:


struct vertexIn
float4 vtx_position:POSITION;

struct vertexOut
float4 l_position:POSITION;

struct pixelOut
float4 o_color:COLOR;

void vshader(uniform float4x4 mat_modelproj, in vertexIn entrada, out vertexOut saida)
saida.l_position=mul(mat_modelproj, entrada.vtx_position);

void fshader(out pixelOut saidaPixel)

Panda send this message:

…unrecognized parameter name (varying out float4 saidaPixel.o_color) …

and i got black screen im my program. :confused:
I’m dummy about cg either :smiley: , still on training…

Oh, hm. This seems like a bug in Panda3D, thanks for reporting.
I’ll try to get this fixed soon. In the meantime, do not use structs.

All right :smiley:
Thanx for

For the record: the upcoming 1.7.0 version of Panda fixes this bug and allows you to put your parameters inside structs.