function h3d_draw_sphere_hs(s, sphere_faces) [x, y, z] = sphere(sphere_faces); for a=1:size(z,1) for b=1:size(z,2) p = [ x(a,b) y(a,b) z(a,b) ]'; [face, u, v] = h3d_coords_s2_to_cube(p); [face, i, j] = h3d_coords_cube_to_cell(face, u, v, s.cube_ncells); texture(a,b) = s.cube_hs(face,i,j); end end globe = surf(x, y, z, 'FaceColor', 'none', 'EdgeColor', 0.5*[1 1 1]); % Set image as color data (cdata) property, and set face color to indicate % a texturemap, which Matlab expects to be in cdata. Turn off the mesh edges. set(globe, 'FaceColor', 'texturemap', 'CData', texture, 'EdgeColor', 'none');