use of com.jogamp.opengl.GLCapabilitiesChooser in project selenium_java by sergueik.
the class CanvasEx method createContents.
private void createContents(Shell shell) {
shell.setLayout(new FillLayout());
animator = new FPSAnimator(60);
animator.setUpdateFPSFrames(60, System.err);
@SuppressWarnings("unused") Canvas canvas = new Canvas(shell, SWT.NONE);
final GLProfile pro = GLProfile.get(GLProfile.GL2GL3);
final GLCapabilities cap = new GLCapabilities(pro);
glCanvas = new GLCanvas(shell, 0, cap, (GLCapabilitiesChooser) null);
glCanvas.addGLEventListener(new GLEventListener() {
@Override
public void display(final GLAutoDrawable drawable) {
final GL2ES2 gl = drawable.getGL().getGL2ES2();
gl.glClearColor(1.0f, 0f, 1.0f, 1f);
gl.glClear(GL.GL_COLOR_BUFFER_BIT);
}
@Override
public void dispose(final GLAutoDrawable drawable) {
System.err.println("dispose");
}
@Override
public void init(final GLAutoDrawable drawable) {
System.err.println("init");
}
@Override
public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int w, final int h) {
}
});
animator.add(glCanvas);
glCanvas.setVisible(true);
shell.addListener(SWT.Close, new Listener() {
public void handleEvent(Event event) {
animator.stop();
glCanvas.destroy();
// TODO: [ERROR] local variable shell is accessed from within inner
// class; needs to be declared final
// shell.setVisible(false);
}
});
animator.start();
}
Aggregations