Search in sources :

Example 11 with GLCapabilities

use of com.jogamp.opengl.GLCapabilities 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 12 with GLCapabilities

use of com.jogamp.opengl.GLCapabilities 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 13 with GLCapabilities

use of com.jogamp.opengl.GLCapabilities 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);
    Console.println(glp);
    Console.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 14 with GLCapabilities

use of com.jogamp.opengl.GLCapabilities in project jmonkeyengine by jMonkeyEngine.

the class JoglNewtAbstractDisplay method initGLCanvas.

protected void initGLCanvas() {
    GLCapabilities caps;
    if (settings.getRenderer().equals(AppSettings.JOGL_OPENGL_FORWARD_COMPATIBLE)) {
        caps = new GLCapabilities(GLProfile.getMaxProgrammable(true));
    } else {
        caps = new GLCapabilities(GLProfile.getMaxFixedFunc(true));
    }
    caps.setHardwareAccelerated(true);
    caps.setDoubleBuffered(true);
    caps.setStencilBits(settings.getStencilBits());
    caps.setDepthBits(settings.getDepthBits());
    if (settings.getSamples() > 1) {
        caps.setSampleBuffers(true);
        caps.setNumSamples(settings.getSamples());
    }
    canvas = GLWindow.create(caps);
    canvas.invoke(false, new GLRunnable() {

        public boolean run(GLAutoDrawable glad) {
            canvas.getGL().setSwapInterval(settings.isVSync() ? 1 : 0);
            return true;
        }
    });
    canvas.requestFocus();
    canvas.setSize(settings.getWidth(), settings.getHeight());
    canvas.addGLEventListener(this);
    //FIXME not sure it is the best place to do that
    renderable.set(true);
}
Also used : GLAutoDrawable(com.jogamp.opengl.GLAutoDrawable) GLCapabilities(com.jogamp.opengl.GLCapabilities) GLRunnable(com.jogamp.opengl.GLRunnable)

Example 15 with GLCapabilities

use of com.jogamp.opengl.GLCapabilities in project jmonkeyengine by jMonkeyEngine.

the class JoglOffscreenBuffer method initInThread.

protected void initInThread() {
    // not necessary as JOGL can create an offscreen buffer even without full FBO support
    //        if (!GLContext.getCurrent().hasFullFBOSupport()){
    //            logger.severe("Offscreen surfaces are not supported.");
    //            return;
    //        }
    final GLProfile profile;
    if (settings.getRenderer().equals(AppSettings.JOGL_OPENGL_FORWARD_COMPATIBLE)) {
        profile = GLProfile.getMaxProgrammable(true);
    } else {
        profile = GLProfile.getMaxFixedFunc(true);
    }
    caps = new GLCapabilities(profile);
    int samples = getNumSamplesToUse();
    caps.setHardwareAccelerated(true);
    caps.setDoubleBuffered(true);
    caps.setStencilBits(settings.getStencilBits());
    caps.setDepthBits(settings.getDepthBits());
    caps.setOnscreen(false);
    caps.setSampleBuffers(true);
    caps.setNumSamples(samples);
    offscreenDrawable = GLDrawableFactory.getFactory(profile).createOffscreenAutoDrawable(null, caps, null, width, height);
    offscreenDrawable.display();
    renderable.set(true);
    logger.fine("Offscreen buffer created.");
    super.internalCreate();
    listener.initialize();
}
Also used : GLCapabilities(com.jogamp.opengl.GLCapabilities) 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