int[] cubemapTmp = new int[1]; gl.glGenTextures(1, cubemapTmp, 0); cubemap = cubemapTmp[0]; gl.glBindTexture(GL.GL_TEXTURE_CUBE_MAP, cubemap);  gl.glTexParameteri(GL.GL_TEXTURE_CUBE_MAP, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR); gl.glTexParameteri(GL.GL_TEXTURE_CUBE_MAP, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR_MIPMAP_LINEAR);
  public void init(GLAutoDrawable drawable) {    initComplete = false;    GL gl = drawable.getGL();    float cc = 1.0f;    gl.glClearColor(cc, cc, cc, 1);    gl.glColor3f(1,1,1);    gl.glEnable(GL.GL_DEPTH_TEST);    try {      initExtension(gl, "GL_ARB_vertex_program");      initExtension(gl, "GL_VERSION_1_3"); // For multitexturing support      if (!gl.isExtensionAvailable("GL_ARB_fragment_program")) {        if (gl.isExtensionAvailable("GL_NV_register_combiners")) {          useRegisterCombiners = true;        } else {          final String message = "This demo requires either the GL_ARB_fragment_program\n" +            "or GL_NV_register_combiners extension";          new Thread(new Runnable() {              public void run() {                JOptionPane.showMessageDialog(null, message, "Unavailable extension", JOptionPane.ERROR_MESSAGE);                shutdownDemo();              }            }).start();          throw new RuntimeException(message);        }      }    } catch (RuntimeException e) {      shutdownDemo();      throw(e);    }    b[' '] = true; // animate by default    int[] vtxProgTmp = new int[1];    gl.glGenProgramsARB(1, vtxProgTmp, 0);    vtxProg = vtxProgTmp[0];    gl.glBindProgramARB  (GL.GL_VERTEX_PROGRAM_ARB, vtxProg);    gl.glProgramStringARB(GL.GL_VERTEX_PROGRAM_ARB, GL.GL_PROGRAM_FORMAT_ASCII_ARB, transformRefract.length(), transformRefract);    gl.glProgramEnvParameter4fARB(GL.GL_VERTEX_PROGRAM_ARB, 0, 0.0f, 0.0f, 0.0f, 1.0f);    // eye position    gl.glProgramEnvParameter4fARB(GL.GL_VERTEX_PROGRAM_ARB, 1, fresnel, fresnel, fresnel, 1.0f);    // fresnel multiplier    gl.glProgramEnvParameter4fARB(GL.GL_VERTEX_PROGRAM_ARB, 2, 1.0f, -1.0f, 1.0f, 0.0f);   // texture scale    gl.glProgramEnvParameter4fARB(GL.GL_VERTEX_PROGRAM_ARB, 3, 0.0f, 1.0f, 2.0f, 3.0f);    // misc constants    int[] cubemapTmp = new int[1];    gl.glGenTextures(1, cubemapTmp, 0);    cubemap = cubemapTmp[0];    gl.glBindTexture(GL.GL_TEXTURE_CUBE_MAP, cubemap);    gl.glTexParameteri(GL.GL_TEXTURE_CUBE_MAP, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR);    gl.glTexParameteri(GL.GL_TEXTURE_CUBE_MAP, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR_MIPMAP_LINEAR);    try {      loadPNGCubemap(gl, "demos/data/cubemaps/uffizi", true);    } catch (IOException e) {      shutdownDemo();      throw new RuntimeException(e);    }    gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_REPLACE);    gl.glDisable(GL.GL_CULL_FACE);    if (useRegisterCombiners) {      initCombiners(gl);    } else {      initFragmentProgram(gl);    }    try {      bunnydl = Bunny.gen3DObjectList(gl);    } catch (IOException e) {      throw new RuntimeException(e);    }    doViewAll = true;    // Do this only once per drawable, not once each time the OpenGL    // context is created    if (firstRender) {      firstRender = false;      drawable.addKeyListener(new KeyAdapter() {          public void keyTyped(KeyEvent e) {            dispatchKey(e.getKeyChar());          }        });      // Register the window with the ManipManager      ManipManager manager = ManipManager.getManipManager();      manager.registerWindow(drawable);      this.drawable = drawable;      viewer = new ExaminerViewer(MouseButtonHelper.numMouseButtons());      viewer.setNoAltKeyMode(true);      viewer.setAutoRedrawMode(false);      viewer.attach(drawable, new BSphereProvider() {          public BSphere getBoundingSphere() {            return new BSphere(new Vec3f(0, 0, 0), 1.0f);          }        });      viewer.setVertFOV((float) (15.0f * Math.PI / 32.0f));      viewer.setZNear(0.1f);      viewer.setZFar(10.0f);    }    initComplete = true;  }