Prev: uitable
Next: read input variables from a file
From: Mark Drakesmith on 7 Jan 2010 14:57 Hi. I hope you can help me. I am rendering a 3D surface using a patch structure and I want to colour different faces of the surface in different colours. I have a n_faces x 3 matrix of RGB colors (no NaNs) but I cannot get them to show up on the patch. The patch always comes out in the default black. I have tried adding a FaceVertexCData field to the patch structure and i have tried creating the patch and then modifying the properties using set(p,'FaceVertexCData',patch_colors). I have also tried using the CData property instead of FaceVertexCData, and I have also tried setting FaceColor to 'none'. I have no problems modifying the the color of the whole patch using FaceColor but i cannot modify individual faces. I'm not sure what else to try. Is there some other property i need to set first? Any help you can offer would be greatly appreciated. Thanks Mark
From: Patrick Kalita on 8 Jan 2010 11:30 Hi Mark, You'll want to set the 'FaceColor' property of the patch to 'flat' in order to pick up the values you've set in the 'FaceVertexCData' property. By default, the patch's 'FaceColor' property is set to [0 0 0], which means it will use that RGB color for each face -- which is what you're currently seeing. Check this out: p = patch( ... 'Vertices', [0 0; 1 0; 1 1; 0 1; 2 0; 2 1], ... 'Faces', [1 2 3 4; 2 5 6 3], ... 'FaceVertexCData', [1 0.5 0; 0 0.5 1], ... 'FaceColor', 'flat');
|
Pages: 1 Prev: uitable Next: read input variables from a file |