From cf4c403733363a0e0e06079d85ddae91399696ab Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 3 Oct 2009 01:18:34 -0700 Subject: Offscreen/PBuffer capabilities cleanup ; Generic read drawable support --- .../classes/com/sun/opengl/impl/GLContextImpl.java | 33 ++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java') diff --git a/src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java b/src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java index 16eb934bd..343ca7efe 100644 --- a/src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java +++ b/src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java @@ -73,9 +73,12 @@ public abstract class GLContextImpl extends GLContext { // repeated glGet calls upon glMapBuffer operations private GLBufferSizeTracker bufferSizeTracker; + protected GLDrawableImpl drawable; + protected GLDrawableImpl drawableRead; + protected GL gl; - public GLContextImpl(GLProfile glp, GLContext shareWith) { + public GLContextImpl(GLDrawableImpl drawable, GLDrawableImpl drawableRead, GLContext shareWith) { extensionAvailability = new ExtensionAvailabilityCache(this); if (shareWith != null) { GLContextShareSet.registerSharing(this, shareWith); @@ -83,7 +86,33 @@ public abstract class GLContextImpl extends GLContext { GLContextShareSet.registerForBufferObjectSharing(shareWith, this); // This must occur after the above calls into the // GLContextShareSet, which set up state needed by the GL object - setGL(createGL(glp)); + setGL(createGL(drawable.getGLProfile())); + + this.drawable = drawable; + setGLDrawableRead(drawableRead); + } + + public GLContextImpl(GLDrawableImpl drawable, GLContext shareWith) { + this(drawable, null, shareWith); + } + + public void setGLDrawableRead(GLDrawable read) { + boolean lockHeld = lock.isHeld(); + if(lockHeld) { + release(); + } + drawableRead = ( null != read ) ? (GLDrawableImpl) read : drawable; + if(lockHeld) { + makeCurrent(); + } + } + + public GLDrawable getGLDrawable() { + return drawable; + } + + public GLDrawable getGLDrawableRead() { + return drawableRead; } public GLDrawableImpl getDrawableImpl() { -- cgit v1.2.3