public static void main(String[] args) {
    // Initialization
    // Setting up GL
    GLProfile.initSingleton();
    GLProfile glp = GLProfile.getDefault();
    GLCapabilities caps = new GLCapabilities(glp);
    GLCanvas canvas = new GLCanvas(caps);

    // Making the AWT frame window
    Frame frame = new Frame("Assignment 1");
    frame.setSize(800, 600);
    frame.add(canvas);
    frame.setVisible(true);

    // Adding a render listener
    canvas.addGLEventListener(new Assignment1());

    // Fixes so the exit button exits the program
    frame.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(0);
          }
        });
  }
예제 #2
0
 static GLProfile getGLProfile(final String profile) {
   if (!GLProfile.isAvailable(profile)) {
     System.err.println("Profile " + profile + " n/a");
     return null;
   }
   return GLProfile.get(profile);
 }
예제 #3
0
 static GLProfile getGL2ES3() {
   final GLProfile glp = GLProfile.getMaxProgrammableCore(true);
   if (null == glp || !glp.isGL2ES3()) {
     System.err.println("GL2ES3 n/a, has max-core " + glp);
     return null;
   }
   return glp;
 }
예제 #4
0
 @Test
 public void test03VBOVAO() throws GLException, InterruptedException {
   if (!GLProfile.isAvailable(GLProfile.GL3bc)) {
     System.err.println("GL3bc n/a");
     return;
   }
   GL3VAODemo.Mode[] modes = new GL3VAODemo.Mode[] {GL3VAODemo.Mode.VBO_VAO};
   testImpl(GLProfile.get(GLProfile.GL3bc), modes);
 }
예제 #5
0
 @Test
 public void test12CPUSourceAndVBOOnly() throws GLException, InterruptedException {
   if (!GLProfile.isAvailable(GLProfile.GL3bc)) {
     System.err.println("GL3bc n/a");
     return;
   }
   GL3VAODemo.Mode[] modes =
       new GL3VAODemo.Mode[] {GL3VAODemo.Mode.CPU_SRC, GL3VAODemo.Mode.VBO_ONLY};
   testImpl(GLProfile.get(GLProfile.GL3bc), modes);
 }
예제 #6
0
 protected static void mapStaticGLESVersion(
     AbstractGraphicsDevice device, GLCapabilitiesImmutable caps) {
   final GLProfile glp = caps.getGLProfile();
   final int[] reqMajorCTP = new int[2];
   GLContext.getRequestMajorAndCompat(glp, reqMajorCTP);
   if (glp.isGLES() && reqMajorCTP[0] >= 2) {
     reqMajorCTP[1] |= GLContext.CTX_IMPL_ES2_COMPAT | GLContext.CTX_IMPL_FBO;
   }
   if (!caps.getHardwareAccelerated()) {
     reqMajorCTP[1] |= GLContext.CTX_IMPL_ACCEL_SOFT;
   }
   mapCurrentAvailableGLVersionImpl(device, reqMajorCTP[0], 0, reqMajorCTP[1]);
 }
예제 #7
0
 @BeforeClass
 public static void initClass() {
   glp = GLProfile.getGL2ES2();
   Assert.assertNotNull(glp);
   width = 640;
   height = 480;
 }
예제 #8
0
  public static void main(String[] args) {
    // 1. Configuración de OpenGL Version 2
    GLProfile profile = GLProfile.get(GLProfile.GL2);
    GLCapabilities capabilities = new GLCapabilities(profile);

    // 2. Canvas es el aplicativo gráfico que se empotra en un JFrame - Ventana
    GLCanvas glcanvas = new GLCanvas(capabilities);
    glcanvas.addGLEventListener(new Renderer_Circulo());

    glcanvas.setSize(600, 600);

    // 3. Crear la ventana para mostrar la aplicación de dibujo
    JFrame frame = new JFrame("Aplicación de OpenGL");
    frame.getContentPane().add(glcanvas);
    // 4. Añadir el evento para cerrar la ventana
    frame.addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosing(WindowEvent ev) {
            System.exit(0);
          }
        });
    // 5. Cambiar el tamaño de la ventana y visualizarla
    frame.setSize(frame.getContentPane().getPreferredSize());
    frame.setVisible(true);
  }
