Here's the code I use:
public partial class Form1 : Form
{
private ILPlotCube plotcube_ = null;
private ILSurface surface_ = null;
public Form1()
{
InitializeComponent();
ilPanel1.Driver = RendererTypes.OpenGL;
}
private void ilPanel1_Load(object sender, EventArgs e)
{
var scene = new ILScene();
plotcube_ = scene.Add(new ILPlotCube(twoDMode: false));
plotcube_.MouseDoubleClick += PlotCube_MouseDoubleClick;
ilPanel1.Scene = scene;
}
private void PlotCube_MouseDoubleClick(object sender, ILMouseEventArgs e)
{
ResetSurface();
e.Cancel = true;
e.Refresh = true;
}
private void ResetSurface()
{
using (ILScope.Enter())
{
ILArray<float> array = ILMath.tosingle(ILSpecialData.sincf(1000, 1000));
if (surface_ == null)
{
surface_ = new ILSurface(0);
surface_.Fill.Markable = false;
surface_.Wireframe.Visible = false;
plotcube_.Add(surface_);
}
surface_.UpdateColormapped(array);
surface_.UseLighting = false;
}
plotcube_.Plots.Reset();
}
}
Each call to ResetSurface() takes a few seconds to complete: ~6s in Debug and ~4s in Release mode.
Once the surface is updated, though, rotation and pan operations are very fluid.
The smaller the surface, the faster the update.
Is there a more efficient way to update the surface positions/colors buffers?
Note: using IlNumerics 3.2.2 Community Edition on Windows 7 laptop with dual graphics (Intel HD 4000 + GeForce GT 650M), with nvidia card activated.