; docformat = 'rst' ;+ ; Simple example of displaying a surface in object graphics. ; ; :Params: ; z : in, required, type=3D numeric array ; surface data to display ; ; :Keywords: ; renderer : in, optional, type=long ; set to 0 for hardware rendering, 1 for software rendering ; _extra : in, optional, type=keywords ; keywords to IDLgrSurface::init ;- pro mg_ogsurface_example, z, renderer=renderer, _extra=e compile_opt strictarr view = obj_new('IDLgrView') model = obj_new('IDLgrModel') view->add, model surface = obj_new('IDLgrSurface', z, _extra=e) model->add, surface lightModel = obj_new('IDLgrModel') view->add, lightModel light = obj_new('IDLgrLight', type=2, location=[-1, 1, 1]) lightModel->add, light surface->getProperty, xrange=xr, yrange=yr, zrange=zr xc = mg_linear_function(xr, [-0.5, 0.5]) yc = mg_linear_function(yr, [-0.5, 0.5]) zc = mg_linear_function(zr, [-0.5, 0.5]) surface->setProperty, xcoord_conv=xc, ycoord_conv=yc, zcoord_conv=zc model->rotate, [1, 0, 0], -90 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]]) model->add, xaxis yaxis = obj_new('IDLgrAxis', direction=1, range=yr, /exact, $ location=[xr[0], yr[0], zr[0]]) model->add, yaxis zaxis = obj_new('IDLgrAxis', direction=2, range=zr, /exact, $ location=[xr[0], yr[0], zr[0]]) model->add, zaxis xaxis->setProperty, xcoord_conv=xc, ycoord_conv=yc, zcoord_conv=zc yaxis->setProperty, xcoord_conv=xc, ycoord_conv=yc, zcoord_conv=zc zaxis->setProperty, xcoord_conv=xc, ycoord_conv=yc, zcoord_conv=zc window = obj_new('IDLgrWindow', dimensions=[500, 500], $ graphics_tree=view, renderer=renderer) window->draw end