예제 #9
0
 /**
  * Validates this instance's parameter. Called automatically by {@link GLArrayDataClient} and
  * {@link GLArrayDataServer}. {@link GLArrayDataWrapper} does not validate it's instance by
  * itself.
  *
  * @param glp the GLProfile to use
  * @param throwException whether to throw an exception if this instance has invalid parameter or
  *     not
  * @return true if this instance has invalid parameter, otherwise false
  */
 public final boolean validate(GLProfile glp, boolean throwException) {
   if (!alive) {
     if (throwException) {
       throw new GLException("Instance !alive " + this);
     }
     return false;
   }
   if (this.isVertexAttribute() && !glp.hasGLSL()) {
     if (throwException) {
       throw new GLException("GLSL not supported on " + glp + ", " + this);
     }
     return false;
   }
   return glp.isValidArrayDataType(
       getIndex(), getComponentCount(), getComponentType(), isVertexAttribute(), throwException);
 }
 // Might be reduced to !double-buff
 @Test
 public void testGL2OffScreenBitmapDblBuf() throws InterruptedException {
   final GLCapabilities reqGLCaps = new GLCapabilities(GLProfile.getDefault());
   reqGLCaps.setOnscreen(false);
   reqGLCaps.setBitmap(true);
   doTest(reqGLCaps, new Gears(1));
 }
예제 #11
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    Log.d(TAG, "onCreate - 0");
    super.onCreate(savedInstanceState);

    // create GLWindow (-> incl. underlying NEWT Display, Screen & Window)
    GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES2));
    Log.d(TAG, "req caps: " + caps);
    GLWindow glWindow = GLWindow.create(caps);
    glWindow.setFullscreen(true);
    setContentView(getWindow(), glWindow);

    glWindow.addGLEventListener(new ElektronenMultiplizierer());
    glWindow
        .getScreen()
        .addMonitorModeListener(
            new MonitorModeListener() {
              @Override
              public void monitorModeChangeNotify(MonitorEvent me) {}

              @Override
              public void monitorModeChanged(MonitorEvent me, boolean success) {
                System.err.println("MonitorMode Changed (success " + success + "): " + me);
              }
            });
    glWindow.setVisible(true);
    Animator animator = new Animator(glWindow);

    animator.setUpdateFPSFrames(60, System.err);
    animator.resetFPSCounter();
    glWindow.resetFPSCounter();

    Log.d(TAG, "onCreate - X");
  }
  protected static X11GLXGraphicsConfiguration createDefaultGraphicsConfiguration(
      AbstractGraphicsScreen absScreen, boolean onscreen, boolean usePBuffer) {
    if (absScreen == null) {
      throw new IllegalArgumentException("AbstractGraphicsScreen is null");
    }
    if (!(absScreen instanceof X11GraphicsScreen)) {
      throw new IllegalArgumentException("Only X11GraphicsScreen are allowed here");
    }
    X11GraphicsScreen x11Screen = (X11GraphicsScreen) absScreen;

    GLProfile glProfile = GLProfile.getDefault();
    GLCapabilities caps = null;
    XVisualInfo xvis = null;
    long fbcfg = 0;
    int fbid = -1;

    // Utilizing FBConfig
    //
    GLCapabilities capsFB = null;
    long display = x11Screen.getDevice().getHandle();
    try {
      NativeWindowFactory.getDefaultFactory().getToolkitLock().lock();
      X11Lib.XLockDisplay(display);
      int screen = x11Screen.getIndex();
      boolean isMultisampleAvailable = GLXUtil.isMultisampleAvailable(display);

      long visID = X11Lib.DefaultVisualID(display, x11Screen.getIndex());
      xvis = X11GLXGraphicsConfiguration.XVisualID2XVisualInfo(display, visID);
      caps =
          X11GLXGraphicsConfiguration.XVisualInfo2GLCapabilities(
              glProfile, display, xvis, onscreen, usePBuffer, isMultisampleAvailable);

      int[] attribs =
          X11GLXGraphicsConfiguration.GLCapabilities2AttribList(
              caps, true, isMultisampleAvailable, display, screen);
      int[] count = {-1};
      PointerBuffer fbcfgsL = GLX.glXChooseFBConfigCopied(display, screen, attribs, 0, count, 0);
      if (fbcfgsL == null || fbcfgsL.limit() < 1) {
        throw new Exception("Could not fetch FBConfig for " + caps);
      }
      fbcfg = fbcfgsL.get(0);
      capsFB =
          X11GLXGraphicsConfiguration.GLXFBConfig2GLCapabilities(
              glProfile, display, fbcfg, true, onscreen, usePBuffer, isMultisampleAvailable);

      fbid = X11GLXGraphicsConfiguration.glXFBConfig2FBConfigID(display, fbcfg);

      xvis = GLX.glXGetVisualFromFBConfigCopied(display, fbcfg);
      if (xvis == null) {
        throw new GLException("Error: Choosen FBConfig has no visual");
      }
    } catch (Throwable t) {
    } finally {
      X11Lib.XUnlockDisplay(display);
      NativeWindowFactory.getDefaultFactory().getToolkitLock().unlock();
    }

    return new X11GLXGraphicsConfiguration(
        x11Screen, (null != capsFB) ? capsFB : caps, caps, null, xvis, fbcfg, fbid);
  }
