diff options
author | Sven Gothel <[email protected]> | 2010-11-28 03:54:00 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2010-11-28 03:54:00 +0100 |
commit | 597007fc23fbf86e036629b6c6b157e0e0506715 (patch) | |
tree | 688dd4c70e76dd23df399a3e008e31a7412dc9aa /src/jogl/classes/javax | |
parent | 0c9eb947a2ffabba2c10799f6ea50756a2749702 (diff) |
JOGL: Proper handling of Read Drawable Support (if not supported), add query.
Read Drawable feature reflects the make context current API
having a seperate read drawable next to the write drawable (default).
glXMakeContextCurrent(write, read, ..)
On X11 a ready drawable is only supported for GLX >= 1.3,
on Windows only if extension WGL_ARB_make_current_read is available,
on EGL it's always supported, on OSX not at all.
API cleanup GLContext:
changes: setGLDrawableRead(GLDrawable) -> setGLReadDrawable(GLDrawable)
new: isGLReadDrawableAvailable()
new: getGLExtensionsString();
Access qualifier cleanup.
GLContextImpl: GLVersionNumber moved out.
Diffstat (limited to 'src/jogl/classes/javax')
-rw-r--r-- | src/jogl/classes/javax/media/opengl/GLContext.java | 47 |
1 files changed, 35 insertions, 12 deletions
diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java index 45e1361fb..f76f2b664 100644 --- a/src/jogl/classes/javax/media/opengl/GLContext.java +++ b/src/jogl/classes/javax/media/opengl/GLContext.java @@ -116,17 +116,32 @@ public abstract class GLContext { public abstract GLDrawable getGLDrawable(); /** - * Set the GLDrawable from which this context may be used to - * read.<br> - * If read is null, the default write drawable will be used. + * Return availability of GL read drawable. + * @return true if a GL read drawable is supported with your driver, otherwise false. */ - public abstract void setGLDrawableRead(GLDrawable read); + public abstract boolean isGLReadDrawableAvailable(); /** - * Returns the GLDrawable from which this context may be used to - * read. + * Set the read GLDrawable for read framebuffer operations.<br> + * The caller should query if this feature is supported via {@link #isGLReadDrawableAvailable()}. + * + * @param read the read GLDrawable for read framebuffer operations. + * If null is passed, the default write drawable will be set. + * + * @throws GLException in case a read drawable is not supported + * and the given drawable is not null and not equal to the internal write drawable. + * + * @see #isGLReadDrawableAvailable() + * @see #getGLReadDrawable() */ - public abstract GLDrawable getGLDrawableRead(); + public abstract void setGLReadDrawable(GLDrawable read); + + /** + * Returns the read GLDrawable this context uses for read framebuffer operations. + * @see #isGLReadDrawableAvailable() + * @see #setGLReadDrawable(javax.media.opengl.GLDrawable) + */ + public abstract GLDrawable getGLReadDrawable(); /** * Makes this GLContext current on the calling thread. @@ -341,13 +356,13 @@ public abstract class GLContext { sb.append(toHexString(contextHandle)); sb.append(", "); sb.append(getGL()); - if(getGLDrawable()!=getGLDrawableRead()) { - sb.append(",\n\tDrawable Read : "); - sb.append(getGLDrawableRead()); - sb.append(",\n\tDrawable Write: "); + if(getGLDrawable()!=getGLReadDrawable()) { + sb.append(",\n\tRead Drawable : "); + sb.append(getGLReadDrawable()); + sb.append(",\n\tWrite Drawable: "); sb.append(getGLDrawable()); } else { - sb.append(",\n\tDrawable Read/Write: "); + sb.append(",\n\tDrawable: "); sb.append(getGLDrawable()); } return sb; @@ -359,6 +374,14 @@ public abstract class GLContext { current. */ public abstract String getPlatformExtensionsString(); + /** Returns a non-null (but possibly empty) string containing the + space-separated list of available extensions. + Can only be called while this context is current. + This is equivalent to + {@link javax.media.opengl.GL#glGetString(int) glGetString}({@link javax.media.opengl.GL#GL_EXTENSIONS GL_EXTENSIONS}) + */ + public abstract String getGLExtensionsString(); + public final int getGLVersionMajor() { return ctxMajorVersion; } public final int getGLVersionMinor() { return ctxMinorVersion; } public final boolean isGLCompatibilityProfile() { return ( 0 != ( CTX_PROFILE_COMPAT & ctxOptions ) ); } |