texture mapping images on the faces of a cuboid with rgl
I am interested in mapping 6 different images on the faces of a cube. I found the full code for doing this here :
http://rwiki.sciviews.org/doku.php?id=graph_gallery:cube But I am unable to adapt the code for my purpose. I would appreciate it if I could get some help on the following points :
1. My images are jpeg images with dimensions of 1936*2584*3. Must I seperately process the grey and rgb attributes as in the code in the above page. Would appreciate it if I could get some explicit help on processing the image matrix. I don't follow in detail how a square portion of the graphic is extracted also.
2. Instead of a cube, I am interested in mapping images on a cuboid (l!=b!=h). Could I get tips on how this can be done. How should the dimensions of the image matrix be tailored then?
3. The following line in the code appears to identify and fix the corner points :
coords <- rbind( c(0 , 2, 3), c(1 , 3, 2), c(3, 0 , 2), c(2, 1 , 3), c(2, 3, 0 ), c(3, 2, 1 ) )
How should I read and understand the orientation of the cube corners from this? A simple tip can get me started.
I would like to add some example code (to complement Romain Francois' code on the rwiki page referred to above). But, as can be seen from my questions, I don't understand this sufficiently to do this. But I hope that I have given sufficient information to explain my problem.