예제 #13
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    Log.d(TAG, "onCreate - 0");
    super.onCreate(savedInstanceState);

    // create GLWindow (-> incl. underlying NEWT Display, Screen & Window)
    GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES1));
    Log.d(TAG, "req caps: " + caps);
    GLWindow glWindow = GLWindow.create(caps);
    setContentView(getWindow(), glWindow);

    glWindow.addGLEventListener(new RedSquareES1(1));
    glWindow
        .getWindow()
        .getScreen()
        .addScreenModeListener(
            new ScreenModeListener() {
              public void screenModeChangeNotify(ScreenMode sm) {}

              public void screenModeChanged(ScreenMode sm, boolean success) {
                System.err.println("ScreenMode Changed: " + sm);
              }
            });
    glWindow.setVisible(true);
    Animator animator = new Animator(glWindow);
    animator.setUpdateFPSFrames(60, System.err);
    setAnimator(animator);

    Log.d(TAG, "onCreate - X");
  }
예제 #14
0
 protected GLCapabilities createCapabilities() {
   GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2));
   caps.setStencilBits(1);
   caps.setDoubleBuffered(true);
   caps.setAlphaBits(8);
   return caps;
 }
예제 #15
0
  public static void main(String args[]) {

    GLProfile.initSingleton();
    SwingUtilities.invokeLater(
        new Runnable() {
          public void run() {
            (new Main()).start();
          }
        });
  }
예제 #16
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    String[] urls0 =
        new String[] {
          System.getProperty("jnlp.media0_url2"),
          System.getProperty("jnlp.media0_url1"),
          System.getProperty("jnlp.media0_url0")
        };
    final URLConnection urlConnection0 = getResource(urls0, 0);
    if (null == urlConnection0) {
      throw new RuntimeException("no media reachable: " + Arrays.asList(urls0));
    }

    // also initializes JOGL
    final GLCapabilities capsMain = new GLCapabilities(GLProfile.getGL2ES2());
    capsMain.setBackgroundOpaque(false);

    // screen for layout params ..
    final com.jogamp.newt.Display dpy = NewtFactory.createDisplay(null);
    final com.jogamp.newt.Screen scrn = NewtFactory.createScreen(dpy, 0);
    scrn.addReference();

    try {
      final Animator animator = new Animator();

      // Main
      final MovieCube demoMain =
          new MovieCube(
              urlConnection0,
              GLMediaPlayer.STREAM_ID_AUTO,
              GLMediaPlayer.STREAM_ID_AUTO,
              -2.3f,
              0f,
              0f);
      final GLWindow glWindowMain = GLWindow.create(scrn, capsMain);
      glWindowMain.setFullscreen(true);
      setContentView(getWindow(), glWindowMain);
      glWindowMain.addMouseListener(showKeyboardMouseListener);
      glWindowMain.addGLEventListener(demoMain);
      animator.add(glWindowMain);
      glWindowMain.setVisible(true);

      // animator.setUpdateFPSFrames(60, System.err);
      animator.setUpdateFPSFrames(-1, null);
      animator.resetFPSCounter();
    } catch (IOException e) {
      e.printStackTrace();
    }

    scrn.removeReference();

    Log.d(TAG, "onCreate - X");
  }
  private void initGL() {
    GLProfile profile = GLProfile.getDefault();

    GLCapabilities capabilities = new GLCapabilities(profile);

    canvas = new GLCanvas(capabilities);

    canvas.setSize(imageWidth, imageHeight);

    canvas.addGLEventListener(this);
  }
