Examples of GLAutoDrawable


Examples of javax.media.opengl.GLAutoDrawable

        this.ships = SpaceshipState.stateType.newArray(maxItems);

        final GLProfile glp = GLProfile.get(GLProfile.GL3);
        final GLCapabilitiesImmutable glcaps = (GLCapabilitiesImmutable) new GLCapabilities(glp);
        final GLAutoDrawable drawable;
        final GLCapabilities tGLCapabilities = new GLCapabilities(glp);
        tGLCapabilities.setSampleBuffers(true);
        tGLCapabilities.setNumSamples(1);

//            tGLCapabilities.setAccumAlphaBits(16);
//            tGLCapabilities.setAccumBlueBits(16);
//            tGLCapabilities.setAccumGreenBits(16);
//            tGLCapabilities.setAccumRedBits(16);

        if (TOOLKIT == Toolkit.NEWT || TOOLKIT == Toolkit.NEWT_CANVAS) {
            final GLWindow newt = GLWindow.create(glcaps);

            final NewtListener listener = new NewtListener();
            newt.addKeyListener(listener);
            newt.addMouseListener(listener);

            drawable = newt;
        } else {
            final GLCanvas glCanvas = new GLCanvas(glcaps);

            final AwtListener listener = new AwtListener();
            glCanvas.addKeyListener(listener);
            glCanvas.addMouseListener(listener);
            glCanvas.addMouseMotionListener(listener);
            glCanvas.addMouseWheelListener(listener);

            drawable = glCanvas;
        }

        animator = new FPSAnimator(drawable, 30);

        if (TOOLKIT == Toolkit.NEWT) {
            final GLWindow window = (GLWindow) drawable;

            window.addWindowListener(new com.jogamp.newt.event.WindowAdapter() {
                @Override
                public void windowDestroyNotify(com.jogamp.newt.event.WindowEvent arg0) {
                    animator.stop();
                    System.exit(0);
                }
            });
            window.setSize(WINDOW_WIDTH, WINDOW_HEIGHT);
            window.setTitle(WINDOW_TITLE);
            window.setVisible(true);
            this.window = window;
        } else {
            final Component canvas;

            if (TOOLKIT == Toolkit.NEWT_CANVAS)
                canvas = new NewtCanvasAWT((GLWindow) drawable);
            else
                canvas = (GLCanvas) drawable;

            final Frame window = new Frame();

            window.addWindowListener(new java.awt.event.WindowAdapter() {
                @Override
                public void windowClosing(java.awt.event.WindowEvent windowevent) {
                    animator.stop();
                    window.remove(canvas);
                    window.dispose();
                    System.exit(0);
                }
            });

            window.add(canvas);
            window.pack();
            canvas.requestFocusInWindow();
            window.setSize(WINDOW_WIDTH, WINDOW_HEIGHT);
            window.setTitle(WINDOW_TITLE);
            window.setVisible(true);
            this.window = window;
        }

        drawable.addGLEventListener(this);
        animator.start();
    }
View Full Code Here

Examples of javax.media.opengl.GLAutoDrawable

      // debug fallback
      if(!properties.isPBuffer()) cannotCreatePBuffer = true;
      if(!usePBuffer) cannotCreatePBuffer = true;
      if(!cannotCreatePBuffer) {
        try {
          GLAutoDrawable imageDrawable = drawableFactory.createGLPbuffer(graphicsDevice,
              PBUFFER_CAPABILITIES, null, imageDrawingWidth, imageDrawingHeight, window.getContext());
          imageRenderContext.setDrawable(imageDrawable);
         
          SupportGLExecutable supportGLExecutable = new SupportGLExecutable();
          glExecutor.execute(supportGLExecutable);
          String vendor = supportGLExecutable.vendor;
          if (vendor != null && vendor.toLowerCase().contains("intel")) {
            imageDrawable.getContext().destroy();
            imageDrawable = null;
            usePBuffer = false;
            cannotCreatePBuffer = true;
          }
        } catch(Exception e) {
View Full Code Here

Examples of javax.media.opengl.GLAutoDrawable

      GL2 gl = (GL2)GLU.getCurrentGL();
      glExecutable.execute(GLContext.getCurrent().getGLDrawable(), gl);
    } catch(GLException e) {
      // no context current
      try {
        GLAutoDrawable imageDrawable = renderContext.getDrawable();
        imageDrawable.setAutoSwapBufferMode(false);
        renderContext.setGLEventListener(executableListener);
        executableListener.executable = glExecutable;
        imageDrawable.display();
        imageDrawable.setAutoSwapBufferMode(true);
        renderContext.resetGLEventListener();
      } catch(GLException e2) {
        // TODO This maybe is a real exception due to a problem not just because no canvas is visible
        return false;
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.