Exemplo n.º 1
0
void init_shader()
{
	u32 fpsize = 0;

	vp_ucode = rsxVertexProgramGetUCode(vpo);
	projMatrix_id = rsxVertexProgramGetConst(vpo,"projMatrix");
	modelViewMatrix_id = rsxVertexProgramGetConst(vpo,"modelViewMatrix");
	vertexPosition_id = rsxVertexProgramGetAttrib(vpo,"vertexPosition");
	vertexNormal_id = rsxVertexProgramGetAttrib(vpo,"vertexNormal");
	vertexTexcoord_id = rsxVertexProgramGetAttrib(vpo,"vertexTexcoord");

	fp_ucode = rsxFragmentProgramGetUCode(fpo,&fpsize);
	fp_buffer = (u32*)rsxMemalign(64,fpsize);
	memcpy(fp_buffer,fp_ucode,fpsize);
	rsxAddressToOffset(fp_buffer,&fp_offset);

	textureUnit_id = rsxFragmentProgramGetAttrib(fpo,"texture");
	eyePosition_id = rsxFragmentProgramGetConst(fpo,"eyePosition");
	globalAmbient_id = rsxFragmentProgramGetConst(fpo,"globalAmbient");
	lightPosition_id = rsxFragmentProgramGetConst(fpo,"lightPosition");
	lightColor_id = rsxFragmentProgramGetConst(fpo,"lightColor");
	shininess_id = rsxFragmentProgramGetConst(fpo,"shininess");
	Ks_id = rsxFragmentProgramGetConst(fpo,"Ks");
	Kd_id = rsxFragmentProgramGetConst(fpo,"Kd");
}
Exemplo n.º 2
0
void init_shader()
{
	u32 fpsize = 0;

	vp_ucode = rsxVertexProgramGetUCode(vpo);
	projMatrix_id = rsxVertexProgramGetConst(vpo, "projMatrix");
	modelViewMatrix_id = rsxVertexProgramGetConst(vpo, "modelViewMatrix");
	vertexPosition_id = rsxVertexProgramGetAttrib(vpo, "vertexPosition");
	vertexNormal_id = rsxVertexProgramGetAttrib(vpo, "vertexNormal");
	vertexTexcoord_id = rsxVertexProgramGetAttrib(vpo, "vertexTexcoord");

	fp_ucode = rsxFragmentProgramGetUCode(fpo, &fpsize);
	fp_buffer = (u32*) rsxMemalign(64, fpsize);
	memcpy(fp_buffer, fp_ucode, fpsize);
	rsxAddressToOffset(fp_buffer, &fp_offset);

	textureUnit_id = rsxFragmentProgramGetAttrib(fpo, "texture");
	scanline_id = rsxFragmentProgramGetConst(fpo, "scanline");
}