예제 #18
0
  protected static X11ExternalGLXContext create(GLDrawableFactory factory, GLProfile glp) {
    long ctx = GLX.glXGetCurrentContext();
    if (ctx == 0) {
      throw new GLException("Error: current context null");
    }
    long display = GLX.glXGetCurrentDisplay();
    if (display == 0) {
      throw new GLException("Error: current display null");
    }
    long drawable = GLX.glXGetCurrentDrawable();
    if (drawable == 0) {
      throw new GLException(
          "Error: attempted to make an external GLDrawable without a drawable/context current");
    }
    IntBuffer val = Buffers.newDirectIntBuffer(1);

    int w, h;
    GLX.glXQueryDrawable(display, drawable, GLX.GLX_WIDTH, val);
    w = val.get(0);
    GLX.glXQueryDrawable(display, drawable, GLX.GLX_HEIGHT, val);
    h = val.get(0);

    GLX.glXQueryContext(display, ctx, GLX.GLX_SCREEN, val);
    X11GraphicsScreen x11Screen =
        (X11GraphicsScreen) X11GraphicsScreen.createScreenDevice(display, val.get(0), false);

    GLX.glXQueryContext(display, ctx, GLX.GLX_FBCONFIG_ID, val);
    X11GLXGraphicsConfiguration cfg = null;
    // sometimes glXQueryContext on an external context gives us a framebuffer config ID
    // of 0, which doesn't work in a subsequent call to glXChooseFBConfig; if this happens,
    // create and use a default config (this has been observed when running on CentOS 5.5 inside
    // of VMWare Server 2.0 with the Mesa 6.5.1 drivers)
    if (VisualIDHolder.VID_UNDEFINED == val.get(0)
        || !X11GLXGraphicsConfiguration.GLXFBConfigIDValid(
            display, x11Screen.getIndex(), val.get(0))) {
      GLCapabilities glcapsDefault = new GLCapabilities(GLProfile.getDefault());
      cfg =
          X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(
              glcapsDefault, glcapsDefault, null, x11Screen, VisualIDHolder.VID_UNDEFINED);
      if (DEBUG) {
        System.err.println(
            "X11ExternalGLXContext invalid FBCONFIG_ID "
                + val.get(0)
                + ", using default cfg: "
                + cfg);
      }
    } else {
      cfg = X11GLXGraphicsConfiguration.create(glp, x11Screen, val.get(0));
    }

    final WrappedSurface ns = new WrappedSurface(cfg, drawable, w, h, true);
    return new X11ExternalGLXContext(new Drawable(factory, ns), ctx);
  }
예제 #19
0
 private static GLCapabilities stdcaps() {
   GLProfile prof = GLProfile.getDefault();
   GLCapabilities cap = new GLCapabilities(prof);
   cap.setDoubleBuffered(true);
   cap.setAlphaBits(8);
   cap.setRedBits(8);
   cap.setGreenBits(8);
   cap.setBlueBits(8);
   cap.setSampleBuffers(true);
   cap.setNumSamples(4);
   return (cap);
 }
  public void init() {
    // initialisation
    GLProfile glp = GLProfile.getDefault();
    GLCapabilities caps = new GLCapabilities(glp);

    setSize(800, 400);

    initPanels(caps);

    setVisible(true);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  }
예제 #21
0
  /**
   * Called back immediately after the OpenGL context is initialized. Can be used to perform
   * one-time initialization. Run only once.
   */
  @Override
  public void init(GLAutoDrawable drawable) {
    GL2 gl = drawable.getGL().getGL2(); // get the OpenGL graphics context
    glu = new GLU(); // get GL Utilities
    gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // set background (clear) color
    gl.glClearDepth(1.0f); // set clear depth value to farthest
    // Do not enable depth test
    //      gl.glEnable(GL_DEPTH_TEST); // enables depth testing
    //      gl.glDepthFunc(GL_LEQUAL);  // the type of depth test to do
    gl.glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // best perspective correction
    gl.glShadeModel(GL_SMOOTH); // blends colors nicely, and smoothes out lighting

    // Load the texture image
    try {
      // Use URL so that can read from JAR and disk file.
      BufferedImage image = ImageIO.read(this.getClass().getResource(textureFileName));

      // Create a OpenGL Texture object
      texture = AWTTextureIO.newTexture(GLProfile.getDefault(), image, false);
      // Use linear filter if image is larger than the original texture
      gl.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
      // Use linear filter if image is smaller than the original texture
      gl.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);

    } catch (GLException | IOException e) {
      e.printStackTrace();
    }

    // Texture image flips vertically. Shall use TextureCoords class to retrieve
    // the top, bottom, left and right coordinates, instead of using 0.0f and 1.0f.
    TextureCoords textureCoords = texture.getImageTexCoords();
    textureCoordTop = textureCoords.top();
    textureCoordBottom = textureCoords.bottom();
    textureCoordLeft = textureCoords.left();
    textureCoordRight = textureCoords.right();

    // Enable the texture
    texture.enable(gl);
    texture.bind(gl);
    // gl.glEnable(GL_TEXTURE_2D);

    // Enable blending
    gl.glEnable(GL_BLEND);
    gl.glBlendFunc(GL_SRC_ALPHA, GL_ONE);

    // Allocate the stars
    for (int i = 0; i < stars.length; i++) {
      stars[i] = new Star();
      // Linearly distributed according to the star number
      stars[i].distance = ((float) i / numStars) * 5.0f;
    }
  }
예제 #22
0
  public PickSquare() {
    super("picksquare");

    GLProfile profile = GLProfile.get(GLProfile.GL2);

    caps = new GLCapabilities(profile);
    canvas = new GLCanvas(caps);
    canvas.addGLEventListener(this);
    canvas.addKeyListener(this);
    canvas.addMouseListener(this);

    getContentPane().add(canvas);
  }
예제 #23
0
 @Override
 public void initGL() {
   if (hasMat)
     if (mat.diffuse_texture == null && mat.img != null && !texture) {
       mat.diffuse_texture = AWTTextureIO.newTexture(GLProfile.getDefault(), mat.img, false);
       mat.diffuse_texture.bind();
       mat.diffuse_texture.enable();
       System.out.println(
           "Texture must be flipped: " + mat.diffuse_texture.getMustFlipVertically());
       texture = true;
       textureBuffer = GLBuffers.newDirectFloatBuffer(uv);
     }
 }
예제 #24
0
  public static void main(String[] args) {
    GLProfile glprofile = GLProfile.getDefault();
    GLCapabilities glcapabilities = new GLCapabilities(glprofile);
    GLJPanel glcanvas = new GLJPanel(glcapabilities);
    glcanvas.addGLEventListener(new ExampleWorld());

    JFrame jframe = new JFrame("JOGL Demo");
    // Catch window closing events and quit
    jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    jframe.add(glcanvas);
    jframe.setSize(480, 480);
    jframe.setVisible(true);
  }
예제 #25
0
  public JOGLViewer(
      Source source,
      boolean autoLayout,
      Context.EngineType engineType,
      Context.RendererType rendererType) {
    this.source = source;

    glp = GLProfile.getDefault();
    glc = new GLCapabilities(glp);

    ctx = new Context(source, engineType, rendererType);
    ctx.init(glc, true, "The GraphStream GL Viewer", 600, 600);

    if (autoLayout) enableAutoLayout();
  }
예제 #26
0
  private void testMultiSampleAAImpl(
      final boolean useFBO, final boolean usePBuffer, final int reqSamples)
      throws InterruptedException {
    final GLReadBufferUtil screenshot = new GLReadBufferUtil(true, false);
    final GLProfile glp = GLProfile.getGL2ES2();
    final GLCapabilities caps = new GLCapabilities(glp);
    final GLCapabilitiesChooser chooser = new MultisampleChooser01();

    caps.setAlphaBits(1);
    caps.setFBO(useFBO);
    caps.setPBuffer(usePBuffer);

    if (reqSamples > 0) {
      caps.setSampleBuffers(true);
      caps.setNumSamples(reqSamples);
    }

    final GLWindow window = GLWindow.create(caps);
    window.setCapabilitiesChooser(chooser);
    window.addGLEventListener(new MultisampleDemoES2(reqSamples > 0 ? true : false));
    window.addGLEventListener(
        new GLEventListener() {
          int displayCount = 0;

          public void init(final GLAutoDrawable drawable) {}

          public void dispose(final GLAutoDrawable drawable) {}

          public void display(final GLAutoDrawable drawable) {
            snapshot(displayCount++, null, drawable.getGL(), screenshot, TextureIO.PNG, null);
          }

          public void reshape(
              final GLAutoDrawable drawable,
              final int x,
              final int y,
              final int width,
              final int height) {}
        });
    window.setSize(512, 512);
    window.setVisible(true);
    window.requestFocus();

    Thread.sleep(durationPerTest);

    window.destroy();
  }
