pro mg_ogmesh_example, vertices, polygons=polygons, renderer=renderer, $
_extra=e
compile_opt strictarr
view = obj_new('IDLgrView')
model = obj_new('IDLgrModel')
view->add, model
polygon = obj_new('IDLgrPolygon', vertices, polygons=polygons, _extra=e)
model->add, polygon
lightModel = obj_new('IDLgrModel')
view->add, lightModel
light = obj_new('IDLgrLight', type=2, location=[-1, 1, 1])
lightModel->add, light
polygon->getProperty, xrange=xr, yrange=yr, zrange=zr
cr = [xr[0] < yr[0] < zr[0], xr[1] > yr[1] > zr[1]]
cc = mg_linear_function(cr, [-0.75, 0.75])
polygon->setProperty, xcoord_conv=cc, ycoord_conv=cc, zcoord_conv=cc
model->rotate, [0, 1, 0], -30
model->rotate, [1, 0, 0], 30
xaxis = obj_new('IDLgrAxis', direction=0, range=xr, /exact, $
location=[xr[0], yr[0], zr[0]], ticklen=0.015)
model->add, xaxis
yaxis = obj_new('IDLgrAxis', direction=1, range=yr, /exact, $
location=[xr[0], yr[0], zr[0]], ticklen=0.015)
model->add, yaxis
zaxis = obj_new('IDLgrAxis', direction=2, range=zr, /exact, $
location=[xr[0], yr[0], zr[0]], ticklen=0.015)
model->add, zaxis
xaxis->setProperty, xcoord_conv=cc, ycoord_conv=cc, zcoord_conv=cc
yaxis->setProperty, xcoord_conv=cc, ycoord_conv=cc, zcoord_conv=cc
zaxis->setProperty, xcoord_conv=cc, ycoord_conv=cc, zcoord_conv=cc
window = obj_new('IDLgrWindow', dimensions=[500, 500], $
graphics_tree=view, renderer=renderer)
window->draw
end
restore, filename=filepath('cow10.sav', subdir=['examples', 'data'])
mg_ogmesh_example, transpose([[x], [y], [z]]), polygons=polylist, $
color=[200, 100, 100], shading=1
end