As part of my work, im trying to write a plugin for a program called Protege using JOGL. Essentially, all you have to do is extend the AbstractTabWidget class provided in the API and away you go. This seems to work…ish. Using my current approach, the JOGL window overwrites all the other tabs in the protege application “until” the JOGL tab is selected. Switching to the other tabs results in just a grey area until the window is resized. Performance, as whole, on the other tabs is quite slow. I’d like JOGL to only do its rendering loop when it is at the forefront and to call a repaint when its not doing anything. Here is the the code i have and the hierarchy of the tab widget class from the javadoc:
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
edu.stanford.smi.protege.widget.AbstractWidget
edu.stanford.smi.protege.widget.AbstractTabWidget
Code in the tab:
public void fireGL() {
behaviour3D = new Behaviour3D(owlData);
//Now we will create our GLCanvas
GLCapabilities glcaps = new GLCapabilities();
glcaps.setHardwareAccelerated(true); glcaps.setDoubleBuffered(true);
glcaps.setSampleBuffers(true);
glcaps.setNumSamples(4);
GLDrawableFactory gldFactory = GLDrawableFactory.getFactory();
GLCanvas glcanvas = gldFactory.createGLCanvas(glcaps);
glcanvas.addGLEventListener(behaviour3D);
//create the animator
animator = new Animator(glcanvas);
//add the GLCanvas just like we would any Component
add(glcanvas, BorderLayout.CENTER);
glcanvas.setSize(500, 300);
//center the JFrame on the screen
centerWindow(this);
}