ecw
1
I am using SUMaterialInput to set a material.
SUMaterialRef mat = SU_INVALID;
SUMaterialCreate(&mat);
SUMaterialSetTexture(mat, tex);
SUMaterialSetName(mat, "material");
SUMaterialInput mat_input;
mat_input.material = mat;
mat_input.num_uv_coords = 3;
I set the number of uv coords to three but when I try to loop through it looks for 4 coords.
for(int k=0; k < 3; k++)
{
mat_input.vertex_indices[k] = k;
mat_input.uv_coords[k] = uv_coords[k];
}
I’m I doing something wrong?
Have you seen :
And especially Bugra answer :
You can also look at the example I posted here. That shows mapping a texture on a face.
Do those help at all?
// Create material input for texture mapping and set it on the faces
SUMaterialInput mat_input;
mat_input.material = mat;
mat_input.num_uv_coords = 3;
SUPoint2D uv_coords[3] = { { 0, 0 }, { 1, 0 }, { 1, 1 } };
for (size_t i = 0; i < 3; ++i) {
mat_input.vertex_indices[i] = i;
mat_input.uv_coords[i] = uv_coords[i];
}
The result after sample compilation :
: