gl.glBindTexture(GL.GL_TEXTURE_CUBE_MAP, cubemap); gl.glEnable(GL.GL_TEXTURE_CUBE_MAP);
cubemap.bind(); cubemap.enable();
  public void display(GLAutoDrawable drawable) {    if (!initComplete) {      return;    }    time.update();    GL gl = drawable.getGL();    gl.glClear(GL.GL_COLOR_BUFFER_BIT|GL.GL_DEPTH_BUFFER_BIT);    if (doViewAll) {      viewer.viewAll(gl);      doViewAll = false;    }    if (getFlag(' ')) {      viewer.rotateAboutFocalPoint(new Rotf(Vec3f.Y_AXIS, (float) (time.deltaT() * animRate)));    }    if (toggleWire) {      toggleWire = false;      wire = !wire;      if (wire) {        gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_LINE);      } else {        gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_FILL);      }    }    // draw background    gl.glDisable(GL.GL_DEPTH_TEST);    drawSkyBox(gl);    gl.glEnable(GL.GL_DEPTH_TEST);    gl.glPushMatrix();    viewer.update(gl);    ManipManager.getManipManager().updateCameraParameters(drawable, viewer.getCameraParameters());    ManipManager.getManipManager().render(drawable, gl);    gl.glBindProgramARB(GL.GL_VERTEX_PROGRAM_ARB, vtxProg);    gl.glEnable(GL.GL_VERTEX_PROGRAM_ARB);    gl.glProgramEnvParameter4fARB(GL.GL_VERTEX_PROGRAM_ARB, 62, fresnel, fresnel, fresnel, 1.0f);    // set texture transforms    gl.glActiveTexture(GL.GL_TEXTURE0);    gl.glBindTexture(GL.GL_TEXTURE_CUBE_MAP, cubemap);    gl.glEnable(GL.GL_TEXTURE_CUBE_MAP);    gl.glMatrixMode(GL.GL_TEXTURE);    gl.glLoadIdentity();    gl.glScalef(1.0f, -1.0f, 1.0f);    viewer.updateInverseRotation(gl);    gl.glActiveTexture(GL.GL_TEXTURE1);    gl.glBindTexture(GL.GL_TEXTURE_CUBE_MAP, cubemap);    gl.glEnable(GL.GL_TEXTURE_CUBE_MAP);    gl.glMatrixMode(GL.GL_TEXTURE);    gl.glLoadIdentity();    gl.glScalef(1.0f, -1.0f, 1.0f);    viewer.updateInverseRotation(gl);    if (useRegisterCombiners) {      gl.glEnable(GL.GL_REGISTER_COMBINERS_NV);    } else {      gl.glBindProgramARB(GL.GL_FRAGMENT_PROGRAM_ARB, fragProg);      gl.glEnable(GL.GL_FRAGMENT_PROGRAM_ARB);    }    gl.glColor3f(1.0f, 1.0f, 1.0f);    if (getFlag('s')) {      // single pass      setRefraction(gl, refract);      drawObj(gl, obj);    } else {      // red pass      gl.glColorMask(true, false, false, false);      setRefraction(gl, refract);      drawObj(gl, obj);        gl.glDepthMask(false);      gl.glDepthFunc(GL.GL_EQUAL);      // green pass      gl.glColorMask(false, true, false, false);      setRefraction(gl, refract + wavelengthDelta);      drawObj(gl, obj);      // blue pass      gl.glColorMask(false, false, true, false);      setRefraction(gl, refract + (wavelengthDelta * 2));      drawObj(gl, obj);      gl.glDepthMask(true);      gl.glDepthFunc(GL.GL_LESS);      gl.glColorMask(true, true, true, false);    }    if (useRegisterCombiners) {      gl.glDisable(GL.GL_REGISTER_COMBINERS_NV);    } else {      gl.glDisable(GL.GL_FRAGMENT_PROGRAM_ARB);    }    gl.glDisable(GL.GL_VERTEX_PROGRAM_ARB);    gl.glMatrixMode(GL.GL_MODELVIEW);    gl.glPopMatrix();  }