[Bf-cycles] Assign shader to a mesh

haggi krey haggi at haggi.de
Sun Nov 15 12:36:03 CET 2015


Thanks,

it seems that the reason was that my shader was not yet compiled. Even 
if I am still unable to build a simple shader graph this failure is gone.

haggi


Am 14.11.2015 um 15:34 schrieb Mohamed Sakr:
> not sure, try to use mesh->reserve and mesh->set_triangle
>
> On Sat, Nov 14, 2015 at 3:43 PM, haggi krey <haggi at haggi.de 
> <mailto:haggi at haggi.de>> wrote:
>
>     Hi,
>
>     following the standalone xml reader, I tried to create a shader and
>     assign it to my mesh.
>     Is it correct that I add the index of the shader in the scene->shaders
>     array to the mesh and to the created triangle?
>
>     For some reason I get an vector error in util_vector.h if I do it this
>     way. ShaderId is set to my self created shader which can be found
>     in the
>     scene at index 4:
>
>          Mesh *mesh = new Mesh();
>          scene->meshes.push_back(mesh);
>          Object *object = new Object();
>          object->mesh = mesh;
>          Transform tfm = transform_identity();
>          object->tfm = tfm;
>          scene->objects.push_back(object);
>          mesh->used_shaders.push_back(shaderId);
>
>          vector<float3> P;
>          float3 p0 = { -1, -1, 0 };
>          float3 p1 = { -1, 1,  0 };
>          float3 p2 = {  1, 1,  0 };
>          P.push_back(p0);
>          P.push_back(p1);
>          P.push_back(p2);
>          mesh->verts = P;
>          mesh->add_triangle(0, 1, 2, shaderId, true);
>
>     Any idea what could be wrong here?
>
>     haggi
>
>
>     _______________________________________________
>     Bf-cycles mailing list
>     Bf-cycles at blender.org <mailto:Bf-cycles at blender.org>
>     http://lists.blender.org/mailman/listinfo/bf-cycles
>
>
>
>
> _______________________________________________
> Bf-cycles mailing list
> Bf-cycles at blender.org
> http://lists.blender.org/mailman/listinfo/bf-cycles

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.blender.org/pipermail/bf-cycles/attachments/20151115/024789f6/attachment.htm 


More information about the Bf-cycles mailing list