Search in sources :

Example 1 with GLProfile

use of com.jogamp.opengl.GLProfile 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 GLProfile

use of com.jogamp.opengl.GLProfile in project tdme by andreasdr.

the class EngineTest method main.

/**
	 * @param args
	 */
public static void main(String[] args) {
    Logger.getLogger("").setLevel(Level.WARNING);
    // create GL canvas
    GLProfile glp = Engine.getProfile();
    GLCapabilities caps = new GLCapabilities(glp);
    // create GL window
    GLWindow glWindow = GLWindow.create(caps);
    glWindow.setTitle("EngineTest");
    // animator
    FPSAnimator animator = new FPSAnimator(glWindow, 60);
    // tdme level editor
    EngineTest engineTest = new EngineTest(glWindow, animator);
    // GL Window
    glWindow.addGLEventListener(engineTest);
    glWindow.setSize(800, 600);
    glWindow.setVisible(true);
    glWindow.addKeyListener(engineTest);
    glWindow.addMouseListener(engineTest);
    glWindow.addWindowListener(engineTest);
    // start animator
    animator.setUpdateFPSFrames(3, null);
    animator.start();
}
Also used : FPSAnimator(com.jogamp.opengl.util.FPSAnimator) GLCapabilities(com.jogamp.opengl.GLCapabilities) GLWindow(com.jogamp.newt.opengl.GLWindow) GLProfile(com.jogamp.opengl.GLProfile)

Example 3 with GLProfile

use of com.jogamp.opengl.GLProfile in project tdme by andreasdr.

the class GUITest method main.

/**
	 * @param args
	 */
public static void main(String[] args) {
    Logger.getLogger("").setLevel(Level.WARNING);
    // gl profile
    GLProfile glp = Engine.getProfile();
    // create GL caps
    GLCapabilities caps = new GLCapabilities(glp);
    caps.setBackgroundOpaque(true);
    caps.setDepthBits(16);
    caps.setDoubleBuffered(true);
    System.out.println(glp);
    System.out.println(caps);
    // create GL window
    GLWindow glWindow = GLWindow.create(caps);
    glWindow.setTitle("GUI Test");
    glWindow.setSize(800, 600);
    // animator
    FPSAnimator animator = new FPSAnimator(glWindow, 60);
    animator.setUpdateFPSFrames(3, null);
    // create test
    GUITest guiTest = new GUITest(glWindow);
    glWindow.addGLEventListener(guiTest);
    glWindow.addWindowListener(guiTest);
    glWindow.setVisible(true);
    // start animator
    animator.start();
}
Also used : FPSAnimator(com.jogamp.opengl.util.FPSAnimator) GLCapabilities(com.jogamp.opengl.GLCapabilities) GLWindow(com.jogamp.newt.opengl.GLWindow) GLProfile(com.jogamp.opengl.GLProfile)

Example 4 with GLProfile

use of com.jogamp.opengl.GLProfile in project tdme by andreasdr.

the class PhysicsTest1 method main.

/**
	 * @param args
	 */
public static void main(String[] args) {
    Logger.getLogger("").setLevel(Level.WARNING);
    // create GL canvas
    GLProfile glp = Engine.getProfile();
    GLCapabilities caps = new GLCapabilities(glp);
    // create GL window
    GLWindow glWindow = GLWindow.create(caps);
    glWindow.setTitle("PhysicsTest1");
    // animator
    FPSAnimator animator = new FPSAnimator(glWindow, 60);
    // tdme level editor
    PhysicsTest1 physicsTest1 = new PhysicsTest1();
    // GL Window
    glWindow.addGLEventListener(physicsTest1);
    glWindow.setSize(800, 600);
    glWindow.setVisible(true);
    glWindow.addKeyListener(physicsTest1);
    glWindow.addMouseListener(physicsTest1);
    glWindow.addWindowListener(physicsTest1);
    // start animator
    animator.setUpdateFPSFrames(3, null);
    animator.start();
}
Also used : FPSAnimator(com.jogamp.opengl.util.FPSAnimator) GLCapabilities(com.jogamp.opengl.GLCapabilities) GLWindow(com.jogamp.newt.opengl.GLWindow) GLProfile(com.jogamp.opengl.GLProfile)

Example 5 with GLProfile

use of com.jogamp.opengl.GLProfile in project tdme by andreasdr.

the class PhysicsTest2 method main.

/**
	 * Main
	 * @param args
	 */
public static void main(String[] args) {
    Logger.getLogger("").setLevel(Level.WARNING);
    // create GL canvas
    GLProfile glp = Engine.getProfile();
    GLCapabilities caps = new GLCapabilities(glp);
    // create GL window
    GLWindow glWindow = GLWindow.create(caps);
    glWindow.setTitle("PhysicsTest2");
    // animator
    FPSAnimator animator = new FPSAnimator(glWindow, 60);
    // tdme level editor
    PhysicsTest2 physicsTest2 = new PhysicsTest2();
    // GL Window
    glWindow.addGLEventListener(physicsTest2);
    glWindow.setSize(800, 600);
    glWindow.setVisible(true);
    glWindow.addKeyListener(physicsTest2);
    glWindow.addMouseListener(physicsTest2);
    glWindow.addWindowListener(physicsTest2);
    // start animator
    animator.setUpdateFPSFrames(3, null);
    animator.start();
}
Also used : FPSAnimator(com.jogamp.opengl.util.FPSAnimator) GLCapabilities(com.jogamp.opengl.GLCapabilities) GLWindow(com.jogamp.newt.opengl.GLWindow) GLProfile(com.jogamp.opengl.GLProfile)

Aggregations

GLProfile (com.jogamp.opengl.GLProfile)11 GLCapabilities (com.jogamp.opengl.GLCapabilities)10 GLWindow (com.jogamp.newt.opengl.GLWindow)8 FPSAnimator (com.jogamp.opengl.util.FPSAnimator)8 Point (java.awt.Point)1