use of maspack.render.GL.jogl.GLJPanel in project artisynth_core by artisynth.
the class GL3JPanelTest method main.
public static void main(String[] args) {
GLProfile glp = GLProfile.getDefault();
GLCapabilities caps = new GLCapabilities(glp);
caps.setSampleBuffers(true);
caps.setNumSamples(8);
caps.setPBuffer(false);
// GLCanvas canvas = new GLCanvas(caps);
progManager = new GL3ProgramManager();
if (resources == null) {
// get attribute map from GLSL generator
StringIntPair[] attributes = GLSLGenerator.ATTRIBUTES;
GL3VertexAttributeMap attributeMap = new GL3VertexAttributeMap(new GL3VertexAttributeInfo(attributes[0].getString(), attributes[0].getInt()), new GL3VertexAttributeInfo(attributes[1].getString(), attributes[1].getInt()), new GL3VertexAttributeInfo(attributes[2].getString(), attributes[2].getInt()), new GL3VertexAttributeInfo(attributes[3].getString(), attributes[3].getInt()));
for (int i = 4; i < attributes.length; ++i) {
attributeMap.add(new GL3VertexAttributeInfo(attributes[i].getString(), attributes[i].getInt()));
}
resources = new GL3SharedResources(caps, attributeMap);
}
lightManager = new GLLightManager();
setDefaultLights();
final GLJPanel canvas = resources.createPanel();
final Frame frame = new Frame("AWT Window Test");
frame.setSize(width, height);
frame.setLocation(30, 30);
frame.add(canvas);
frame.setVisible(true);
resources.registerViewer(frame);
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
frame.remove(canvas);
resources.deregisterViewer(frame);
frame.dispose();
System.exit(0);
}
});
canvas.addGLEventListener(new GL3JPanelTest());
FPSAnimator animator = new FPSAnimator(canvas, 60);
animator.start();
}
use of maspack.render.GL.jogl.GLJPanel in project artisynth_core by artisynth.
the class GLJPanelTest method main.
public static void main(String[] args) {
GLProfile glp = GLProfile.getDefault();
GLCapabilities caps = new GLCapabilities(glp);
GLJPanel canvas = new GLJPanel(caps);
final Frame frame = new Frame("AWT Window Test");
frame.setSize(300, 300);
frame.setLocation(30, 30);
frame.add(canvas);
frame.setVisible(true);
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
frame.dispose();
System.exit(0);
}
});
canvas.addGLEventListener(new GLJPanelTest());
FPSAnimator animator = new FPSAnimator(canvas, 60);
animator.start();
}
use of maspack.render.GL.jogl.GLJPanel in project artisynth_core by artisynth.
the class GLSharedResources method createPanel.
/**
* Creates a canvas with the same capabilities and shared context
* as other viewers using this set of resources. This ensures
* that the sharing of resources is properly initialized.
* MUST BE CALLED IN THE GLViewer's CONSTRUCTOR!!
* @return the created canvas
*/
public synchronized GLJPanel createPanel() {
maybeCreateMaster();
GLJPanel panel = new GLJPanel(glCapabilities);
panel.setSharedAutoDrawable(masterDrawable);
return panel;
}
Aggregations