public class Example {
public Example() {
//do some stuff for initilization
GLCanvas canvas = new GLCanvas(/*Parameters*/);
initScene();
set2dRendering();
display.asyncExec(new Runnable() {
public void run() {
if (!canvas.isDisposed()) {
canvas.setCurrent();
try {
GLContext.useContext(canvas);
} catch(LWJGLException e) { e.printStackTrace(); }
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); //clears the last rendering and does a new one
GL11.glLoadIdentity();
render();
canvas.swapBuffers();
display.asyncExec(this);
}
}
});
}
}
This is a hacked down version of the loop from Snippet95.java (a code snipet from www.eclipse.org). This loop seems incredibly greedy. Is this really the right (best) way to do this?