use of com.jogamp.opengl.GLCapabilities in project gephi by gephi.
the class GLAbstractListener method getCaps.
protected GLCapabilities getCaps() {
GLProfile profile = GLProfile.get(GLProfile.GL2);
GLCapabilities caps = new GLCapabilities(profile);
try {
// if NOT opaque
caps.setAlphaBits(8);
caps.setDoubleBuffered(true);
caps.setHardwareAccelerated(true);
// FSAA
int antialisaing = vizController.getVizConfig().getAntialiasing();
switch(antialisaing) {
case 0:
caps.setSampleBuffers(false);
break;
case 2:
caps.setSampleBuffers(true);
caps.setNumSamples(2);
break;
case 4:
caps.setSampleBuffers(true);
caps.setNumSamples(4);
break;
case 8:
caps.setSampleBuffers(true);
caps.setNumSamples(8);
break;
case 16:
caps.setSampleBuffers(true);
caps.setNumSamples(16);
break;
default:
}
} catch (com.jogamp.opengl.GLException ex) {
Exceptions.printStackTrace(ex);
}
return caps;
}
use of com.jogamp.opengl.GLCapabilities in project artisynth_core by artisynth.
the class GLSupport method getVersionInfo.
public static GLVersionInfo getVersionInfo(GLProfile glp) {
GLCapabilities glc = new GLCapabilities(glp);
GLAutoDrawable dummy = GLDrawableFactory.getFactory(glp).createDummyAutoDrawable(null, true, glc, null);
GLVersionListener listener = new GLVersionListener();
dummy.addGLEventListener(listener);
// triggers GLContext object creation and native realization.
dummy.display();
while (!listener.isValid()) {
// let other threads do stuff
Thread.yield();
}
GLVersionInfo vinfo = listener.getVersionInfo();
dummy.disposeGLEventListener(listener, true);
// XXX should be auto-destroyed. We have reports that manually calling destroy sometimes crashes the JVM.
dummy.destroy();
return vinfo;
}
use of com.jogamp.opengl.GLCapabilities in project artisynth_core by artisynth.
the class JOGLTest method main.
public static void main(String[] args) {
// getting the capabilities object of GL2 profile
final GLProfile profile = GLProfile.get(GLProfile.GL2);
GLCapabilities capabilities = new GLCapabilities(profile);
// The canvas
final GLJPanel glcanvas = new GLJPanel(capabilities);
JOGLTest b = new JOGLTest();
glcanvas.addGLEventListener(b);
glcanvas.setSize(400, 400);
// creating frame
final JFrame frame = new JFrame(" Basic Frame");
// adding canvas to it
frame.getContentPane().add(glcanvas);
frame.setSize(frame.getContentPane().getPreferredSize());
frame.setVisible(true);
}
use of com.jogamp.opengl.GLCapabilities in project artisynth_core by artisynth.
the class MultiViewer method addGL2Viewer.
public void addGL2Viewer(String title, int x, int y, int w, int h) {
if (gl2resources == null) {
GLProfile glp3 = GLProfile.get(GLProfile.GL2);
GLCapabilities cap = new GLCapabilities(glp3);
cap.setSampleBuffers(true);
cap.setNumSamples(8);
gl2resources = new GL2SharedResources(cap);
}
GL2Viewer viewer = new GL2Viewer(null, gl2resources, w, h);
addViewer(title, viewer, x, y, w, h);
}
use of com.jogamp.opengl.GLCapabilities in project artisynth_core by artisynth.
the class MultiViewer method addGL3Viewer.
public void addGL3Viewer(String title, int x, int y, int w, int h) {
if (gl3resources == null) {
GLProfile glp3 = GLProfile.get(GLProfile.GL3);
GLCapabilities cap = new GLCapabilities(glp3);
cap.setSampleBuffers(true);
cap.setNumSamples(8);
// 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()));
}
gl3resources = new GL3SharedResources(cap, attributeMap);
}
GLViewer viewer = new GL3Viewer(null, gl3resources, w, h);
addViewer(title, viewer, x, y, w, h);
}
Aggregations