예제 #27
0
 protected TextureData asTextureData(FloatBuffer buffer, int width, int height) {
   TextureData texData =
       new TextureData(
           GLProfile.getDefault(),
           GL.GL_RGBA /* internalFormat */,
           width,
           height,
           0 /* border */,
           GL.GL_RGBA /* pixelFormat */,
           GL.GL_FLOAT /* pixelType */,
           false /* mipmap */,
           false /* dataIsCompressed */,
           false /* mustFlipVertically */,
           buffer,
           null);
   return texData;
 }
예제 #28
0
  public static void main(String[] args) {
    // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example
    // <application-desc main-class="demos.j2d.TextCube"/>
    //   <argument>NotFirstUIActionOnProcess</argument>
    // </application-desc>
    boolean firstUIActionOnProcess =
        0 == args.length || !args[0].equals("NotFirstUIActionOnProcess");
    GLProfile.initSingleton();

    Frame frame = new Frame();
    GLCanvas canvas = new GLCanvas();
    canvas.addGLEventListener(new Listener());
    frame.setUndecorated(true);
    frame.add(canvas);
    frame.setSize(1, 1);
    frame.setVisible(true);
  }
예제 #29
0
  public DrawByLevelFractal() {
    baseDir = "CS371/assignments/assignment02/ifs/";

    ifsFiles = new ArrayList<String>();
    ifsFiles.add("carpet.ifs");
    ifsFiles.add("chaos.ifs");
    ifsFiles.add("coral.ifs");
    ifsFiles.add("curl.ifs");
    ifsFiles.add("four.ifs");
    ifsFiles.add("galaxy.ifs");
    ifsFiles.add("dragon.ifs");
    ifsFiles.add("leady.ifs");
    ifsFiles.add("koch.ifs");
    ifsFiles.add("mouse.ifs");
    ifsFiles.add("leaf.ifs");
    ifsFiles.add("seven.ifs");
    ifsFiles.add("three.ifs");
    ifsFiles.add("tri.ifs");

    pointsToDraw = 80000;
    left = -7;
    right = 7;
    bottom = -7;
    top = 11;
    xOrigin = 0;
    yOrigin = 0;

    rotate_scale_xx = new double[maximumTransitions];
    rotate_scale_xy = new double[maximumTransitions];
    rotate_scale_yx = new double[maximumTransitions];
    rotate_scale_yy = new double[maximumTransitions];
    trans_x = new double[maximumTransitions];
    trans_y = new double[maximumTransitions];
    prob = new double[maximumTransitions];

    caps = new GLCapabilities(GLProfile.getGL2GL3());
    caps.setDoubleBuffered(true); // request double buffer display mode
    caps.setHardwareAccelerated(true);
    canvas = new GLJPanel();
    // canvas.setOpaque(true);
    canvas.addGLEventListener(this);
    canvas.addKeyListener(this);
    animator = new FPSAnimator(canvas, 60);

    getContentPane().add(canvas);
  }
  public static void main(String[] args) {

    Frame frame = new Frame("Simple JOGL Application");

    // use GL2 profile since we only use the old OpenGL 2.x fixed function pipeline
    GLCapabilities capabilities = new GLCapabilities(GLProfile.get(GLProfile.GL2));

    // try to enable 2x anti aliasing - should be supported on most hardware
    //        capabilities.setNumSamples(2);
    //        capabilities.setSampleBuffers(true);

    GLCanvas canvas = new GLCanvas(capabilities);

    canvas.addGLEventListener(new SimpleJOGL());
    frame.add(canvas);

    // use JOGL's Animator utility for rendering
    final Animator animator = new Animator(canvas);

    // stop the Animator when we receive a window closing event
    frame.addWindowListener(
        new WindowAdapter() {

          @Override
          public void windowClosing(WindowEvent e) {
            // Run this on another thread than the AWT event queue to
            // make sure the call to Animator.stop() completes before
            // exiting
            new Thread(
                    new Runnable() {

                      public void run() {
                        animator.stop();
                        System.exit(0);
                      }
                    })
                .start();
          }
        });

    // Center frame, set its size and start rendering
    frame.setSize(640, 480);
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
    animator.start();
  }