Search in sources :

Example 1 with GLCapabilities

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;
}
Also used : GLCapabilities(com.jogamp.opengl.GLCapabilities) Point(java.awt.Point) GLProfile(com.jogamp.opengl.GLProfile)

Example 2 with GLCapabilities

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;
}
Also used : GLAutoDrawable(com.jogamp.opengl.GLAutoDrawable) GLCapabilities(com.jogamp.opengl.GLCapabilities)

Example 3 with GLCapabilities

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);
}
Also used : GLCapabilities(com.jogamp.opengl.GLCapabilities) JFrame(javax.swing.JFrame) GLJPanel(com.jogamp.opengl.awt.GLJPanel) GLProfile(com.jogamp.opengl.GLProfile)

Example 4 with GLCapabilities

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);
}
Also used : GLCapabilities(com.jogamp.opengl.GLCapabilities) GL2SharedResources(maspack.render.GL.GL2.GL2SharedResources) GL2Viewer(maspack.render.GL.GL2.GL2Viewer) GLProfile(com.jogamp.opengl.GLProfile)

Example 5 with GLCapabilities

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);
}
Also used : GL3VertexAttributeInfo(maspack.render.GL.GL3.GL3VertexAttributeInfo) GLCapabilities(com.jogamp.opengl.GLCapabilities) GLViewer(maspack.render.GL.GLViewer) GL3SharedResources(maspack.render.GL.GL3.GL3SharedResources) GL3Viewer(maspack.render.GL.GL3.GL3Viewer) GL3VertexAttributeMap(maspack.render.GL.GL3.GL3VertexAttributeMap) StringIntPair(maspack.render.GL.GL3.GLSLGenerator.StringIntPair) GLProfile(com.jogamp.opengl.GLProfile)

Aggregations

GLCapabilities (com.jogamp.opengl.GLCapabilities)27 GLProfile (com.jogamp.opengl.GLProfile)18 FPSAnimator (com.jogamp.opengl.util.FPSAnimator)12 GLWindow (com.jogamp.newt.opengl.GLWindow)8 GLJPanel (com.jogamp.opengl.awt.GLJPanel)4 GLAutoDrawable (com.jogamp.opengl.GLAutoDrawable)3 GLCanvas (com.jogamp.opengl.awt.GLCanvas)3 Frame (java.awt.Frame)3 WindowAdapter (java.awt.event.WindowAdapter)3 WindowEvent (java.awt.event.WindowEvent)3 GLRunnable (com.jogamp.opengl.GLRunnable)2 JFrame (javax.swing.JFrame)2 GL3SharedResources (maspack.render.GL.GL3.GL3SharedResources)2 GL3VertexAttributeInfo (maspack.render.GL.GL3.GL3VertexAttributeInfo)2 GL3VertexAttributeMap (maspack.render.GL.GL3.GL3VertexAttributeMap)2 StringIntPair (maspack.render.GL.GL3.GLSLGenerator.StringIntPair)2 GLJPanel (maspack.render.GL.jogl.GLJPanel)2 NWindow (automenta.vivisect.swing.NWindow)1 MutableGraphicsConfiguration (com.jogamp.nativewindow.MutableGraphicsConfiguration)1 NativeSurface (com.jogamp.nativewindow.NativeSurface)1