public static final GL2 getCurrentGL2() throws GLException {
   GLContext curContext = GLContext.getCurrent();
   if (curContext == null) {
     throw new GLException("No OpenGL context current on this thread");
   }
   return curContext.getGL().getGL2();
 }
 private static final GLUgl2ProcAddressTable getGLUProcAddressTable() {
   if (gluProcAddressTable == null) {
     GLContext curContext = GLContext.getCurrent();
     if (curContext == null) {
       throw new GLException("No OpenGL context current on this thread");
     }
     GLDynamicLookupHelper glLookupHelper =
         ((GLContextImpl) curContext).getGLDynamicLookupHelper();
     glLookupHelper.loadGLULibrary();
     GLUgl2ProcAddressTable tmp = new GLUgl2ProcAddressTable(new GLProcAddressResolver());
     tmp.reset(glLookupHelper);
     gluProcAddressTable = tmp;
   }
   return gluProcAddressTable;
 }
Пример #3
0
 public void surfaceUpdated(Object updater, NativeWindow window, long when) {
   if (updater instanceof GLDrawable) {
     GLDrawable drawable = (GLDrawable) updater;
     GLContext ctx = GLContext.getCurrent();
     if (null != ctx && ctx.getGLDrawable() == drawable) {
       GL gl = ctx.getGL();
       // FIXME glFinish() is an expensive paranoia sync, should not be necessary due to spec
       gl.glFinish();
       readBufferUtil.fetchOffscreenTexture(drawable, gl);
       gl.glFinish();
       try {
         surface2File("shot");
       } catch (IOException ex) {
         throw new RuntimeException("can not write survace to file", ex);
       }
     }
   }
 }
  public void applyInternalTransform(DrawContext dc) {
    if (dc == null) {
      String message = Logging.getMessage("nullValue.DrawContextIsNull");
      Logging.logger().severe(message);
      throw new IllegalStateException(message);
    }

    Texture texture = this.getTexture(dc);
    if (texture == null) texture = this.requestTexture(dc);

    if (texture == null) return;

    if (texture.getMustFlipVertically()) {
      GL gl = GLContext.getCurrent().getGL();
      gl.glMatrixMode(GL.GL_TEXTURE);
      gl.glLoadIdentity();
      gl.glScaled(1, -1, 1);
      gl.glTranslated(0, -1, 0);
    }
  }