From 4dd44b985fe0541be3a3bcd9045d201ed3ca2cc5 Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Sat, 15 Sep 2012 16:54:52 +0200
Subject: Seamless Integration of an FBObject based GLFBODrawable as
GLOffscreenAutoDrawable.FBO and as an OffscreenLayerSurface's drawable (OSX)
- Fix Bugs 569 and 599
Summary:
=========
The new FBObject based GLFBODrawable implementation allows the seamless utilization of
FBO offscreen rendering in single buffer, double buffer and MSAA mode.
The GLFBODrawable uses a parent drawable based on a
dummy surface to allow a GLOffscreenAutoDrawable.FBO creation
or a mutable surface supporting an existing offscreen layer surface (OSX CALayer).
Offscreen GLDrawable's and GLOffscreenAutoDrawable's can be selected via the
GLCapabilities. If simply !onscreen is selected in the caps instance w/o enabling FBO, PBuffer or Bitmap,
the factory will automatically choose regarding availability:
FBO > PBuffer > Bitmap
Double buffering is supported in MSAA more (intrinsic) and explicit in non MSAA.
It is preferred when delivering resources (texture id's or framebuffer names)
to a shared GLContext.
This is demonstrated in (emulates our OSX CALayer implementation):
TestFBOOffThreadSharedContextMix2DemosES2NEWT,
TestFBOOnThreadSharedContext1DemoES2NEWT
and with the OSX JAWT OffscreenLayerSurface itself. FBO is the preferred choice.
+++
Offscreen drawables can be resized while maintaining a bound GLContext (e.g. w/ GLAutoDrawable).
Previously both, drawable and context, needed to be destroyed and recreated at offscreen resize.
Common implementation in GLDrawableHelper is used in the implementations
(NEWT's GLWindow, AWT GLCanvas, SWT GLCanvas).
+++
Tested:
=======
Manually run all unit tests on:
- Linux x86_64 NVidia/AMD/Mesa3d(ES)
- OSX x86_64 NVidia
- Windows x86_64 NVidia
- Android arm Mali-400/Tegra-2
No regressions.
Disclaimer:
===========
This feature is committed almost in one patch.
Both previous commits were introducing / fixing the capabilities behavior:
90d45928186f2be99999461cfe45f76a783cc961
9036376b7806a5fc61590bf49404eb71830de92f
I have to appologize for the huge size and impact (files and platforms) of this commit
however, I could not find a better way to inject this feature in one sane piece.
NativeWindow Details:
=====================
Complete decoupling of platform impl. detail of surfaces
implementing ProxySurface. Used to generalize dummy surfaces and EGL surfaces
on top of a native platform surface.
- ProxySurface.UpstreamSurfaceHook -> UpstreamSurfaceHook
- abstract class ProxySurface -> interface ProxySurface + ProxySurfaceImpl
- Misc. implementations
JOGL Details:
=====================
FBOObject: API Change / Simplification & Usability
- Removed reference counter to remove complexity, allow user to choose.
- Add 'dispose' flag for detachColorbuffer(..), allowing to keep attachment alive
- Fix equals operation of Attachment
- Check pre-exising GL errors
- Interface Colobuffer gets lifecycle methods
- Add static factory methods to create Attachments w/o FBObject instance
- Reset:
- Clip min size to 1
- Keep alive samplingSink, i.e. don't issue resetMSAATexture2DSink(..).
It gets called at syncFramebuffer()/use(..) later on before actual usage.
This allows the consumer to utilize the GL_FRONT buffer until (e.g.) swap.
- misc bugfixes
GLOffscreenAutoDrawable: API Change
- Reloc and interfacing
- class com.jogamp.opengl.OffscreenAutoDrawable -> javax.media.opengl.*
interfaces GLOffscreenAutoDrawable extends GLAutoDrawable
GLOffscreenAutoDrawable.FBO extends GLOffscreenAutoDrawable, GLFBODrawable
- Added general implementation and FBO specialization
- Replacing GLPBuffer (deprecated) .. usable for any offscreen GLDrawable via factory
GLAutoDrawable:
- Add 'GLDrawable getDelegatedDrawable()'
- Refine documentation of setContext(..), remove disclaimer and fixme tags
GLDrawableFactory:
- Refine API doc and it's selection mechanism for offscreen.
- Add createOffscreenDrawable(..)
- Add createOffscreenAutoDrawable(..)
- Add canCreateFBO(..)
- Mark createGLPbuffer(..) deprectated
Mark GLPBuffer deprecated
New: GLFBODrawable extends GLDrawable
GLCanvas (AWT and SWT): Add offscreen resize support w/o GLContext recreation
GLAutoDrawableBase .. GLWindow:
- Add offscreen resize support w/o GLContext recreation
- Remove double swapBuffer call
-
GLBase/GLContext:
- Add:
- boolean hasBasicFBOSupport()
- boolean hasFullFBOSupport()
- int getMaxRenderbufferSamples()
- boolean isTextureFormatBGRA8888Available()
GLContext: Fix version detection and hasGLSL()
- Version detection in setGLFunctionAvailability(..)
- Query GL_VERSION ASAP and parse it and compare w/ given major/minor
- Use parsed version if valid and lower than given _or_ given is invalid.
- Use validated version for caching (procaddr, ..), version number, etc.
- Fix hasGLSL()
Since 'isGL2ES2()' is true if 'isGL2()'
and the latter simply alows GL 1.*, we confine the result to a GL >= 2.0
on desktops. FIXME: May consider GL 1.5 w/ extensions.
- return isGL2ES2();
+ return isGLES2() ||
+ isGL3() ||
+ isGL2() && ctxMajorVersion>1 ;
GLDrawableImpl:
- Add 'associateContext(GLContext, boolean)' allowing impl.
to have a (weak) reference list of bound context.
This is was pulled up from the OSX specific drawable impl.
- swapBuffersImpl() -> swapBuffersImpl(boolean doubleBuffered)
and call it regardless of single buffering.
This is required to propagate this event to impl. properly,
i.e. FBODrawable requires a swap notification.
- Clarify 'contextMadeCurrent(..)' protocol
GLDrawableHelper:
- Add resize and recreate offscreen drawable util method
- Simplify required init/reshape calls for GLEventListener
-
GLGraphicsConfigurationUtil:
- fixWinAttribBitsAndHwAccel: Reflect sharede context hw-accel bits
- OSX has no offscreen bitmap, use pbuffer
- use proper offscreen auto selection if offscreen and no modes are set
EGL Context/Drawable/DrawableFactory: Abstract native platform code out of base classes
- Use EGLWrappedSurface w/ UpstreamSurfaceHook to handle upstream (X11, WGL, ..)
lifecycle - in case the EGL resource is hooked up on it.
Invisible dummy surfaces: All platforms
- size is now reduced to 64x64 and decoupled of actual generic mutable size
- fix device lifecycle, no more leaks
+++
OSX
====
Enable support for GLFBODrawableImpl in offscreen CALayer mode
- NSOpenGLImpl: hooks to calayer native code
- calayer code:
- allows pbuffer and texures (FBO)
- decouple size and draw calls avoiding flickering
- enable auto resize of calayer tree
MacOSXCGLContext:
- NSOpenGLImpl:
- Fix false pbuffer 'usage', validate the pointer
- If !pbuffer, copy other window mode bits of caps
-
MacOSXCGLGraphicsConfiguration:
- Only assume pbuffer if !onscreen
- Remove reference of native pixelformat pointer
Native code:
- use 'respondsToSelector:' query before calling 'new' methods
avoiding an error message where unsuported (prev. OSX versions)
- if monitor refresh-rate is queried 0, set to default 60hz
- add missing NSAutoreleasePool decoration
+++
Android / NEWT:
===============
Issue setVisible(..) w/o wait, i.e. queue on EDT,
@Android surfaceChanged() callback. Otherwise we could deadlock:
setVisible(..) -> EDT -> setVisibleImpl(..) -> 'GL-display'.
the latter may may cause havoc while Android-EDT is blocked [until it's return].
---
.../com/jogamp/opengl/GLAutoDrawableDelegate.java | 189 +++++++++++++++++++++
1 file changed, 189 insertions(+)
create mode 100644 src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java
(limited to 'src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java')
diff --git a/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java b/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java
new file mode 100644
index 000000000..38a8deef8
--- /dev/null
+++ b/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java
@@ -0,0 +1,189 @@
+/**
+ * Copyright 2012 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+
+package com.jogamp.opengl;
+
+import javax.media.nativewindow.AbstractGraphicsDevice;
+import javax.media.nativewindow.NativeSurface;
+import javax.media.nativewindow.WindowClosingProtocol;
+import javax.media.nativewindow.WindowClosingProtocol.WindowClosingMode;
+import javax.media.opengl.GLAutoDrawable;
+import javax.media.opengl.GLContext;
+import javax.media.opengl.GLDrawable;
+import javax.media.opengl.GLDrawableFactory;
+import javax.media.opengl.GLException;
+
+import com.jogamp.common.util.locks.LockFactory;
+import com.jogamp.common.util.locks.RecursiveLock;
+
+import jogamp.opengl.GLAutoDrawableBase;
+import jogamp.opengl.GLContextImpl;
+import jogamp.opengl.GLDrawableImpl;
+
+
+/**
+ * Fully functional {@link GLAutoDrawable} implementation
+ * utilizing already created created {@link GLDrawable} and {@link GLContext} instances.
+ *
+ * Since no native windowing system events are being processed, it is recommended
+ * to handle at least:
+ *
+ *
{@link com.jogamp.newt.event.WindowListener#windowRepaint(com.jogamp.newt.event.WindowUpdateEvent) repaint} using {@link #windowRepaintOp()}
+ *
{@link com.jogamp.newt.event.WindowListener#windowResized(com.jogamp.newt.event.WindowEvent) resize} using {@link #windowResizedOp()}
+ *
{@link com.jogamp.newt.event.WindowListener#windowDestroyNotify(com.jogamp.newt.event.WindowEvent) destroy-notify} using {@link #windowDestroyNotifyOp()}
+ *
+ *
+ *
+ * See example {@link com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableDelegateNEWT TestGLAutoDrawableDelegateNEWT}.
+ *
+ */
+public class GLAutoDrawableDelegate extends GLAutoDrawableBase implements GLAutoDrawable {
+ /**
+ * @param drawable a valid and already realized {@link GLDrawable}
+ * @param context a valid {@link GLContext}, may not be made current (created) yet.
+ * @param upstreamWidget optional UI element holding this instance, see {@link #getUpstreamWidget()}.
+ * @param ownDevice pass true if {@link AbstractGraphicsDevice#close()} shall be issued,
+ * otherwise pass false. Closing the device is required in case
+ * the drawable is created w/ it's own new instance, e.g. offscreen drawables,
+ * and no further lifecycle handling is applied.
+ * @param lock optional custom {@link RecursiveLock}.
+ */
+ public GLAutoDrawableDelegate(GLDrawable drawable, GLContext context, Object upstreamWidget, boolean ownDevice, RecursiveLock lock) {
+ super((GLDrawableImpl)drawable, (GLContextImpl)context, ownDevice);
+ if(null == drawable) {
+ throw new IllegalArgumentException("null drawable");
+ }
+ if(null == context) {
+ throw new IllegalArgumentException("null context");
+ }
+ if(!drawable.isRealized()) {
+ throw new IllegalArgumentException("drawable not realized");
+ }
+ this.upstreamWidget = upstreamWidget;
+ this.lock = ( null != lock ) ? lock : LockFactory.createRecursiveLock() ;
+ }
+
+ //
+ // expose default methods
+ //
+
+ /** Default implementation to handle repaint events from the windowing system */
+ public final void windowRepaintOp() {
+ super.defaultWindowRepaintOp();
+ }
+
+ /** Implementation to handle resize events from the windowing system. All required locks are being claimed. */
+ public final void windowResizedOp(int newWidth, int newHeight) {
+ super.defaultWindowResizedOp(newWidth, newHeight);
+ }
+
+ /**
+ * Implementation to handle destroy notifications from the windowing system.
+ *
+ *
+ * If the {@link NativeSurface} does not implement {@link WindowClosingProtocol}
+ * or {@link WindowClosingMode#DISPOSE_ON_CLOSE} is enabled (default),
+ * a thread safe destruction is being induced.
+ *
+ */
+ public final void windowDestroyNotifyOp() {
+ super.defaultWindowDestroyNotifyOp();
+ }
+
+ //
+ // Complete GLAutoDrawable
+ //
+
+ private Object upstreamWidget;
+ private final RecursiveLock lock;
+
+ @Override
+ protected final RecursiveLock getLock() { return lock; }
+
+ @Override
+ public final Object getUpstreamWidget() {
+ return upstreamWidget;
+ }
+
+ /**
+ * Set the upstream UI toolkit object.
+ * @see #getUpstreamWidget()
+ */
+ public final void setUpstreamWidget(Object newUpstreamWidget) {
+ upstreamWidget = newUpstreamWidget;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * This implementation calls {@link #defaultDestroy()}.
+ *
+ *
+ * User still needs to destroy the upstream window, which details are hidden from this aspect.
+ * This can be performed by overriding {@link #destroyImplInLock()}.
+ *
+ */
+ @Override
+ public final void destroy() {
+ defaultDestroy();
+ }
+
+ @Override
+ protected void destroyImplInLock() {
+ super.destroyImplInLock();
+ }
+
+ @Override
+ public void display() {
+ defaultDisplay();
+ }
+
+ //
+ // GLDrawable delegation
+ //
+
+ @Override
+ public final GLDrawableFactory getFactory() {
+ return drawable.getFactory();
+ }
+
+ @Override
+ public final void setRealized(boolean realized) {
+ }
+
+ @Override
+ public final void swapBuffers() throws GLException {
+ defaultSwapBuffers();
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName()+"[ \n\tHelper: " + helper + ", \n\tDrawable: " + drawable +
+ ", \n\tContext: " + context + ", \n\tUpstreamWidget: "+upstreamWidget+ /** ", \n\tFactory: "+factory+ */ "]";
+ }
+}
--
cgit v1.2.3
From b738983638703bb721ee4c9820c8ef43e2252e73 Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Thu, 24 Jan 2013 17:24:22 +0100
Subject: Bug 665 (part 1) - Allow dis-association of GLContext's GLDrawable ..
Changes allowing re-association (incl. null) of GLContext/GLDrawable:
- GLAutoDrawable: Refine API doc 'setContext(..)'
- GLContext: Refine API doc: 'setGLDrawable(..)' 'getGLDrawable()'
- GLContextImpl.setGLDrawable(): Handle null drawable
- GLAutoDrawableDelegate/GLAutoDrawableBase: Allow null GLContext
- GLDrawableHelper.switchContext(..)/recreateGLDrawable(): Balance GLContext.setGLDrawable(..) calls
- New GLEventListenerState, holding state vector [GLEventListener, GLContext, .. ]
impl. relocation of all components from/to GLAutoDrawable.
- GLDrawableUtil
- Using GLEventListenerState for swapGLContextAndAllGLEventListener(..)
+++
NEWT Window*:
- getDisplayHandle() is 'final', no more 'shortcut' code allowed
due to re-association incl. display handle.
- close*:
- close config's device (was missing)
- null config
+++
Changes allowing reconfig of Display handle as required
to re-associate pre-existing GLContext to a 'window':
- AbstractGraphicsDevice: Add isHandleOwner() / clearHandleOwner()
- Impl. in X11GraphicsDevice and EGLGraphicsDevice, NOP in DefaultGraphicsDevice
- DefaultGraphicsConfiguration add 'setScreen(..)'
- MutableGraphicsConfiguration
- Make DefaultGraphicsConfiguration.setScreen(..) public
- NativeWindowFactory add 'createScreen(String type, AbstractGraphicsDevice device, int screen)'
- Refactored from SWTAccessor
- NativeWindow x11ErrorHandler: Dump Stack Trace in DEBUG mode, always.
---
make/scripts/tests-x64.bat | 3 +-
make/scripts/tests.sh | 10 +-
.../com/jogamp/opengl/GLAutoDrawableDelegate.java | 8 +-
.../com/jogamp/opengl/util/GLDrawableUtil.java | 116 +------
.../classes/javax/media/opengl/GLAutoDrawable.java | 32 +-
src/jogl/classes/javax/media/opengl/GLContext.java | 23 +-
.../classes/jogamp/opengl/GLAutoDrawableBase.java | 13 +-
src/jogl/classes/jogamp/opengl/GLContextImpl.java | 24 +-
.../classes/jogamp/opengl/GLDrawableHelper.java | 31 +-
.../jogamp/opengl/GLEventListenerState.java | 267 ++++++++++++++++
.../nativewindow/MutableGraphicsConfiguration.java | 7 +
.../jogamp/nativewindow/egl/EGLGraphicsDevice.java | 11 +-
.../com/jogamp/nativewindow/swt/SWTAccessor.java | 19 +-
.../jogamp/nativewindow/x11/X11GraphicsDevice.java | 12 +-
.../AbstractGraphicsConfiguration.java | 3 +-
.../media/nativewindow/AbstractGraphicsDevice.java | 12 +-
.../media/nativewindow/AbstractGraphicsScreen.java | 2 +
.../nativewindow/DefaultGraphicsConfiguration.java | 17 +-
.../media/nativewindow/DefaultGraphicsDevice.java | 19 +-
.../media/nativewindow/DefaultGraphicsScreen.java | 6 +-
.../media/nativewindow/NativeWindowFactory.java | 27 ++
src/nativewindow/native/x11/Xmisc.c | 2 +-
.../classes/com/jogamp/newt/opengl/GLWindow.java | 18 +-
src/newt/classes/jogamp/newt/WindowImpl.java | 9 +-
.../jogamp/newt/driver/x11/WindowDriver.java | 10 +-
.../acore/TestGLContextDrawableSwitch01NEWT.java | 330 +++++++++++++++++++
.../acore/TestGLContextDrawableSwitch11NEWT.java | 352 +++++++++++++++++++++
.../acore/TestGLContextDrawableSwitchNEWT.java | 310 ------------------
.../test/junit/util/GLEventListenerCounter.java | 65 ++++
29 files changed, 1222 insertions(+), 536 deletions(-)
create mode 100644 src/jogl/classes/jogamp/opengl/GLEventListenerState.java
create mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLContextDrawableSwitch01NEWT.java
create mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLContextDrawableSwitch11NEWT.java
delete mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLContextDrawableSwitchNEWT.java
create mode 100644 src/test/com/jogamp/opengl/test/junit/util/GLEventListenerCounter.java
(limited to 'src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java')
diff --git a/make/scripts/tests-x64.bat b/make/scripts/tests-x64.bat
index b66f8b8ab..8bee4c6dd 100755
--- a/make/scripts/tests-x64.bat
+++ b/make/scripts/tests-x64.bat
@@ -12,7 +12,8 @@ REM scripts\java-win64.bat com.jogamp.opengl.test.junit.jogl.acore.TestSharedCon
REM scripts\java-win64.bat com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2NEWT %*
REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile01NEWT %*
REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile02NEWT %*
-REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLContextDrawableSwitchNEWT %*
+scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLContextDrawableSwitch01NEWT %*
+REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLContextDrawableSwitch11NEWT %*
REM scripts\java-win64.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLDebug00NEWT %*
REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLDebug01NEWT %*
REM scripts\java-win64.bat com.jogamp.opengl.test.junit.jogl.acore.TestGPUMemSec01NEWT %*
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index 80e418056..9625519b9 100755
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -89,6 +89,7 @@ function jrun() {
#D_ARGS="-Djogl.debug.FBObject"
#D_ARGS="-Djogl.debug.GLSLCode"
#D_ARGS="-Djogl.debug.GLSLCode -Djogl.debug.DebugGL -Djogl.debug.TraceGL"
+ #D_ARGS="-Djogl.debug.GLContext -Djogl.debug.GLContext.TraceSwitch"
#D_ARGS="-Djogl.debug.GLContext.TraceSwitch"
#D_ARGS="-Djogl.debug.FixedFuncPipeline -Djogl.debug.GLSLCode"
#D_ARGS="-Djogl.debug.FixedFuncPipeline -Djogl.debug.GLSLState"
@@ -105,6 +106,7 @@ function jrun() {
#D_ARGS="-Djogamp.debug=all"
#D_ARGS="-Djogamp.debug=all -Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all"
#D_ARGS="-Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all"
+ #D_ARGS="-Dnativewindow.debug.X11Util"
#D_ARGS="-Djogl.debug.Animator"
#D_ARGS="-Djogl.debug=all -Dnewt.debug=all"
#D_ARGS="-Djogl.debug.GLDrawable -Djogl.debug.GLContext -Djogl.debug.GLCanvas"
@@ -284,7 +286,8 @@ function testawtswt() {
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextListNEWT2 $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES1NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2NEWT $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLContextDrawableSwitchNEWT $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLContextDrawableSwitch01NEWT $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLContextDrawableSwitch02NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLPointsNEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLMesaBug651NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLMesaBug658NEWT $*
@@ -303,6 +306,9 @@ function testawtswt() {
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLContextDrawableSwitch01NEWT $*
+testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLContextDrawableSwitch11NEWT $*
+
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestOffscreenLayer01GLCanvasAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestOffscreenLayer02NewtCanvasAWT $*
@@ -399,7 +405,7 @@ function testawtswt() {
#
# newt.awt (testawt)
#
-testawt com.jogamp.opengl.test.junit.jogl.newt.TestSwingAWTRobotUsageBeforeJOGLInitBug411 $*
+#testawt com.jogamp.opengl.test.junit.jogl.newt.TestSwingAWTRobotUsageBeforeJOGLInitBug411 $*
#testawt com.jogamp.opengl.test.junit.jogl.demos.gl2.newt.TestGearsNewtAWTWrapper $*
#testawt com.jogamp.opengl.test.junit.newt.TestEventSourceNotAWTBug
#testawt com.jogamp.opengl.test.junit.newt.TestFocus01SwingAWTRobot $*
diff --git a/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java b/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java
index 38a8deef8..38315dc72 100644
--- a/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java
@@ -65,7 +65,10 @@ import jogamp.opengl.GLDrawableImpl;
public class GLAutoDrawableDelegate extends GLAutoDrawableBase implements GLAutoDrawable {
/**
* @param drawable a valid and already realized {@link GLDrawable}
- * @param context a valid {@link GLContext}, may not be made current (created) yet.
+ * @param context a valid {@link GLContext},
+ * may not have been made current (created) yet,
+ * may not be associated w/ drawable yet,
+ * may be null for lazy initialization
* @param upstreamWidget optional UI element holding this instance, see {@link #getUpstreamWidget()}.
* @param ownDevice pass true if {@link AbstractGraphicsDevice#close()} shall be issued,
* otherwise pass false. Closing the device is required in case
@@ -78,9 +81,6 @@ public class GLAutoDrawableDelegate extends GLAutoDrawableBase implements GLAuto
if(null == drawable) {
throw new IllegalArgumentException("null drawable");
}
- if(null == context) {
- throw new IllegalArgumentException("null context");
- }
if(!drawable.isRealized()) {
throw new IllegalArgumentException("drawable not realized");
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.java b/src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.java
index cc81e4820..c03e4bfa4 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.java
@@ -27,17 +27,14 @@
*/
package com.jogamp.opengl.util;
-import java.util.ArrayList;
-import java.util.List;
-
import javax.media.opengl.GLAnimatorControl;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLContext;
import javax.media.opengl.GLDrawable;
import javax.media.opengl.GLEventListener;
-import javax.media.opengl.GLRunnable;
import jogamp.opengl.Debug;
+import jogamp.opengl.GLEventListenerState;
/**
* Providing utility functions dealing w/ {@link GLDrawable}s, {@link GLAutoDrawable} and their {@link GLEventListener}.
@@ -83,7 +80,7 @@ public class GLDrawableUtil {
dest.addGLEventListener(listener);
if(preserveInitState && initialized) {
dest.setGLEventListenerInitState(listener, true);
- dest.invoke(false, new ReshapeGLEventListener(listener));
+ dest.invoke(false, new GLEventListenerState.ReshapeGLEventListener(listener));
} // else .. !init state is default
}
@@ -121,108 +118,13 @@ public class GLDrawableUtil {
* @param b
*/
public static final void swapGLContextAndAllGLEventListener(GLAutoDrawable a, GLAutoDrawable b) {
- final List aGLCmds = new ArrayList();
- final List bGLCmds = new ArrayList();
- final GLAnimatorControl aAnim = a.getAnimator();
- final GLAnimatorControl bAnim = b.getAnimator();
- final boolean aIsPaused = isAnimatorAnimatingOnOtherThread(aAnim) && aAnim.pause();
- final boolean bIsPaused = isAnimatorAnimatingOnOtherThread(bAnim) && bAnim.pause();
-
- //
- // remove and cache all GLEventListener and their init-state
- //
- final int aSz = a.getGLEventListenerCount();
- final GLEventListener[] aGLE = new GLEventListener[aSz];
- final boolean[] aInit = new boolean[aSz];
- for(int i=0; idrawable might be an inner GLDrawable instance if using a delegation pattern,
- * or this GLAutoDrawable instance.
+ * Associate the new context, newtCtx, to this auto-drawable.
*
- * If the old or new context was current on this thread, it is being released before switching the drawable.
+ * The current context will be dis-associated from this auto-drawable
+ * via {@link GLContext#setGLDrawable(GLDrawable, boolean) setGLDrawable(null, true);} first.
+ *
+ *
+ * The new context will be associated with this auto-drawable
+ * via {@link GLContext#setGLDrawable(GLDrawable, boolean) newCtx.setGLDrawable(drawable, true);}.
+ *
+ *
+ * If the old or new context was current on this thread, it is being released before switching the association.
* The new context will be made current afterwards, if it was current before.
* However the user shall take extra care that no other thread
* attempts to make this context current.
*
*
- * Be aware that the old context is still bound to the drawable,
- * and that one context can only be bound to one drawable at one time!
- *
- *
* In case you do not intend to use the old context anymore, i.e.
- * not assigning it to another drawable, it shall be
- * destroyed before setting the new context, i.e.:
+ * not assigning it to another drawable, it shall be
+ * destroyed, i.e.:
*
- * This is required, since a context must have a valid drawable at all times
- * and this API shall not restrict the user in any way.
*
*
- * @param newCtx the new context
- * @return the replaced GLContext, maybe null
+ * @param newCtx the new context, maybe null for dis-association.
+ * @return the previous GLContext, maybe null
*
* @see GLContext#setGLDrawable(GLDrawable, boolean)
* @see GLContext#setGLReadDrawable(GLDrawable)
diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java
index 455f2d70d..4817add4d 100644
--- a/src/jogl/classes/javax/media/opengl/GLContext.java
+++ b/src/jogl/classes/javax/media/opengl/GLContext.java
@@ -217,15 +217,20 @@ public abstract class GLContext {
/**
* Sets the read/write drawable for framebuffer operations.
*
+ * If the arguments reflect the current state of this context
+ * this method is a no-operation and returns the old and current {@link GLDrawable}.
+ *
+ *
* If the context was current on this thread, it is being released before switching the drawable
* and made current afterwards. However the user shall take extra care that not other thread
* attempts to make this context current. Otherwise a race condition may happen.
*
- * @param readWrite the read/write drawable for framebuffer operations.
- * @param setWriteOnly if true and if the current read-drawable differs
- * from the write-drawable ({@link #setGLReadDrawable(GLDrawable)}),
- * only change the write-drawable. Otherwise set both drawables.
- * @return the replaced read/write drawable
+ * @param readWrite The read/write drawable for framebuffer operations, maybe null to remove association.
+ * @param setWriteOnly Only change the write-drawable, if setWriteOnly is true and
+ * if the {@link #getGLReadDrawable() read-drawable} differs
+ * from the {@link #getGLDrawable() write-drawable}.
+ * Otherwise set both drawables, read and write.
+ * @return The previous read/write drawable
*
* @throws GLException in case null is being passed or
* this context is made current on another thread.
@@ -239,6 +244,12 @@ public abstract class GLContext {
/**
* Returns the write-drawable this context uses for framebuffer operations.
+ *
+ * If the read-drawable has not been changed manually via {@link #setGLReadDrawable(GLDrawable)},
+ * it equals to the write-drawable (default).
+ *
+ * @see #setGLDrawable(GLDrawable, boolean)
+ * @see #setGLReadDrawable(GLDrawable)
*/
public abstract GLDrawable getGLDrawable();
@@ -259,7 +270,7 @@ public abstract class GLContext {
*
* @param read the read-drawable for read framebuffer operations.
* If null is passed, the default write drawable will be set.
- * @return the replaced read-drawable
+ * @return the previous read-drawable
*
* @throws GLException in case a read drawable is not supported or
* this context is made current on another thread.
diff --git a/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java b/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java
index eadd59559..c20197e72 100644
--- a/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java
+++ b/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java
@@ -74,8 +74,12 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, FPSCounter {
protected volatile boolean sendDestroy = false; // volatile: maybe written by WindowManager thread w/o locking
/**
- * @param drawable upstream {@link GLDrawableImpl} instance, may be null for lazy initialization
- * @param context upstream {@link GLContextImpl} instance, may be null for lazy initialization
+ * @param drawable upstream {@link GLDrawableImpl} instance,
+ * may be null for lazy initialization
+ * @param context upstream {@link GLContextImpl} instance,
+ * may not have been made current (created) yet,
+ * may not be associated w/ drawable yet,
+ * may be null for lazy initialization
* @param ownsDevice pass true if {@link AbstractGraphicsDevice#close()} shall be issued,
* otherwise pass false. Closing the device is required in case
* the drawable is created w/ it's own new instance, e.g. offscreen drawables,
@@ -85,6 +89,9 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, FPSCounter {
this.drawable = drawable;
this.context = context;
this.ownsDevice = ownsDevice;
+ if(null != context && null != drawable) {
+ context.setGLDrawable(drawable, false);
+ }
resetFPSCounter();
}
@@ -326,7 +333,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, FPSCounter {
final GLContext oldCtx = context;
final boolean newCtxCurrent = GLDrawableHelper.switchContext(drawable, oldCtx, newCtx, additionalCtxCreationFlags);
context=(GLContextImpl)newCtx;
- if(newCtxCurrent) {
+ if(newCtxCurrent) { // implies null != newCtx
context.makeCurrent();
}
return oldCtx;
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index f2c2cfada..2a2b6a8fd 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -203,8 +203,8 @@ public abstract class GLContextImpl extends GLContext {
@Override
public final GLDrawable setGLDrawable(GLDrawable readWrite, boolean setWriteOnly) {
- if(null==readWrite) {
- throw new GLException("Null read/write drawable not allowed");
+ if( drawable == readWrite && ( setWriteOnly || drawableRead == readWrite ) ) {
+ return drawable; // no change.
}
final boolean lockHeld = lock.isOwner(Thread.currentThread());
if(lockHeld) {
@@ -212,16 +212,20 @@ public abstract class GLContextImpl extends GLContext {
} else if(lock.isLockedByOtherThread()) { // still could glitch ..
throw new GLException("GLContext current by other thread ("+lock.getOwner()+"), operation not allowed.");
}
- if(!setWriteOnly || drawableRead==drawable) { // if !setWriteOnly || !explicitReadDrawable
+ if( !setWriteOnly || drawableRead == drawable ) { // if !setWriteOnly || !explicitReadDrawable
drawableRead = (GLDrawableImpl) readWrite;
}
final GLDrawableImpl old = drawable;
- old.associateContext(this, false);
- drawableRetargeted = null != drawable;
+ if( null != old ) {
+ old.associateContext(this, false);
+ }
+ drawableRetargeted |= null != drawable && readWrite != drawable;
drawable = (GLDrawableImpl) readWrite ;
- drawable.associateContext(this, true);
- if(lockHeld) {
- makeCurrent();
+ if( null != drawable ) {
+ drawable.associateContext(this, true);
+ if( lockHeld ) {
+ makeCurrent();
+ }
}
return old;
}
@@ -334,7 +338,7 @@ public abstract class GLContextImpl extends GLContext {
", surf "+toHexString(drawable.getHandle())+", isShared "+GLContextShareSet.isShared(this)+" - "+lock);
}
if (contextHandle != 0) {
- int lockRes = drawable.lockSurface();
+ final int lockRes = drawable.lockSurface();
if (NativeSurface.LOCK_SURFACE_NOT_READY == lockRes) {
// this would be odd ..
throw new GLException("Surface not ready to lock: "+drawable);
@@ -408,7 +412,7 @@ public abstract class GLContextImpl extends GLContext {
throw new GLException("Destination OpenGL context has not been created");
}
- int lockRes = drawable.lockSurface();
+ final int lockRes = drawable.lockSurface();
if (NativeSurface.LOCK_SURFACE_NOT_READY == lockRes) {
// this would be odd ..
throw new GLException("Surface not ready to lock");
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
index f8c58ee34..5d113ff83 100644
--- a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
+++ b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
@@ -131,30 +131,36 @@ public class GLDrawableHelper {
}
/**
- * Associate a new context to the drawable and also propagates the context/drawable switch by
- * calling {@link GLContext#setGLDrawable(GLDrawable, boolean) newCtx.setGLDrawable(drawable, true);}.
- *
- * If the old or new context was current on this thread, it is being released before switching the drawable.
+ * Switch {@link GLContext} / {@link GLDrawable} association.
+ *
+ * Dis-associate oldCtx from drawable
+ * via {@link GLContext#setGLDrawable(GLDrawable, boolean) oldCtx.setGLDrawable(null, true);}.
*
*
- * Be aware that the old context is still bound to the drawable,
- * and that one context can only bound to one drawable at one time!
+ * Re-associate newCtx with drawable
+ * via {@link GLContext#setGLDrawable(GLDrawable, boolean) newCtx.setGLDrawable(drawable, true);}.
+ *
+ *
+ * If the old or new context was current on this thread, it is being released before switching the drawable.
*
*
* No locking is being performed on the drawable, caller is required to take care of it.
*
*
* @param drawable the drawable which context is changed
- * @param oldCtx the old context
- * @param newCtx the new context
+ * @param oldCtx the old context, maybe null.
+ * @param newCtx the new context, maybe null for dis-association.
* @param newCtxCreationFlags additional creation flags if newCtx is not null and not been created yet, see {@link GLContext#setContextCreationFlags(int)}
* @return true if the new context was current, otherwise false
*
* @see GLAutoDrawable#setContext(GLContext)
*/
public static final boolean switchContext(GLDrawable drawable, GLContext oldCtx, GLContext newCtx, int newCtxCreationFlags) {
- if( null != oldCtx && oldCtx.isCurrent() ) {
- oldCtx.release();
+ if( null != oldCtx ) {
+ if( oldCtx.isCurrent() ) {
+ oldCtx.release();
+ }
+ oldCtx.setGLDrawable(null, true); // dis-associate old pair
}
final boolean newCtxCurrent;
if(null!=newCtx) {
@@ -163,8 +169,8 @@ public class GLDrawableHelper {
newCtx.release();
}
newCtx.setContextCreationFlags(newCtxCreationFlags);
- newCtx.setGLDrawable(drawable, true); // propagate context/drawable switch
- } else {
+ newCtx.setGLDrawable(drawable, true); // re-associate new pair
+ } else {
newCtxCurrent = false;
}
return newCtxCurrent;
@@ -203,6 +209,7 @@ public class GLDrawableHelper {
}
context.getGL().glFinish();
context.release();
+ context.setGLDrawable(null, true); // dis-associate
}
if(null != proxySurface) {
diff --git a/src/jogl/classes/jogamp/opengl/GLEventListenerState.java b/src/jogl/classes/jogamp/opengl/GLEventListenerState.java
new file mode 100644
index 000000000..dea2bc85b
--- /dev/null
+++ b/src/jogl/classes/jogamp/opengl/GLEventListenerState.java
@@ -0,0 +1,267 @@
+/**
+ * Copyright 2013 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+package jogamp.opengl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.media.nativewindow.AbstractGraphicsConfiguration;
+import javax.media.nativewindow.AbstractGraphicsDevice;
+import javax.media.nativewindow.AbstractGraphicsScreen;
+import javax.media.nativewindow.NativeWindowFactory;
+import javax.media.nativewindow.VisualIDHolder;
+import javax.media.opengl.GLAnimatorControl;
+import javax.media.opengl.GLAutoDrawable;
+import javax.media.opengl.GLCapabilitiesImmutable;
+import javax.media.opengl.GLContext;
+import javax.media.opengl.GLEventListener;
+import javax.media.opengl.GLException;
+import javax.media.opengl.GLRunnable;
+
+import com.jogamp.nativewindow.MutableGraphicsConfiguration;
+
+/**
+ * GLEventListenerState is holding {@link GLAutoDrawable} components crucial
+ * to relocating all its {@link GLEventListener} w/ their operating {@link GLContext}, etc.
+ * The components are:
+ *
+ *
{@link AbstractGraphicsScreen}
+ *
{@link GLCapabilitiesImmutable}
+ *
{@link GLContext} operating all {@link GLEventListener}
+ *
All {@link GLEventListener}
+ *
All {@link GLEventListener}'s init state
+ *
{@link GLAnimatorControl}
+ *
+ *
+ * A GLEventListenerState instance can be created while components are {@link #moveFrom(GLAutoDrawable) moved from} a {@link GLAutoDrawable}
+ * to the new instance, which gains {@link #isOwner() ownership} of the moved components.
+ *
+ *
+ * A GLEventListenerState instance's components can be {@link #moveTo(GLAutoDrawable) moved to} a {@link GLAutoDrawable},
+ * while loosing {@link #isOwner() ownership} of the moved components.
+ *
+ *
+ */
+public class GLEventListenerState {
+ private GLEventListenerState(AbstractGraphicsScreen screen, GLCapabilitiesImmutable caps, GLContext context, int count, GLAnimatorControl anim) {
+ this.screen = screen;
+ this.caps = caps;
+ this.context = context;
+ this.listeners = new GLEventListener[count];
+ this.listenersInit = new boolean[count];
+ this.anim = anim;
+ this.owner = true;
+ }
+ /**
+ * Returns true, if this instance is the current owner of the components,
+ * otherwise false.
+ *
+ * Ownership is lost if {@link #moveTo(GLAutoDrawable)} is being called successfully
+ * and all components are transferred to the new {@link GLAutoDrawable}.
+ *
+ */
+ public final boolean isOwner() { return owner; }
+
+ public final int listenerCount() { return listeners.length; }
+
+ public final AbstractGraphicsScreen screen;
+ public final GLCapabilitiesImmutable caps;
+ public final GLContext context;
+ public final GLEventListener[] listeners;
+ public final boolean[] listenersInit;
+ public final GLAnimatorControl anim;
+
+ private boolean owner;
+
+ /**
+ * Last resort to destroy and loose ownership
+ */
+ public void destroy() {
+ if( owner ) {
+ final int aSz = listenerCount();
+ for(int i=0; i
+ * Note that all components are removed from the {@link GLAutoDrawable},
+ * i.e. the {@link GLContext}, all {@link GLEventListener}.
+ *
+ *
+ * If the {@link GLAutoDrawable} was added to a {@link GLAnimatorControl}, it is removed
+ * and the {@link GLAnimatorControl} added to the GLEventListenerState.
+ *
+ *
+ * The returned GLEventListenerState instance is the {@link #isOwner() owner of the components}.
+ *
+ *
+ * @param a {@link GLAutoDrawable} source to move components from
+ * @return new GLEventListenerState instance {@link #isOwner() owning} moved components.
+ *
+ * @see #moveTo(GLAutoDrawable)
+ */
+ public static GLEventListenerState moveFrom(GLAutoDrawable a) {
+ final int aSz = a.getGLEventListenerCount();
+
+ // Create new AbstractGraphicsScreen w/ cloned AbstractGraphicsDevice for future GLAutoDrawable
+ // allowing this AbstractGraphicsDevice to loose ownership -> not closing display/device!
+ final AbstractGraphicsConfiguration aCfg1 = a.getNativeSurface().getGraphicsConfiguration();
+ final GLCapabilitiesImmutable caps1 = (GLCapabilitiesImmutable) aCfg1.getChosenCapabilities();
+ final AbstractGraphicsScreen aScreen1 = aCfg1.getScreen();
+ final AbstractGraphicsDevice aDevice1 = aScreen1.getDevice();
+ final AbstractGraphicsDevice aDevice2 = (AbstractGraphicsDevice) aDevice1.clone();
+ final AbstractGraphicsScreen aScreen2 = NativeWindowFactory.createScreen( NativeWindowFactory.getNativeWindowType(false), aDevice2, aScreen1.getIndex() );
+
+ final GLAnimatorControl aAnim = a.getAnimator();
+ if( null != aAnim ) {
+ aAnim.remove(a); // also handles ECT
+ }
+
+ final GLEventListenerState glls = new GLEventListenerState(aScreen2, caps1, a.getContext(), aSz, aAnim);
+
+ //
+ // remove and cache all GLEventListener and their init-state
+ //
+ for(int i=0; i
+ * If the previous {@link GLAutoDrawable} was removed from a {@link GLAnimatorControl} by previous {@link #moveFrom(GLAutoDrawable)},
+ * the given {@link GLAutoDrawable} is added to the cached {@link GLAnimatorControl}.
+ * This operation is skipped, if the given {@link GLAutoDrawable} is already added to a {@link GLAnimatorControl} instance.
+ *
+ *
+ * Note: After this operation, the GLEventListenerState reference should be released.
+ *
+ *
+ * @param a {@link GLAutoDrawable} destination to move GLEventListenerState components to
+ *
+ * @throws GLException if the {@link GLAutoDrawable}'s configuration is incompatible, i.e. different {@link GLCapabilitiesImmutable}.
+ *
+ * @see #moveFrom(GLAutoDrawable)
+ * @see #isOwner()
+ */
+ public final void moveTo(GLAutoDrawable a) {
+ final List aGLCmds = new ArrayList();
+ final int aSz = listenerCount();
+
+ final MutableGraphicsConfiguration aCfg = (MutableGraphicsConfiguration) a.getNativeSurface().getGraphicsConfiguration();
+ final GLCapabilitiesImmutable aCaps = (GLCapabilitiesImmutable) aCfg.getChosenCapabilities();
+ if( caps.getVisualID(VisualIDHolder.VIDType.INTRINSIC) != aCaps.getVisualID(VisualIDHolder.VIDType.INTRINSIC) ) {
+ throw new GLException("XXX: Incompatible - Prev Holder: "+caps+", New Holder "+caps);
+ }
+ final GLContext prevContext = a.getContext();
+ if( null != prevContext) {
+ prevContext.destroy();
+ }
+ final AbstractGraphicsScreen preScreen = aCfg.getScreen();
+ aCfg.setScreen( screen );
+ preScreen.getDevice().close();
+ a.setContext( context );
+ owner = false;
+
+ //
+ // Trigger GL-Viewport reset and reshape of all initialized GLEventListeners
+ //
+ aGLCmds.add(setViewport);
+ for(int i=0; i= 0 is specific screen
* @return
- * @throws UnsupportedOperationException
*/
- public static AbstractGraphicsScreen getScreen(AbstractGraphicsDevice device, int screen) throws UnsupportedOperationException {
- if( isX11 ) {
- X11GraphicsDevice x11Device = (X11GraphicsDevice)device;
- if(0 > screen) {
- screen = x11Device.getDefaultScreen();
- }
- return new X11GraphicsScreen(x11Device, screen);
- }
- if(0 > screen) {
- screen = 0; // FIXME: Needs native API utilization
- }
- if( isWindows || isOSX ) {
- return new DefaultGraphicsScreen(device, screen);
- }
- throw new UnsupportedOperationException("n/a for this windowing system: "+nwt);
+ public static AbstractGraphicsScreen getScreen(AbstractGraphicsDevice device, int screen) {
+ return NativeWindowFactory.createScreen(nwt, device, screen);
}
public static int getNativeVisualID(AbstractGraphicsDevice device, long windowHandle) {
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsDevice.java b/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsDevice.java
index 0f28ca67c..da3b31de4 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsDevice.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsDevice.java
@@ -45,7 +45,7 @@ import javax.media.nativewindow.ToolkitLock;
*/
public class X11GraphicsDevice extends DefaultGraphicsDevice implements Cloneable {
- final boolean handleOwner;
+ /* final */ boolean handleOwner;
final boolean isXineramaEnabled;
/** Constructs a new X11GraphicsDevice corresponding to the given connection and default
@@ -153,5 +153,13 @@ public class X11GraphicsDevice extends DefaultGraphicsDevice implements Cloneabl
}
return super.close();
}
+
+ @Override
+ public boolean isHandleOwner() {
+ return handleOwner;
+ }
+ @Override
+ public void clearHandleOwner() {
+ handleOwner = false;
+ }
}
-
diff --git a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsConfiguration.java b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsConfiguration.java
index ebdaf2fbb..4e45113d4 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsConfiguration.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsConfiguration.java
@@ -42,8 +42,9 @@ package javax.media.nativewindow;
/** A marker interface describing a graphics configuration, visual, or
pixel format in a toolkit-independent manner. */
-
public interface AbstractGraphicsConfiguration extends VisualIDHolder, Cloneable {
+ public Object clone();
+
/**
* Return the screen this graphics configuration is valid for
*/
diff --git a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java
index 8ecd5242d..585cd1f09 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java
@@ -45,7 +45,6 @@ import jogamp.nativewindow.Debug;
/** A interface describing a graphics device in a
toolkit-independent manner.
*/
-
public interface AbstractGraphicsDevice extends Cloneable {
public static final boolean DEBUG = Debug.debug("GraphicsDevice");
@@ -58,6 +57,8 @@ public interface AbstractGraphicsDevice extends Cloneable {
/** Default unit id for the 1st device: 0 */
public static int DEFAULT_UNIT = 0;
+ public Object clone();
+
/**
* Returns the type of the underlying subsystem, ie
* NativeWindowFactory.TYPE_KD, NativeWindowFactory.TYPE_X11, ..
@@ -143,10 +144,17 @@ public interface AbstractGraphicsDevice extends Cloneable {
*
* Example implementations like {@link com.jogamp.nativewindow.x11.X11GraphicsDevice}
* or {@link com.jogamp.nativewindow.egl.EGLGraphicsDevice}
- * issue the native close operation or skip it depending on the handles's ownership.
+ * issue the native close operation or skip it depending on the {@link #isHandleOwner() handles's ownership}.
*
*
* @return true if the handle was not null and closing was successful, otherwise false.
*/
public boolean close();
+
+ /**
+ * @return true if instance owns the handle to issue {@link #close()}, otherwise false.
+ */
+ public boolean isHandleOwner();
+
+ public void clearHandleOwner();
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsScreen.java b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsScreen.java
index eb2cc9120..acb98073b 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsScreen.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsScreen.java
@@ -44,6 +44,8 @@ package javax.media.nativewindow;
*/
public interface AbstractGraphicsScreen extends Cloneable {
+ public Object clone();
+
/**
* Return the device this graphics configuration is valid for
*/
diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java
index a33c3792a..6b23172e1 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java
@@ -93,25 +93,26 @@ public class DefaultGraphicsConfiguration implements Cloneable, AbstractGraphics
/**
* Set the capabilities to a new value.
*
+ *
* The use case for setting the Capabilities at a later time is
- * a change of the graphics device in a multi-screen environment.
- *
+ * a change or re-validation of capabilities.
+ *
* @see javax.media.nativewindow.GraphicsConfigurationFactory#chooseGraphicsConfiguration(Capabilities, CapabilitiesChooser, AbstractGraphicsScreen)
*/
protected void setChosenCapabilities(CapabilitiesImmutable capsChosen) {
- capabilitiesChosen = capsChosen;
+ this.capabilitiesChosen = capsChosen;
}
/**
* Set a new screen.
*
+ *
* the use case for setting a new screen at a later time is
- * a change of the graphics device in a multi-screen environment.
- *
- * A copy of the passed object is being used.
+ * a change of the graphics device in a multi-screen environment.
+ *
*/
- final protected void setScreen(DefaultGraphicsScreen screen) {
- this.screen = (AbstractGraphicsScreen) screen.clone();
+ protected void setScreen(AbstractGraphicsScreen screen) {
+ this.screen = screen;
}
@Override
diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java
index 9288652d9..b3ae4628c 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java
@@ -37,10 +37,10 @@ import jogamp.nativewindow.NativeWindowFactoryImpl;
public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice {
private static final String separator = "_";
- private String type;
- protected String connection;
- protected int unitID;
- protected String uniqueID;
+ private final String type;
+ protected final String connection;
+ protected final int unitID;
+ protected final String uniqueID;
protected long handle;
protected ToolkitLock toolkitLock;
@@ -170,9 +170,18 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice
return false;
}
+ @Override
+ public boolean isHandleOwner() {
+ return false;
+ }
+
+ @Override
+ public void clearHandleOwner() {
+ }
+
@Override
public String toString() {
- return getClass().getSimpleName()+"[type "+getType()+", connection "+getConnection()+", unitID "+getUnitID()+", handle 0x"+Long.toHexString(getHandle())+", "+toolkitLock+"]";
+ return getClass().getSimpleName()+"[type "+getType()+", connection "+getConnection()+", unitID "+getUnitID()+", handle 0x"+Long.toHexString(getHandle())+", owner "+isHandleOwner()+", "+toolkitLock+"]";
}
/**
diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsScreen.java b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsScreen.java
index f50bd0e14..9fa58c7a3 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsScreen.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsScreen.java
@@ -33,8 +33,8 @@
package javax.media.nativewindow;
public class DefaultGraphicsScreen implements Cloneable, AbstractGraphicsScreen {
- AbstractGraphicsDevice device;
- private int idx;
+ private final AbstractGraphicsDevice device;
+ private final int idx;
public DefaultGraphicsScreen(AbstractGraphicsDevice device, int idx) {
this.device = device;
@@ -57,7 +57,7 @@ public class DefaultGraphicsScreen implements Cloneable, AbstractGraphicsScreen
public AbstractGraphicsDevice getDevice() {
return device;
}
-
+
public int getIndex() {
return idx;
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java
index d7f28a986..07702c762 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java
@@ -48,6 +48,10 @@ import jogamp.nativewindow.ResourceToolkitLock;
import com.jogamp.common.os.Platform;
import com.jogamp.common.util.ReflectionUtil;
+import com.jogamp.nativewindow.awt.AWTGraphicsDevice;
+import com.jogamp.nativewindow.awt.AWTGraphicsScreen;
+import com.jogamp.nativewindow.x11.X11GraphicsDevice;
+import com.jogamp.nativewindow.x11.X11GraphicsScreen;
/** Provides a pluggable mechanism for arbitrary window toolkits to
adapt their components to the {@link NativeWindow} interface,
@@ -428,6 +432,29 @@ public abstract class NativeWindowFactory {
return NativeWindowFactoryImpl.getNullToolkitLock();
}
+ /**
+ * @param device
+ * @param screen -1 is default screen of the given device, e.g. maybe 0 or determined by native API. >= 0 is specific screen
+ * @return newly created AbstractGraphicsScreen of given native type
+ */
+ public static AbstractGraphicsScreen createScreen(String type, AbstractGraphicsDevice device, int screen) {
+ if( TYPE_X11 == type ) {
+ final X11GraphicsDevice x11Device = (X11GraphicsDevice)device;
+ if(0 > screen) {
+ screen = x11Device.getDefaultScreen();
+ }
+ return new X11GraphicsScreen(x11Device, screen);
+ }
+ if(0 > screen) {
+ screen = 0; // FIXME: Needs native API utilization
+ }
+ if( TYPE_AWT == type ) {
+ final AWTGraphicsDevice awtDevice = (AWTGraphicsDevice) device;
+ return new AWTGraphicsScreen(awtDevice);
+ }
+ return new DefaultGraphicsScreen(device, screen);
+ }
+
/** Returns the appropriate NativeWindowFactory to handle window
objects of the given type. The windowClass might be {@link
NativeWindow NativeWindow}, in which case the client has
diff --git a/src/nativewindow/native/x11/Xmisc.c b/src/nativewindow/native/x11/Xmisc.c
index a8d45f288..017c52df2 100644
--- a/src/nativewindow/native/x11/Xmisc.c
+++ b/src/nativewindow/native/x11/Xmisc.c
@@ -180,7 +180,7 @@ static int errorHandlerThrowException = 0;
static int x11ErrorHandler(Display *dpy, XErrorEvent *e)
{
- if(!errorHandlerQuiet) {
+ if( !errorHandlerQuiet || errorHandlerDebug ) {
const char * errnoStr = strerror(errno);
char errCodeStr[80];
char reqCodeStr[80];
diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
index 96d0f6e3b..7fccb6622 100644
--- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
+++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
@@ -458,24 +458,22 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
} else {
t0 = 0;
}
-
- /* if (nativeWindowCreated && null != context) {
- throw new GLException("InternalError: Native Windows has been just created, but context wasn't destroyed (is not null)");
- } */
- if (null == context && visible && 0 != window.getWindowHandle() && 0 ctx1/draw2, ctx2/draw1.
+ */
+public class TestGLContextDrawableSwitch01NEWT extends UITestCase {
+ static GLProfile glp;
+ static GLCapabilities caps;
+ static int width, height;
+
+ @BeforeClass
+ public static void initClass() {
+ glp = GLProfile.getGL2ES2();
+ caps = new GLCapabilities(glp);
+ width = 256;
+ height = 256;
+ }
+
+ private GLAutoDrawable createGLAutoDrawable(GLCapabilities caps, int x, int y, int width, int height, WindowListener wl) throws InterruptedException {
+ final Window window = NewtFactory.createWindow(caps);
+ Assert.assertNotNull(window);
+ window.setPosition(x, y);
+ window.setSize(width, height);
+ window.setVisible(true);
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(window, true));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(window, true));
+
+ final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile());
+ final GLDrawable drawable = factory.createGLDrawable(window);
+ Assert.assertNotNull(drawable);
+
+ drawable.setRealized(true);
+ Assert.assertTrue(drawable.isRealized());
+
+ final GLContext context = drawable.createContext(null);
+ Assert.assertNotNull(context);
+
+ final GLAutoDrawableDelegate glad = new GLAutoDrawableDelegate(drawable, context, window, false, null) {
+ @Override
+ protected void destroyImplInLock() {
+ super.destroyImplInLock();
+ window.destroy(); // destroys the actual window
+ }
+ };
+
+ // add basic window interaction
+ window.addWindowListener(new WindowAdapter() {
+ @Override
+ public void windowRepaint(WindowUpdateEvent e) {
+ glad.windowRepaintOp();
+ }
+ @Override
+ public void windowResized(WindowEvent e) {
+ glad.windowResizedOp(window.getWidth(), window.getHeight());
+ }
+ @Override
+ public void windowDestroyNotify(WindowEvent e) {
+ glad.windowDestroyNotifyOp();
+ }
+ });
+ window.addWindowListener(wl);
+
+ return glad;
+ }
+
+ @Test(timeout=30000)
+ public void testSwitch2WindowSingleContext() throws InterruptedException {
+ final QuitAdapter quitAdapter = new QuitAdapter();
+
+ GLAutoDrawable glad1 = createGLAutoDrawable(caps, 64, 64, width, height, quitAdapter);
+ GLAutoDrawable glad2 = createGLAutoDrawable(caps, 2*64+width, 64, width+100, height+100, quitAdapter);
+
+ // create single context using glad1 and assign it to glad1,
+ // destroy the prev. context afterwards.
+ {
+ final GLContext newCtx = glad1.createContext(null);
+ Assert.assertNotNull(newCtx);
+ final GLContext oldCtx = glad1.setContext(newCtx);
+ Assert.assertNotNull(oldCtx);
+ oldCtx.destroy();
+ final int res = newCtx.makeCurrent();
+ Assert.assertTrue(GLContext.CONTEXT_CURRENT_NEW==res || GLContext.CONTEXT_CURRENT==res);
+ newCtx.release();
+ }
+
+ final SnapshotGLEventListener snapshotGLEventListener = new SnapshotGLEventListener();
+ GearsES2 gears = new GearsES2(1);
+ glad1.addGLEventListener(gears);
+ glad1.addGLEventListener(snapshotGLEventListener);
+ snapshotGLEventListener.setMakeSnapshot();
+
+ Animator animator = new Animator();
+ animator.add(glad1);
+ animator.add(glad2);
+ animator.start();
+
+ int s = 0;
+ long t0 = System.currentTimeMillis();
+ long t1 = t0;
+
+ while( !quitAdapter.shouldQuit() && ( t1 - t0 ) < duration ) {
+ if( ( t1 - t0 ) / period > s) {
+ s++;
+ System.err.println(s+" - switch - START "+ ( t1 - t0 ));
+
+ // switch context _and_ the demo synchronously
+ GLDrawableUtil.swapGLContextAndAllGLEventListener(glad1, glad2);
+
+ System.err.println(s+" - switch - END "+ ( t1 - t0 ));
+ }
+ Thread.sleep(100);
+ t1 = System.currentTimeMillis();
+ }
+
+ animator.stop();
+ glad1.destroy();
+ glad2.destroy();
+ }
+
+ @Test(timeout=30000)
+ public void testSwitch2GLWindowOneDemo() throws InterruptedException {
+ final SnapshotGLEventListener snapshotGLEventListener = new SnapshotGLEventListener();
+ final GearsES2 gears = new GearsES2(1);
+ final QuitAdapter quitAdapter = new QuitAdapter();
+
+ GLWindow glWindow1 = GLWindow.create(caps);
+ glWindow1.setTitle("win1");
+ glWindow1.setSize(width, height);
+ glWindow1.setPosition(64, 64);
+ glWindow1.addGLEventListener(0, gears);
+ glWindow1.addGLEventListener(snapshotGLEventListener);
+ glWindow1.addWindowListener(quitAdapter);
+
+ GLWindow glWindow2 = GLWindow.create(caps);
+ glWindow2.setTitle("win2");
+ glWindow2.setSize(width+100, height+100);
+ glWindow2.setPosition(2*64+width, 64);
+ glWindow2.addWindowListener(quitAdapter);
+
+ Animator animator = new Animator();
+ animator.add(glWindow1);
+ animator.add(glWindow2);
+ animator.start();
+
+ glWindow1.setVisible(true);
+ glWindow2.setVisible(true);
+
+ snapshotGLEventListener.setMakeSnapshot();
+
+ int s = 0;
+ long t0 = System.currentTimeMillis();
+ long t1 = t0;
+
+ while( !quitAdapter.shouldQuit() && ( t1 - t0 ) < duration ) {
+ if( ( t1 - t0 ) / period > s) {
+ s++;
+ System.err.println(s+" - switch - START "+ ( t1 - t0 ));
+ System.err.println(s+" - A w1-h 0x"+Long.toHexString(glWindow1.getHandle())+",-ctx 0x"+Long.toHexString(glWindow1.getContext().getHandle()));
+ System.err.println(s+" - A w2-h 0x"+Long.toHexString(glWindow2.getHandle())+",-ctx 0x"+Long.toHexString(glWindow2.getContext().getHandle()));
+
+ // switch context _and_ the demo synchronously
+ GLDrawableUtil.swapGLContextAndAllGLEventListener(glWindow1, glWindow2);
+
+ System.err.println(s+" - B w1-h 0x"+Long.toHexString(glWindow1.getHandle())+",-ctx 0x"+Long.toHexString(glWindow1.getContext().getHandle()));
+ System.err.println(s+" - B w2-h 0x"+Long.toHexString(glWindow2.getHandle())+",-ctx 0x"+Long.toHexString(glWindow2.getContext().getHandle()));
+ System.err.println(s+" - switch - END "+ ( t1 - t0 ));
+
+ snapshotGLEventListener.setMakeSnapshot();
+ }
+ Thread.sleep(100);
+ t1 = System.currentTimeMillis();
+ }
+
+ animator.stop();
+ glWindow1.destroy();
+ glWindow2.destroy();
+
+ }
+
+ @Test(timeout=30000)
+ public void testSwitch2GLWindowEachWithOwnDemo() throws InterruptedException {
+ final GearsES2 gears = new GearsES2(1);
+ final RedSquareES2 rsquare = new RedSquareES2(1);
+ final QuitAdapter quitAdapter = new QuitAdapter();
+ final SnapshotGLEventListener snapshotGLEventListener1 = new SnapshotGLEventListener();
+ final SnapshotGLEventListener snapshotGLEventListener2 = new SnapshotGLEventListener();
+
+ GLWindow glWindow1 = GLWindow.create(caps);
+ glWindow1.setTitle("win1");
+ glWindow1.setSize(width, height);
+ glWindow1.setPosition(64, 64);
+ glWindow1.addGLEventListener(0, gears);
+ glWindow1.addGLEventListener(snapshotGLEventListener1);
+ glWindow1.addWindowListener(quitAdapter);
+
+ GLWindow glWindow2 = GLWindow.create(caps);
+ glWindow2.setTitle("win2");
+ glWindow2.setSize(width+100, height+100);
+ glWindow2.setPosition(2*64+width, 64);
+ glWindow2.addGLEventListener(0, rsquare);
+ glWindow2.addGLEventListener(snapshotGLEventListener2);
+ glWindow2.addWindowListener(quitAdapter);
+
+ Animator animator = new Animator();
+ animator.add(glWindow1);
+ animator.add(glWindow2);
+ animator.start();
+
+ glWindow1.setVisible(true);
+ glWindow2.setVisible(true);
+
+ snapshotGLEventListener1.setMakeSnapshot();
+ snapshotGLEventListener2.setMakeSnapshot();
+
+ int s = 0;
+ long t0 = System.currentTimeMillis();
+ long t1 = t0;
+
+ while( !quitAdapter.shouldQuit() && ( t1 - t0 ) < duration ) {
+ if( ( t1 - t0 ) / period > s) {
+ s++;
+ System.err.println(s+" - switch - START "+ ( t1 - t0 ));
+ System.err.println(s+" - A w1-h 0x"+Long.toHexString(glWindow1.getHandle())+",-ctx 0x"+Long.toHexString(glWindow1.getContext().getHandle()));
+ System.err.println(s+" - A w2-h 0x"+Long.toHexString(glWindow2.getHandle())+",-ctx 0x"+Long.toHexString(glWindow2.getContext().getHandle()));
+ GLDrawableUtil.swapGLContextAndAllGLEventListener(glWindow1, glWindow2);
+ System.err.println(s+" - B w1-h 0x"+Long.toHexString(glWindow1.getHandle())+",-ctx 0x"+Long.toHexString(glWindow1.getContext().getHandle()));
+ System.err.println(s+" - B w2-h 0x"+Long.toHexString(glWindow2.getHandle())+",-ctx 0x"+Long.toHexString(glWindow2.getContext().getHandle()));
+ System.err.println(s+" - switch - END "+ ( t1 - t0 ));
+ snapshotGLEventListener1.setMakeSnapshot();
+ snapshotGLEventListener2.setMakeSnapshot();
+ }
+ Thread.sleep(100);
+ t1 = System.currentTimeMillis();
+ }
+
+ animator.stop();
+ // System.err.println("pre -del-w1: w1: "+glWindow1);
+ // System.err.println("pre -del-w1: w2: "+glWindow2);
+ glWindow1.destroy();
+ // System.err.println("post-del-w1: w1: "+glWindow1);
+ // System.err.println("post-del-w1: w2: "+glWindow2);
+ glWindow2.destroy();
+
+ }
+
+ // default timing for 2 switches
+ static long duration = 2200; // ms
+ static long period = 1000; // ms
+
+ public static void main(String args[]) throws IOException {
+ for(int i=0; i
+ * See Bug 665 - https://jogamp.org/bugzilla/show_bug.cgi?id=665.
+ *
+ */
+public class TestGLContextDrawableSwitch11NEWT extends UITestCase {
+ static GLProfile glp;
+ static GLCapabilities caps;
+ static int width, height;
+
+ @BeforeClass
+ public static void initClass() {
+ glp = GLProfile.getGL2ES2();
+ caps = new GLCapabilities(glp);
+ width = 256;
+ height = 256;
+ }
+
+ private GLAutoDrawable createGLAutoDrawable(GLCapabilities caps, int x, int y, int width, int height, WindowListener wl) throws InterruptedException {
+ final Window window = NewtFactory.createWindow(caps);
+ Assert.assertNotNull(window);
+ window.setPosition(x, y);
+ window.setSize(width, height);
+ window.setVisible(true);
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(window, true));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(window, true));
+
+ final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile());
+ final GLDrawable drawable = factory.createGLDrawable(window);
+ Assert.assertNotNull(drawable);
+
+ drawable.setRealized(true);
+ Assert.assertTrue(drawable.isRealized());
+
+ final GLAutoDrawableDelegate glad = new GLAutoDrawableDelegate(drawable, null, window, false, null) {
+ @Override
+ protected void destroyImplInLock() {
+ super.destroyImplInLock();
+ window.destroy(); // destroys the actual window
+ }
+ };
+
+ // add basic window interaction
+ window.addWindowListener(new WindowAdapter() {
+ @Override
+ public void windowRepaint(WindowUpdateEvent e) {
+ glad.windowRepaintOp();
+ }
+ @Override
+ public void windowResized(WindowEvent e) {
+ glad.windowResizedOp(window.getWidth(), window.getHeight());
+ }
+ @Override
+ public void windowDestroyNotify(WindowEvent e) {
+ glad.windowDestroyNotifyOp();
+ }
+ });
+ window.addWindowListener(wl);
+
+ return glad;
+ }
+
+ @Test(timeout=30000)
+ public void test01() throws InterruptedException {
+ final QuitAdapter quitAdapter = new QuitAdapter();
+
+ final GLEventListenerCounter glelCounter = new GLEventListenerCounter();
+ final SnapshotGLEventListener snapshotGLEventListener = new SnapshotGLEventListener();
+ final Animator animator = new Animator();
+ animator.start();
+
+ final long t0 = System.currentTimeMillis();
+ final GLEventListenerState glls1;
+
+ // - create glad1 w/o context
+ // - create context using glad1 and assign it to glad1
+ {
+ final GLAutoDrawable glad1 = createGLAutoDrawable(caps, 64, 64, width, height, quitAdapter);
+ final GLContext context1 = glad1.createContext(null);
+ glad1.setContext(context1);
+ animator.add(glad1);
+
+ glad1.addGLEventListener(glelCounter);
+ glad1.addGLEventListener(new GearsES2(1));
+ glad1.addGLEventListener(snapshotGLEventListener);
+ snapshotGLEventListener.setMakeSnapshot();
+
+ long t1 = System.currentTimeMillis();
+
+ while( !quitAdapter.shouldQuit() && ( t1 - t0 ) < duration/2 ) {
+ Thread.sleep(100);
+ t1 = System.currentTimeMillis();
+ }
+
+ // - dis-associate context from glad1
+ // - destroy glad1
+ Assert.assertEquals(1, glelCounter.initCount);
+ Assert.assertTrue(1 <= glelCounter.reshapeCount);
+ Assert.assertTrue(1 <= glelCounter.displayCount);
+ Assert.assertEquals(0, glelCounter.disposeCount);
+ Assert.assertEquals(context1, glad1.getContext());
+ Assert.assertEquals(3, glad1.getGLEventListenerCount());
+ Assert.assertEquals(context1.getGLReadDrawable(), glad1.getDelegatedDrawable());
+ Assert.assertEquals(context1.getGLDrawable(), glad1.getDelegatedDrawable());
+
+ glls1 = GLEventListenerState.moveFrom(glad1);
+
+ Assert.assertEquals(1, glelCounter.initCount);
+ Assert.assertTrue(1 <= glelCounter.reshapeCount);
+ Assert.assertTrue(1 <= glelCounter.displayCount);
+ Assert.assertEquals(0, glelCounter.disposeCount);
+ Assert.assertEquals(context1, glls1.context);
+ Assert.assertNull(context1.getGLReadDrawable());
+ Assert.assertNull(context1.getGLDrawable());
+ Assert.assertEquals(3, glls1.listenerCount());
+ Assert.assertEquals(true, glls1.isOwner());
+ Assert.assertEquals(null, glad1.getContext());
+ Assert.assertEquals(0, glad1.getGLEventListenerCount());
+
+ glad1.destroy();
+ Assert.assertEquals(1, glelCounter.initCount);
+ Assert.assertTrue(1 <= glelCounter.reshapeCount);
+ Assert.assertTrue(1 <= glelCounter.displayCount);
+ Assert.assertEquals(0, glelCounter.disposeCount);
+ }
+
+ // - create glad2 w/ survived context
+ {
+ final GLAutoDrawable glad2 = createGLAutoDrawable(caps, 2*64+width, 64, width+100, height+100, quitAdapter);
+ snapshotGLEventListener.setMakeSnapshot();
+
+ Assert.assertEquals(null, glad2.getContext());
+ Assert.assertEquals(0, glad2.getGLEventListenerCount());
+
+ glls1.moveTo(glad2);
+
+ Assert.assertEquals(1, glelCounter.initCount);
+ Assert.assertTrue(1 <= glelCounter.reshapeCount);
+ Assert.assertTrue(1 <= glelCounter.displayCount);
+ Assert.assertEquals(0, glelCounter.disposeCount);
+ Assert.assertEquals(glls1.context, glad2.getContext());
+ Assert.assertEquals(3, glad2.getGLEventListenerCount());
+ Assert.assertEquals(glls1.context.getGLReadDrawable(), glad2.getDelegatedDrawable());
+ Assert.assertEquals(glls1.context.getGLDrawable(), glad2.getDelegatedDrawable());
+ Assert.assertEquals(false, glls1.isOwner());
+
+ long t1 = System.currentTimeMillis();
+
+ while( !quitAdapter.shouldQuit() && ( t1 - t0 ) < duration/1 ) {
+ Thread.sleep(100);
+ t1 = System.currentTimeMillis();
+ }
+
+ glad2.destroy();
+ Assert.assertEquals(1, glelCounter.initCount);
+ Assert.assertTrue(1 <= glelCounter.reshapeCount);
+ Assert.assertTrue(1 <= glelCounter.displayCount);
+ Assert.assertEquals(1, glelCounter.disposeCount);
+ }
+ animator.stop();
+ }
+
+ @Test(timeout=30000)
+ public void test02() throws InterruptedException {
+ final QuitAdapter quitAdapter = new QuitAdapter();
+
+ final SnapshotGLEventListener snapshotGLEventListener = new SnapshotGLEventListener();
+ final GLEventListenerCounter glelTracker = new GLEventListenerCounter();
+ final Animator animator = new Animator();
+ animator.start();
+
+ final long t0 = System.currentTimeMillis();
+ final GLEventListenerState glls1;
+
+ // - create glad1 w/o context
+ // - create context using glad1 and assign it to glad1
+ {
+ final GLWindow glad1 = GLWindow.create(caps);
+ glad1.setSize(width, height);
+ glad1.setPosition(64, 64);
+ glad1.addWindowListener(quitAdapter);
+ glad1.setVisible(true);
+ animator.add(glad1);
+
+ glad1.addGLEventListener(glelTracker);
+ glad1.addGLEventListener(new GearsES2(1));
+ glad1.addGLEventListener(snapshotGLEventListener);
+ snapshotGLEventListener.setMakeSnapshot();
+
+ long t1 = System.currentTimeMillis();
+
+ while( !quitAdapter.shouldQuit() && ( t1 - t0 ) < duration/2 ) {
+ Thread.sleep(100);
+ t1 = System.currentTimeMillis();
+ }
+
+ // - dis-associate context from glad1
+ // - destroy glad1
+ Assert.assertEquals(1, glelTracker.initCount);
+ Assert.assertTrue(1 <= glelTracker.reshapeCount);
+ Assert.assertTrue(1 <= glelTracker.displayCount);
+ Assert.assertEquals(0, glelTracker.disposeCount);
+ Assert.assertEquals(3, glad1.getGLEventListenerCount());
+ Assert.assertEquals(glad1.getContext().getGLReadDrawable(), glad1.getDelegatedDrawable());
+ Assert.assertEquals(glad1.getContext().getGLDrawable(), glad1.getDelegatedDrawable());
+
+ final GLContext context1 = glad1.getContext();
+ glls1 = GLEventListenerState.moveFrom(glad1);
+
+ Assert.assertEquals(1, glelTracker.initCount);
+ Assert.assertTrue(1 <= glelTracker.reshapeCount);
+ Assert.assertTrue(1 <= glelTracker.displayCount);
+ Assert.assertEquals(0, glelTracker.disposeCount);
+ Assert.assertEquals(context1, glls1.context);
+ Assert.assertNull(context1.getGLReadDrawable());
+ Assert.assertNull(context1.getGLDrawable());
+ Assert.assertEquals(3, glls1.listenerCount());
+ Assert.assertEquals(true, glls1.isOwner());
+ Assert.assertEquals(null, glad1.getContext());
+ Assert.assertEquals(0, glad1.getGLEventListenerCount());
+
+ glad1.destroy();
+ Assert.assertEquals(1, glelTracker.initCount);
+ Assert.assertTrue(1 <= glelTracker.reshapeCount);
+ Assert.assertTrue(1 <= glelTracker.displayCount);
+ Assert.assertEquals(0, glelTracker.disposeCount);
+ }
+
+ // - create glad2 w/ survived context
+ {
+ final GLWindow glad2 = GLWindow.create(caps);
+ glad2.setSize(width+100, height+100);
+ glad2.setPosition(2*64+width, 64);
+ glad2.addWindowListener(quitAdapter);
+ glad2.setVisible(true);
+ snapshotGLEventListener.setMakeSnapshot();
+
+ Assert.assertNotNull(glad2.getContext());
+ Assert.assertEquals(0, glad2.getGLEventListenerCount());
+
+ glls1.moveTo(glad2);
+
+ Assert.assertEquals(1, glelTracker.initCount);
+ Assert.assertTrue(1 <= glelTracker.reshapeCount);
+ Assert.assertTrue(1 <= glelTracker.displayCount);
+ Assert.assertEquals(0, glelTracker.disposeCount);
+ Assert.assertEquals(glls1.context, glad2.getContext());
+ Assert.assertEquals(3, glad2.getGLEventListenerCount());
+ Assert.assertEquals(glls1.context.getGLReadDrawable(), glad2.getDelegatedDrawable());
+ Assert.assertEquals(glls1.context.getGLDrawable(), glad2.getDelegatedDrawable());
+ Assert.assertEquals(false, glls1.isOwner());
+
+ long t1 = System.currentTimeMillis();
+
+ while( !quitAdapter.shouldQuit() && ( t1 - t0 ) < duration/1 ) {
+ Thread.sleep(100);
+ t1 = System.currentTimeMillis();
+ }
+
+ glad2.destroy();
+ Assert.assertEquals(1, glelTracker.initCount);
+ Assert.assertTrue(1 <= glelTracker.reshapeCount);
+ Assert.assertTrue(1 <= glelTracker.displayCount);
+ Assert.assertEquals(1, glelTracker.disposeCount);
+ }
+ animator.stop();
+ }
+
+ // default timing for 2 switches
+ static long duration = 2200; // ms
+
+ public static void main(String args[]) throws IOException {
+ for(int i=0; i s) {
- s++;
- System.err.println(s+" - switch - START "+ ( t1 - t0 ));
-
- // switch context _and_ the demo synchronously
- GLDrawableUtil.swapGLContextAndAllGLEventListener(glad1, glad2);
-
- System.err.println(s+" - switch - END "+ ( t1 - t0 ));
- }
- Thread.sleep(100);
- t1 = System.currentTimeMillis();
- }
-
- animator.stop();
- glad1.destroy();
- glad2.destroy();
- }
-
- @Test(timeout=30000)
- public void testSwitch2GLWindowOneDemo() throws InterruptedException {
- GearsES2 gears = new GearsES2(1);
- final QuitAdapter quitAdapter = new QuitAdapter();
-
- GLWindow glWindow1 = GLWindow.create(caps);
- glWindow1.setTitle("win1");
- glWindow1.setSize(width, height);
- glWindow1.setPosition(64, 64);
- glWindow1.addGLEventListener(0, gears);
- glWindow1.addWindowListener(quitAdapter);
-
- GLWindow glWindow2 = GLWindow.create(caps);
- glWindow2.setTitle("win2");
- glWindow2.setSize(width+100, height+100);
- glWindow2.setPosition(2*64+width, 64);
- glWindow2.addWindowListener(quitAdapter);
-
- Animator animator = new Animator();
- animator.add(glWindow1);
- animator.add(glWindow2);
- animator.start();
-
- glWindow1.setVisible(true);
- glWindow2.setVisible(true);
-
- int s = 0;
- long t0 = System.currentTimeMillis();
- long t1 = t0;
-
- while( !quitAdapter.shouldQuit() && ( t1 - t0 ) < duration ) {
- if( ( t1 - t0 ) / period > s) {
- s++;
- System.err.println(s+" - switch - START "+ ( t1 - t0 ));
- System.err.println(s+" - A w1-h 0x"+Long.toHexString(glWindow1.getHandle())+",-ctx 0x"+Long.toHexString(glWindow1.getContext().getHandle()));
- System.err.println(s+" - A w2-h 0x"+Long.toHexString(glWindow2.getHandle())+",-ctx 0x"+Long.toHexString(glWindow2.getContext().getHandle()));
-
- // switch context _and_ the demo synchronously
- GLDrawableUtil.swapGLContextAndAllGLEventListener(glWindow1, glWindow2);
-
- System.err.println(s+" - B w1-h 0x"+Long.toHexString(glWindow1.getHandle())+",-ctx 0x"+Long.toHexString(glWindow1.getContext().getHandle()));
- System.err.println(s+" - B w2-h 0x"+Long.toHexString(glWindow2.getHandle())+",-ctx 0x"+Long.toHexString(glWindow2.getContext().getHandle()));
- System.err.println(s+" - switch - END "+ ( t1 - t0 ));
- }
- Thread.sleep(100);
- t1 = System.currentTimeMillis();
- }
-
- animator.stop();
- glWindow1.destroy();
- glWindow2.destroy();
-
- }
-
- @Test(timeout=30000)
- public void testSwitch2GLWindowEachWithOwnDemo() throws InterruptedException {
- GearsES2 gears = new GearsES2(1);
- RedSquareES2 rsquare = new RedSquareES2(1);
- final QuitAdapter quitAdapter = new QuitAdapter();
-
- GLWindow glWindow1 = GLWindow.create(caps);
- glWindow1.setTitle("win1");
- glWindow1.setSize(width, height);
- glWindow1.setPosition(64, 64);
- glWindow1.addGLEventListener(0, gears);
- glWindow1.addWindowListener(quitAdapter);
-
- GLWindow glWindow2 = GLWindow.create(caps);
- glWindow2.setTitle("win2");
- glWindow2.setSize(width+100, height+100);
- glWindow2.setPosition(2*64+width, 64);
- glWindow2.addGLEventListener(0, rsquare);
- glWindow2.addWindowListener(quitAdapter);
-
- Animator animator = new Animator();
- animator.add(glWindow1);
- animator.add(glWindow2);
- animator.start();
-
- glWindow1.setVisible(true);
- glWindow2.setVisible(true);
-
- int s = 0;
- long t0 = System.currentTimeMillis();
- long t1 = t0;
-
- while( !quitAdapter.shouldQuit() && ( t1 - t0 ) < duration ) {
- if( ( t1 - t0 ) / period > s) {
- s++;
- System.err.println(s+" - switch - START "+ ( t1 - t0 ));
- System.err.println(s+" - A w1-h 0x"+Long.toHexString(glWindow1.getHandle())+",-ctx 0x"+Long.toHexString(glWindow1.getContext().getHandle()));
- System.err.println(s+" - A w2-h 0x"+Long.toHexString(glWindow2.getHandle())+",-ctx 0x"+Long.toHexString(glWindow2.getContext().getHandle()));
- GLDrawableUtil.swapGLContextAndAllGLEventListener(glWindow1, glWindow2);
- System.err.println(s+" - B w1-h 0x"+Long.toHexString(glWindow1.getHandle())+",-ctx 0x"+Long.toHexString(glWindow1.getContext().getHandle()));
- System.err.println(s+" - B w2-h 0x"+Long.toHexString(glWindow2.getHandle())+",-ctx 0x"+Long.toHexString(glWindow2.getContext().getHandle()));
- System.err.println(s+" - switch - END "+ ( t1 - t0 ));
- }
- Thread.sleep(100);
- t1 = System.currentTimeMillis();
- }
-
- animator.stop();
- // System.err.println("pre -del-w1: w1: "+glWindow1);
- // System.err.println("pre -del-w1: w2: "+glWindow2);
- glWindow1.destroy();
- // System.err.println("post-del-w1: w1: "+glWindow1);
- // System.err.println("post-del-w1: w2: "+glWindow2);
- glWindow2.destroy();
-
- }
-
- // default timing for 2 switches
- static long duration = 2200; // ms
- static long period = 1000; // ms
-
- public static void main(String args[]) throws IOException {
- for(int i=0; i
Date: Sat, 26 Jan 2013 07:43:08 +0100
Subject: Refine GL[Auto]Drawable 'realized' state in API doc, and relax it's
realized requirement in GL[Offscreen]AutoDrawableDelegate*
Compatible w/ 'before'.
TODO: Contemplate about GLDrawableFactory.createOffscreenAutoDrawable(..) whether it:
- should better return an unrealized [auto]drawable
- or adding another API method for such case
Goal: Allow passing vector of [device/context/..] for use cases
such as re-using an onscreen destructed surface and on-/offscreen hopping.
---
.../classes/com/jogamp/opengl/GLAutoDrawableDelegate.java | 8 +++-----
src/jogl/classes/javax/media/opengl/GLDrawable.java | 7 ++++++-
src/jogl/classes/javax/media/opengl/GLDrawableFactory.java | 14 +++++++++-----
src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java | 6 +++---
.../classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java | 14 ++++++++++----
5 files changed, 31 insertions(+), 18 deletions(-)
(limited to 'src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java')
diff --git a/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java b/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java
index 38315dc72..24116f199 100644
--- a/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java
@@ -64,10 +64,10 @@ import jogamp.opengl.GLDrawableImpl;
*/
public class GLAutoDrawableDelegate extends GLAutoDrawableBase implements GLAutoDrawable {
/**
- * @param drawable a valid and already realized {@link GLDrawable}
+ * @param drawable a valid {@link GLDrawable}, may not be {@link GLDrawable#isRealized() realized} yet.
* @param context a valid {@link GLContext},
* may not have been made current (created) yet,
- * may not be associated w/ drawable yet,
+ * may not be associated w/ drawable yet,
* may be null for lazy initialization
* @param upstreamWidget optional UI element holding this instance, see {@link #getUpstreamWidget()}.
* @param ownDevice pass true if {@link AbstractGraphicsDevice#close()} shall be issued,
@@ -81,9 +81,6 @@ public class GLAutoDrawableDelegate extends GLAutoDrawableBase implements GLAuto
if(null == drawable) {
throw new IllegalArgumentException("null drawable");
}
- if(!drawable.isRealized()) {
- throw new IllegalArgumentException("drawable not realized");
- }
this.upstreamWidget = upstreamWidget;
this.lock = ( null != lock ) ? lock : LockFactory.createRecursiveLock() ;
}
@@ -174,6 +171,7 @@ public class GLAutoDrawableDelegate extends GLAutoDrawableBase implements GLAuto
@Override
public final void setRealized(boolean realized) {
+ drawable.setRealized(realized);
}
@Override
diff --git a/src/jogl/classes/javax/media/opengl/GLDrawable.java b/src/jogl/classes/javax/media/opengl/GLDrawable.java
index c0910eb0f..95c314a48 100644
--- a/src/jogl/classes/javax/media/opengl/GLDrawable.java
+++ b/src/jogl/classes/javax/media/opengl/GLDrawable.java
@@ -126,7 +126,12 @@ public interface GLDrawable {
*/
public void setRealized(boolean realized);
- /** @return true if this drawable is realized, otherwise false */
+ /**
+ * Returns true if this drawable is realized, otherwise true.
+ *
+ * A drawable can be realized and unrealized via {@link #setRealized(boolean)}.
+ *
+ */
public boolean isRealized();
/** Returns the current width of this GLDrawable. */
diff --git a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
index 70480e728..7fcd913cf 100644
--- a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
+++ b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
@@ -436,7 +436,7 @@ public abstract class GLDrawableFactory {
// Methods to create high-level objects
/**
- * Returns a GLDrawable according to it's chosen {@link GLCapabilitiesImmutable},
+ * Returns an {@link GLDrawable#isRealized() unrealized} GLDrawable according to it's chosen {@link GLCapabilitiesImmutable},
* which determines pixel format, on- and offscreen incl. PBuffer type.
*
* The chosen {@link GLCapabilitiesImmutable} are referenced within the target
@@ -473,9 +473,11 @@ public abstract class GLDrawableFactory {
throws IllegalArgumentException, GLException;
/**
- * Creates an {@link GLOffscreenAutoDrawable} incl it's offscreen {@link javax.media.nativewindow.NativeSurface} with the given capabilites and dimensions.
+ * Creates a {@link GLDrawable#isRealized() realized} {@link GLOffscreenAutoDrawable}
+ * incl it's offscreen {@link javax.media.nativewindow.NativeSurface} with the given capabilites and dimensions.
*
- * The {@link GLOffscreenAutoDrawable}'s {@link GLDrawable} is realized and it's {@link GLContext} assigned but not yet made current.
+ * The {@link GLOffscreenAutoDrawable}'s {@link GLDrawable} is {@link GLDrawable#isRealized() realized}
+ * and it's {@link GLContext} assigned but not yet made current.
*
*
* In case the passed {@link GLCapabilitiesImmutable} contains default values, i.e.
@@ -513,7 +515,8 @@ public abstract class GLDrawableFactory {
int width, int height,
GLContext shareWith) throws GLException;
/**
- * Creates a offscreen {@link GLDrawable} incl it's offscreen {@link javax.media.nativewindow.NativeSurface} with the given capabilites and dimensions.
+ * Creates an {@link GLDrawable#isRealized() unrealized} offscreen {@link GLDrawable}
+ * incl it's offscreen {@link javax.media.nativewindow.NativeSurface} with the given capabilites and dimensions.
*
* In case the passed {@link GLCapabilitiesImmutable} contains default values, i.e.
* {@link GLCapabilitiesImmutable#isOnscreen() caps.isOnscreen()} == true,
@@ -557,7 +560,8 @@ public abstract class GLDrawableFactory {
* windowHandle's native visualID if set or the given {@link GLCapabilitiesImmutable}.
*
*
- * Lifecycle (destruction) of the given surface handle shall be handled by the caller.
+ * Lifecycle (creation and destruction) of the given surface handle shall be handled by the caller
+ * via {@link ProxySurface#createNotify()} and {@link ProxySurface#destroyNotify()}.
*
*
* Such surface can be used to instantiate a GLDrawable. With the help of {@link GLAutoDrawableDelegate}
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java
index 5c5db6d31..92ec96ad7 100644
--- a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java
@@ -273,7 +273,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
GLCapabilitiesChooser chooser,
int width, int height,
GLContext shareWith) {
- final GLDrawable drawable = createOffscreenDrawable( deviceReq, capsRequested, chooser, width, height );
+ final GLDrawable drawable = createOffscreenDrawable( deviceReq, capsRequested, chooser, width, height );
drawable.setRealized(true);
final GLContext context = drawable.createContext(shareWith);
if(drawable instanceof GLFBODrawableImpl) {
@@ -318,13 +318,13 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
}
}
- /** Creates a platform independent FBO offscreen GLDrawable */
+ /** Creates a platform independent unrealized FBO offscreen GLDrawable */
protected GLFBODrawable createFBODrawableImpl(NativeSurface dummySurface, GLCapabilitiesImmutable fboCaps, int textureUnit) {
final GLDrawableImpl dummyDrawable = createOnscreenDrawableImpl(dummySurface);
return new GLFBODrawableImpl(this, dummyDrawable, dummySurface, fboCaps, textureUnit);
}
- /** Creates a platform dependent offscreen pbuffer/pixmap GLDrawable implementation */
+ /** Creates a platform dependent unrealized offscreen pbuffer/pixmap GLDrawable instance */
protected abstract GLDrawableImpl createOffscreenDrawableImpl(NativeSurface target) ;
/**
diff --git a/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java
index 59a00170d..6d9116303 100644
--- a/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java
@@ -44,8 +44,11 @@ import jogamp.opengl.GLFBODrawableImpl;
public class GLOffscreenAutoDrawableImpl extends GLAutoDrawableDelegate implements GLOffscreenAutoDrawable {
/**
- * @param drawable a valid and already realized {@link GLDrawable}
- * @param context a valid {@link GLContext}, may not be made current (created) yet.
+ * @param drawable a valid {@link GLDrawable}, may not be {@link GLDrawable#isRealized() realized} yet.
+ * @param context a valid {@link GLContext},
+ * may not have been made current (created) yet,
+ * may not be associated w/ drawable yet,
+ * may be null for lazy initialization
* @param upstreamWidget optional UI element holding this instance, see {@link #getUpstreamWidget()}.
* @param lock optional upstream lock, may be null
*/
@@ -60,8 +63,11 @@ public class GLOffscreenAutoDrawableImpl extends GLAutoDrawableDelegate implemen
public static class FBOImpl extends GLOffscreenAutoDrawableImpl implements GLOffscreenAutoDrawable.FBO {
/**
- * @param drawable a valid and already realized {@link GLDrawable}
- * @param context a valid {@link GLContext}, may not be made current (created) yet.
+ * @param drawable a valid {@link GLDrawable}, may not be {@link GLDrawable#isRealized() realized} yet.
+ * @param context a valid {@link GLContext},
+ * may not have been made current (created) yet,
+ * may not be associated w/ drawable yet,
+ * may be null for lazy initialization
* @param upstreamWidget optional UI element holding this instance, see {@link #getUpstreamWidget()}.
* @param lock optional upstream lock, may be null
*/
--
cgit v1.2.3
From 4e9054d996870467182b0e963fa80aa6740968b6 Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Sun, 27 Jan 2013 04:36:53 +0100
Subject: Fix misc API docs ..
---
src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java | 2 +-
src/jogl/classes/javax/media/opengl/GLAutoDrawable.java | 4 ++--
src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java | 3 +++
3 files changed, 6 insertions(+), 3 deletions(-)
(limited to 'src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java')
diff --git a/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java b/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java
index 24116f199..206331ac0 100644
--- a/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java
@@ -48,7 +48,7 @@ import jogamp.opengl.GLDrawableImpl;
/**
* Fully functional {@link GLAutoDrawable} implementation
- * utilizing already created created {@link GLDrawable} and {@link GLContext} instances.
+ * utilizing already created {@link GLDrawable} and {@link GLContext} instances.
*
* Since no native windowing system events are being processed, it is recommended
* to handle at least:
diff --git a/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java b/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java
index 612ff6bdb..6abe4308b 100644
--- a/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java
+++ b/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java
@@ -382,7 +382,7 @@ public interface GLAutoDrawable extends GLDrawable {
* which will be executed within the next {@link #display()} call
* after all registered {@link GLEventListener}s
* {@link GLEventListener#display(GLAutoDrawable) display(GLAutoDrawable)}
- * methods has been called.
+ * methods have been called.
*
* If no {@link GLAnimatorControl} is animating (default),
* or if the current thread is the animator thread,
@@ -391,7 +391,7 @@ public interface GLAutoDrawable extends GLDrawable {
*
*
* If an {@link GLAnimatorControl animator} is running,
- * no explicit {@link #display()} call is issued, allowing the {@link GLAnimatorControl animator} to perform it when it's due.
+ * no explicit {@link #display()} call is issued, allowing the {@link GLAnimatorControl animator} to perform at due time.
*
*
* If wait is true the call blocks until the glRunnable
diff --git a/src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java b/src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java
index a83739a1d..15a8738c5 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java
@@ -44,6 +44,7 @@ public interface ProxySurface extends MutableSurface {
/**
* Implementation specific bit-value stating this {@link ProxySurface} owns the upstream's surface handle
* @see #addUpstreamOptionBits(int)
+ * @see #clearUpstreamOptionBits(int)
* @see #getUpstreamOptionBits()
*/
public static final int OPT_PROXY_OWNS_UPSTREAM_SURFACE = 1 << 6;
@@ -51,6 +52,7 @@ public interface ProxySurface extends MutableSurface {
/**
* Implementation specific bit-value stating this {@link ProxySurface} owns the upstream's {@link AbstractGraphicsDevice}.
* @see #addUpstreamOptionBits(int)
+ * @see #clearUpstreamOptionBits(int)
* @see #getUpstreamOptionBits()
*/
public static final int OPT_PROXY_OWNS_UPSTREAM_DEVICE = 1 << 7;
@@ -58,6 +60,7 @@ public interface ProxySurface extends MutableSurface {
/**
* Implementation specific bitvalue stating the upstream's {@link NativeSurface} is an invisible window, i.e. maybe incomplete.
* @see #addUpstreamOptionBits(int)
+ * @see #clearUpstreamOptionBits(int)
* @see #getUpstreamOptionBits()
*/
public static final int OPT_UPSTREAM_WINDOW_INVISIBLE = 1 << 8;
--
cgit v1.2.3
From 808a9a27a8c1c9e0a6701a8dd81d51f8daa8129d Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Thu, 28 Feb 2013 00:39:28 +0100
Subject: Fix NEWT/AWT WindowClosing Unit Tests ; Review/Cleanup NEWT
WindowClosing mechanism
Due to a NEWT WindowClosing event regression cause by NewtCanvasAWT changes
a review of our WindowClosing event mechanism was required.
Important cleanups are marked w/ '(*)' below.
I would have preferred to change the 'WindowListener.windowDestroyNotify(WindowEvent)'
method to pass a WindowCloseEvent object exposing more information like
toolkit or programmatic destruction and passing whether a 'closing' or 'nop' action
will be performed based on the WindowClosingMode.
For now I postponed this idea .. since it would change the API again,
but may reconsider it after merging the Android 'closing' patch.
- InputEvent.consumedTag -> NEWTEvent.consumedTag
- Window
- (*) Promote setWindowDestroyNotifyAction(Runnable) to public,
former WindowImpl.setHandleDestroyNotify(boolean).
Using a Runnable action for WindowImpl.windowDestroyNotify(boolean)
allows a setting defined alternative for destroy() and gets rid
of [ab]using WindowListener.windowDestroyNotify(WindowEvent) for
lifecycle actions. Used in:
- GLWindow
- GLAutoDrawableDelegate impl.
- WindowImpl
- Respect NEWTEvent.consumedTag for WindowEvents as well
- (*) Impl. setHandleDestroyNotify(boolean) (see above)
- (*) destroy() simply sends out pre- and post- destruction Window events,
where windowDestroyNotify(boolean) sends out the pre-destruction event if NOP.
- (*) windowDestroyNotify(boolean) is public now, allowing other impl. details
to follow proper destruction using handleDestroyNotify Runnable (-> NewtCanvasAWT).
- AWTWindowClosingProtocol:
- addClosingListenerOneShot() -> addClosingListener()
- calling addClosingListener() at addNotify()
- calling removeClosingListener() at removeNotify()
- AWTWindowClosingProtocol ctor taking NOP runnable,
allowing to send WindowEvent.EVENT_WINDOW_DESTROY_NOTIFY at WindowClosingMode.DO_NOTHING_ON_CLOSE
- add/remove listener on AWT-EDT
- AWTWindowAdapter
- Add 'removeWindowClosingFrom(..)',
allowing to remove window closing event fwd.
- Also fwd windowClosed in window closing fwd'ing.
- NewtCanvasAWT
- (*) Utilize AWTWindowClosingProtocol NOP runnable (see above)
to fwd closing-NOP event to NEWT
- (*) Unify remove/destroy code in destroyImpl(..)
- !removeNotify -> destroy NEWT child programatic or as toolkit event
- removeNotify || windowClosing -> destroy jawtWindow
- (*) Remove AWTWindowAdapter/AWTParentWindowAdapter's windowClosingListener,
since we utilize AWTWindowClosingProtocol
- DisplayImpl
- Adding 'final void dispatchMessage(final NEWTEvent event)'
allowing to remove the NEWTEventTask wrapping for no reason
in enqueueEvent(..) if on EDT and waiting.
---
make/scripts/tests.sh | 5 +-
.../com/jogamp/opengl/GLAutoDrawableDelegate.java | 6 +-
.../classes/javax/media/opengl/awt/GLCanvas.java | 6 +-
.../classes/javax/media/opengl/awt/GLJPanel.java | 5 +-
.../nativewindow/awt/AWTWindowClosingProtocol.java | 85 ++++++-----
.../javax/media/nativewindow/NativeWindow.java | 3 +-
.../media/nativewindow/WindowClosingProtocol.java | 4 +
src/newt/classes/com/jogamp/newt/Window.java | 36 ++++-
.../classes/com/jogamp/newt/awt/NewtCanvasAWT.java | 83 ++++++-----
.../jogamp/newt/awt/applet/JOGLNewtAppletBase.java | 4 +-
.../classes/com/jogamp/newt/event/InputEvent.java | 5 -
.../classes/com/jogamp/newt/event/NEWTEvent.java | 6 +
.../com/jogamp/newt/event/WindowListener.java | 5 +-
.../com/jogamp/newt/event/awt/AWTAdapter.java | 7 +-
.../jogamp/newt/event/awt/AWTWindowAdapter.java | 20 ++-
.../classes/com/jogamp/newt/opengl/GLWindow.java | 14 +-
src/newt/classes/jogamp/newt/DisplayImpl.java | 26 ++--
src/newt/classes/jogamp/newt/WindowImpl.java | 72 ++++++----
.../newt/awt/event/AWTParentWindowAdapter.java | 4 +-
.../jogamp/newt/driver/awt/WindowDriver.java | 5 +-
.../jogl/acore/TestGLAutoDrawableDelegateNEWT.java | 160 +++++++++++++++++++++
...estGLAutoDrawableDelegateOnOffscrnCapsNEWT.java | 11 +-
.../acore/TestGLContextDrawableSwitch01NEWT.java | 9 +-
.../acore/TestGLContextDrawableSwitch11NEWT.java | 9 +-
.../jogl/acore/TestSharedContextNewtAWTBug523.java | 5 +-
.../opengl/test/junit/newt/TestCloseNewtAWT.java | 7 +-
.../junit/newt/TestWindowClosingProtocol01AWT.java | 24 ++--
.../newt/TestWindowClosingProtocol02NEWT.java | 12 +-
.../newt/TestWindowClosingProtocol03NewtAWT.java | 41 ++++--
.../opengl/test/junit/util/AWTRobotUtil.java | 83 +++++++----
30 files changed, 539 insertions(+), 223 deletions(-)
create mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateNEWT.java
(limited to 'src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java')
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index 7a71932ca..7a43fd3da 100755
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -266,7 +266,7 @@ function testawtswt() {
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es1.newt.TestOlympicES1NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es1.newt.TestRedSquareES1NEWT $*
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2AWT $*
-testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $*
#testawtswt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasSWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube $*
@@ -330,6 +330,7 @@ testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasA
#testnoawt com.jogamp.opengl.test.junit.jogl.offscreen.TestOffscreen01GLPBufferNEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.offscreen.TestOffscreen02BitmapNEWT $*
+testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableDelegateNEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableDelegateOnOffscrnCapsNEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableFactoryOffscrnCapsNEWT $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT $*
@@ -437,7 +438,6 @@ testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasA
#testawtswt com.jogamp.opengl.test.junit.newt.event.TestNewtEventModifiersNewtCanvasSWT $*
#testawt com.jogamp.opengl.test.junit.newt.TestListenerCom01AWT
-#testawt com.jogamp.opengl.test.junit.newt.TestCloseNewtAWT
#testawt com.jogamp.opengl.test.junit.jogl.caps.TestMultisampleES1AWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.caps.TestMultisampleES1NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.caps.TestMultisampleES2NEWT $*
@@ -448,6 +448,7 @@ testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasA
#testnoawt com.jogamp.opengl.test.junit.jogl.caps.TestBug605FlippedImageAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.glsl.TestShaderCompilationBug459AWT
+#testawt com.jogamp.opengl.test.junit.newt.TestCloseNewtAWT
#testawt com.jogamp.opengl.test.junit.newt.TestWindowClosingProtocol01AWT $*
#testnoawt com.jogamp.opengl.test.junit.newt.TestWindowClosingProtocol02NEWT $*
#testawt com.jogamp.opengl.test.junit.newt.TestWindowClosingProtocol03NewtAWT $*
diff --git a/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java b/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java
index 206331ac0..0f0f03ac4 100644
--- a/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java
@@ -51,12 +51,12 @@ import jogamp.opengl.GLDrawableImpl;
* utilizing already created {@link GLDrawable} and {@link GLContext} instances.
*
* Since no native windowing system events are being processed, it is recommended
- * to handle at least:
+ * to handle at least the {@link com.jogamp.newt.event.WindowEvent window events}:
*
*
{@link com.jogamp.newt.event.WindowListener#windowRepaint(com.jogamp.newt.event.WindowUpdateEvent) repaint} using {@link #windowRepaintOp()}
*
{@link com.jogamp.newt.event.WindowListener#windowResized(com.jogamp.newt.event.WindowEvent) resize} using {@link #windowResizedOp()}
- *
{@link com.jogamp.newt.event.WindowListener#windowDestroyNotify(com.jogamp.newt.event.WindowEvent) destroy-notify} using {@link #windowDestroyNotifyOp()}
- *
+ *
+ * and setup a {@link com.jogamp.newt.Window#setWindowDestroyNotifyAction(Runnable) custom toolkit destruction} issuing {@link #windowDestroyNotifyOp()}.
*
*
* See example {@link com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableDelegateNEWT TestGLAutoDrawableDelegateNEWT}.
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
index dc4fe955c..94e123b3e 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
@@ -176,7 +176,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
public void run() {
GLCanvas.this.destroyImpl( true );
}
- });
+ }, null);
/** Creates a new GLCanvas component with a default set of OpenGL
capabilities, using the default OpenGL capabilities selection
@@ -460,7 +460,6 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
if( isVisible() ) {
Threading.invoke(true, displayOnEDTAction, getTreeLock());
}
- awtWindowClosingProtocol.addClosingListenerOneShot();
}
/**
@@ -568,7 +567,8 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
// for all launch flavors (applet/javaws/..)
// validateGLDrawable();
}
-
+ awtWindowClosingProtocol.addClosingListener();
+
if(DEBUG) {
System.err.println(getThreadName()+": Info: addNotify - end: peer: "+getPeer());
}
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
index 2b99bb570..6c28c75ab 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
@@ -174,7 +174,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
public void run() {
GLJPanel.this.destroy();
}
- });
+ }, null);
static {
// Force eager initialization of part of the Java2D class since
@@ -369,6 +369,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
@Override
public void addNotify() {
super.addNotify();
+ awtWindowClosingProtocol.addClosingListener();
if (DEBUG) {
System.err.println(getThreadName()+": GLJPanel.addNotify()");
}
@@ -677,8 +678,6 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
if (!isInitialized) {
backend.initialize();
}
-
- awtWindowClosingProtocol.addClosingListenerOneShot();
}
@Override
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTWindowClosingProtocol.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTWindowClosingProtocol.java
index d78b4ac15..e3f85b948 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTWindowClosingProtocol.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTWindowClosingProtocol.java
@@ -33,22 +33,31 @@ import java.awt.Window;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
+
import javax.media.nativewindow.WindowClosingProtocol;
+import jogamp.common.awt.AWTEDTExecutor;
import jogamp.nativewindow.awt.AWTMisc;
public class AWTWindowClosingProtocol implements WindowClosingProtocol {
private Component comp;
- private Runnable closingOperation;
- private volatile boolean closingListenerSet = false;
+ private Runnable closingOperationClose;
+ private Runnable closingOperationNOP;
+ private boolean closingListenerSet = false;
private Object closingListenerLock = new Object();
private WindowClosingMode defaultCloseOperation = WindowClosingMode.DISPOSE_ON_CLOSE;
private boolean defaultCloseOperationSetByUser = false;
- public AWTWindowClosingProtocol(Component comp, Runnable closingOperation) {
+ /**
+ * @param comp mandatory AWT component which AWT Window is being queried by parent traversal
+ * @param closingOperationClose mandatory closing operation, triggered if windowClosing and {@link WindowClosingMode#DISPOSE_ON_CLOSE}
+ * @param closingOperationNOP optional closing operation, triggered if windowClosing and {@link WindowClosingMode#DO_NOTHING_ON_CLOSE}
+ */
+ public AWTWindowClosingProtocol(Component comp, Runnable closingOperationClose, Runnable closingOperationNOP) {
this.comp = comp;
- this.closingOperation = closingOperation;
+ this.closingOperationClose = closingOperationClose;
+ this.closingOperationNOP = closingOperationNOP;
}
class WindowClosingAdapter extends WindowAdapter {
@@ -59,54 +68,56 @@ public class AWTWindowClosingProtocol implements WindowClosingProtocol {
if( WindowClosingMode.DISPOSE_ON_CLOSE == op ) {
// we have to issue this call right away,
// otherwise the window gets destroyed
- closingOperation.run();
+ closingOperationClose.run();
+ } else if( null != closingOperationNOP ){
+ closingOperationNOP.run();
}
}
}
WindowListener windowClosingAdapter = new WindowClosingAdapter();
- final boolean addClosingListenerImpl() {
- Window w = AWTMisc.getWindow(comp);
- if(null!=w) {
- w.addWindowListener(windowClosingAdapter);
- return true;
- }
- return false;
- }
-
/**
- * Adds this closing listener to the components Window if exist and only one time.
- * Hence you may call this method every time to ensure it has been set,
- * ie in case the Window parent is not available yet.
+ * Adds this closing listener to the components Window if exist and only one time.
+ *
+ * If the closing listener is already added, and {@link IllegalStateException} is thrown.
+ *
*
- * @return
+ * @return true if added, otherwise false.
+ * @throws IllegalStateException
*/
- public final boolean addClosingListenerOneShot() {
- if(!closingListenerSet) { // volatile: ok
+ public final boolean addClosingListener() throws IllegalStateException {
synchronized(closingListenerLock) {
- if(!closingListenerSet) {
- closingListenerSet=addClosingListenerImpl();
- return closingListenerSet;
- }
+ if(closingListenerSet) {
+ throw new IllegalStateException("WindowClosingListener already set");
+ }
+ final Window w = AWTMisc.getWindow(comp);
+ if(null!=w) {
+ AWTEDTExecutor.singleton.invoke(true, new Runnable() {
+ public void run() {
+ w.addWindowListener(windowClosingAdapter);
+ } } );
+ closingListenerSet = true;
+ return true;
+ }
}
- }
- return false;
+ return false;
}
public final boolean removeClosingListener() {
- if(closingListenerSet) { // volatile: ok
synchronized(closingListenerLock) {
- if(closingListenerSet) {
- Window w = AWTMisc.getWindow(comp);
- if(null!=w) {
- w.removeWindowListener(windowClosingAdapter);
- closingListenerSet = false;
- return true;
- }
- }
+ if(closingListenerSet) {
+ final Window w = AWTMisc.getWindow(comp);
+ if(null!=w) {
+ AWTEDTExecutor.singleton.invoke(true, new Runnable() {
+ public void run() {
+ w.removeWindowListener(windowClosingAdapter);
+ } } );
+ closingListenerSet = false;
+ return true;
+ }
+ }
}
- }
- return false;
+ return false;
}
/**
diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindow.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindow.java
index 12e202975..a740ebbe0 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindow.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindow.java
@@ -54,8 +54,7 @@ import javax.media.nativewindow.util.Point;
public interface NativeWindow extends NativeSurface {
/**
- * destroys the window and releases
- * windowing related resources.
+ * Destroys this window incl. releasing all related resources.
*/
public void destroy();
diff --git a/src/nativewindow/classes/javax/media/nativewindow/WindowClosingProtocol.java b/src/nativewindow/classes/javax/media/nativewindow/WindowClosingProtocol.java
index 884c916e4..02f68f442 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/WindowClosingProtocol.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/WindowClosingProtocol.java
@@ -37,6 +37,10 @@ package javax.media.nativewindow;
* this protocol default behavior {@link WindowClosingMode#DISPOSE_ON_CLOSE DISPOSE_ON_CLOSE} shall be used.
*/
public interface WindowClosingProtocol {
+
+ /**
+ * Window closing mode if triggered by toolkit close operation.
+ */
public enum WindowClosingMode {
/**
* Do nothing on native window close operation.
diff --git a/src/newt/classes/com/jogamp/newt/Window.java b/src/newt/classes/com/jogamp/newt/Window.java
index cc42465f1..ab1eef308 100644
--- a/src/newt/classes/com/jogamp/newt/Window.java
+++ b/src/newt/classes/com/jogamp/newt/Window.java
@@ -28,12 +28,15 @@
package com.jogamp.newt;
+import com.jogamp.newt.event.WindowEvent;
import com.jogamp.newt.event.WindowListener;
import com.jogamp.newt.event.KeyListener;
import com.jogamp.newt.event.KeyEvent;
import com.jogamp.newt.event.InputEvent;
import com.jogamp.newt.event.MouseListener;
import jogamp.newt.Debug;
+import jogamp.newt.WindowImpl;
+
import javax.media.nativewindow.CapabilitiesChooser;
import javax.media.nativewindow.CapabilitiesImmutable;
import javax.media.nativewindow.NativeWindow;
@@ -104,20 +107,42 @@ public interface Window extends NativeWindow, WindowClosingProtocol {
CapabilitiesImmutable getChosenCapabilities();
/**
- * Destroy the Window and it's children, incl. native destruction.
- * The Window can be recreate via {@link #setVisible(boolean) setVisible(true)}.
- *
Visibility is set to false.
+ * {@inheritDoc}
+ *
+ * Also iterates through this window's children and destroys them.
+ *
+ *
+ * Visibility is set to false.
+ *
+ *
+ * Method sends out {@link WindowEvent#EVENT_WINDOW_DESTROY_NOTIFY pre-} and
+ * {@link WindowEvent#EVENT_WINDOW_DESTROYED post-} destruction events
+ * to all of it's {@link WindowListener}.
+ *
*
* This method invokes {@link Screen#removeReference()} after it's own destruction,
* which will issue {@link Screen#destroy()} if the reference count becomes 0.
* This destruction sequence shall end up in {@link Display#destroy()}, if all reference counts become 0.
*
+ *
+ * The Window can be recreate via {@link #setVisible(boolean) setVisible(true)}.
+ *
* @see #destroy()
* @see #setVisible(boolean)
*/
@Override
void destroy();
+ /**
+ * Set a custom action handling destruction issued by a {@link WindowImpl#windowDestroyNotify(boolean) toolkit triggered window destroy}
+ * replacing the default {@link #destroy()} action.
+ *
+ * The custom action shall call {@link #destroy()}
+ * but may perform further tasks before and after.
+ *
+ */
+ void setWindowDestroyNotifyAction(Runnable r);
+
/**
* setVisible makes the window and children visible if visible is true,
* otherwise the window and children becomes invisible.
@@ -383,10 +408,13 @@ public interface Window extends NativeWindow, WindowClosingProtocol {
// WindowListener
//
+ /**
+ * Send a {@link WindowEvent} to all {@link WindowListener}.
+ * @param eventType a {@link WindowEvent} type, e.g. {@link WindowEvent#EVENT_WINDOW_REPAINT}.
+ */
public void sendWindowEvent(int eventType);
/**
- *
* Appends the given {@link com.jogamp.newt.event.WindowListener} to the end of
* the list.
*/
diff --git a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
index 3503dabd5..3c10859bf 100644
--- a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
+++ b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
@@ -51,6 +51,7 @@ import javax.swing.MenuSelectionManager;
import jogamp.nativewindow.awt.AWTMisc;
import jogamp.newt.Debug;
+import jogamp.newt.WindowImpl;
import jogamp.newt.awt.NewtFactoryAWT;
import jogamp.newt.awt.event.AWTParentWindowAdapter;
import jogamp.newt.driver.DriverClearFocus;
@@ -59,9 +60,9 @@ import com.jogamp.nativewindow.awt.AWTWindowClosingProtocol;
import com.jogamp.nativewindow.awt.JAWTWindow;
import com.jogamp.newt.Display;
import com.jogamp.newt.Window;
-import com.jogamp.newt.event.InputEvent;
import com.jogamp.newt.event.KeyEvent;
import com.jogamp.newt.event.KeyListener;
+import com.jogamp.newt.event.NEWTEvent;
import com.jogamp.newt.event.WindowAdapter;
import com.jogamp.newt.event.WindowEvent;
import com.jogamp.newt.event.WindowListener;
@@ -88,16 +89,22 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
private boolean newtChildAttached = false;
private boolean isOnscreen = true;
private WindowClosingMode newtChildCloseOp;
- private AWTAdapter awtAdapter = null;
+ private AWTParentWindowAdapter awtAdapter = null;
private AWTAdapter awtMouseAdapter = null;
private AWTAdapter awtKeyAdapter = null;
private AWTWindowClosingProtocol awtWindowClosingProtocol =
new AWTWindowClosingProtocol(this, new Runnable() {
public void run() {
- NewtCanvasAWT.this.destroy();
+ NewtCanvasAWT.this.destroyImpl(false /* removeNotify */, true /* windowClosing */);
}
- });
+ }, new Runnable() {
+ public void run() {
+ if( newtChild != null ) {
+ newtChild.sendWindowEvent(WindowEvent.EVENT_WINDOW_DESTROY_NOTIFY);
+ }
+ }
+ } );
/**
* Instantiates a NewtCanvas without a NEWT child.
@@ -209,7 +216,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
}
public void keyTyped(KeyEvent e) {
if(suppress) {
- e.setAttachment(InputEvent.consumedTag);
+ e.setAttachment(NEWTEvent.consumedTag);
suppress = false; // reset
}
}
@@ -239,7 +246,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
}
}
if(suppress) {
- evt.setAttachment(InputEvent.consumedTag);
+ evt.setAttachment(NEWTEvent.consumedTag);
}
if(DEBUG) {
System.err.println("NewtCanvasAWT.focusKey: XXX: "+ks);
@@ -361,27 +368,17 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
", displayable "+isDisplayable()+", cont "+AWTMisc.getContainer(this));
}
}
+ awtWindowClosingProtocol.addClosingListener();
}
@Override
public void removeNotify() {
+ awtWindowClosingProtocol.removeClosingListener();
+
if( Beans.isDesignTime() ) {
super.removeNotify();
} else {
- java.awt.Container cont = AWTMisc.getContainer(this);
- if(DEBUG) {
- System.err.println("NewtCanvasAWT.removeNotify: "+newtChild+", from "+cont);
- }
- // Detach OLS early..
- final OffscreenLayerSurface ols = NativeWindowFactory.getOffscreenLayerSurface(newtChild, true);
- if(null != ols && ols.isSurfaceLayerAttached()) {
- ols.detachSurfaceLayer();
- }
- detachNewtChild(cont); // will destroy context (offscreen -> onscreen) and implicit detachSurfaceLayer (if still attached)
-
- NewtFactoryAWT.destroyNativeWindow(jawtWindow);
- jawtWindow=null;
-
+ destroyImpl(true /* removeNotify */, false /* windowClosing */);
super.removeNotify();
}
}
@@ -397,20 +394,32 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
* @see Window#destroy()
*/
public final void destroy() {
+ destroyImpl(false /* removeNotify */, false /* windowClosing */);
+ }
+
+ private final void destroyImpl(boolean removeNotify, boolean windowClosing) {
if( null !=newtChild ) {
java.awt.Container cont = AWTMisc.getContainer(this);
if(DEBUG) {
- System.err.println("NewtCanvasAWT.destroy(): "+newtChild+", from "+cont);
+ System.err.println("NewtCanvasAWT.destroy(removeNotify "+removeNotify+", windowClosing "+windowClosing+"): nw "+newtWinHandleToHexString(newtChild)+", from "+cont);
}
- // Detach OLS early..
- final OffscreenLayerSurface ols = NativeWindowFactory.getOffscreenLayerSurface(newtChild, true);
- if(null != ols && ols.isSurfaceLayerAttached()) {
- ols.detachSurfaceLayer();
- }
- detachNewtChild(cont); // will destroy context (offscreen -> onscreen) and implicit detachSurfaceLayer (if still attached)
- newtChild.destroy();
- newtChild=null;
+ detachNewtChild(cont);
+
+ if( !removeNotify ) {
+ final Window cWin = newtChild;
+ final Window dWin = cWin.getDelegatedWindow();
+ newtChild=null;
+ if( windowClosing && dWin instanceof WindowImpl ) {
+ ((WindowImpl)dWin).windowDestroyNotify(true);
+ } else {
+ cWin.destroy();
+ }
+ }
}
+ if( ( removeNotify || windowClosing ) && null!=jawtWindow) {
+ NewtFactoryAWT.destroyNativeWindow(jawtWindow);
+ jawtWindow=null;
+ }
}
@Override
@@ -501,8 +510,6 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
return false;
}
- awtWindowClosingProtocol.addClosingListenerOneShot();
-
if( attachNewtChild && !newtChildAttached && null != newtChild ) {
attachNewtChild(cont);
}
@@ -535,11 +542,11 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
throw new InternalError("XXX");
}
isOnscreen = jawtWindow.getGraphicsConfiguration().getChosenCapabilities().isOnscreen();
- awtAdapter = new AWTParentWindowAdapter(jawtWindow, newtChild).addTo(this);
+ awtAdapter = (AWTParentWindowAdapter) new AWTParentWindowAdapter(jawtWindow, newtChild).addTo(this);
+ awtAdapter.removeWindowClosingFrom(this); // we utilize AWTWindowClosingProtocol triggered destruction!
newtChild.addWindowListener(clearAWTMenusOnNewtFocus);
newtChild.setFocusAction(focusAction); // enable AWT focus traversal
newtChildCloseOp = newtChild.setDefaultCloseOperation(WindowClosingMode.DO_NOTHING_ON_CLOSE);
- awtWindowClosingProtocol.addClosingListenerOneShot();
keyboardFocusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
keyboardFocusManager.addPropertyChangeListener("focusOwner", focusPropertyChangeListener);
if(isOnscreen) {
@@ -554,7 +561,6 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
newtChild.removeWindowListener(clearAWTMenusOnNewtFocus);
newtChild.setFocusAction(null);
newtChild.setDefaultCloseOperation(newtChildCloseOp);
- awtWindowClosingProtocol.removeClosingListener();
}
}
}
@@ -611,7 +617,14 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
newtChild.setFocusAction(null); // no AWT focus traversal ..
configureNewtChild(false);
newtChild.setVisible(false);
- newtChild.reparentWindow(null);
+
+ // Detach OLS early..
+ final OffscreenLayerSurface ols = NativeWindowFactory.getOffscreenLayerSurface(newtChild, true);
+ if(null != ols && ols.isSurfaceLayerAttached()) {
+ ols.detachSurfaceLayer();
+ }
+ newtChild.reparentWindow(null); // will destroy context (offscreen -> onscreen) and implicit detachSurfaceLayer (if still attached)
+
if(DEBUG) {
System.err.println("NewtCanvasAWT.detachNewtChild.X: win "+newtWinHandleToHexString(newtChild)+", EDTUtil: cur "+newtChild.getScreen().getDisplay().getEDTUtil()+", comp "+this);
}
diff --git a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java
index 07004503e..c3ad51c96 100755
--- a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java
+++ b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java
@@ -300,9 +300,7 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener {
glWindow.reparentWindow(awtParent);
} else {
glWindow.reparentWindow(null);
- if(glClosable) {
- glWindow.setDefaultCloseOperation(WindowClosingMode.DISPOSE_ON_CLOSE);
- }
+ glWindow.setDefaultCloseOperation( glClosable ? WindowClosingMode.DISPOSE_ON_CLOSE : WindowClosingMode.DO_NOTHING_ON_CLOSE );
}
}
}
diff --git a/src/newt/classes/com/jogamp/newt/event/InputEvent.java b/src/newt/classes/com/jogamp/newt/event/InputEvent.java
index 9ef4de2b6..4920b59ea 100644
--- a/src/newt/classes/com/jogamp/newt/event/InputEvent.java
+++ b/src/newt/classes/com/jogamp/newt/event/InputEvent.java
@@ -81,11 +81,6 @@ public abstract class InputEvent extends NEWTEvent
return 0;
}
- /** Object when attached via {@link #setAttachment(Object)} marks the event consumed,
- * ie. stops propagating the event any further to the event listener.
- */
- public static final Object consumedTag = new Object();
-
protected InputEvent(short eventType, Object source, long when, int modifiers) {
super(eventType, source, when);
this.modifiers=modifiers;
diff --git a/src/newt/classes/com/jogamp/newt/event/NEWTEvent.java b/src/newt/classes/com/jogamp/newt/event/NEWTEvent.java
index b8de6eb18..6f4561ce6 100644
--- a/src/newt/classes/com/jogamp/newt/event/NEWTEvent.java
+++ b/src/newt/classes/com/jogamp/newt/event/NEWTEvent.java
@@ -48,6 +48,12 @@ package com.jogamp.newt.event;
*/
@SuppressWarnings("serial")
public class NEWTEvent extends java.util.EventObject {
+ /**
+ * Object when attached via {@link #setAttachment(Object)} marks the event consumed,
+ * ie. stops propagating the event any further to the other event listener.
+ */
+ public static final Object consumedTag = new Object();
+
private final short eventType;
private final long when;
private Object attachment;
diff --git a/src/newt/classes/com/jogamp/newt/event/WindowListener.java b/src/newt/classes/com/jogamp/newt/event/WindowListener.java
index 011e1f654..dde182510 100644
--- a/src/newt/classes/com/jogamp/newt/event/WindowListener.java
+++ b/src/newt/classes/com/jogamp/newt/event/WindowListener.java
@@ -36,6 +36,7 @@ package com.jogamp.newt.event;
import javax.media.nativewindow.WindowClosingProtocol;
+/** NEWT {@link WindowEvent} listener. */
public interface WindowListener extends NEWTEventListener {
/** Window is resized, your application shall respect the new window dimension. A repaint is recommended. */
public void windowResized(WindowEvent e);
@@ -53,7 +54,9 @@ public interface WindowListener extends NEWTEventListener {
**/
public void windowDestroyNotify(WindowEvent e);
- /** Window has been destroyed.*/
+ /**
+ * Window has been destroyed.
+ */
public void windowDestroyed(WindowEvent e);
/** Window gained focus. */
diff --git a/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java b/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java
index 8991203d5..6de2eee45 100644
--- a/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java
@@ -181,8 +181,13 @@ public abstract class AWTAdapter implements java.util.EventListener
/** @see #addTo(java.awt.Component) */
public abstract AWTAdapter removeFrom(java.awt.Component awtComponent);
+ /**
+ * Enqueues the event to the {@link #getNewtWindow()} is not null.
+ */
void enqueueEvent(boolean wait, com.jogamp.newt.event.NEWTEvent event) {
- newtWindow.enqueueEvent(wait, event);
+ if( null != newtWindow ) {
+ newtWindow.enqueueEvent(wait, event);
+ }
}
}
diff --git a/src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java b/src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java
index 2d63ca455..e91bb2f82 100644
--- a/src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java
@@ -66,13 +66,18 @@ public class AWTWindowAdapter
return this;
}
- public AWTAdapter removeFrom(java.awt.Component awtComponent) {
- awtComponent.removeFocusListener(this);
- awtComponent.removeComponentListener(this);
+ public AWTAdapter removeWindowClosingFrom(java.awt.Component awtComponent) {
java.awt.Window win = getWindow(awtComponent);
if( null != win && null != windowClosingListener ) {
win.removeWindowListener(windowClosingListener);
}
+ return this;
+ }
+
+ public AWTAdapter removeFrom(java.awt.Component awtComponent) {
+ awtComponent.removeFocusListener(this);
+ awtComponent.removeComponentListener(this);
+ removeWindowClosingFrom(awtComponent);
if(awtComponent instanceof java.awt.Window) {
((java.awt.Window)awtComponent).removeWindowListener(this);
}
@@ -220,9 +225,16 @@ public class AWTWindowAdapter
enqueueEvent(true, event);
}
}
+ public void windowClosed(java.awt.event.WindowEvent e) {
+ com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, newtWindow);
+ if(null!=newtListener) {
+ ((com.jogamp.newt.event.WindowListener)newtListener).windowDestroyed(event);
+ } else {
+ enqueueEvent(true, event);
+ }
+ }
public void windowActivated(java.awt.event.WindowEvent e) { }
- public void windowClosed(java.awt.event.WindowEvent e) { }
public void windowDeactivated(java.awt.event.WindowEvent e) { }
public void windowDeiconified(java.awt.event.WindowEvent e) { }
public void windowIconified(java.awt.event.WindowEvent e) { }
diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
index 7fccb6622..ce50d95dd 100644
--- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
+++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
@@ -100,7 +100,10 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
protected GLWindow(Window window) {
super(null, null, false /* always handle device lifecycle ourselves */);
this.window = (WindowImpl) window;
- this.window.setHandleDestroyNotify(false);
+ this.window.setWindowDestroyNotifyAction( new Runnable() {
+ public void run() {
+ defaultWindowDestroyNotifyOp();
+ } } );
window.addWindowListener(new WindowAdapter() {
@Override
public void windowRepaint(WindowUpdateEvent e) {
@@ -112,10 +115,6 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
defaultWindowResizedOp(getWidth(), getHeight());
}
- @Override
- public void windowDestroyNotify(WindowEvent e) {
- defaultWindowDestroyNotifyOp();
- }
});
this.window.setLifecycleHook(new GLLifecycleHook());
}
@@ -389,6 +388,11 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
window.destroy();
}
+ @Override
+ public void setWindowDestroyNotifyAction(Runnable r) {
+ window.setWindowDestroyNotifyAction(r);
+ }
+
@Override
public final void setVisible(boolean visible) {
window.setVisible(visible);
diff --git a/src/newt/classes/jogamp/newt/DisplayImpl.java b/src/newt/classes/jogamp/newt/DisplayImpl.java
index 20b915cae..d4842ba2f 100644
--- a/src/newt/classes/jogamp/newt/DisplayImpl.java
+++ b/src/newt/classes/jogamp/newt/DisplayImpl.java
@@ -370,15 +370,8 @@ public abstract class DisplayImpl extends Display {
DisplayImpl.this.dispatchMessages();
} };
- final void dispatchMessage(final NEWTEventTask eventTask) {
- final NEWTEvent event = eventTask.get();
+ final void dispatchMessage(final NEWTEvent event) {
try {
- if(null == event) {
- // Ooops ?
- System.err.println("Warning: event of eventTask is NULL");
- Thread.dumpStack();
- return;
- }
final Object source = event.getSource();
if(source instanceof NEWTEventConsumer) {
final NEWTEventConsumer consumer = (NEWTEventConsumer) source ;
@@ -396,6 +389,21 @@ public abstract class DisplayImpl extends Display {
} else {
re = new RuntimeException(t);
}
+ throw re;
+ }
+ }
+
+ final void dispatchMessage(final NEWTEventTask eventTask) {
+ final NEWTEvent event = eventTask.get();
+ try {
+ if(null == event) {
+ // Ooops ?
+ System.err.println("Warning: event of eventTask is NULL");
+ Thread.dumpStack();
+ return;
+ }
+ dispatchMessage(event);
+ } catch (RuntimeException re) {
if( eventTask.isCallerWaiting() ) {
// propagate exception to caller
eventTask.setException(re);
@@ -451,7 +459,7 @@ public abstract class DisplayImpl extends Display {
// can't wait if we are on EDT or NEDT -> consume right away
if(wait && edtUtil.isCurrentThreadEDTorNEDT() ) {
- dispatchMessage(new NEWTEventTask(e, null));
+ dispatchMessage(e);
return;
}
diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java
index 222a1173c..66ca3e07d 100644
--- a/src/newt/classes/jogamp/newt/WindowImpl.java
+++ b/src/newt/classes/jogamp/newt/WindowImpl.java
@@ -110,7 +110,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
private boolean pointerConfined = false;
private LifecycleHook lifecycleHook = null;
- private boolean handleDestroyNotify = true;
+ private Runnable windowDestroyNotifyAction = null;
private FocusRunnable focusAction = null;
private KeyListener keyboardFocusHandler = null;
@@ -864,8 +864,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
_lock.lock();
try {
if(DEBUG_IMPLEMENTATION) {
- System.err.println("Window DestroyAction() "+getThreadName());
+ System.err.println("Window DestroyAction() hasScreen "+(null != screen)+", isNativeValid "+isNativeValid()+" - "+getThreadName());
}
+
+ // send synced destroy-notify notification
+ sendWindowEvent(WindowEvent.EVENT_WINDOW_DESTROY_NOTIFY);
+
// Childs first ..
synchronized(childWindowsLock) {
if(childWindows.size()>0) {
@@ -875,8 +879,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
while( clonedChildWindows.size() > 0 ) {
NativeWindow nw = clonedChildWindows.remove(0);
if(nw instanceof WindowImpl) {
- ((WindowImpl)nw).sendWindowEvent(WindowEvent.EVENT_WINDOW_DESTROY_NOTIFY);
- ((WindowImpl)nw).destroy();
+ ((WindowImpl)nw).windowDestroyNotify(true);
} else {
nw.destroy();
}
@@ -1549,14 +1552,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
public Object getWrappedWindow() {
return null;
}
-
- /**
- * If set to true, the default value, this NEWT Window implementation will
- * handle the destruction (ie {@link #destroy()} call) within {@link #windowDestroyNotify(boolean)} implementation.
- * If set to false, it's up to the caller/owner to handle destruction within {@link #windowDestroyNotify(boolean)}.
- */
- public void setHandleDestroyNotify(boolean b) {
- handleDestroyNotify = b;
+
+ @Override
+ public void setWindowDestroyNotifyAction(Runnable r) {
+ windowDestroyNotifyAction = r;
}
/**
@@ -2211,7 +2210,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
default:
throw new NativeWindowException("Unexpected mouse event type " + e.getEventType());
}
- consumed = InputEvent.consumedTag == e.getAttachment();
+ consumed = NEWTEvent.consumedTag == e.getAttachment();
}
}
@@ -2340,7 +2339,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
default:
throw new NativeWindowException("Unexpected key event type " + e.getEventType());
}
- return InputEvent.consumedTag == e.getAttachment();
+ return NEWTEvent.consumedTag == e.getAttachment();
}
@SuppressWarnings("deprecation")
@@ -2446,7 +2445,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if(DEBUG_IMPLEMENTATION) {
System.err.println("consumeWindowEvent: "+e+", visible "+isVisible()+" "+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight());
}
- for(int i = 0; i < windowListeners.size(); i++ ) {
+ boolean consumed = false;
+ for(int i = 0; !consumed && i < windowListeners.size(); i++ ) {
WindowListener l = windowListeners.get(i);
switch(e.getEventType()) {
case WindowEvent.EVENT_WINDOW_RESIZED:
@@ -2475,6 +2475,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
new NativeWindowException("Unexpected window event type "
+ e.getEventType());
}
+ consumed = NEWTEvent.consumedTag == e.getAttachment();
}
}
@@ -2615,32 +2616,45 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
/**
- * Triggered by implementation's WM events or programmatically
+ * Triggered by implementation's WM events or programmatic while respecting {@link #getDefaultCloseOperation()}.
*
* @param force if true, overrides {@link #setDefaultCloseOperation(WindowClosingMode)} with {@link WindowClosingProtocol#DISPOSE_ON_CLOSE}
* and hence force destruction. Otherwise is follows the user settings.
* @return true if this window is no more valid and hence has been destroyed, otherwise false.
*/
- protected boolean windowDestroyNotify(boolean force) {
+ public boolean windowDestroyNotify(boolean force) {
+ final WindowClosingMode defMode = getDefaultCloseOperation();
+ final WindowClosingMode mode = force ? WindowClosingMode.DISPOSE_ON_CLOSE : defMode;
if(DEBUG_IMPLEMENTATION) {
- System.err.println("Window.windowDestroyNotify(force: "+force+") START "+getThreadName()+": "+this);
- }
- if(force) {
- setDefaultCloseOperation(WindowClosingMode.DISPOSE_ON_CLOSE);
+ System.err.println("Window.windowDestroyNotify(force: "+force+", mode "+defMode+" -> "+mode+") "+getThreadName()+": "+this);
}
-
- // send synced destroy notifications
- enqueueWindowEvent(true, WindowEvent.EVENT_WINDOW_DESTROY_NOTIFY);
-
- if(handleDestroyNotify && WindowClosingMode.DISPOSE_ON_CLOSE == getDefaultCloseOperation()) {
- destroy();
+
+ if( WindowClosingMode.DISPOSE_ON_CLOSE == mode ) {
+ if(force) {
+ setDefaultCloseOperation(mode);
+ }
+ try {
+ if( null == windowDestroyNotifyAction ) {
+ destroy();
+ } else {
+ windowDestroyNotifyAction.run();
+ }
+ } finally {
+ if(force) {
+ setDefaultCloseOperation(defMode);
+ }
+ }
+ } else {
+ // send synced destroy notifications
+ sendWindowEvent(WindowEvent.EVENT_WINDOW_DESTROY_NOTIFY);
}
final boolean destroyed = !isNativeValid();
if(DEBUG_IMPLEMENTATION) {
- System.err.println("Window.windowDestroyNotify(force: "+force+") END "+getThreadName()+": destroyed "+destroyed+", "+this);
- }
+ System.err.println("Window.windowDestroyNotify(force: "+force+", mode "+mode+") END "+getThreadName()+": destroyed "+destroyed+", "+this);
+ }
+
return destroyed;
}
diff --git a/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java b/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java
index 701d9d60a..b348220d6 100644
--- a/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java
+++ b/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java
@@ -42,9 +42,7 @@ import com.jogamp.newt.event.awt.AWTWindowAdapter;
* Specialized parent/client adapter,
* where the NEWT child window really gets resized,
* and the parent move window event gets discarded. */
-public class AWTParentWindowAdapter
- extends AWTWindowAdapter
- implements java.awt.event.HierarchyListener
+public class AWTParentWindowAdapter extends AWTWindowAdapter implements java.awt.event.HierarchyListener
{
NativeWindow downstreamParent;
diff --git a/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java
index bee43a95e..0172309fb 100644
--- a/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java
@@ -256,10 +256,7 @@ public class WindowDriver extends WindowImpl {
}
@Override
public void windowDestroyed(WindowEvent e) {
- if(isNativeValid()) {
- WindowDriver.this.windowDestroyNotify(true);
- }
-
+ // Not fwd by AWTWindowAdapter, synthesized by NEWT
}
@Override
public void windowGainedFocus(WindowEvent e) {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateNEWT.java
new file mode 100644
index 000000000..2729d6a5d
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateNEWT.java
@@ -0,0 +1,160 @@
+/**
+ * Copyright 2013 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+
+package com.jogamp.opengl.test.junit.jogl.acore;
+
+import java.io.IOException;
+
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.GLCapabilitiesImmutable;
+import javax.media.opengl.GLContext;
+import javax.media.opengl.GLDrawable;
+import javax.media.opengl.GLDrawableFactory;
+import javax.media.opengl.GLEventListener;
+import javax.media.opengl.GLProfile;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.jogamp.newt.NewtFactory;
+import com.jogamp.newt.Window;
+import com.jogamp.newt.event.WindowAdapter;
+import com.jogamp.newt.event.WindowEvent;
+import com.jogamp.newt.event.WindowUpdateEvent;
+import com.jogamp.opengl.GLAutoDrawableDelegate;
+import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
+import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.test.junit.util.QuitAdapter;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.util.Animator;
+
+/**
+ * Test using a NEWT {@link Window} for onscreen case.
+ *
+ * Creates a {@link GLDrawable} using the
+ * {@link GLDrawableFactory#createGLDrawable(javax.media.nativewindow.NativeSurface) factory model}.
+ * The {@link GLContext} is derived {@link GLDrawable#createContext(GLContext) from the drawable}.
+ *
+ *
+ * Finally a {@link GLAutoDrawableDelegate} is created with the just created {@link GLDrawable} and {@link GLContext}.
+ * It is being used to run the {@link GLEventListener}.
+ *
+ */
+public class TestGLAutoDrawableDelegateNEWT extends UITestCase {
+ static long duration = 500; // ms
+
+ void doTest(GLCapabilitiesImmutable reqGLCaps, GLEventListener demo) throws InterruptedException {
+ final GLDrawableFactory factory = GLDrawableFactory.getFactory(reqGLCaps.getGLProfile());
+
+ //
+ // Create native windowing resources .. X11/Win/OSX
+ //
+ final Window window = NewtFactory.createWindow(reqGLCaps);
+ Assert.assertNotNull(window);
+ window.setSize(640, 400);
+ window.setVisible(true);
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(window, true));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(window, true));
+ System.out.println("Window: "+window.getClass().getName());
+
+ final GLDrawable drawable = factory.createGLDrawable(window);
+ Assert.assertNotNull(drawable);
+ drawable.setRealized(true);
+
+ final GLAutoDrawableDelegate glad = new GLAutoDrawableDelegate(drawable, drawable.createContext(null), window, false, null) {
+ @Override
+ protected void destroyImplInLock() {
+ super.destroyImplInLock(); // destroys drawable/context
+ window.destroy(); // destroys the actual window, incl. the device
+ }
+ };
+
+ window.setWindowDestroyNotifyAction( new Runnable() {
+ public void run() {
+ glad.windowDestroyNotifyOp();
+ } } );
+
+ window.addWindowListener(new WindowAdapter() {
+ @Override
+ public void windowRepaint(WindowUpdateEvent e) {
+ glad.windowRepaintOp();
+ }
+
+ @Override
+ public void windowResized(WindowEvent e) {
+ glad.windowResizedOp(window.getWidth(), window.getHeight());
+ }
+ });
+
+ glad.addGLEventListener(demo);
+
+ QuitAdapter quitAdapter = new QuitAdapter();
+ //glWindow.addKeyListener(new TraceKeyAdapter(quitAdapter));
+ //glWindow.addWindowListener(new TraceWindowAdapter(quitAdapter));
+ window.addKeyListener(quitAdapter);
+ window.addWindowListener(quitAdapter);
+
+ Animator animator = new Animator();
+ animator.setUpdateFPSFrames(60, System.err);
+ animator.setModeBits(false, Animator.MODE_EXPECT_AWT_RENDERING_THREAD);
+ animator.add(glad);
+ animator.start();
+ Assert.assertTrue(animator.isStarted());
+ Assert.assertTrue(animator.isAnimating());
+
+ while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getTotalFPSDuration() dispose
@@ -90,10 +93,12 @@ public class TestWindowClosingProtocol01AWT extends UITestCase {
Thread.sleep(300);
- Assert.assertEquals(true, AWTRobotUtil.closeWindow(frame, false)); // no frame close, but GLCanvas's GL resources will be destroyed
+ Assert.assertEquals(true, AWTRobotUtil.closeWindow(frame, false, closingListener)); // no frame close, but GLCanvas's GL resources will be destroyed
Thread.sleep(100);
Assert.assertEquals(true, frame.isDisplayable());
Assert.assertEquals(true, frame.isVisible());
+ Assert.assertEquals(true, closingListener.isWindowClosing());
+ Assert.assertEquals(false, closingListener.isWindowClosed());
for (int wait=0; wait dispose
@@ -84,9 +84,9 @@ public class TestWindowClosingProtocol02NEWT extends UITestCase {
op = glWindow.getDefaultCloseOperation();
Assert.assertEquals(WindowClosingMode.DISPOSE_ON_CLOSE, op);
- Assert.assertEquals(true, AWTRobotUtil.closeWindow(glWindow, true));
+ Assert.assertEquals(true, AWTRobotUtil.closeWindow(glWindow, true, closingListener));
Assert.assertEquals(false, glWindow.isNativeValid());
- Assert.assertEquals(true, windowClosingListener.isWindowClosing());
+ Assert.assertEquals(true, closingListener.isWindowClosing());
}
public static void main(String[] args) {
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol03NewtAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol03NewtAWT.java
index be3c48fb6..b0a222a5a 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol03NewtAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol03NewtAWT.java
@@ -46,17 +46,19 @@ import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.test.junit.util.AWTRobotUtil.WindowClosingListener;
public class TestWindowClosingProtocol03NewtAWT extends UITestCase {
@Test
public void testCloseJFrameNewtCanvasAWT() throws InterruptedException, InvocationTargetException {
final JFrame frame = new JFrame("testCloseJFrameNewtCanvasAWT");
-
+ final WindowClosingListener awtClosingListener = AWTRobotUtil.addClosingListener(frame);
+
GLProfile glp = GLProfile.getGL2ES2();
GLCapabilities caps = new GLCapabilities(glp);
final GLWindow glWindow = GLWindow.create(caps);
- final AWTRobotUtil.WindowClosingListener windowClosingListener = AWTRobotUtil.addClosingListener(glWindow);
+ final AWTRobotUtil.WindowClosingListener newtClosingListener = AWTRobotUtil.addClosingListener(glWindow);
glWindow.addGLEventListener(new GearsES2());
@@ -81,20 +83,26 @@ public class TestWindowClosingProtocol03NewtAWT extends UITestCase {
//
// close with op: DO_NOTHING_ON_CLOSE -> NOP / HIDE (default)
//
- Assert.assertEquals(JFrame.HIDE_ON_CLOSE, frame.getDefaultCloseOperation());
- WindowClosingMode op = newtCanvas.getDefaultCloseOperation();
- Assert.assertEquals(WindowClosingMode.DO_NOTHING_ON_CLOSE, op);
+ {
+ Assert.assertEquals(JFrame.HIDE_ON_CLOSE, frame.getDefaultCloseOperation());
+ WindowClosingMode op = newtCanvas.getDefaultCloseOperation();
+ Assert.assertEquals(WindowClosingMode.DO_NOTHING_ON_CLOSE, op);
+ }
Thread.sleep(300);
- Assert.assertEquals(true, AWTRobotUtil.closeWindow(frame, false));
+ Assert.assertEquals(true, AWTRobotUtil.closeWindow(frame, false, awtClosingListener));
Assert.assertEquals(true, frame.isDisplayable());
Assert.assertEquals(false, frame.isVisible());
Assert.assertEquals(true, newtCanvas.isValid());
Assert.assertEquals(true, newtCanvas.isDisplayable());
Assert.assertEquals(true, glWindow.isNativeValid());
- Assert.assertEquals(true, windowClosingListener.isWindowClosing());
- windowClosingListener.reset();
+ Assert.assertEquals(true, awtClosingListener.isWindowClosing());
+ Assert.assertEquals(false, awtClosingListener.isWindowClosed());
+ Assert.assertEquals(true, newtClosingListener.isWindowClosing());
+ Assert.assertEquals(false, newtClosingListener.isWindowClosed());
+ awtClosingListener.reset();
+ newtClosingListener.reset();
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
@@ -107,20 +115,25 @@ public class TestWindowClosingProtocol03NewtAWT extends UITestCase {
//
// close with op (JFrame): DISPOSE_ON_CLOSE -- newtCanvas -- glWindow --> dispose
//
- frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
- Assert.assertEquals(JFrame.DISPOSE_ON_CLOSE, frame.getDefaultCloseOperation());
- op = newtCanvas.getDefaultCloseOperation();
- Assert.assertEquals(WindowClosingMode.DISPOSE_ON_CLOSE, op);
+ {
+ frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+ Assert.assertEquals(JFrame.DISPOSE_ON_CLOSE, frame.getDefaultCloseOperation());
+ WindowClosingMode op = newtCanvas.getDefaultCloseOperation();
+ Assert.assertEquals(WindowClosingMode.DISPOSE_ON_CLOSE, op);
+ }
Thread.sleep(300);
- Assert.assertEquals(true, AWTRobotUtil.closeWindow(frame, true));
+ Assert.assertEquals(true, AWTRobotUtil.closeWindow(frame, true, awtClosingListener));
Assert.assertEquals(false, frame.isDisplayable());
Assert.assertEquals(false, frame.isVisible());
Assert.assertEquals(false, newtCanvas.isValid());
Assert.assertEquals(false, newtCanvas.isDisplayable());
Assert.assertEquals(false, glWindow.isNativeValid());
- Assert.assertEquals(true, windowClosingListener.isWindowClosing());
+ Assert.assertEquals(true, awtClosingListener.isWindowClosing());
+ Assert.assertEquals(true, awtClosingListener.isWindowClosed());
+ Assert.assertEquals(true, newtClosingListener.isWindowClosing());
+ Assert.assertEquals(true, newtClosingListener.isWindowClosed());
}
public static void main(String[] args) {
diff --git a/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java b/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java
index ffc42e318..8b46760e1 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java
@@ -28,6 +28,7 @@
package com.jogamp.opengl.test.junit.util;
+import jogamp.common.awt.AWTEDTExecutor;
import jogamp.newt.WindowImplAccess;
import java.lang.reflect.InvocationTargetException;
@@ -41,6 +42,8 @@ import javax.media.opengl.awt.GLCanvas;
import org.junit.Assert;
+import com.jogamp.newt.event.WindowEvent;
+
public class AWTRobotUtil {
static final boolean DEBUG = false;
@@ -646,16 +649,19 @@ public class AWTRobotUtil {
*
* @param obj either an AWT Window (Frame, JFrame) or NEWT Window
* @param willClose indicating that the window will close, hence this method waits for the window to be closed
+ * @param wcl the WindowClosingListener to determine whether the AWT or NEWT widget has been closed. It should be attached
+ * to the widget ASAP before any other listener, e.g. via {@link #addClosingListener(Object)}.
+ * The WindowClosingListener will be reset before attempting to close the widget.
* @return True if the Window is closing and closed (if willClose is true), each within TIME_OUT
* @throws InterruptedException
*/
- public static boolean closeWindow(Object obj, boolean willClose) throws InterruptedException, InvocationTargetException {
- WindowClosingListener closingListener = addClosingListener(obj);
+ public static boolean closeWindow(Object obj, boolean willClose, WindowClosingListener closingListener) throws InterruptedException {
+ closingListener.reset();
if(obj instanceof java.awt.Window) {
final java.awt.Window win = (java.awt.Window) obj;
java.awt.Toolkit tk = java.awt.Toolkit.getDefaultToolkit();
final java.awt.EventQueue evtQ = tk.getSystemEventQueue();
- java.awt.EventQueue.invokeAndWait(new Runnable() {
+ AWTEDTExecutor.singleton.invoke(true, new Runnable() {
public void run() {
evtQ.postEvent(new java.awt.event.WindowEvent(win, java.awt.event.WindowEvent.WINDOW_CLOSING));
} });
@@ -675,12 +681,15 @@ public class AWTRobotUtil {
return wait
Date: Wed, 13 Mar 2013 06:35:30 +0100
Subject: Bug 665: Allow re-association of GLContext/GLEventListener to a
GLDrawable (Part 4)
Note:
- GLEventListenerState preservs the GLAutoDrawable state,
i.e. GLContext, all GLEventListener and the GLAnimatorControl association.
- GLEventListenerState may be utilized to move the state from a dying GLAutoDrawable,
to be moved to a new created GLAutoDrawable at a later time.
- GLEventListenerState will be made public soon.
+++
Exessive unit tests cover the new feature, tested manually on GNU/Linux/X11 and OSX(Java6/Java7).
+++
- GLAutoDrawable
- Change 'setContext(..)' to allow the destruction of the unbound old context:
'setContext(GLContext newCtx)' -> 'setContext(GLContext newCtx, boolean destroyPrevCtx)'
- Implementations: Properly implement 'setRealized(..)' incl. obeying threading constraints if exists.
Method is being utilized at least for GLEventListenerState.moveTo(..)
to unrealize and realize the drawable resources.
+++
Fix propagation of GLContext/GLDrawable association change (Bottom -> Top):
GLDrawableImpl.associateContext
GLContextImpl.associateDrawable
GLContextImpl.makeCurrent
GLContextImpl.destroy
GLContext.setGLDrawable
...
GLDrawableHelper.switchContext
GLAutoDrawble.setContext
associateDrawable(..)/associateContext(..) unifies and hence:
- GLContextImpl.contextRealized() (removed)
- GLDrawableImpl.contextRealized() (removed)
- GLDrawableImpl.associateContext(..) (merged)
- MacOSXCGLContext.drawableChangedNotify(..) (removed)
+++
- EGLUpstreamSurfaceHook.evalUpstreamSurface() validates the surface's device for reusage,
which is valid in case of GLEventListenerState.moveTo(..)
- MacOSXCGLContext.NSOpenGLImpl: pixelFormat replaces NSOpenGLLayerPfmt and has simplified lifecycle [create..destroy],
while native NSOpenGLLayer code only holds the reference until released.
---
make/scripts/tests.sh | 45 ++-
.../com/jogamp/opengl/GLAutoDrawableDelegate.java | 5 -
.../classes/com/jogamp/opengl/swt/GLCanvas.java | 7 +-
.../com/jogamp/opengl/util/GLDrawableUtil.java | 2 +-
.../classes/javax/media/opengl/GLAutoDrawable.java | 21 +-
.../classes/javax/media/opengl/awt/GLCanvas.java | 90 ++---
.../classes/javax/media/opengl/awt/GLJPanel.java | 7 +-
.../classes/jogamp/opengl/GLAutoDrawableBase.java | 25 +-
src/jogl/classes/jogamp/opengl/GLContextImpl.java | 59 ++--
.../classes/jogamp/opengl/GLDrawableHelper.java | 45 +--
src/jogl/classes/jogamp/opengl/GLDrawableImpl.java | 40 +--
.../jogamp/opengl/GLEventListenerState.java | 55 +--
.../classes/jogamp/opengl/GLFBODrawableImpl.java | 14 +-
src/jogl/classes/jogamp/opengl/GLPbufferImpl.java | 10 +-
.../jogamp/opengl/egl/EGLUpstreamSurfaceHook.java | 53 ++-
.../jogamp/opengl/macosx/cgl/MacOSXCGLContext.java | 132 +++----
.../opengl/macosx/cgl/MacOSXCGLDrawable.java | 1 -
.../macosx/MacOSXWindowSystemInterface-calayer.m | 17 +-
.../acore/TestGLContextDrawableSwitch01NEWT.java | 374 --------------------
.../acore/TestGLContextDrawableSwitch11NEWT.java | 386 ---------------------
.../acore/glels/GLContextDrawableSwitchBase.java | 276 +++++++++++++++
.../glels/TestGLContextDrawableSwitch01NEWT.java | 374 ++++++++++++++++++++
.../glels/TestGLContextDrawableSwitch10NEWT.java | 274 +++++++++++++++
.../TestGLContextDrawableSwitch11NewtAWT.java | 118 +++++++
.../glels/TestGLContextDrawableSwitch12AWT.java | 144 ++++++++
.../TestGLContextDrawableSwitch21Newt2AWT.java | 165 +++++++++
.../demos/es2/newt/TestGearsES2NewtCanvasAWT.java | 31 +-
.../jogamp/opengl/test/junit/util/QuitAdapter.java | 19 +-
28 files changed, 1730 insertions(+), 1059 deletions(-)
delete mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLContextDrawableSwitch01NEWT.java
delete mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLContextDrawableSwitch11NEWT.java
create mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/GLContextDrawableSwitchBase.java
create mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch01NEWT.java
create mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch10NEWT.java
create mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch11NewtAWT.java
create mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch12AWT.java
create mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch21Newt2AWT.java
(limited to 'src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java')
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index 5d259d6be..8cc3fd84a 100755
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -106,10 +106,11 @@ function jrun() {
#D_ARGS="-Djogamp.debug=all"
#D_ARGS="-Djogamp.debug=all -Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all"
#D_ARGS="-Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all"
- #D_ARGS="-Dnativewindow.debug.X11Util -Djogl.debug.EGLDisplayUtil -Djogl.debug.GLDrawable"
+ #D_ARGS="-Dnativewindow.debug.X11Util -Dnativewindow.debug.X11Util.TraceDisplayLifecycle -Djogl.debug.EGLDisplayUtil -Djogl.debug.GLDrawable"
#D_ARGS="-Dnativewindow.debug.X11Util"
#D_ARGS="-Djogl.debug.Animator"
#D_ARGS="-Djogl.debug=all -Dnewt.debug=all"
+ #D_ARGS="-Djogl.debug.EGLDisplayUtil -Djogl.debug.GLDrawable"
#D_ARGS="-Djogl.debug.GLDrawable -Djogl.debug.GLContext -Djogl.debug.GLCanvas"
#D_ARGS="-Djogl.debug.GLDrawable"
#D_ARGS="-Djogl.fbo.force.none"
@@ -194,7 +195,6 @@ function jrun() {
#D_ARGS="-Djogl.debug.GLContext -Dnewt.debug=all -Djogamp.debug.Lock -Djogamp.common.utils.locks.Lock.timeout=10000"
#D_ARGS="-Djogl.debug.GLContext -Dnewt.debug=all"
#D_ARGS="-Dnewt.debug=all"
- #D_ARGS="-Dnewt.debug=all"
#D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.GLJPanel"
#X_ARGS="-Dsun.java2d.noddraw=True -Dsun.java2d.opengl=True -Dsun.java2d.xrender=false"
#X_ARGS="-Dsun.java2d.noddraw=True -Dsun.java2d.opengl=false -Dsun.java2d.xrender=false"
@@ -312,17 +312,9 @@ function testawtswt() {
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextListNEWT2 $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES1NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2NEWT $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLContextDrawableSwitch01NEWT $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLContextDrawableSwitch02NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLPointsNEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLMesaBug651NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLMesaBug658NEWT $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.acore.ect.TestExclusiveContext01VSyncAnimNEWT $*
-#testawt com.jogamp.opengl.test.junit.jogl.acore.ect.TestExclusiveContext01VSyncAnimAWT $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.acore.ect.TestExclusiveContext02FPSAnimNEWT $*
-#testawt com.jogamp.opengl.test.junit.jogl.acore.ect.TestExclusiveContext02FPSAnimAWT $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.acore.ect.TestExclusiveContext11VSyncAnimNEWT $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.acore.ect.TestExclusiveContext12FPSAnimNEWT $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestOffscreenLayer01GLCanvasAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestOffscreenLayer02NewtCanvasAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestAddRemove01GLCanvasSwingAWT $*
@@ -339,15 +331,27 @@ function testawtswt() {
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLContextDrawableSwitch01NEWT $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLContextDrawableSwitch11NEWT $*
-
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOAutoDrawableFactoryNEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOOffThreadSharedContextMix2DemosES2NEWT $*
-testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOOnThreadSharedContext1DemoES2NEWT $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOOnThreadSharedContext1DemoES2NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOMix2DemosES2NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOMRTNEWT01 $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.ect.TestExclusiveContext01VSyncAnimNEWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.acore.ect.TestExclusiveContext01VSyncAnimAWT $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.ect.TestExclusiveContext02FPSAnimNEWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.acore.ect.TestExclusiveContext02FPSAnimAWT $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.ect.TestExclusiveContext11VSyncAnimNEWT $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.ect.TestExclusiveContext12FPSAnimNEWT $*
+
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.glels.TestGLContextDrawableSwitch01NEWT $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.glels.TestGLContextDrawableSwitch10NEWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.acore.glels.TestGLContextDrawableSwitch11NewtAWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.acore.glels.TestGLContextDrawableSwitch12AWT $*
+testawt com.jogamp.opengl.test.junit.jogl.acore.glels.TestGLContextDrawableSwitch21Newt2AWT $*
+
+#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT $*
+
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOAutoDrawableDeadlockAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug461FBOSupersamplingSwingAWT
@@ -560,9 +564,6 @@ testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOOnThreadSharedContext1D
# Child too low
#testnoawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting02NEWT $*
-# NPE:
-#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLContextDrawableSwitch11NEWT $*
-
# test rotation change
#testnoawt com.jogamp.opengl.test.junit.newt.TestScreenMode02NEWT
@@ -580,5 +581,15 @@ testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOOnThreadSharedContext1D
# ../../src/xcb_io.c:178: dequeue_pending_request: Assertion `!xcb_xlib_unknown_req_in_deq' failed.
#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting04AWT $*
+# NEW
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOAutoDrawableFactoryNEWT $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.caps.TestBug605FlippedImageNEWT $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.caps.TestBug605FlippedImageAWT $*
+
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.glels.TestGLContextDrawableSwitch11NEWT $*
+
+#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting04AWT $*
+
+
$spath/count-edt-start.sh java-run.log
diff --git a/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java b/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java
index 0f0f03ac4..bec05a0bd 100644
--- a/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java
@@ -169,11 +169,6 @@ public class GLAutoDrawableDelegate extends GLAutoDrawableBase implements GLAuto
return drawable.getFactory();
}
- @Override
- public final void setRealized(boolean realized) {
- drawable.setRealized(realized);
- }
-
@Override
public final void swapBuffers() throws GLException {
defaultSwapBuffers();
diff --git a/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java b/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java
index 80e1aa80d..169266152 100644
--- a/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java
+++ b/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java
@@ -705,16 +705,13 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
}
@Override
- public GLContext setContext(GLContext newCtx) {
+ public GLContext setContext(GLContext newCtx, boolean destroyPrevCtx) {
final RecursiveLock _lock = lock;
_lock.lock();
try {
final GLContext oldCtx = context;
- final boolean newCtxCurrent = GLDrawableHelper.switchContext(drawable, oldCtx, newCtx, additionalCtxCreationFlags);
+ GLDrawableHelper.switchContext(drawable, oldCtx, destroyPrevCtx, newCtx, additionalCtxCreationFlags);
context=(GLContextImpl)newCtx;
- if(newCtxCurrent) {
- context.makeCurrent();
- }
return oldCtx;
} finally {
_lock.unlock();
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.java b/src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.java
index c03e4bfa4..83414ddb0 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.java
@@ -151,7 +151,7 @@ public class GLDrawableUtil {
for(int i = dest.getGLEventListenerCount() - 1; 0 <= i; i--) {
dest.disposeGLEventListener(dest.getGLEventListener(i), false);
}
- dest.setContext( src.setContext( dest.getContext() ) );
+ dest.setContext( src.setContext( dest.getContext(), false ), false );
src.invoke(true, GLEventListenerState.setViewport);
dest.invoke(true, GLEventListenerState.setViewport);
diff --git a/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java b/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java
index 6abe4308b..bdbbd96a5 100644
--- a/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java
+++ b/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java
@@ -132,7 +132,8 @@ public interface GLAutoDrawable extends GLDrawable {
/**
* Associate the new context, newtCtx, to this auto-drawable.
*
- * The current context will be dis-associated from this auto-drawable
+ * The current context will be destroyed if destroyPrevCtx is true,
+ * otherwise it will be dis-associated from this auto-drawable
* via {@link GLContext#setGLDrawable(GLDrawable, boolean) setGLDrawable(null, true);} first.
*
*
@@ -145,26 +146,16 @@ public interface GLAutoDrawable extends GLDrawable {
* However the user shall take extra care that no other thread
* attempts to make this context current.
*
- *
- * In case you do not intend to use the old context anymore, i.e.
- * not assigning it to another drawable, it shall be
- * destroyed, i.e.:
- *
- *
*
* @param newCtx the new context, maybe null for dis-association.
+ * @param destroyPrevCtx if true, destroy the previous context if exists
* @return the previous GLContext, maybe null
*
* @see GLContext#setGLDrawable(GLDrawable, boolean)
* @see GLContext#setGLReadDrawable(GLDrawable)
- * @see jogamp.opengl.GLDrawableHelper#switchContext(GLDrawable, GLContext, GLContext, int)
+ * @see jogamp.opengl.GLDrawableHelper#switchContext(GLDrawable, GLContext, boolean, GLContext, int)
*/
- public GLContext setContext(GLContext newCtx);
+ public GLContext setContext(GLContext newCtx, boolean destroyPrevCtx);
/**
* Adds the given {@link GLEventListener listener} to the end of this drawable queue.
@@ -500,7 +491,7 @@ public interface GLAutoDrawable extends GLDrawable {
*
* This GLAutoDrawable implementation holds it's own GLContext reference,
* thus created a GLContext using this methods won't replace it implicitly.
- * To replace or set this GLAutoDrawable's GLContext you need to call {@link #setContext(GLContext)}.
+ * To replace or set this GLAutoDrawable's GLContext you need to call {@link #setContext(GLContext, boolean)}.
*
*
* The GLAutoDrawable implementation shall also set the
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
index ebc25e2ad..63c18db5d 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
@@ -429,8 +429,29 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
}
}
+ private final void setRealizedImpl(boolean realized) {
+ final RecursiveLock _lock = lock;
+ _lock.lock();
+ try {
+ final GLDrawable _drawable = drawable;
+ if( null == _drawable || realized && ( 0 >= _drawable.getWidth() || 0 >= _drawable.getHeight() ) ) {
+ return;
+ }
+ _drawable.setRealized(realized);
+ if( realized && _drawable.isRealized() ) {
+ sendReshape=true; // ensure a reshape is being send ..
+ }
+ } finally {
+ _lock.unlock();
+ }
+ }
+ private final Runnable realizeOnEDTAction = new Runnable() { public void run() { setRealizedImpl(true); } };
+ private final Runnable unrealizeOnEDTAction = new Runnable() { public void run() { setRealizedImpl(false); } };
+
@Override
- public void setRealized(boolean realized) {
+ public final void setRealized(boolean realized) {
+ // Make sure drawable realization happens on AWT-EDT and only there. Consider the AWTTree lock!
+ AWTEDTExecutor.singleton.invoke(getTreeLock(), false /* allowOnNonEDT */, true /* wait */, realized ? realizeOnEDTAction : unrealizeOnEDTAction);
}
@Override
@@ -595,46 +616,28 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
}
private boolean validateGLDrawable() {
- if( Beans.isDesignTime() || !isDisplayable() ) {
- return false; // early out!
- }
- final GLDrawable _drawable = drawable;
- if ( null != _drawable ) {
- if( _drawable.isRealized() ) {
- return true;
- }
- if( 0 >= _drawable.getWidth() || 0 >= _drawable.getHeight() ) {
- return false; // early out!
- }
- // Make sure drawable realization happens on AWT-EDT and only there. Consider the AWTTree lock!
- final boolean res0 = AWTEDTExecutor.singleton.invoke(getTreeLock(), false /* allowOnNonEDT */, true /* wait */, setRealizedOnEDTAction);
- final boolean res1 = res0 && _drawable.isRealized();
- if(DEBUG) {
- System.err.println(getThreadName()+": Realized Drawable: invoked "+res0+", probedIsRealized "+res1+", "+_drawable.toString());
- Thread.dumpStack();
- }
- return res1;
- }
- return false;
- }
- private Runnable setRealizedOnEDTAction = new Runnable() {
- public void run() {
- final RecursiveLock _lock = lock;
- _lock.lock();
- try {
- final GLDrawable _drawable = drawable;
- if( null == _drawable || 0 >= _drawable.getWidth() || 0 >= _drawable.getHeight() ) {
- return;
- }
- _drawable.setRealized(true);
- if( _drawable.isRealized() ) {
- sendReshape=true; // ensure a reshape is being send ..
- }
- } finally {
- _lock.unlock();
+ if( Beans.isDesignTime() || !isDisplayable() ) {
+ return false; // early out!
+ }
+ final GLDrawable _drawable = drawable;
+ if ( null != _drawable ) {
+ if( _drawable.isRealized() ) {
+ return true;
}
- } };
-
+ if( 0 >= _drawable.getWidth() || 0 >= _drawable.getHeight() ) {
+ return false; // early out!
+ }
+ setRealized(true);
+ final boolean res = _drawable.isRealized();
+ if(DEBUG) {
+ System.err.println(getThreadName()+": Realized Drawable: isRealized "+res+", "+_drawable.toString());
+ Thread.dumpStack();
+ }
+ return res;
+ }
+ return false;
+ }
+
/**
Overridden to track when this component is removed from a
container. Subclasses which override this method must call
super.removeNotify() in their removeNotify() method in order to
@@ -791,16 +794,13 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
}
@Override
- public GLContext setContext(GLContext newCtx) {
+ public GLContext setContext(GLContext newCtx, boolean destroyPrevCtx) {
final RecursiveLock _lock = lock;
_lock.lock();
try {
final GLContext oldCtx = context;
- final boolean newCtxCurrent = GLDrawableHelper.switchContext(drawable, oldCtx, newCtx, additionalCtxCreationFlags);
+ GLDrawableHelper.switchContext(drawable, oldCtx, destroyPrevCtx, newCtx, additionalCtxCreationFlags);
context=(GLContextImpl)newCtx;
- if(newCtxCurrent) {
- context.makeCurrent();
- }
return oldCtx;
} finally {
_lock.unlock();
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
index 8d9493cbf..d62967d7f 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
@@ -519,16 +519,13 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
}
@Override
- public GLContext setContext(GLContext newCtx) {
+ public GLContext setContext(GLContext newCtx, boolean destroyPrevCtx) {
if (backend == null) {
return null;
}
final GLContext oldCtx = backend.getContext();
- final boolean newCtxCurrent = GLDrawableHelper.switchContext(backend.getDrawable(), oldCtx, newCtx, additionalCtxCreationFlags);
+ GLDrawableHelper.switchContext(backend.getDrawable(), oldCtx, destroyPrevCtx, newCtx, additionalCtxCreationFlags);
backend.setContext(newCtx);
- if(newCtxCurrent) {
- newCtx.makeCurrent();
- }
return oldCtx;
}
diff --git a/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java b/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java
index c20197e72..ad67f8281 100644
--- a/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java
+++ b/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java
@@ -326,16 +326,13 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, FPSCounter {
}
@Override
- public final GLContext setContext(GLContext newCtx) {
+ public final GLContext setContext(GLContext newCtx, boolean destroyPrevCtx) {
final RecursiveLock lock = getLock();
lock.lock();
try {
final GLContext oldCtx = context;
- final boolean newCtxCurrent = GLDrawableHelper.switchContext(drawable, oldCtx, newCtx, additionalCtxCreationFlags);
+ GLDrawableHelper.switchContext(drawable, oldCtx, destroyPrevCtx, newCtx, additionalCtxCreationFlags);
context=(GLContextImpl)newCtx;
- if(newCtxCurrent) { // implies null != newCtx
- context.makeCurrent();
- }
return oldCtx;
} finally {
lock.unlock();
@@ -530,6 +527,24 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, FPSCounter {
}
}
+ @Override
+ public final void setRealized(boolean realized) {
+ final RecursiveLock _lock = getLock();
+ _lock.lock();
+ try {
+ final GLDrawable _drawable = drawable;
+ if( null == _drawable || realized && ( 0 >= _drawable.getWidth() || 0 >= _drawable.getHeight() ) ) {
+ return;
+ }
+ _drawable.setRealized(realized);
+ if( realized && _drawable.isRealized() ) {
+ sendReshape=true; // ensure a reshape is being send ..
+ }
+ } finally {
+ _lock.unlock();
+ }
+ }
+
@Override
public final boolean isRealized() {
final GLDrawable _drawable = drawable;
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index 42364dbfd..4121e8f77 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -133,9 +133,6 @@ public abstract class GLContextImpl extends GLContext {
GLContextShareSet.synchronizeBufferObjectSharing(shareWith, this);
this.drawable = drawable;
- if(null != drawable) {
- drawable.associateContext(this, true);
- }
this.drawableRead = drawable;
this.glDebugHandler = new GLDebugMessageHandler(this);
@@ -207,25 +204,36 @@ public abstract class GLContextImpl extends GLContext {
return drawable; // no change.
}
final Thread currentThread = Thread.currentThread();
+ if( lock.isLockedByOtherThread() ) {
+ throw new GLException("GLContext current by other thread "+lock.getOwner().getName()+", operation not allowed on this thread "+currentThread.getName());
+ }
final boolean lockHeld = lock.isOwner(currentThread);
+ if( lockHeld && lock.getHoldCount() > 1 ) {
+ // would need to makeCurrent * holdCount
+ throw new GLException("GLContext is recursively locked - unsupported for setGLDrawable(..)");
+ }
+ final GLDrawableImpl old = drawable;
+ if( isCreated() && null != old && old.isRealized() ) {
+ if(!lockHeld) {
+ makeCurrent();
+ }
+ associateDrawable(false);
+ if(!lockHeld) {
+ release();
+ }
+ }
if(lockHeld) {
release();
- } else if(lock.isLockedByOtherThread()) { // still could glitch ..
- throw new GLException("GLContext current by other thread "+lock.getOwner().getName()+", operation not allowed on this thread "+currentThread.getName());
- }
+ }
if( !setWriteOnly || drawableRead == drawable ) { // if !setWriteOnly || !explicitReadDrawable
drawableRead = (GLDrawableImpl) readWrite;
}
- final GLDrawableImpl old = drawable;
- if( null != old ) {
- old.associateContext(this, false);
- }
drawableRetargeted |= null != drawable && readWrite != drawable;
drawable = (GLDrawableImpl) readWrite ;
- if( null != drawable ) {
- drawable.associateContext(this, true);
- if( lockHeld ) {
- makeCurrent();
+ if( isCreated() && null != drawable && drawable.isRealized() ) {
+ makeCurrent(true); // implicit: associateDrawable(true)
+ if( !lockHeld ) {
+ release();
}
}
return old;
@@ -363,8 +371,7 @@ public abstract class GLContextImpl extends GLContext {
makeCurrent();
}
try {
- contextRealized(false);
- drawable.associateContext(this, false);
+ associateDrawable(false);
} catch (Throwable t) {
drawableContextRealizedException = t;
}
@@ -467,7 +474,11 @@ public abstract class GLContextImpl extends GLContext {
* @see #destroyContextARBImpl
*/
@Override
- public int makeCurrent() throws GLException {
+ public final int makeCurrent() throws GLException {
+ return makeCurrent(false);
+ }
+
+ protected final int makeCurrent(boolean forceDrawableAssociation) throws GLException {
if( TRACE_SWITCH ) {
System.err.println(getThreadName() +": GLContext.ContextSwitch[makeCurrent.0]: obj " + toHexString(hashCode()) + ", ctx "+toHexString(contextHandle)+", surf "+toHexString(drawable.getHandle())+" - "+lock);
}
@@ -561,7 +572,11 @@ public abstract class GLContextImpl extends GLContext {
gl = gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", null, gl, new Object[] { System.err } ) );
}
- contextRealized(true);
+ forceDrawableAssociation = true;
+ }
+
+ if( forceDrawableAssociation ) {
+ associateDrawable(true);
}
contextMadeCurrent(true);
@@ -662,14 +677,14 @@ public abstract class GLContextImpl extends GLContext {
protected abstract void makeCurrentImpl() throws GLException;
/**
- * @see GLDrawableImpl#contextRealized(GLContext, boolean)
+ * Calls {@link GLDrawableImpl#associateContext(GLContext, boolean)}
*/
- protected void contextRealized(boolean realized) {
- drawable.contextRealized(this, realized);
+ protected void associateDrawable(boolean bound) {
+ drawable.associateContext(this, bound);
}
/**
- * @see GLDrawableImpl#contextMadeCurrent(GLContext, boolean)
+ * Calls {@link GLDrawableImpl#contextMadeCurrent(GLContext, boolean)}
*/
protected void contextMadeCurrent(boolean current) {
drawable.contextMadeCurrent(this, current);
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
index 3eedf918e..1caa942ba 100644
--- a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
+++ b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
@@ -59,7 +59,7 @@ import javax.media.opengl.GLFBODrawable;
import javax.media.opengl.GLRunnable;
/** Encapsulates the implementation of most of the GLAutoDrawable's
- methods to be able to share it between GLCanvas and GLJPanel. */
+ methods to be able to share it between GLAutoDrawable implementations like GLAutoDrawableBase, GLCanvas and GLJPanel. */
public class GLDrawableHelper {
/** true if property jogl.debug.GLDrawable.PerfStats is defined. */
private static final boolean PERF_STATS = Debug.isPropertyDefined("jogl.debug.GLDrawable.PerfStats", true);
@@ -113,6 +113,9 @@ public class GLDrawableHelper {
return sb.toString();
}
+ /** Limit release calls of {@link #forceNativeRelease(GLContext)} to {@value}. */
+ private static final int MAX_RELEASE_ITER = 512;
+
/**
* Since GLContext's {@link GLContext#makeCurrent()} and {@link GLContext#release()}
* is recursive, a call to {@link GLContext#release()} may not natively release the context.
@@ -122,18 +125,25 @@ public class GLDrawableHelper {
* @param ctx
*/
public static final void forceNativeRelease(GLContext ctx) {
+ int releaseCount = 0;
do {
ctx.release();
+ releaseCount++;
if (DEBUG) {
- System.err.println("GLDrawableHelper.forceNativeRelease() -- currentThread "+Thread.currentThread()+" -> "+GLContext.getCurrent());
+ System.err.println("GLDrawableHelper.forceNativeRelease() #"+releaseCount+" -- currentThread "+Thread.currentThread()+" -> "+GLContext.getCurrent());
}
- } while( ctx == GLContext.getCurrent() );
+ } while( MAX_RELEASE_ITER > releaseCount && ctx.isCurrent() );
+
+ if( ctx.isCurrent() ) {
+ throw new GLException("Context still current after "+MAX_RELEASE_ITER+" releases: "+ctx);
+ }
}
/**
* Switch {@link GLContext} / {@link GLDrawable} association.
*
- * Dis-associate oldCtx from drawable
+ * The oldCtx will be destroyed if destroyPrevCtx is true,
+ * otherwise dis-associate oldCtx from drawable
* via {@link GLContext#setGLDrawable(GLDrawable, boolean) oldCtx.setGLDrawable(null, true);}.
*
*
@@ -149,31 +159,25 @@ public class GLDrawableHelper {
*
* @param drawable the drawable which context is changed
* @param oldCtx the old context, maybe null.
+ * @param destroyOldCtx if true, destroy the oldCtx
* @param newCtx the new context, maybe null for dis-association.
* @param newCtxCreationFlags additional creation flags if newCtx is not null and not been created yet, see {@link GLContext#setContextCreationFlags(int)}
- * @return true if the new context was current, otherwise false
*
- * @see GLAutoDrawable#setContext(GLContext)
+ * @see GLAutoDrawable#setContext(GLContext, boolean)
*/
- public static final boolean switchContext(GLDrawable drawable, GLContext oldCtx, GLContext newCtx, int newCtxCreationFlags) {
+ public static final void switchContext(GLDrawable drawable, GLContext oldCtx, boolean destroyOldCtx, GLContext newCtx, int newCtxCreationFlags) {
if( null != oldCtx ) {
- if( oldCtx.isCurrent() ) {
- oldCtx.release();
+ if( destroyOldCtx ) {
+ oldCtx.destroy();
+ } else {
+ oldCtx.setGLDrawable(null, true); // dis-associate old pair
}
- oldCtx.setGLDrawable(null, true); // dis-associate old pair
}
- final boolean newCtxCurrent;
+
if(null!=newCtx) {
- newCtxCurrent = newCtx.isCurrent();
- if(newCtxCurrent) {
- newCtx.release();
- }
newCtx.setContextCreationFlags(newCtxCreationFlags);
- newCtx.setGLDrawable(drawable, true); // re-associate new pair
- } else {
- newCtxCurrent = false;
+ newCtx.setGLDrawable(drawable, true); // re-associate new pair
}
- return newCtxCurrent;
}
/**
@@ -208,7 +212,6 @@ public class GLDrawableHelper {
context.makeCurrent();
}
context.getGL().glFinish();
- context.release();
context.setGLDrawable(null, true); // dis-associate
}
@@ -837,7 +840,7 @@ public class GLDrawableHelper {
if( null != exclusiveContextThread ) {
throw new GLException("Release current exclusive Context Thread "+exclusiveContextThread+" first");
}
- if( null != context && GLContext.getCurrent() == context ) {
+ if( null != context && context.isCurrent() ) {
try {
forceNativeRelease(context);
} catch (Throwable ex) {
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java
index c0c28a5f2..d0c1461a9 100644
--- a/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java
@@ -164,13 +164,14 @@ public abstract class GLDrawableImpl implements GLDrawable {
@Override
public final void setRealized(boolean realizedArg) {
if ( realized != realizedArg ) { // volatile: OK (locked below)
+ final boolean isProxySurface = surface instanceof ProxySurface;
if(DEBUG) {
- System.err.println(getThreadName() + ": setRealized: "+getClass().getSimpleName()+" "+realized+" -> "+realizedArg);
+ System.err.println(getThreadName() + ": setRealized: drawable "+getClass().getSimpleName()+", surface "+surface.getClass().getSimpleName()+", isProxySurface "+isProxySurface+": "+realized+" -> "+realizedArg);
Thread.dumpStack();
}
AbstractGraphicsDevice aDevice = surface.getGraphicsConfiguration().getScreen().getDevice();
if(realizedArg) {
- if(surface instanceof ProxySurface) {
+ if(isProxySurface) {
((ProxySurface)surface).createNotify();
}
if(NativeSurface.LOCK_SURFACE_NOT_READY >= lockSurface()) {
@@ -195,7 +196,7 @@ public abstract class GLDrawableImpl implements GLDrawable {
unlockSurface();
} else {
aDevice.unlock();
- if(surface instanceof ProxySurface) {
+ if(isProxySurface) {
((ProxySurface)surface).destroyNotify();
}
}
@@ -210,18 +211,26 @@ public abstract class GLDrawableImpl implements GLDrawable {
*/
protected abstract void setRealizedImpl();
- /**
- * Callback for special implementations, allowing GLContext to trigger GL related lifecycle: construct, destroy.
+ /**
+ * Callback for special implementations, allowing
+ *
+ *
to associate bound context to this drawable (bound == true)
+ * or to remove such association (bound == false).
+ *
to trigger GLContext/GLDrawable related lifecycle: construct, destroy.
+ *
*
- * If realized is true, the context has just been created and made current.
+ * If bound is true, the context is current and being newly associated w/ this drawable.
*
*
- * If realized is false, the context is still current and will be released and destroyed after this method returns.
+ * If bound is false, the context is still current and will be unbound (released and destroyed, or simply disassociated).
*
*
- * @see #contextMadeCurrent(GLContext, boolean)
+ * Being called by {@link GLContextImpl#associateDrawable(boolean)}.
+ *
+ * @param ctx the just bounded or unbounded context
+ * @param bound if true create an association, otherwise remove it
*/
- protected void contextRealized(GLContext glc, boolean realized) {}
+ protected void associateContext(GLContext ctx, boolean bound) { }
/**
* Callback for special implementations, allowing GLContext to trigger GL related lifecycle: makeCurrent, release.
@@ -232,21 +241,12 @@ public abstract class GLDrawableImpl implements GLDrawable {
* If current is false, the context is still current and will be release after this method returns.
*
*
- * Note: Will also be called after {@link #contextRealized(GLContext, boolean) contextRealized(ctx, true)}
- * but not at context destruction, i.e. {@link #contextRealized(GLContext, boolean) contextRealized(ctx, false)}.
+ * Being called by {@link GLContextImpl#contextMadeCurrent(boolean)}.
*
- * @see #contextRealized(GLContext, boolean)
+ * @see #associateContext(GLContext, boolean)
*/
protected void contextMadeCurrent(GLContext glc, boolean current) { }
- /**
- * Callback for special implementations, allowing to associate bound context to this drawable (bound == true)
- * or to remove such association (bound == false).
- * @param ctx the just bounded or unbounded context
- * @param bound if true create an association, otherwise remove it
- */
- protected void associateContext(GLContext ctx, boolean bound) { }
-
/** Callback for special implementations, allowing GLContext to fetch a custom default render framebuffer. Defaults to zero.*/
protected int getDefaultDrawFramebuffer() { return 0; }
/** Callback for special implementations, allowing GLContext to fetch a custom default read framebuffer. Defaults to zero. */
diff --git a/src/jogl/classes/jogamp/opengl/GLEventListenerState.java b/src/jogl/classes/jogamp/opengl/GLEventListenerState.java
index 7a2569850..2385460fe 100644
--- a/src/jogl/classes/jogamp/opengl/GLEventListenerState.java
+++ b/src/jogl/classes/jogamp/opengl/GLEventListenerState.java
@@ -45,7 +45,6 @@ import javax.media.opengl.GLEventListener;
import javax.media.opengl.GLException;
import javax.media.opengl.GLRunnable;
-import com.jogamp.common.util.locks.RecursiveLock;
import com.jogamp.nativewindow.MutableGraphicsConfiguration;
/**
@@ -71,11 +70,12 @@ import com.jogamp.nativewindow.MutableGraphicsConfiguration;
*
*/
public class GLEventListenerState {
- private static final boolean DEBUG = true;
+ private static final boolean DEBUG = GLDrawableImpl.DEBUG;
- private GLEventListenerState(AbstractGraphicsScreen upstreamScreen, AbstractGraphicsScreen screen, GLCapabilitiesImmutable caps,
+ private GLEventListenerState(AbstractGraphicsScreen upstreamScreen, boolean proxyOwnsUpstreamDevice, AbstractGraphicsScreen screen, GLCapabilitiesImmutable caps,
GLContext context, int count, GLAnimatorControl anim) {
this.upstreamScreen = upstreamScreen;
+ this.proxyOwnsUpstreamDevice = proxyOwnsUpstreamDevice;
this.screen = screen;
this.caps = caps;
this.context = context;
@@ -97,6 +97,7 @@ public class GLEventListenerState {
public final int listenerCount() { return listeners.length; }
public final AbstractGraphicsScreen upstreamScreen;
+ public final boolean proxyOwnsUpstreamDevice;
public final AbstractGraphicsScreen screen;
public final GLCapabilitiesImmutable caps;
public final GLContext context;
@@ -161,25 +162,30 @@ public class GLEventListenerState {
}
aScreen1.getDevice().clearHandleOwner(); // don't close device handle
- final AbstractGraphicsScreen aUpScreen2;
+ final AbstractGraphicsScreen aUpScreen2;
+ final boolean proxyOwnsUpstreamDevice;
{
AbstractGraphicsScreen _aUpScreen2=null;
if(aSurface instanceof ProxySurface) {
final ProxySurface aProxy = (ProxySurface)aSurface;
+ proxyOwnsUpstreamDevice = aProxy.containsUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_DEVICE );
final NativeSurface aUpSurface = aProxy.getUpstreamSurface();
- if(null != aUpSurface) {
+ if(DEBUG && null != aUpSurface) {
System.err.println("X00 UpstreamSurface: "+aUpSurface.getClass().getName()+", "+aUpSurface);
}
- aProxy.clearUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_DEVICE ); // don't close device handle
if(null != aUpSurface) {
final AbstractGraphicsScreen aUpScreen1 = aUpSurface.getGraphicsConfiguration().getScreen();
_aUpScreen2 = cloneScreen(aUpScreen1);
if(null != aUpScreen1) {
aUpScreen1.getDevice().clearHandleOwner(); // don't close device handle
}
- System.err.println("X0X NativeSurface: "+aSurface.getClass().getName()+", "+aSurface);
- System.err.println("X0X UpstreamSurface: "+aUpSurface.getClass().getName()+", "+aUpSurface);
+ if(DEBUG) {
+ System.err.println("X0X NativeSurface: "+aSurface.getClass().getName()+", "+aSurface);
+ System.err.println("X0X UpstreamSurface: "+aUpSurface.getClass().getName()+", "+aUpSurface);
+ }
}
+ } else {
+ proxyOwnsUpstreamDevice = false;
}
aUpScreen2=_aUpScreen2;
}
@@ -189,7 +195,7 @@ public class GLEventListenerState {
aAnim.remove(a); // also handles ECT
}
- final GLEventListenerState glls = new GLEventListenerState(aUpScreen2, aScreen2, caps, a.getContext(), aSz, aAnim);
+ final GLEventListenerState glls = new GLEventListenerState(aUpScreen2, proxyOwnsUpstreamDevice, aScreen2, caps, a.getContext(), aSz, aAnim);
//
// remove and cache all GLEventListener and their init-state
@@ -205,7 +211,7 @@ public class GLEventListenerState {
//
a.invoke(true, glFinish);
- a.setContext( null );
+ a.setContext( null, false );
return glls;
}
@@ -241,13 +247,7 @@ public class GLEventListenerState {
throw new GLException("Incompatible Capabilities - Prev-Holder: "+caps+", New-Holder "+caps);
}
// Destroy and remove currently associated GLContext, if any (will be replaced)
- {
- final GLContext ctx = a.getContext();
- if( null != ctx) {
- ctx.destroy();
- }
- a.setContext( null );
- }
+ a.setContext( null, true );
final boolean aRealized = a.isRealized();
if( aRealized ) {
a.setRealized(false);
@@ -260,8 +260,11 @@ public class GLEventListenerState {
final AbstractGraphicsScreen aScreen1 = aCfg.getScreen();
aCfg.setScreen( screen );
aScreen1.getDevice().close();
- System.err.println("XXX NativeSurface: "+aSurface.getClass().getName()+", "+aSurface);
+ if( DEBUG ) {
+ System.err.println("XXX NativeSurface: "+aSurface.getClass().getName()+", "+aSurface);
+ }
}
+
// If using a ProxySurface w/ an upstream surface, set new Screen and close previous one on it
{
boolean upstreamSet = false;
@@ -270,13 +273,19 @@ public class GLEventListenerState {
final NativeSurface aUpSurface = aProxy.getUpstreamSurface();
if(null != aUpSurface) {
final MutableGraphicsConfiguration aUpCfg = (MutableGraphicsConfiguration) aUpSurface.getGraphicsConfiguration();
- final AbstractGraphicsScreen aUpScreen1 = aUpCfg.getScreen();
if( null != upstreamScreen ) {
- System.err.println("XX0 UpstreamSurface: "+aUpSurface.getClass().getName()+", "+aUpSurface);
+ if( DEBUG ) {
+ System.err.println("XX0 UpstreamSurface: "+aUpSurface.getClass().getName()+", "+aUpSurface+", "+aProxy.getUpstreamOptionBits(null).toString());
+ }
+ aUpCfg.getScreen().getDevice().close();
aUpCfg.setScreen( upstreamScreen );
- aUpScreen1.getDevice().close();
+ if( proxyOwnsUpstreamDevice ) {
+ aProxy.addUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_DEVICE );
+ }
upstreamSet = true;
- System.err.println("XXX UpstreamSurface: "+aUpSurface.getClass().getName()+", "+aUpSurface);
+ if( DEBUG ) {
+ System.err.println("XXX UpstreamSurface: "+aUpSurface.getClass().getName()+", "+aUpSurface+", "+aProxy.getUpstreamOptionBits(null).toString());
+ }
} else {
throw new GLException("Incompatible Surface config - Has Upstream-Surface: Prev-Holder = false, New-Holder = true");
}
@@ -292,7 +301,7 @@ public class GLEventListenerState {
}
final boolean surfaceLocked = false; // NativeSurface.LOCK_SURFACE_NOT_READY < aSurface.lockSurface();
try {
- a.setContext( context );
+ a.setContext( context, false );
} finally {
if( surfaceLocked ) {
aSurface.unlockSurface();
diff --git a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
index 86cfa4f4c..51ec7dda6 100644
--- a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
@@ -38,6 +38,7 @@ import com.jogamp.opengl.JoglVersion;
*/
public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
protected static final boolean DEBUG = GLDrawableImpl.DEBUG || Debug.debug("FBObject");
+ protected static final boolean DEBUG_SWAP = Debug.isPropertyDefined("jogl.debug.FBObject.Swap", true);
private final GLDrawableImpl parent;
private GLCapabilitiesImmutable origParentChosenCaps;
@@ -92,6 +93,9 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
}
private final void initialize(boolean realize, GL gl) {
+ if( initialized == realize ) {
+ throw new InternalError("Already set to initialize := "+realize+": "+this);
+ }
if(realize) {
final GLCapabilities chosenFBOCaps = (GLCapabilities) getChosenGLCapabilities(); // cloned at setRealized(true)
@@ -323,8 +327,8 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
}
@Override
- protected final void contextRealized(GLContext glc, boolean realized) {
- initialize(realized, glc.getGL());
+ protected void associateContext(GLContext glc, boolean bound) {
+ initialize(bound, glc.getGL());
}
@Override
@@ -338,7 +342,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
swapFBOImpl(glc);
swapFBOImplPost(glc);
fboBound=false;
- if(DEBUG) {
+ if(DEBUG_SWAP) {
System.err.println("Post FBO swap(@release): done");
}
}
@@ -354,7 +358,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
swapFBOImpl(ctx);
doPostSwap = true;
fboBound=false;
- if(DEBUG) {
+ if(DEBUG_SWAP) {
System.err.println("Post FBO swap(@swap): done");
}
}
@@ -406,7 +410,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
gl.glBindFramebuffer(GL2GL3.GL_READ_FRAMEBUFFER, fbos[fboIFront].getReadFramebuffer());
} */
- if(DEBUG) {
+ if(DEBUG_SWAP) {
System.err.println("Post FBO swap(X): fboI back "+fboIBack+", front "+fboIFront+", num "+fbos.length);
}
}
diff --git a/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java b/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java
index b438131bc..ddc6d5917 100644
--- a/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java
@@ -86,9 +86,10 @@ public class GLPbufferImpl extends GLAutoDrawableBase implements GLPbuffer {
//
@Override
- public final void setRealized(boolean realized) {
+ public final void swapBuffers() throws GLException {
+ defaultSwapBuffers();
}
-
+
//
// GLAutoDrawable completion
//
@@ -125,11 +126,6 @@ public class GLPbufferImpl extends GLAutoDrawableBase implements GLPbuffer {
}
}
- @Override
- public final void swapBuffers() throws GLException {
- defaultSwapBuffers();
- }
-
//----------------------------------------------------------------------
// Internals only below this point
//
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java b/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java
index 342c4c417..77e9dc173 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java
@@ -47,7 +47,7 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize {
public final void create(ProxySurface surface) {
final String dbgPrefix;
if(DEBUG) {
- dbgPrefix = getThreadName() + ": EGLUpstreamSurfaceHook.create("+surface.getClass().getSimpleName()+"): ";
+ dbgPrefix = getThreadName() + ": EGLUpstreamSurfaceHook.create( up "+upstreamSurface.getClass().getSimpleName()+" -> this "+surface.getClass().getSimpleName()+" ): ";
System.err.println(dbgPrefix+this);
} else {
dbgPrefix = null;
@@ -76,24 +76,51 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize {
boolean isEGLSurfaceValid = true; // assume yes
- final AbstractGraphicsConfiguration aConfig = upstreamSurface.getGraphicsConfiguration();
- final AbstractGraphicsDevice aDevice = aConfig.getScreen().getDevice();
-
final EGLGraphicsDevice eglDevice;
- if( aDevice instanceof EGLGraphicsDevice ) {
- eglDevice = (EGLGraphicsDevice) aDevice;
+ final AbstractGraphicsConfiguration aConfig;
+ {
+ final AbstractGraphicsConfiguration surfaceConfig = surface.getGraphicsConfiguration();
+ final AbstractGraphicsDevice surfaceDevice = null != surfaceConfig ? surfaceConfig.getScreen().getDevice() : null;
+ if(DEBUG) {
+ System.err.println(dbgPrefix+"SurfaceDevice: "+surfaceDevice.getClass().getSimpleName()+", hash 0x"+Integer.toHexString(surfaceDevice.hashCode())+", "+surfaceDevice);
+ System.err.println(dbgPrefix+"SurfaceConfig: "+surfaceConfig.getClass().getSimpleName()+", hash 0x"+Integer.toHexString(surfaceConfig.hashCode())+", "+surfaceConfig);
+ }
+
+ final AbstractGraphicsConfiguration upstreamConfig = upstreamSurface.getGraphicsConfiguration();
+ final AbstractGraphicsDevice upstreamDevice = upstreamConfig.getScreen().getDevice();
if(DEBUG) {
- System.err.println(dbgPrefix+"Reusing eglDevice: "+eglDevice);
+ System.err.println(dbgPrefix+"UpstreamDevice: "+upstreamDevice.getClass().getSimpleName()+", hash 0x"+Integer.toHexString(upstreamDevice.hashCode())+", "+upstreamDevice);
+ System.err.println(dbgPrefix+"UpstreamConfig: "+upstreamConfig.getClass().getSimpleName()+", hash 0x"+Integer.toHexString(upstreamConfig.hashCode())+", "+upstreamConfig);
}
- if(EGL.EGL_NO_DISPLAY == eglDevice.getHandle()) {
- eglDevice.open();
+
+ if( surfaceDevice instanceof EGLGraphicsDevice ) {
+ eglDevice = (EGLGraphicsDevice) surfaceDevice;
+ aConfig = surfaceConfig;
+ if(DEBUG) {
+ System.err.println(dbgPrefix+"Reusing this eglDevice: "+eglDevice+", using this config "+aConfig.getClass().getSimpleName()+" "+aConfig);
+ }
+ if(EGL.EGL_NO_DISPLAY == eglDevice.getHandle()) {
+ eglDevice.open();
+ isEGLSurfaceValid = false;
+ surface.addUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_DEVICE );
+ }
+ } else if( upstreamDevice instanceof EGLGraphicsDevice ) {
+ eglDevice = (EGLGraphicsDevice) upstreamDevice;
+ aConfig = upstreamConfig;
+ if(DEBUG) {
+ System.err.println(dbgPrefix+"Reusing upstream eglDevice: "+eglDevice+", using upstream config "+aConfig.getClass().getSimpleName()+" "+aConfig);
+ }
+ if(EGL.EGL_NO_DISPLAY == eglDevice.getHandle()) {
+ eglDevice.open();
+ isEGLSurfaceValid = false;
+ surface.addUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_DEVICE );
+ }
+ } else {
+ eglDevice = EGLDisplayUtil.eglCreateEGLGraphicsDevice(upstreamSurface);
+ aConfig = upstreamConfig;
isEGLSurfaceValid = false;
surface.addUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_DEVICE );
}
- } else {
- eglDevice = EGLDisplayUtil.eglCreateEGLGraphicsDevice(upstreamSurface);
- isEGLSurfaceValid = false;
- surface.addUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_DEVICE );
}
final GLCapabilitiesImmutable capsRequested = (GLCapabilitiesImmutable) aConfig.getRequestedCapabilities();
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
index 3825f855c..a03850043 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
@@ -85,10 +85,9 @@ public abstract class MacOSXCGLContext extends GLContextImpl
// NSOpenGL-based or CGL-based)
protected interface GLBackendImpl {
boolean isNSContext();
- void drawableChangedNotify();
long create(long share, int ctp, int major, int minor);
boolean destroy(long ctx);
- boolean contextRealized(boolean realized);
+ void associateDrawable(boolean bound);
boolean copyImpl(long src, int mask);
boolean makeCurrent(long ctx);
boolean release(long ctx);
@@ -328,20 +327,15 @@ public abstract class MacOSXCGLContext extends GLContextImpl
}
@Override
- protected void contextRealized(boolean realized) {
+ protected void associateDrawable(boolean bound) {
// context stuff depends on drawable stuff
- if(realized) {
- super.contextRealized(true); // 1) init drawable stuff
- impl.contextRealized(true); // 2) init context stuff
+ System.err.println("MaxOSXCGLContext.associateDrawable: "+bound);
+ if(bound) {
+ super.associateDrawable(true); // 1) init drawable stuff
+ impl.associateDrawable(true); // 2) init context stuff
} else {
- impl.contextRealized(false); // 1) free context stuff
- super.contextRealized(false); // 2) free drawable stuff
- }
- }
-
- /* pp */ void drawableChangedNotify() {
- if( 0 != contextHandle) {
- impl.drawableChangedNotify();
+ impl.associateDrawable(false); // 1) free context stuff
+ super.associateDrawable(false); // 2) free drawable stuff
}
}
@@ -467,9 +461,8 @@ public abstract class MacOSXCGLContext extends GLContextImpl
// NSOpenGLContext-based implementation
class NSOpenGLImpl implements GLBackendImpl {
- private OffscreenLayerSurface backingLayerHost = null;
- private long nsOpenGLLayer = 0;
- private long nsOpenGLLayerPFmt = 0; // lifecycle: [create - contextRealized]
+ private long pixelFormat = 0; // lifecycle: [create - destroy]
+ private long nsOpenGLLayer = 0; // lifecycle: [associateDrawable_true - associateDrawable_false]
private float screenVSyncTimeout; // microSec
private int vsyncTimeout; // microSec - for nsOpenGLLayer mode
private int lastWidth=0, lastHeight=0; // allowing to detect size change
@@ -479,18 +472,6 @@ public abstract class MacOSXCGLContext extends GLContextImpl
@Override
public boolean isNSContext() { return true; }
- @Override
- public void drawableChangedNotify() {
- backingLayerHost = NativeWindowFactory.getOffscreenLayerSurface(drawable.getNativeSurface(), true);
- if( null == backingLayerHost ) {
- boolean[] isPBuffer = { false };
- boolean[] isFBO = { false };
- CGL.setContextView(contextHandle, getNSViewHandle(isPBuffer, isFBO));
- } else {
- nsOpenGLLayer = backingLayerHost.getAttachedSurfaceLayer();
- }
- }
-
private long getNSViewHandle(boolean[] isPBuffer, boolean[] isFBO) {
final long nsViewHandle;
if(drawable instanceof GLFBODrawableImpl) {
@@ -549,13 +530,12 @@ public abstract class MacOSXCGLContext extends GLContextImpl
isPBuffer = _isPBuffer[0];
isFBO = _isFBO[0];
}
- backingLayerHost = NativeWindowFactory.getOffscreenLayerSurface(surface, true);
+ final OffscreenLayerSurface backingLayerHost = NativeWindowFactory.getOffscreenLayerSurface(surface, true);
boolean incompleteView = null != backingLayerHost;
if( !incompleteView && surface instanceof ProxySurface ) {
incompleteView = ((ProxySurface)surface).containsUpstreamOptionBits( ProxySurface.OPT_UPSTREAM_WINDOW_INVISIBLE );
}
- long pixelFormat;
{
final GLCapabilitiesImmutable targetCaps;
if( isFBO ) {
@@ -606,48 +586,54 @@ public abstract class MacOSXCGLContext extends GLContextImpl
}
config.setChosenCapabilities(fixedCaps);
- try {
- final IntBuffer viewNotReady = Buffers.newDirectIntBuffer(1);
- // Try to allocate a context with this
- ctx = CGL.createContext(share,
- nsViewHandle, incompleteView,
- pixelFormat,
- chosenCaps.isBackgroundOpaque(),
- viewNotReady);
- if (0 == ctx) {
- if(DEBUG) {
- System.err.println("NS create failed: viewNotReady: "+ (1 == viewNotReady.get(0)));
- }
- return 0;
+ final IntBuffer viewNotReady = Buffers.newDirectIntBuffer(1);
+ // Try to allocate a context with this
+ ctx = CGL.createContext(share, nsViewHandle, incompleteView,
+ pixelFormat, chosenCaps.isBackgroundOpaque(), viewNotReady);
+ if (0 == ctx) {
+ if(DEBUG) {
+ System.err.println("NS create failed: viewNotReady: "+ (1 == viewNotReady.get(0)));
}
+ return 0;
+ }
- if(null != backingLayerHost) {
- nsOpenGLLayerPFmt = pixelFormat;
- pixelFormat = 0;
- }
-
- if (chosenCaps.isOnscreen() && !chosenCaps.isBackgroundOpaque()) {
- // Set the context opacity
- CGL.setContextOpacity(ctx, 0);
- }
- } finally {
- if(0!=pixelFormat) {
- CGL.deletePixelFormat(pixelFormat);
- pixelFormat = 0;
- }
+ if (chosenCaps.isOnscreen() && !chosenCaps.isBackgroundOpaque()) {
+ // Set the context opacity
+ CGL.setContextOpacity(ctx, 0);
}
return ctx;
}
@Override
public boolean destroy(long ctx) {
+ if(0!=pixelFormat) {
+ CGL.deletePixelFormat(pixelFormat);
+ pixelFormat = 0;
+ }
return CGL.deleteContext(ctx, true);
+
}
@Override
- public boolean contextRealized(boolean realized) {
- if( realized ) {
+ public void associateDrawable(boolean bound) {
+ final OffscreenLayerSurface backingLayerHost = NativeWindowFactory.getOffscreenLayerSurface(drawable.getNativeSurface(), true);
+
+ if(DEBUG) {
+ System.err.println("MaxOSXCGLContext.NSOpenGLImpl.associateDrawable: "+bound+", ctx "+toHexString(contextHandle)+", hasBackingLayerHost "+(null!=backingLayerHost));
+ }
+
+ if( bound ) {
+
if( null != backingLayerHost ) {
+
+ if( 0 != nsOpenGLLayer ) { // FIXME: redundant
+ throw new InternalError("Lifecycle: bound=true, hasBackingLayerHost=true, but 'nsOpenGLLayer' is already/still set local: "+nsOpenGLLayer+", "+this);
+ }
+ nsOpenGLLayer = backingLayerHost.getAttachedSurfaceLayer();
+ if( 0 != nsOpenGLLayer ) { // FIXME: redundant
+ throw new InternalError("Lifecycle: bound=true, hasBackingLayerHost=true, but 'nsOpenGLLayer' is already/still set on backingLayerHost: "+nsOpenGLLayer+", "+this);
+ }
+
//
// handled layered surface
//
@@ -700,8 +686,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
}
final boolean ctxUnlocked = CGL.kCGLNoError == CGL.CGLUnlockContext(cglCtx);
try {
- nsOpenGLLayer = CGL.createNSOpenGLLayer(ctx, gl3ShaderProgramName, nsOpenGLLayerPFmt, pbufferHandle, texID, chosenCaps.isBackgroundOpaque(), lastWidth, lastHeight);
- nsOpenGLLayerPFmt = 0; // NSOpenGLLayer will release pfmt
+ nsOpenGLLayer = CGL.createNSOpenGLLayer(ctx, gl3ShaderProgramName, pixelFormat, pbufferHandle, texID, chosenCaps.isBackgroundOpaque(), lastWidth, lastHeight);
if (DEBUG) {
System.err.println("NS create nsOpenGLLayer "+toHexString(nsOpenGLLayer)+" w/ pbuffer "+toHexString(pbufferHandle)+", texID "+texID+", texSize "+lastWidth+"x"+lastHeight+", "+drawable);
}
@@ -718,17 +703,22 @@ public abstract class MacOSXCGLContext extends GLContextImpl
} else {
lastWidth = drawable.getWidth();
lastHeight = drawable.getHeight();
+ boolean[] isPBuffer = { false };
+ boolean[] isFBO = { false };
+ CGL.setContextView(contextHandle, getNSViewHandle(isPBuffer, isFBO));
}
} else {
if( 0 != nsOpenGLLayer ) {
- final NativeSurface surface = drawable.getNativeSurface();
+ if( null == backingLayerHost ) { // FIXME: redundant
+ throw new InternalError("Lifecycle: bound=false, hasNSOpneGLLayer=true, but 'backingLayerHost' is null local: "+nsOpenGLLayer+", "+this);
+ }
+
if (DEBUG) {
System.err.println("NS destroy nsOpenGLLayer "+toHexString(nsOpenGLLayer)+", "+drawable);
}
- final OffscreenLayerSurface ols = NativeWindowFactory.getOffscreenLayerSurface(surface, true);
- if(null != ols && ols.isSurfaceLayerAttached()) {
+ if( backingLayerHost.isSurfaceLayerAttached() ) {
// still having a valid OLS attached to surface (parent OLS could have been removed)
- ols.detachSurfaceLayer();
+ backingLayerHost.detachSurfaceLayer();
}
CGL.releaseNSOpenGLLayer(nsOpenGLLayer);
if( null != gl3ShaderProgram ) {
@@ -738,8 +728,6 @@ public abstract class MacOSXCGLContext extends GLContextImpl
nsOpenGLLayer = 0;
}
}
- backingLayerHost = null;
- return true;
}
private final void validatePBufferConfig(long ctx) {
@@ -888,11 +876,6 @@ public abstract class MacOSXCGLContext extends GLContextImpl
@Override
public boolean isNSContext() { return false; }
- @Override
- public void drawableChangedNotify() {
- // FIXME
- }
-
@Override
public long create(long share, int ctp, int major, int minor) {
long ctx = 0;
@@ -947,8 +930,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
}
@Override
- public boolean contextRealized(boolean realized) {
- return true;
+ public void associateDrawable(boolean bound) {
}
@Override
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java
index ff1772860..0f282d33f 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java
@@ -119,7 +119,6 @@ public abstract class MacOSXCGLDrawable extends GLDrawableImpl {
if(bound) {
final MacOSXCGLContext osxCtx = (MacOSXCGLContext)ctx;
createdContexts.add(new WeakReference(osxCtx));
- osxCtx.drawableChangedNotify();
} else {
for(int i=0; i ref = createdContexts.get(i);
diff --git a/src/jogl/native/macosx/MacOSXWindowSystemInterface-calayer.m b/src/jogl/native/macosx/MacOSXWindowSystemInterface-calayer.m
index 2cf74380c..abc9d7958 100644
--- a/src/jogl/native/macosx/MacOSXWindowSystemInterface-calayer.m
+++ b/src/jogl/native/macosx/MacOSXWindowSystemInterface-calayer.m
@@ -275,7 +275,7 @@ static const GLfloat gl_verts[] = {
vboBufTexCoord = 0;
vertAttrLoc = 0;
texCoordAttrLoc = 0;
- parentPixelFmt = _parentPixelFmt;
+ parentPixelFmt = [_parentPixelFmt retain]; // until destruction
swapInterval = 1; // defaults to on (as w/ new GL profiles)
swapIntervalCounter = 0;
timespec_now(&lastWaitTime);
@@ -338,13 +338,13 @@ static const GLfloat gl_verts[] = {
#ifdef VERBOSE_ON
CGRect lRect = [self bounds];
if(NULL != pbuffer) {
- DBG_PRINT("MyNSOpenGLLayer::init (pbuffer) %p, ctx %p, pfmt %p, pbuffer %p, opaque %d, pbuffer %dx%d -> tex %dx%d, bounds: %lf/%lf %lfx%lf (refcnt %d)\n",
+ DBG_PRINT("MyNSOpenGLLayer::init (pbuffer) %p, ctx %p, pfmt %p, pbuffer %p, opaque %d, pbuffer %dx%d -> tex %dx%d, bounds: %lf/%lf %lfx%lf, displayLink %p (refcnt %d)\n",
self, parentCtx, parentPixelFmt, pbuffer, opaque, [pbuffer pixelsWide], [pbuffer pixelsHigh], texWidth, texHeight,
- lRect.origin.x, lRect.origin.y, lRect.size.width, lRect.size.height, (int)[self retainCount]);
+ lRect.origin.x, lRect.origin.y, lRect.size.width, lRect.size.height, displayLink, (int)[self retainCount]);
} else {
- DBG_PRINT("MyNSOpenGLLayer::init (texture) %p, ctx %p, pfmt %p, opaque %d, tex[id %d, %dx%d], bounds: %lf/%lf %lfx%lf (refcnt %d)\n",
+ DBG_PRINT("MyNSOpenGLLayer::init (texture) %p, ctx %p, pfmt %p, opaque %d, tex[id %d, %dx%d], bounds: %lf/%lf %lfx%lf, displayLink %p (refcnt %d)\n",
self, parentCtx, parentPixelFmt, opaque, (int)textureID, texWidth, texHeight,
- lRect.origin.x, lRect.origin.y, lRect.size.width, lRect.size.height, (int)[self retainCount]);
+ lRect.origin.x, lRect.origin.y, lRect.size.width, lRect.size.height, displayLink, (int)[self retainCount]);
}
#endif
return self;
@@ -498,7 +498,10 @@ static const GLfloat gl_verts[] = {
myCtx = NULL;
}
parentCtx = NULL;
- [parentPixelFmt release];
+ if( NULL != parentPixelFmt ) {
+ [parentPixelFmt release];
+ parentPixelFmt = NULL;
+ }
pthread_mutex_unlock(&renderLock);
[self release];
DBG_PRINT("MyNSOpenGLLayer::releaseLayer.X: %p\n", self);
@@ -623,7 +626,7 @@ static const GLfloat gl_verts[] = {
{
DBG_PRINT("MyNSOpenGLLayer::openGLPixelFormatForDisplayMask: %p (refcnt %d) - parent-pfmt %p -> new-pfmt %p\n",
self, (int)[self retainCount], parentPixelFmt, parentPixelFmt);
- // We simply take over ownership of parent PixelFormat ..
+ // We simply take over ownership of parent PixelFormat until releaseLayer..
return parentPixelFmt;
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLContextDrawableSwitch01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLContextDrawableSwitch01NEWT.java
deleted file mode 100644
index cce4149ba..000000000
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLContextDrawableSwitch01NEWT.java
+++ /dev/null
@@ -1,374 +0,0 @@
-/**
- * Copyright 2010 JogAmp Community. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this list of
- * conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice, this list
- * of conditions and the following disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those of the
- * authors and should not be interpreted as representing official policies, either expressed
- * or implied, of JogAmp Community.
- */
-
-package com.jogamp.opengl.test.junit.jogl.acore;
-
-import java.io.IOException;
-
-import com.jogamp.newt.NewtFactory;
-import com.jogamp.newt.Window;
-import com.jogamp.newt.event.WindowAdapter;
-import com.jogamp.newt.event.WindowEvent;
-import com.jogamp.newt.event.WindowListener;
-import com.jogamp.newt.event.WindowUpdateEvent;
-import com.jogamp.newt.opengl.GLWindow;
-
-import javax.media.opengl.GLAutoDrawable;
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLDrawable;
-import javax.media.opengl.GLDrawableFactory;
-import javax.media.opengl.GLProfile;
-
-import com.jogamp.opengl.GLAutoDrawableDelegate;
-import com.jogamp.opengl.util.Animator;
-import com.jogamp.opengl.util.GLDrawableUtil;
-
-import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
-import com.jogamp.opengl.test.junit.jogl.demos.es2.RedSquareES2;
-import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
-import com.jogamp.opengl.test.junit.util.QuitAdapter;
-import com.jogamp.opengl.test.junit.util.UITestCase;
-
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * Test re-association (switching) of GLContext/GLDrawables,
- * i.e. ctx1/draw1, ctx2/draw2 -> ctx1/draw2, ctx2/draw1.
- */
-public class TestGLContextDrawableSwitch01NEWT extends UITestCase {
- static int width, height;
-
- static GLCapabilities getCaps(String profile) {
- if( !GLProfile.isAvailable(profile) ) {
- System.err.println("Profile "+profile+" n/a");
- return null;
- }
- return new GLCapabilities(GLProfile.get(profile));
- }
-
- @BeforeClass
- public static void initClass() {
- width = 256;
- height = 256;
- }
-
- private GLAutoDrawable createGLAutoDrawable(GLCapabilities caps, int x, int y, int width, int height, WindowListener wl) throws InterruptedException {
- final Window window = NewtFactory.createWindow(caps);
- Assert.assertNotNull(window);
- window.setPosition(x, y);
- window.setSize(width, height);
- window.setVisible(true);
- Assert.assertTrue(AWTRobotUtil.waitForVisible(window, true));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(window, true));
-
- final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile());
- final GLDrawable drawable = factory.createGLDrawable(window);
- Assert.assertNotNull(drawable);
-
- drawable.setRealized(true);
- Assert.assertTrue(drawable.isRealized());
-
- final GLContext context = drawable.createContext(null);
- Assert.assertNotNull(context);
-
- final GLAutoDrawableDelegate glad = new GLAutoDrawableDelegate(drawable, context, window, false, null) {
- @Override
- protected void destroyImplInLock() {
- super.destroyImplInLock();
- window.destroy(); // destroys the actual window
- }
- };
-
- window.setWindowDestroyNotifyAction( new Runnable() {
- public void run() {
- glad.windowDestroyNotifyOp();
- } } );
-
- // add basic window interaction
- window.addWindowListener(new WindowAdapter() {
- @Override
- public void windowRepaint(WindowUpdateEvent e) {
- glad.windowRepaintOp();
- }
- @Override
- public void windowResized(WindowEvent e) {
- glad.windowResizedOp(window.getWidth(), window.getHeight());
- }
- });
- window.addWindowListener(wl);
-
- return glad;
- }
-
- @Test(timeout=30000)
- public void testSwitch2WindowSingleContextGL2ES2() throws InterruptedException {
- final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2ES2);
- if(null == reqGLCaps) return;
- testSwitch2WindowSingleContextImpl(reqGLCaps);
- }
-
- @Test(timeout=30000)
- public void testSwitch2WindowSingleContextGLES2() throws InterruptedException {
- final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2);
- if(null == reqGLCaps) return;
- testSwitch2WindowSingleContextImpl(reqGLCaps);
- }
-
- private void testSwitch2WindowSingleContextImpl(GLCapabilities caps) throws InterruptedException {
- final QuitAdapter quitAdapter = new QuitAdapter();
-
- GLAutoDrawable glad1 = createGLAutoDrawable(caps, 64, 64, width, height, quitAdapter);
- GLAutoDrawable glad2 = createGLAutoDrawable(caps, 2*64+width, 64, width+100, height+100, quitAdapter);
-
- // create single context using glad1 and assign it to glad1,
- // destroy the prev. context afterwards.
- {
- final GLContext newCtx = glad1.createContext(null);
- Assert.assertNotNull(newCtx);
- final GLContext oldCtx = glad1.setContext(newCtx);
- Assert.assertNotNull(oldCtx);
- oldCtx.destroy();
- final int res = newCtx.makeCurrent();
- Assert.assertTrue(GLContext.CONTEXT_CURRENT_NEW==res || GLContext.CONTEXT_CURRENT==res);
- newCtx.release();
- }
-
- final SnapshotGLEventListener snapshotGLEventListener = new SnapshotGLEventListener();
- GearsES2 gears = new GearsES2(1);
- glad1.addGLEventListener(gears);
- glad1.addGLEventListener(snapshotGLEventListener);
- snapshotGLEventListener.setMakeSnapshot();
-
- Animator animator = new Animator();
- animator.add(glad1);
- animator.add(glad2);
- animator.start();
-
- int s = 0;
- long t0 = System.currentTimeMillis();
- long t1 = t0;
-
- while( !quitAdapter.shouldQuit() && ( t1 - t0 ) < duration ) {
- if( ( t1 - t0 ) / period > s) {
- s++;
- System.err.println(s+" - switch - START "+ ( t1 - t0 ));
-
- // switch context _and_ the demo synchronously
- GLDrawableUtil.swapGLContextAndAllGLEventListener(glad1, glad2);
-
- System.err.println(s+" - switch - END "+ ( t1 - t0 ));
- }
- Thread.sleep(100);
- t1 = System.currentTimeMillis();
- }
-
- animator.stop();
- glad1.destroy();
- glad2.destroy();
- }
-
- @Test(timeout=30000)
- public void testSwitch2GLWindowOneDemoGL2ES2() throws InterruptedException {
- final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2ES2);
- if(null == reqGLCaps) return;
- testSwitch2GLWindowOneDemoImpl(reqGLCaps);
- }
-
- @Test(timeout=30000)
- public void testSwitch2GLWindowOneDemoGLES2() throws InterruptedException {
- final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2);
- if(null == reqGLCaps) return;
- testSwitch2GLWindowOneDemoImpl(reqGLCaps);
- }
-
- private void testSwitch2GLWindowOneDemoImpl(GLCapabilities caps) throws InterruptedException {
- final SnapshotGLEventListener snapshotGLEventListener = new SnapshotGLEventListener();
- final GearsES2 gears = new GearsES2(1);
- final QuitAdapter quitAdapter = new QuitAdapter();
-
- GLWindow glWindow1 = GLWindow.create(caps);
- glWindow1.setTitle("win1");
- glWindow1.setSize(width, height);
- glWindow1.setPosition(64, 64);
- glWindow1.addGLEventListener(0, gears);
- glWindow1.addGLEventListener(snapshotGLEventListener);
- glWindow1.addWindowListener(quitAdapter);
-
- GLWindow glWindow2 = GLWindow.create(caps);
- glWindow2.setTitle("win2");
- glWindow2.setSize(width+100, height+100);
- glWindow2.setPosition(2*64+width, 64);
- glWindow2.addWindowListener(quitAdapter);
-
- Animator animator = new Animator();
- animator.add(glWindow1);
- animator.add(glWindow2);
- animator.start();
-
- glWindow1.setVisible(true);
- glWindow2.setVisible(true);
-
- snapshotGLEventListener.setMakeSnapshot();
-
- int s = 0;
- long t0 = System.currentTimeMillis();
- long t1 = t0;
-
- while( !quitAdapter.shouldQuit() && ( t1 - t0 ) < duration ) {
- if( ( t1 - t0 ) / period > s) {
- s++;
- System.err.println(s+" - switch - START "+ ( t1 - t0 ));
- System.err.println(s+" - A w1-h 0x"+Long.toHexString(glWindow1.getHandle())+",-ctx 0x"+Long.toHexString(glWindow1.getContext().getHandle()));
- System.err.println(s+" - A w2-h 0x"+Long.toHexString(glWindow2.getHandle())+",-ctx 0x"+Long.toHexString(glWindow2.getContext().getHandle()));
-
- // switch context _and_ the demo synchronously
- GLDrawableUtil.swapGLContextAndAllGLEventListener(glWindow1, glWindow2);
-
- System.err.println(s+" - B w1-h 0x"+Long.toHexString(glWindow1.getHandle())+",-ctx 0x"+Long.toHexString(glWindow1.getContext().getHandle()));
- System.err.println(s+" - B w2-h 0x"+Long.toHexString(glWindow2.getHandle())+",-ctx 0x"+Long.toHexString(glWindow2.getContext().getHandle()));
- System.err.println(s+" - switch - END "+ ( t1 - t0 ));
-
- snapshotGLEventListener.setMakeSnapshot();
- }
- Thread.sleep(100);
- t1 = System.currentTimeMillis();
- }
-
- animator.stop();
- glWindow1.destroy();
- glWindow2.destroy();
-
- }
-
- @Test(timeout=30000)
- public void testSwitch2GLWindowEachWithOwnDemoGL2ES2() throws InterruptedException {
- final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2ES2);
- if(null == reqGLCaps) return;
- testSwitch2GLWindowEachWithOwnDemoImpl(reqGLCaps);
- }
-
- @Test(timeout=30000)
- public void testSwitch2GLWindowEachWithOwnDemoGLES2() throws InterruptedException {
- final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2);
- if(null == reqGLCaps) return;
- testSwitch2GLWindowEachWithOwnDemoImpl(reqGLCaps);
- }
-
- public void testSwitch2GLWindowEachWithOwnDemoImpl(GLCapabilities caps) throws InterruptedException {
- final GearsES2 gears = new GearsES2(1);
- final RedSquareES2 rsquare = new RedSquareES2(1);
- final QuitAdapter quitAdapter = new QuitAdapter();
- final SnapshotGLEventListener snapshotGLEventListener1 = new SnapshotGLEventListener();
- final SnapshotGLEventListener snapshotGLEventListener2 = new SnapshotGLEventListener();
-
- GLWindow glWindow1 = GLWindow.create(caps);
- glWindow1.setTitle("win1");
- glWindow1.setSize(width, height);
- glWindow1.setPosition(64, 64);
- glWindow1.addGLEventListener(0, gears);
- glWindow1.addGLEventListener(snapshotGLEventListener1);
- glWindow1.addWindowListener(quitAdapter);
-
- GLWindow glWindow2 = GLWindow.create(caps);
- glWindow2.setTitle("win2");
- glWindow2.setSize(width+100, height+100);
- glWindow2.setPosition(2*64+width, 64);
- glWindow2.addGLEventListener(0, rsquare);
- glWindow2.addGLEventListener(snapshotGLEventListener2);
- glWindow2.addWindowListener(quitAdapter);
-
- Animator animator = new Animator();
- animator.add(glWindow1);
- animator.add(glWindow2);
- animator.start();
-
- glWindow1.setVisible(true);
- glWindow2.setVisible(true);
-
- snapshotGLEventListener1.setMakeSnapshot();
- snapshotGLEventListener2.setMakeSnapshot();
-
- int s = 0;
- long t0 = System.currentTimeMillis();
- long t1 = t0;
-
- while( !quitAdapter.shouldQuit() && ( t1 - t0 ) < duration ) {
- if( ( t1 - t0 ) / period > s) {
- s++;
- System.err.println(s+" - switch - START "+ ( t1 - t0 ));
- System.err.println(s+" - A w1-h 0x"+Long.toHexString(glWindow1.getHandle())+",-ctx 0x"+Long.toHexString(glWindow1.getContext().getHandle()));
- System.err.println(s+" - A w2-h 0x"+Long.toHexString(glWindow2.getHandle())+",-ctx 0x"+Long.toHexString(glWindow2.getContext().getHandle()));
- GLDrawableUtil.swapGLContextAndAllGLEventListener(glWindow1, glWindow2);
- System.err.println(s+" - B w1-h 0x"+Long.toHexString(glWindow1.getHandle())+",-ctx 0x"+Long.toHexString(glWindow1.getContext().getHandle()));
- System.err.println(s+" - B w2-h 0x"+Long.toHexString(glWindow2.getHandle())+",-ctx 0x"+Long.toHexString(glWindow2.getContext().getHandle()));
- System.err.println(s+" - switch - END "+ ( t1 - t0 ));
- snapshotGLEventListener1.setMakeSnapshot();
- snapshotGLEventListener2.setMakeSnapshot();
- }
- Thread.sleep(100);
- t1 = System.currentTimeMillis();
- }
-
- animator.stop();
- // System.err.println("pre -del-w1: w1: "+glWindow1);
- // System.err.println("pre -del-w1: w2: "+glWindow2);
- glWindow1.destroy();
- // System.err.println("post-del-w1: w1: "+glWindow1);
- // System.err.println("post-del-w1: w2: "+glWindow2);
- glWindow2.destroy();
-
- }
-
- // default timing for 2 switches
- static long duration = 2200; // ms
- static long period = 1000; // ms
-
- public static void main(String args[]) throws IOException {
- for(int i=0; i
- * See Bug 665 - https://jogamp.org/bugzilla/show_bug.cgi?id=665.
- *
+ * See Bug 665 - https://jogamp.org/bugzilla/show_bug.cgi?id=665.
+ *
+ */
+public class TestGLContextDrawableSwitch11NewtAWT extends GLContextDrawableSwitchBase {
+
+ @Test(timeout=30000)
+ public void test21GLWindowGL2ES2() throws InterruptedException {
+ final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2ES2);
+ if(null == reqGLCaps) return;
+ testGLWindowImpl(reqGLCaps);
+ }
+
+ @Test(timeout=30000)
+ public void test22GLWindowGLES2() throws InterruptedException {
+ final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2);
+ if(null == reqGLCaps) return;
+ testGLWindowImpl(reqGLCaps);
+ }
+
+ private void testGLWindowImpl(GLCapabilities caps) throws InterruptedException {
+ final SnapshotGLEventListener snapshotGLEventListener = new SnapshotGLEventListener();
+ final GLEventListenerCounter glelTracker = new GLEventListenerCounter();
+ final Animator animator = new Animator();
+ animator.start();
+
+ final GLEventListenerState glels[] = new GLEventListenerState[1];
+
+ // - create glad1 w/o context
+ // - create context using glad1 and assign it to glad1
+ {
+ testGLADOneLifecycle(caps, GLADType.GLWindow, width, height,
+ glelTracker, snapshotGLEventListener,
+ null,
+ glels, animator);
+ }
+
+ // - create glad2 w/ survived context
+ {
+ testGLADOneLifecycle(caps, GLADType.GLWindow, width+100, height+100,
+ glelTracker, snapshotGLEventListener,
+ glels[0],
+ null, null);
+ }
+ animator.stop();
+ }
+
+ public static void main(String args[]) throws IOException {
+ for(int i=0; i
+ * Test utilizes {@link GLEventListenerState} for preserving the
+ * GLAutoDrawable state, i.e. GLContext, all GLEventListener
+ * and the GLAnimatorControl association.
+ *
+ *
+ * This test is using JOGL's AWT GLCanvas
+ *
+ *
+ * See Bug 665 - https://jogamp.org/bugzilla/show_bug.cgi?id=665.
+ *
+ */
+public class TestGLContextDrawableSwitch12AWT extends GLContextDrawableSwitchBase {
+
+ @Test(timeout=30000)
+ public void test01GLCanvasOnscreenGL2ES2() throws InterruptedException {
+ final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2ES2);
+ if(null == reqGLCaps) return;
+ testGLCanvasImpl(reqGLCaps, false);
+ }
+
+ @Test(timeout=30000)
+ public void test02GLCanvasOnscreenGLES2() throws InterruptedException {
+ final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2);
+ if(null == reqGLCaps) return;
+ testGLCanvasImpl(reqGLCaps, false);
+ }
+
+ @Test(timeout=30000)
+ public void test11GLCanvasOffscreenGL2ES2() throws InterruptedException {
+ final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2ES2);
+ if(null == reqGLCaps) return;
+ testGLCanvasImpl(reqGLCaps, true);
+ }
+
+ @Test(timeout=30000)
+ public void test12GLCanvasOffscreenGLES2() throws InterruptedException {
+ final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2);
+ if(null == reqGLCaps) return;
+ testGLCanvasImpl(reqGLCaps, true);
+ }
+
+ private void testGLCanvasImpl(GLCapabilities caps, boolean offscreenLayer) throws InterruptedException {
+ if( offscreenLayer ) {
+ if( !JAWTUtil.isOffscreenLayerSupported() ) {
+ System.err.println("Platform doesn't support offscreen rendering.");
+ return;
+ }
+ } else {
+ if( JAWTUtil.isOffscreenLayerRequired() ) {
+ System.err.println("Platform requires offscreen rendering.");
+ return;
+ }
+ }
+ final SnapshotGLEventListener snapshotGLEventListener = new SnapshotGLEventListener();
+ final GLEventListenerCounter glelTracker = new GLEventListenerCounter();
+ final Animator animator = new Animator();
+ animator.start();
+
+ final GLEventListenerState glels[] = new GLEventListenerState[1];
+
+ // - create glad1 w/o context
+ // - create context using glad1 and assign it to glad1
+ {
+ testGLADOneLifecycle(caps, offscreenLayer ? GLADType.GLCanvasOffscreen : GLADType.GLCanvasOnscreen, width, height,
+ glelTracker, snapshotGLEventListener,
+ null,
+ glels, animator);
+ }
+
+ // - create glad2 w/ survived context
+ {
+ testGLADOneLifecycle(caps, offscreenLayer ? GLADType.GLCanvasOffscreen : GLADType.GLCanvasOnscreen, width+100, height+100,
+ glelTracker, snapshotGLEventListener,
+ glels[0],
+ null, null);
+ }
+ animator.stop();
+ }
+
+ public static void main(String args[]) throws IOException {
+ for(int i=0; i
+ * Test utilizes {@link GLEventListenerState} for preserving the
+ * GLAutoDrawable state, i.e. GLContext, all GLEventListener
+ * and the GLAnimatorControl association.
+ *
+ *
+ * This test moves the {@link GLEventListenerState} from a
+ * NEWT GLWindow before it's destruction to an AWT GLCanvas after it's creation
+ * and vice versa
+ *
+ *
+ * See Bug 665 - https://jogamp.org/bugzilla/show_bug.cgi?id=665.
+ *
+ */
+public class TestGLContextDrawableSwitch21Newt2AWT extends GLContextDrawableSwitchBase {
+
+ @Test(timeout=30000)
+ public void test01GLCanvasOnScrn2GLWindowGL2ES2() throws InterruptedException {
+ final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2ES2);
+ if(null == reqGLCaps) return;
+ testGLCanvas2GLWindowImpl(reqGLCaps, GLADType.GLCanvasOnscreen, GLADType.GLWindow);
+ }
+
+ @Test(timeout=30000)
+ public void test02GLCanvasOnScrn2GLWindowGLES2() throws InterruptedException {
+ final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2);
+ if(null == reqGLCaps) return;
+ testGLCanvas2GLWindowImpl(reqGLCaps, GLADType.GLCanvasOnscreen, GLADType.GLWindow);
+ }
+
+ @Test(timeout=30000)
+ public void test11GLWindow2GLCanvasOnScrnGL2ES2() throws InterruptedException {
+ final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2ES2);
+ if(null == reqGLCaps) return;
+ testGLCanvas2GLWindowImpl(reqGLCaps, GLADType.GLWindow, GLADType.GLCanvasOnscreen);
+ }
+
+ @Test(timeout=30000)
+ public void test12GLWindow2GLCanvasOnScrnGLES2() throws InterruptedException {
+ final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2);
+ if(null == reqGLCaps) return;
+ testGLCanvas2GLWindowImpl(reqGLCaps, GLADType.GLWindow, GLADType.GLCanvasOnscreen);
+ }
+
+ @Test(timeout=30000)
+ public void test21GLCanvasOffScrn2GLWindowGL2ES2() throws InterruptedException {
+ final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2ES2);
+ if(null == reqGLCaps) return;
+ testGLCanvas2GLWindowImpl(reqGLCaps, GLADType.GLCanvasOffscreen, GLADType.GLWindow);
+ }
+
+ @Test(timeout=30000)
+ public void test22GLCanvasOffScrn2GLWindowGLES2() throws InterruptedException {
+ final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2);
+ if(null == reqGLCaps) return;
+ testGLCanvas2GLWindowImpl(reqGLCaps, GLADType.GLCanvasOffscreen, GLADType.GLWindow);
+ }
+
+ @Test(timeout=30000)
+ public void test31GLWindow2GLCanvasOffScrnGL2ES2() throws InterruptedException {
+ final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2ES2);
+ if(null == reqGLCaps) return;
+ testGLCanvas2GLWindowImpl(reqGLCaps, GLADType.GLWindow, GLADType.GLCanvasOffscreen);
+ }
+
+ @Test(timeout=30000)
+ public void test32GLWindow2GLCanvasOffScrnGLES2() throws InterruptedException {
+ final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2);
+ if(null == reqGLCaps) return;
+ testGLCanvas2GLWindowImpl(reqGLCaps, GLADType.GLWindow, GLADType.GLCanvasOffscreen);
+ }
+
+ private void testGLCanvas2GLWindowImpl(GLCapabilities caps, GLADType gladType1, GLADType gladType2) throws InterruptedException {
+ if( !validateOnOffscreenLayer(gladType1, gladType2) ) {
+ return;
+ }
+ final SnapshotGLEventListener snapshotGLEventListener = new SnapshotGLEventListener();
+ final GLEventListenerCounter glelTracker = new GLEventListenerCounter();
+ final Animator animator = new Animator();
+ animator.start();
+
+ final GLEventListenerState glels[] = new GLEventListenerState[1];
+
+ // - create glad1 w/o context
+ // - create context using glad1 and assign it to glad1
+ {
+ testGLADOneLifecycle(caps, gladType1, width, height,
+ glelTracker, snapshotGLEventListener,
+ null,
+ glels, animator);
+ }
+
+ // - create glad2 w/ survived context
+ {
+ testGLADOneLifecycle(caps, gladType2, width+100, height+100,
+ glelTracker, snapshotGLEventListener,
+ glels[0],
+ null, null);
+ }
+ animator.stop();
+ }
+
+ public static void main(String args[]) throws IOException {
+ for(int i=0; i pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", "+glWindow.getInsets());
}
- while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getTotalFPSDuration()
Date: Thu, 17 Oct 2013 22:27:27 -0700
Subject: jogl: remove all trailing whitespace
Signed-off-by: Harvey Harrison
---
.../com/jogamp/audio/windows/waveout/Audio.java | 10 +-
.../com/jogamp/audio/windows/waveout/Mixer.java | 12 +-
.../jogamp/audio/windows/waveout/SoundBuffer.java | 10 +-
.../com/jogamp/audio/windows/waveout/Track.java | 12 +-
.../com/jogamp/audio/windows/waveout/Vec3f.java | 10 +-
.../gluegen/opengl/BuildComposablePipeline.java | 18 +-
.../jogamp/gluegen/opengl/BuildStaticGLInfo.java | 38 +-
.../com/jogamp/gluegen/opengl/GLConfiguration.java | 28 +-
.../com/jogamp/gluegen/opengl/GLEmitter.java | 34 +-
.../gluegen/opengl/GLJavaMethodBindingEmitter.java | 16 +-
.../jogamp/gluegen/opengl/ant/StaticGLGenTask.java | 72 +-
.../opengl/nativesig/NativeSignatureEmitter.java | 18 +-
.../NativeSignatureJavaMethodBindingEmitter.java | 26 +-
.../gluegen/runtime/opengl/GLNameResolver.java | 20 +-
.../runtime/opengl/GLProcAddressResolver.java | 10 +-
.../com/jogamp/graph/curve/OutlineShape.java | 124 ++--
.../classes/com/jogamp/graph/curve/Region.java | 68 +-
.../com/jogamp/graph/curve/opengl/GLRegion.java | 42 +-
.../jogamp/graph/curve/opengl/RegionRenderer.java | 24 +-
.../com/jogamp/graph/curve/opengl/RenderState.java | 32 +-
.../com/jogamp/graph/curve/opengl/Renderer.java | 84 +--
.../jogamp/graph/curve/opengl/TextRenderer.java | 60 +-
.../com/jogamp/graph/curve/tess/Triangulation.java | 2 +-
.../com/jogamp/graph/curve/tess/Triangulator.java | 12 +-
src/jogl/classes/com/jogamp/graph/font/Font.java | 34 +-
.../classes/com/jogamp/graph/font/FontFactory.java | 20 +-
.../classes/com/jogamp/graph/font/FontSet.java | 16 +-
.../classes/com/jogamp/graph/geom/Outline.java | 36 +-
.../classes/com/jogamp/graph/geom/Triangle.java | 10 +-
src/jogl/classes/com/jogamp/graph/geom/Vertex.java | 22 +-
.../com/jogamp/graph/geom/opengl/SVertex.java | 40 +-
src/jogl/classes/com/jogamp/opengl/FBObject.java | 786 ++++++++++-----------
.../com/jogamp/opengl/GLAutoDrawableDelegate.java | 56 +-
.../com/jogamp/opengl/GLEventListenerState.java | 118 ++--
.../classes/com/jogamp/opengl/GLExtensions.java | 22 +-
.../com/jogamp/opengl/GLRendererQuirks.java | 64 +-
.../classes/com/jogamp/opengl/GLStateKeeper.java | 38 +-
.../opengl/GenericGLCapabilitiesChooser.java | 10 +-
.../classes/com/jogamp/opengl/JoglVersion.java | 40 +-
.../opengl/cg/CgDynamicLibraryBundleInfo.java | 24 +-
.../classes/com/jogamp/opengl/cg/CgException.java | 14 +-
.../classes/com/jogamp/opengl/math/FixedPoint.java | 12 +-
.../classes/com/jogamp/opengl/math/FloatUtil.java | 88 +--
.../classes/com/jogamp/opengl/math/Quaternion.java | 38 +-
.../classes/com/jogamp/opengl/math/VectorUtil.java | 46 +-
.../com/jogamp/opengl/math/Vert2fImmutable.java | 4 +-
.../com/jogamp/opengl/math/geom/AABBox.java | 84 +--
.../com/jogamp/opengl/math/geom/Frustum.java | 82 +--
.../classes/com/jogamp/opengl/swt/GLCanvas.java | 134 ++--
.../com/jogamp/opengl/util/AWTAnimatorImpl.java | 10 +-
.../classes/com/jogamp/opengl/util/Animator.java | 34 +-
.../com/jogamp/opengl/util/AnimatorBase.java | 106 +--
.../jogamp/opengl/util/DefaultAnimatorImpl.java | 10 +-
.../com/jogamp/opengl/util/FPSAnimator.java | 66 +-
.../com/jogamp/opengl/util/GLArrayDataClient.java | 80 +--
.../jogamp/opengl/util/GLArrayDataEditable.java | 28 +-
.../com/jogamp/opengl/util/GLArrayDataServer.java | 122 ++--
.../com/jogamp/opengl/util/GLArrayDataWrapper.java | 112 +--
.../classes/com/jogamp/opengl/util/GLBuffers.java | 388 +++++-----
.../com/jogamp/opengl/util/GLDrawableUtil.java | 50 +-
.../com/jogamp/opengl/util/GLPixelBuffer.java | 126 ++--
.../jogamp/opengl/util/GLPixelStorageModes.java | 48 +-
.../com/jogamp/opengl/util/GLReadBufferUtil.java | 62 +-
src/jogl/classes/com/jogamp/opengl/util/Gamma.java | 14 +-
.../com/jogamp/opengl/util/ImmModeSink.java | 382 +++++-----
.../classes/com/jogamp/opengl/util/PMVMatrix.java | 276 ++++----
.../com/jogamp/opengl/util/RandomTileRenderer.java | 56 +-
.../classes/com/jogamp/opengl/util/TGAWriter.java | 16 +-
.../com/jogamp/opengl/util/TileRenderer.java | 78 +-
.../com/jogamp/opengl/util/TileRendererBase.java | 148 ++--
.../classes/com/jogamp/opengl/util/TimeFrameI.java | 30 +-
.../com/jogamp/opengl/util/av/AudioSink.java | 188 ++---
.../jogamp/opengl/util/av/AudioSinkFactory.java | 10 +-
.../com/jogamp/opengl/util/av/GLMediaPlayer.java | 192 ++---
.../opengl/util/av/GLMediaPlayerFactory.java | 12 +-
.../jogamp/opengl/util/awt/AWTGLPixelBuffer.java | 78 +-
.../opengl/util/awt/AWTGLReadBufferUtil.java | 12 +-
.../com/jogamp/opengl/util/awt/ImageUtil.java | 26 +-
.../com/jogamp/opengl/util/awt/Overlay.java | 14 +-
.../com/jogamp/opengl/util/awt/Screenshot.java | 28 +-
.../com/jogamp/opengl/util/awt/TextRenderer.java | 12 +-
.../jogamp/opengl/util/awt/TextureRenderer.java | 28 +-
.../com/jogamp/opengl/util/gl2/BitmapCharRec.java | 18 +-
.../com/jogamp/opengl/util/gl2/BitmapFontRec.java | 18 +-
.../com/jogamp/opengl/util/gl2/CoordRec.java | 18 +-
.../classes/com/jogamp/opengl/util/gl2/GLUT.java | 52 +-
.../com/jogamp/opengl/util/gl2/GLUTBitmap8x13.java | 14 +-
.../com/jogamp/opengl/util/gl2/GLUTBitmap9x15.java | 14 +-
.../opengl/util/gl2/GLUTBitmapHelvetica10.java | 14 +-
.../opengl/util/gl2/GLUTBitmapHelvetica12.java | 14 +-
.../opengl/util/gl2/GLUTBitmapHelvetica18.java | 14 +-
.../opengl/util/gl2/GLUTBitmapTimesRoman10.java | 14 +-
.../opengl/util/gl2/GLUTBitmapTimesRoman24.java | 14 +-
.../opengl/util/gl2/GLUTStrokeMonoRoman.java | 14 +-
.../jogamp/opengl/util/gl2/GLUTStrokeRoman.java | 14 +-
.../com/jogamp/opengl/util/gl2/StrokeCharRec.java | 18 +-
.../com/jogamp/opengl/util/gl2/StrokeFontRec.java | 18 +-
.../com/jogamp/opengl/util/gl2/StrokeRec.java | 20 +-
.../com/jogamp/opengl/util/glsl/ShaderCode.java | 208 +++---
.../com/jogamp/opengl/util/glsl/ShaderProgram.java | 42 +-
.../com/jogamp/opengl/util/glsl/ShaderState.java | 232 +++---
.../com/jogamp/opengl/util/glsl/ShaderUtil.java | 54 +-
.../opengl/util/glsl/fixedfunc/FixedFuncUtil.java | 12 +-
.../util/glsl/fixedfunc/ShaderSelectionMode.java | 18 +-
.../jogamp/opengl/util/glsl/sdk/CompileShader.java | 4 +-
.../opengl/util/packrect/BackingStoreManager.java | 14 +-
.../com/jogamp/opengl/util/packrect/Level.java | 16 +-
.../com/jogamp/opengl/util/packrect/LevelSet.java | 16 +-
.../com/jogamp/opengl/util/packrect/Rect.java | 16 +-
.../jogamp/opengl/util/packrect/RectVisitor.java | 14 +-
.../opengl/util/packrect/RectanglePacker.java | 16 +-
.../com/jogamp/opengl/util/texture/Texture.java | 86 +--
.../jogamp/opengl/util/texture/TextureCoords.java | 16 +-
.../jogamp/opengl/util/texture/TextureData.java | 94 +--
.../com/jogamp/opengl/util/texture/TextureIO.java | 74 +-
.../opengl/util/texture/TextureSequence.java | 120 ++--
.../jogamp/opengl/util/texture/TextureState.java | 52 +-
.../opengl/util/texture/awt/AWTTextureData.java | 28 +-
.../opengl/util/texture/awt/AWTTextureIO.java | 18 +-
.../jogamp/opengl/util/texture/spi/DDSImage.java | 22 +-
.../jogamp/opengl/util/texture/spi/JPEGImage.java | 40 +-
.../opengl/util/texture/spi/LEDataInputStream.java | 22 +-
.../util/texture/spi/LEDataOutputStream.java | 14 +-
.../util/texture/spi/NetPbmTextureWriter.java | 36 +-
.../jogamp/opengl/util/texture/spi/PNGImage.java | 66 +-
.../jogamp/opengl/util/texture/spi/SGIImage.java | 38 +-
.../jogamp/opengl/util/texture/spi/TGAImage.java | 34 +-
.../opengl/util/texture/spi/TextureProvider.java | 14 +-
.../opengl/util/texture/spi/TextureWriter.java | 14 +-
.../util/texture/spi/awt/IIOTextureProvider.java | 14 +-
.../util/texture/spi/awt/IIOTextureWriter.java | 16 +-
src/jogl/classes/javax/media/opengl/DebugGL2.java | 2 +-
src/jogl/classes/javax/media/opengl/DebugGL3.java | 2 +-
.../classes/javax/media/opengl/DebugGL3bc.java | 2 +-
src/jogl/classes/javax/media/opengl/DebugGL4.java | 2 +-
.../classes/javax/media/opengl/DebugGLES2.java | 2 +-
.../media/opengl/DefaultGLCapabilitiesChooser.java | 32 +-
.../classes/javax/media/opengl/FPSCounter.java | 32 +-
.../javax/media/opengl/GLAnimatorControl.java | 16 +-
.../classes/javax/media/opengl/GLArrayData.java | 20 +-
.../classes/javax/media/opengl/GLAutoDrawable.java | 120 ++--
src/jogl/classes/javax/media/opengl/GLBase.java | 108 +--
.../classes/javax/media/opengl/GLCapabilities.java | 16 +-
.../javax/media/opengl/GLCapabilitiesChooser.java | 16 +-
.../media/opengl/GLCapabilitiesImmutable.java | 10 +-
src/jogl/classes/javax/media/opengl/GLContext.java | 320 ++++-----
.../javax/media/opengl/GLDebugListener.java | 8 +-
.../classes/javax/media/opengl/GLDebugMessage.java | 114 +--
.../classes/javax/media/opengl/GLDrawable.java | 22 +-
.../javax/media/opengl/GLDrawableFactory.java | 152 ++--
.../javax/media/opengl/GLEventListener.java | 22 +-
.../classes/javax/media/opengl/GLException.java | 14 +-
.../classes/javax/media/opengl/GLFBODrawable.java | 76 +-
.../media/opengl/GLOffscreenAutoDrawable.java | 20 +-
src/jogl/classes/javax/media/opengl/GLPbuffer.java | 4 +-
.../javax/media/opengl/GLPipelineFactory.java | 22 +-
src/jogl/classes/javax/media/opengl/GLProfile.java | 282 ++++----
.../classes/javax/media/opengl/GLRunnable.java | 20 +-
.../classes/javax/media/opengl/GLRunnable2.java | 14 +-
.../classes/javax/media/opengl/GLUniformData.java | 14 +-
src/jogl/classes/javax/media/opengl/Threading.java | 52 +-
src/jogl/classes/javax/media/opengl/TraceGL2.java | 2 +-
src/jogl/classes/javax/media/opengl/TraceGL3.java | 2 +-
.../classes/javax/media/opengl/TraceGL3bc.java | 2 +-
src/jogl/classes/javax/media/opengl/TraceGL4.java | 2 +-
.../classes/javax/media/opengl/TraceGLES2.java | 2 +-
.../javax/media/opengl/awt/ComponentEvents.java | 14 +-
.../classes/javax/media/opengl/awt/GLCanvas.java | 104 +--
.../classes/javax/media/opengl/awt/GLJPanel.java | 192 ++---
.../javax/media/opengl/fixedfunc/GLMatrixFunc.java | 18 +-
.../media/opengl/fixedfunc/GLPointerFunc.java | 2 +-
.../media/opengl/fixedfunc/GLPointerFuncUtil.java | 10 +-
.../jogamp/graph/curve/opengl/RegionFactory.java | 20 +-
.../graph/curve/opengl/RegionRendererImpl01.java | 24 +-
.../jogamp/graph/curve/opengl/RenderStateImpl.java | 14 +-
.../graph/curve/opengl/TextRendererImpl01.java | 26 +-
.../jogamp/graph/curve/opengl/VBORegion2PES2.java | 178 ++---
.../jogamp/graph/curve/opengl/VBORegionSPES2.java | 34 +-
.../graph/curve/opengl/shader/AttributeNames.java | 12 +-
.../graph/curve/opengl/shader/UniformNames.java | 2 +-
.../jogamp/graph/curve/tess/CDTriangulator2D.java | 30 +-
.../jogamp/graph/curve/tess/GraphOutline.java | 10 +-
.../jogamp/graph/curve/tess/GraphVertex.java | 12 +-
.../classes/jogamp/graph/curve/tess/HEdge.java | 12 +-
src/jogl/classes/jogamp/graph/curve/tess/Loop.java | 30 +-
.../jogamp/graph/curve/text/GlyphShape.java | 20 +-
.../jogamp/graph/curve/text/GlyphString.java | 58 +-
src/jogl/classes/jogamp/graph/font/FontInt.java | 2 +-
.../classes/jogamp/graph/font/JavaFontLoader.java | 46 +-
.../jogamp/graph/font/UbuntuFontLoader.java | 36 +-
.../jogamp/graph/font/typecast/TypecastFont.java | 56 +-
.../font/typecast/TypecastFontConstructor.java | 10 +-
.../jogamp/graph/font/typecast/TypecastGlyph.java | 88 +--
.../graph/font/typecast/TypecastHMetrics.java | 14 +-
.../graph/font/typecast/TypecastRenderer.java | 26 +-
.../graph/font/typecast/ot/Disassembler.java | 8 +-
.../jogamp/graph/font/typecast/ot/Fixed.java | 4 +-
.../jogamp/graph/font/typecast/ot/Mnemonic.java | 8 +-
.../jogamp/graph/font/typecast/ot/OTFont.java | 36 +-
.../graph/font/typecast/ot/OTFontCollection.java | 4 +-
.../jogamp/graph/font/typecast/ot/OTGlyph.java | 8 +-
.../graph/font/typecast/ot/mac/ResourceData.java | 2 +-
.../graph/font/typecast/ot/mac/ResourceFile.java | 10 +-
.../graph/font/typecast/ot/mac/ResourceHeader.java | 6 +-
.../graph/font/typecast/ot/mac/ResourceMap.java | 10 +-
.../font/typecast/ot/mac/ResourceReference.java | 12 +-
.../graph/font/typecast/ot/mac/ResourceType.java | 10 +-
.../graph/font/typecast/ot/table/BaseTable.java | 98 +--
.../graph/font/typecast/ot/table/CffTable.java | 122 ++--
.../graph/font/typecast/ot/table/Charstring.java | 2 +-
.../font/typecast/ot/table/CharstringType2.java | 18 +-
.../graph/font/typecast/ot/table/ClassDef.java | 8 +-
.../font/typecast/ot/table/ClassDefFormat1.java | 8 +-
.../font/typecast/ot/table/ClassDefFormat2.java | 8 +-
.../graph/font/typecast/ot/table/CmapFormat.java | 14 +-
.../graph/font/typecast/ot/table/CmapFormat0.java | 2 +-
.../graph/font/typecast/ot/table/CmapFormat2.java | 28 +-
.../graph/font/typecast/ot/table/CmapFormat4.java | 4 +-
.../graph/font/typecast/ot/table/CmapFormat6.java | 4 +-
.../font/typecast/ot/table/CmapFormatUnknown.java | 6 +-
.../font/typecast/ot/table/CmapIndexEntry.java | 2 +-
.../graph/font/typecast/ot/table/CmapTable.java | 10 +-
.../graph/font/typecast/ot/table/Coverage.java | 2 +-
.../graph/font/typecast/ot/table/CvtTable.java | 12 +-
.../graph/font/typecast/ot/table/Device.java | 8 +-
.../font/typecast/ot/table/DirectoryEntry.java | 4 +-
.../graph/font/typecast/ot/table/DsigEntry.java | 14 +-
.../graph/font/typecast/ot/table/DsigTable.java | 12 +-
.../graph/font/typecast/ot/table/FeatureList.java | 8 +-
.../font/typecast/ot/table/FeatureRecord.java | 2 +-
.../graph/font/typecast/ot/table/FpgmTable.java | 12 +-
.../graph/font/typecast/ot/table/GaspRange.java | 12 +-
.../graph/font/typecast/ot/table/GaspTable.java | 14 +-
.../typecast/ot/table/GlyfCompositeDescript.java | 2 +-
.../graph/font/typecast/ot/table/GlyfDescript.java | 2 +-
.../font/typecast/ot/table/GlyfSimpleDescript.java | 4 +-
.../graph/font/typecast/ot/table/GlyfTable.java | 6 +-
.../font/typecast/ot/table/GlyphDescription.java | 24 +-
.../graph/font/typecast/ot/table/GposTable.java | 4 +-
.../graph/font/typecast/ot/table/GsubTable.java | 20 +-
.../graph/font/typecast/ot/table/HdmxTable.java | 20 +-
.../graph/font/typecast/ot/table/HeadTable.java | 4 +-
.../graph/font/typecast/ot/table/HheaTable.java | 12 +-
.../jogamp/graph/font/typecast/ot/table/ID.java | 4 +-
.../graph/font/typecast/ot/table/KernSubtable.java | 12 +-
.../typecast/ot/table/KernSubtableFormat0.java | 10 +-
.../typecast/ot/table/KernSubtableFormat2.java | 8 +-
.../graph/font/typecast/ot/table/KernTable.java | 14 +-
.../graph/font/typecast/ot/table/KerningPair.java | 8 +-
.../graph/font/typecast/ot/table/LangSys.java | 10 +-
.../font/typecast/ot/table/LangSysRecord.java | 2 +-
.../graph/font/typecast/ot/table/Ligature.java | 4 +-
.../typecast/ot/table/LigatureSubstFormat1.java | 2 +-
.../graph/font/typecast/ot/table/LocaTable.java | 10 +-
.../graph/font/typecast/ot/table/Lookup.java | 2 +-
.../graph/font/typecast/ot/table/LookupList.java | 8 +-
.../typecast/ot/table/LookupSubtableFactory.java | 4 +-
.../graph/font/typecast/ot/table/LtshTable.java | 16 +-
.../graph/font/typecast/ot/table/MaxpTable.java | 14 +-
.../graph/font/typecast/ot/table/NameRecord.java | 18 +-
.../graph/font/typecast/ot/table/NameTable.java | 14 +-
.../graph/font/typecast/ot/table/Os2Table.java | 14 +-
.../graph/font/typecast/ot/table/Panose.java | 26 +-
.../graph/font/typecast/ot/table/PcltTable.java | 14 +-
.../graph/font/typecast/ot/table/PostTable.java | 18 +-
.../graph/font/typecast/ot/table/PrepTable.java | 12 +-
.../graph/font/typecast/ot/table/Program.java | 8 +-
.../graph/font/typecast/ot/table/RangeRecord.java | 2 +-
.../graph/font/typecast/ot/table/Script.java | 6 +-
.../graph/font/typecast/ot/table/ScriptList.java | 12 +-
.../graph/font/typecast/ot/table/ScriptRecord.java | 4 +-
.../font/typecast/ot/table/SignatureBlock.java | 10 +-
.../graph/font/typecast/ot/table/SingleSubst.java | 2 +-
.../font/typecast/ot/table/SingleSubstFormat1.java | 2 +-
.../font/typecast/ot/table/SingleSubstFormat2.java | 2 +-
.../graph/font/typecast/ot/table/TTCHeader.java | 12 +-
.../jogamp/graph/font/typecast/ot/table/Table.java | 12 +-
.../font/typecast/ot/table/TableDirectory.java | 2 +-
.../font/typecast/ot/table/TableException.java | 6 +-
.../graph/font/typecast/ot/table/TableFactory.java | 10 +-
.../graph/font/typecast/ot/table/VdmxTable.java | 40 +-
.../graph/font/typecast/ot/table/VheaTable.java | 2 +-
.../graph/font/typecast/t2/T2Interpreter.java | 146 ++--
.../graph/font/typecast/tt/engine/Interpreter.java | 4 +-
.../jogamp/graph/geom/plane/AffineTransform.java | 50 +-
.../classes/jogamp/graph/geom/plane/Crossing.java | 26 +-
.../classes/jogamp/graph/geom/plane/Path2D.java | 42 +-
src/jogl/classes/jogamp/opengl/Debug.java | 20 +-
.../opengl/DesktopGLDynamicLibraryBundleInfo.java | 14 +-
.../opengl/DesktopGLDynamicLookupHelper.java | 10 +-
.../jogamp/opengl/ExtensionAvailabilityCache.java | 38 +-
src/jogl/classes/jogamp/opengl/FPSCounterImpl.java | 50 +-
.../classes/jogamp/opengl/GLAutoDrawableBase.java | 144 ++--
.../classes/jogamp/opengl/GLBufferSizeTracker.java | 18 +-
.../jogamp/opengl/GLBufferStateTracker.java | 30 +-
src/jogl/classes/jogamp/opengl/GLContextImpl.java | 296 ++++----
.../classes/jogamp/opengl/GLContextShareSet.java | 50 +-
.../jogamp/opengl/GLDebugMessageHandler.java | 126 ++--
.../jogamp/opengl/GLDrawableFactoryImpl.java | 58 +-
.../classes/jogamp/opengl/GLDrawableHelper.java | 198 +++---
src/jogl/classes/jogamp/opengl/GLDrawableImpl.java | 64 +-
.../jogamp/opengl/GLDynamicLibraryBundleInfo.java | 18 +-
.../jogamp/opengl/GLDynamicLookupHelper.java | 10 +-
.../classes/jogamp/opengl/GLFBODrawableImpl.java | 142 ++--
.../jogamp/opengl/GLGraphicsConfigurationUtil.java | 60 +-
.../jogamp/opengl/GLOffscreenAutoDrawableImpl.java | 42 +-
src/jogl/classes/jogamp/opengl/GLPbufferImpl.java | 16 +-
src/jogl/classes/jogamp/opengl/GLRunnableTask.java | 28 +-
src/jogl/classes/jogamp/opengl/GLStateTracker.java | 52 +-
.../classes/jogamp/opengl/GLVersionNumber.java | 20 +-
src/jogl/classes/jogamp/opengl/GLWorkerThread.java | 24 +-
src/jogl/classes/jogamp/opengl/GLXExtensions.java | 4 +-
.../jogamp/opengl/ListenerSyncedImplStub.java | 12 +-
src/jogl/classes/jogamp/opengl/ProjectFloat.java | 120 ++--
.../jogamp/opengl/SharedResourceRunner.java | 44 +-
src/jogl/classes/jogamp/opengl/ThreadingImpl.java | 38 +-
.../jogamp/opengl/ToolkitThreadingPlugin.java | 16 +-
.../jogamp/opengl/awt/AWTThreadingPlugin.java | 16 +-
.../classes/jogamp/opengl/awt/AWTTilePainter.java | 74 +-
src/jogl/classes/jogamp/opengl/awt/AWTUtil.java | 16 +-
src/jogl/classes/jogamp/opengl/awt/Java2D.java | 46 +-
.../classes/jogamp/opengl/awt/VersionApplet.java | 6 +-
.../egl/DesktopES2DynamicLibraryBundleInfo.java | 26 +-
src/jogl/classes/jogamp/opengl/egl/EGLContext.java | 20 +-
.../classes/jogamp/opengl/egl/EGLDisplayUtil.java | 62 +-
.../classes/jogamp/opengl/egl/EGLDrawable.java | 20 +-
.../jogamp/opengl/egl/EGLDrawableFactory.java | 136 ++--
.../opengl/egl/EGLDummyUpstreamSurfaceHook.java | 12 +-
.../opengl/egl/EGLDynamicLibraryBundleInfo.java | 30 +-
.../opengl/egl/EGLES1DynamicLibraryBundleInfo.java | 28 +-
.../opengl/egl/EGLES2DynamicLibraryBundleInfo.java | 38 +-
.../opengl/egl/EGLGraphicsConfiguration.java | 58 +-
.../egl/EGLGraphicsConfigurationFactory.java | 68 +-
.../jogamp/opengl/egl/EGLOnscreenDrawable.java | 4 +-
.../jogamp/opengl/egl/EGLUpstreamSurfaceHook.java | 50 +-
.../jogamp/opengl/egl/EGLWrappedSurface.java | 10 +-
.../classes/jogamp/opengl/gl2/ProjectDouble.java | 92 +--
.../classes/jogamp/opengl/glu/GLUquadricImpl.java | 82 +--
src/jogl/classes/jogamp/opengl/glu/Glue.java | 16 +-
.../classes/jogamp/opengl/glu/error/Error.java | 16 +-
.../opengl/glu/gl2/nurbs/GL2CurveEvaluator.java | 2 +-
.../opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java | 38 +-
.../jogamp/opengl/glu/mipmap/BuildMipmap.java | 198 +++---
.../classes/jogamp/opengl/glu/mipmap/Extract.java | 8 +-
.../jogamp/opengl/glu/mipmap/Extract1010102.java | 24 +-
.../jogamp/opengl/glu/mipmap/Extract1555rev.java | 24 +-
.../opengl/glu/mipmap/Extract2101010rev.java | 24 +-
.../jogamp/opengl/glu/mipmap/Extract233rev.java | 18 +-
.../jogamp/opengl/glu/mipmap/Extract332.java | 18 +-
.../jogamp/opengl/glu/mipmap/Extract4444.java | 24 +-
.../jogamp/opengl/glu/mipmap/Extract4444rev.java | 24 +-
.../jogamp/opengl/glu/mipmap/Extract5551.java | 24 +-
.../jogamp/opengl/glu/mipmap/Extract565.java | 24 +-
.../jogamp/opengl/glu/mipmap/Extract565rev.java | 24 +-
.../jogamp/opengl/glu/mipmap/Extract8888.java | 24 +-
.../jogamp/opengl/glu/mipmap/Extract8888rev.java | 24 +-
.../jogamp/opengl/glu/mipmap/ExtractFloat.java | 14 +-
.../jogamp/opengl/glu/mipmap/ExtractPrimitive.java | 8 +-
.../jogamp/opengl/glu/mipmap/ExtractSByte.java | 14 +-
.../jogamp/opengl/glu/mipmap/ExtractSInt.java | 14 +-
.../jogamp/opengl/glu/mipmap/ExtractSShort.java | 14 +-
.../jogamp/opengl/glu/mipmap/ExtractUByte.java | 14 +-
.../jogamp/opengl/glu/mipmap/ExtractUInt.java | 14 +-
.../jogamp/opengl/glu/mipmap/ExtractUShort.java | 14 +-
.../jogamp/opengl/glu/mipmap/HalveImage.java | 276 ++++----
.../classes/jogamp/opengl/glu/mipmap/Image.java | 120 ++--
.../classes/jogamp/opengl/glu/mipmap/Mipmap.java | 200 +++---
.../opengl/glu/mipmap/PixelStorageModes.java | 14 +-
.../jogamp/opengl/glu/mipmap/ScaleInternal.java | 364 +++++-----
.../jogamp/opengl/glu/mipmap/Type_Widget.java | 80 +--
src/jogl/classes/jogamp/opengl/glu/nurbs/Arc.java | 18 +-
.../jogamp/opengl/glu/nurbs/ArcSdirSorter.java | 2 +-
.../jogamp/opengl/glu/nurbs/ArcTdirSorter.java | 2 +-
.../classes/jogamp/opengl/glu/nurbs/Backend.java | 2 +-
src/jogl/classes/jogamp/opengl/glu/nurbs/Bin.java | 2 +-
.../classes/jogamp/opengl/glu/nurbs/Breakpt.java | 4 +-
.../jogamp/opengl/glu/nurbs/CArrayOfArcs.java | 32 +-
.../jogamp/opengl/glu/nurbs/CArrayOfBreakpts.java | 22 +-
.../jogamp/opengl/glu/nurbs/CArrayOfFloats.java | 32 +-
.../opengl/glu/nurbs/CArrayOfQuiltspecs.java | 28 +-
.../classes/jogamp/opengl/glu/nurbs/Curve.java | 6 +-
.../classes/jogamp/opengl/glu/nurbs/Flist.java | 6 +-
.../classes/jogamp/opengl/glu/nurbs/Knotspec.java | 20 +-
.../jogamp/opengl/glu/nurbs/Knotvector.java | 14 +-
.../classes/jogamp/opengl/glu/nurbs/Mapdesc.java | 12 +-
.../jogamp/opengl/glu/nurbs/O_nurbscurve.java | 2 +-
.../classes/jogamp/opengl/glu/nurbs/Patchlist.java | 2 +-
.../classes/jogamp/opengl/glu/nurbs/Property.java | 6 +-
.../jogamp/opengl/glu/nurbs/Renderhints.java | 2 +-
.../jogamp/opengl/glu/nurbs/Subdivider.java | 6 +-
.../jogamp/opengl/glu/nurbs/TrimVertex.java | 4 +-
.../jogamp/opengl/glu/registry/Registry.java | 14 +-
.../jogamp/opengl/macosx/cgl/MacOSXCGLContext.java | 144 ++--
.../opengl/macosx/cgl/MacOSXCGLDrawable.java | 10 +-
.../macosx/cgl/MacOSXCGLDrawableFactory.java | 28 +-
.../cgl/MacOSXCGLDynamicLibraryBundleInfo.java | 18 +-
.../macosx/cgl/MacOSXCGLGraphicsConfiguration.java | 44 +-
.../cgl/MacOSXCGLGraphicsConfigurationFactory.java | 18 +-
.../macosx/cgl/MacOSXPbufferCGLDrawable.java | 4 +-
.../MacOSXAWTCGLGraphicsConfigurationFactory.java | 12 +-
.../classes/jogamp/opengl/util/GLArrayHandler.java | 24 +-
.../jogamp/opengl/util/GLArrayHandlerFlat.java | 14 +-
.../opengl/util/GLArrayHandlerInterleaved.java | 20 +-
.../jogamp/opengl/util/GLDataArrayHandler.java | 10 +-
.../jogamp/opengl/util/GLFixedArrayHandler.java | 16 +-
.../opengl/util/GLFixedArrayHandlerFlat.java | 8 +-
.../jogamp/opengl/util/GLVBOArrayHandler.java | 10 +-
.../jogamp/opengl/util/av/EGLMediaPlayerImpl.java | 46 +-
.../jogamp/opengl/util/av/GLMediaPlayerImpl.java | 284 ++++----
.../jogamp/opengl/util/av/JavaSoundAudioSink.java | 70 +-
.../jogamp/opengl/util/av/NullAudioSink.java | 54 +-
.../jogamp/opengl/util/av/NullGLMediaPlayer.java | 44 +-
.../av/impl/FFMPEGDynamicLibraryBundleInfo.java | 118 ++--
.../opengl/util/av/impl/FFMPEGMediaPlayer.java | 174 ++---
.../jogamp/opengl/util/av/impl/FFMPEGNatives.java | 92 +--
.../opengl/util/av/impl/FFMPEGStaticNatives.java | 10 +-
.../opengl/util/av/impl/FFMPEGv08Natives.java | 10 +-
.../opengl/util/av/impl/FFMPEGv09Natives.java | 10 +-
.../opengl/util/av/impl/FFMPEGv10Natives.java | 10 +-
.../opengl/util/av/impl/OMXGLMediaPlayer.java | 48 +-
.../jogamp/opengl/util/glsl/GLSLArrayHandler.java | 24 +-
.../opengl/util/glsl/GLSLArrayHandlerFlat.java | 10 +-
.../util/glsl/GLSLArrayHandlerInterleaved.java | 18 +-
.../jogamp/opengl/util/glsl/GLSLTextureRaster.java | 70 +-
.../opengl/util/glsl/fixedfunc/FixedFuncHook.java | 60 +-
.../util/glsl/fixedfunc/FixedFuncPipeline.java | 236 +++----
.../jogamp/opengl/util/jpeg/JPEGDecoder.java | 132 ++--
.../jogamp/opengl/util/pngj/FilterType.java | 2 +-
.../classes/jogamp/opengl/util/pngj/ImageInfo.java | 2 +-
.../classes/jogamp/opengl/util/pngj/ImageLine.java | 30 +-
.../jogamp/opengl/util/pngj/ImageLineHelper.java | 8 +-
.../jogamp/opengl/util/pngj/ImageLines.java | 8 +-
.../jogamp/opengl/util/pngj/PngHelperInternal.java | 2 +-
.../classes/jogamp/opengl/util/pngj/PngReader.java | 56 +-
.../classes/jogamp/opengl/util/pngj/PngWriter.java | 28 +-
.../jogamp/opengl/util/pngj/PngjException.java | 4 +-
.../opengl/util/pngj/PngjExceptionInternal.java | 4 +-
.../opengl/util/pngj/chunks/ChunkHelper.java | 14 +-
.../util/pngj/chunks/ChunkLoadBehaviour.java | 2 +-
.../opengl/util/pngj/chunks/ChunkPredicate.java | 2 +-
.../jogamp/opengl/util/pngj/chunks/ChunksList.java | 12 +-
.../util/pngj/chunks/ChunksListForWrite.java | 6 +-
.../jogamp/opengl/util/pngj/chunks/PngChunk.java | 2 +-
.../opengl/util/pngj/chunks/PngChunkBKGD.java | 6 +-
.../opengl/util/pngj/chunks/PngChunkMultiple.java | 4 +-
.../opengl/util/pngj/chunks/PngChunkSBIT.java | 2 +-
.../opengl/util/pngj/chunks/PngChunkTRNS.java | 2 +-
.../opengl/util/pngj/chunks/PngMetadata.java | 10 +-
.../opengl/windows/wgl/WGLGLCapabilities.java | 8 +-
.../classes/jogamp/opengl/windows/wgl/WGLUtil.java | 22 +-
.../windows/wgl/WindowsBitmapWGLDrawable.java | 4 +-
.../windows/wgl/WindowsExternalWGLContext.java | 2 +-
.../windows/wgl/WindowsPbufferWGLDrawable.java | 6 +-
.../opengl/windows/wgl/WindowsWGLContext.java | 10 +-
.../opengl/windows/wgl/WindowsWGLDrawable.java | 8 +-
.../windows/wgl/WindowsWGLDrawableFactory.java | 30 +-
.../wgl/WindowsWGLDynamicLibraryBundleInfo.java | 14 +-
.../wgl/WindowsWGLGraphicsConfiguration.java | 72 +-
.../WindowsWGLGraphicsConfigurationFactory.java | 42 +-
.../WindowsAWTWGLGraphicsConfigurationFactory.java | 22 +-
.../classes/jogamp/opengl/x11/glx/GLXUtil.java | 44 +-
.../opengl/x11/glx/X11ExternalGLXContext.java | 6 +-
.../opengl/x11/glx/X11ExternalGLXDrawable.java | 2 +-
.../jogamp/opengl/x11/glx/X11GLXContext.java | 18 +-
.../opengl/x11/glx/X11GLXDrawableFactory.java | 30 +-
.../x11/glx/X11GLXDynamicLibraryBundleInfo.java | 22 +-
.../x11/glx/X11GLXGraphicsConfiguration.java | 60 +-
.../glx/X11GLXGraphicsConfigurationFactory.java | 46 +-
.../DelegatedUpstreamSurfaceHookMutableSize.java | 6 +-
...elegatedUpstreamSurfaceHookWithSurfaceSize.java | 8 +-
.../nativewindow/MutableGraphicsConfiguration.java | 4 +-
.../jogamp/nativewindow/NativeWindowVersion.java | 10 +-
.../UpstreamSurfaceHookMutableSize.java | 10 +-
.../nativewindow/awt/AWTGraphicsConfiguration.java | 26 +-
.../jogamp/nativewindow/awt/AWTGraphicsDevice.java | 14 +-
.../jogamp/nativewindow/awt/AWTGraphicsScreen.java | 14 +-
.../jogamp/nativewindow/awt/AWTPrintLifecycle.java | 26 +-
.../nativewindow/awt/AWTWindowClosingProtocol.java | 2 +-
.../nativewindow/awt/DirectDataBufferInt.java | 62 +-
.../com/jogamp/nativewindow/awt/JAWTWindow.java | 52 +-
.../jogamp/nativewindow/egl/EGLGraphicsDevice.java | 30 +-
.../nativewindow/macosx/MacOSXGraphicsDevice.java | 10 +-
.../com/jogamp/nativewindow/swt/SWTAccessor.java | 164 ++---
.../windows/WindowsGraphicsDevice.java | 12 +-
.../nativewindow/x11/X11GraphicsConfiguration.java | 16 +-
.../jogamp/nativewindow/x11/X11GraphicsDevice.java | 30 +-
.../jogamp/nativewindow/x11/X11GraphicsScreen.java | 12 +-
.../AbstractGraphicsConfiguration.java | 16 +-
.../media/nativewindow/AbstractGraphicsDevice.java | 46 +-
.../media/nativewindow/AbstractGraphicsScreen.java | 16 +-
.../javax/media/nativewindow/Capabilities.java | 46 +-
.../media/nativewindow/CapabilitiesChooser.java | 16 +-
.../media/nativewindow/CapabilitiesImmutable.java | 8 +-
.../nativewindow/DefaultCapabilitiesChooser.java | 24 +-
.../nativewindow/DefaultGraphicsConfiguration.java | 18 +-
.../media/nativewindow/DefaultGraphicsDevice.java | 34 +-
.../media/nativewindow/DefaultGraphicsScreen.java | 12 +-
.../nativewindow/GraphicsConfigurationFactory.java | 84 +--
.../javax/media/nativewindow/MutableSurface.java | 4 +-
.../javax/media/nativewindow/NativeSurface.java | 40 +-
.../media/nativewindow/NativeWindowException.java | 14 +-
.../media/nativewindow/NativeWindowFactory.java | 134 ++--
.../media/nativewindow/OffscreenLayerOption.java | 12 +-
.../media/nativewindow/OffscreenLayerSurface.java | 22 +-
.../javax/media/nativewindow/ProxySurface.java | 60 +-
.../media/nativewindow/SurfaceUpdatedListener.java | 12 +-
.../javax/media/nativewindow/ToolkitLock.java | 14 +-
.../media/nativewindow/UpstreamSurfaceHook.java | 18 +-
.../javax/media/nativewindow/VisualIDHolder.java | 36 +-
.../media/nativewindow/WindowClosingProtocol.java | 4 +-
.../javax/media/nativewindow/util/Dimension.java | 18 +-
.../nativewindow/util/DimensionImmutable.java | 4 +-
.../javax/media/nativewindow/util/Insets.java | 18 +-
.../media/nativewindow/util/InsetsImmutable.java | 4 +-
.../javax/media/nativewindow/util/Point.java | 8 +-
.../media/nativewindow/util/PointImmutable.java | 6 +-
.../javax/media/nativewindow/util/Rectangle.java | 28 +-
.../nativewindow/util/RectangleImmutable.java | 10 +-
.../javax/media/nativewindow/util/SurfaceSize.java | 18 +-
.../classes/jogamp/nativewindow/Debug.java | 16 +-
.../DefaultGraphicsConfigurationFactoryImpl.java | 10 +-
.../jogamp/nativewindow/GlobalToolkitLock.java | 14 +-
.../jogamp/nativewindow/NWJNILibLoader.java | 12 +-
.../nativewindow/NativeWindowFactoryImpl.java | 16 +-
.../jogamp/nativewindow/NullToolkitLock.java | 10 +-
.../jogamp/nativewindow/ProxySurfaceImpl.java | 42 +-
.../jogamp/nativewindow/ResourceToolkitLock.java | 8 +-
.../nativewindow/SharedResourceToolkitLock.java | 18 +-
.../jogamp/nativewindow/SurfaceUpdatedHelper.java | 22 +-
.../jogamp/nativewindow/ToolkitProperties.java | 20 +-
.../jogamp/nativewindow/WrappedSurface.java | 10 +-
.../classes/jogamp/nativewindow/awt/AWTMisc.java | 20 +-
.../jogamp/nativewindow/jawt/JAWTJNILibLoader.java | 24 +-
.../classes/jogamp/nativewindow/jawt/JAWTUtil.java | 112 +--
.../nativewindow/jawt/JAWT_PlatformInfo.java | 14 +-
.../nativewindow/jawt/macosx/MacOSXJAWTWindow.java | 82 +--
.../jawt/windows/Win32SunJDKReflection.java | 14 +-
.../jawt/windows/WindowsJAWTWindow.java | 16 +-
.../nativewindow/jawt/x11/X11JAWTWindow.java | 18 +-
.../nativewindow/jawt/x11/X11SunJDKReflection.java | 14 +-
.../macosx/OSXDummyUpstreamSurfaceHook.java | 14 +-
.../jogamp/nativewindow/macosx/OSXUtil.java | 94 +--
.../windows/GDIDummyUpstreamSurfaceHook.java | 18 +-
.../jogamp/nativewindow/windows/GDISurface.java | 14 +-
.../jogamp/nativewindow/windows/GDIUtil.java | 36 +-
.../nativewindow/windows/RegisteredClass.java | 2 +-
.../windows/RegisteredClassFactory.java | 16 +-
.../x11/X11DummyUpstreamSurfaceHook.java | 14 +-
.../x11/X11GraphicsConfigurationFactory.java | 16 +-
.../classes/jogamp/nativewindow/x11/X11Util.java | 94 +--
.../awt/X11AWTGraphicsConfigurationFactory.java | 36 +-
src/newt/classes/com/jogamp/newt/Display.java | 32 +-
.../classes/com/jogamp/newt/MonitorDevice.java | 46 +-
src/newt/classes/com/jogamp/newt/MonitorMode.java | 84 +--
src/newt/classes/com/jogamp/newt/NewtFactory.java | 24 +-
src/newt/classes/com/jogamp/newt/NewtVersion.java | 10 +-
src/newt/classes/com/jogamp/newt/Screen.java | 34 +-
src/newt/classes/com/jogamp/newt/Window.java | 32 +-
.../classes/com/jogamp/newt/awt/NewtCanvasAWT.java | 158 ++---
.../jogamp/newt/awt/applet/JOGLNewtApplet1Run.java | 24 +-
.../jogamp/newt/awt/applet/JOGLNewtAppletBase.java | 22 +-
.../jogamp/newt/event/DoubleTapScrollGesture.java | 66 +-
.../com/jogamp/newt/event/GestureHandler.java | 60 +-
.../classes/com/jogamp/newt/event/InputEvent.java | 56 +-
.../classes/com/jogamp/newt/event/KeyAdapter.java | 10 +-
.../classes/com/jogamp/newt/event/KeyEvent.java | 256 +++----
.../classes/com/jogamp/newt/event/KeyListener.java | 22 +-
.../com/jogamp/newt/event/MonitorEvent.java | 12 +-
.../com/jogamp/newt/event/MouseAdapter.java | 10 +-
.../classes/com/jogamp/newt/event/MouseEvent.java | 164 ++---
.../com/jogamp/newt/event/MouseListener.java | 20 +-
.../classes/com/jogamp/newt/event/NEWTEvent.java | 30 +-
.../com/jogamp/newt/event/NEWTEventConsumer.java | 14 +-
.../com/jogamp/newt/event/NEWTEventFiFo.java | 10 +-
.../com/jogamp/newt/event/NEWTEventListener.java | 12 +-
.../classes/com/jogamp/newt/event/OutputEvent.java | 2 +-
.../com/jogamp/newt/event/PinchToZoomGesture.java | 48 +-
.../com/jogamp/newt/event/TraceKeyAdapter.java | 10 +-
.../com/jogamp/newt/event/TraceMouseAdapter.java | 10 +-
.../com/jogamp/newt/event/TraceWindowAdapter.java | 10 +-
.../com/jogamp/newt/event/WindowAdapter.java | 10 +-
.../classes/com/jogamp/newt/event/WindowEvent.java | 16 +-
.../com/jogamp/newt/event/WindowListener.java | 18 +-
.../com/jogamp/newt/event/WindowUpdateEvent.java | 10 +-
.../com/jogamp/newt/event/awt/AWTAdapter.java | 36 +-
.../com/jogamp/newt/event/awt/AWTKeyAdapter.java | 12 +-
.../com/jogamp/newt/event/awt/AWTMouseAdapter.java | 12 +-
.../jogamp/newt/event/awt/AWTWindowAdapter.java | 24 +-
.../classes/com/jogamp/newt/opengl/GLWindow.java | 38 +-
.../classes/com/jogamp/newt/swt/NewtCanvasSWT.java | 130 ++--
src/newt/classes/com/jogamp/newt/util/EDTUtil.java | 30 +-
.../classes/com/jogamp/newt/util/MainThread.java | 90 +--
.../com/jogamp/newt/util/MonitorModeUtil.java | 18 +-
src/newt/classes/jogamp/newt/Debug.java | 18 +-
src/newt/classes/jogamp/newt/DefaultEDTUtil.java | 36 +-
src/newt/classes/jogamp/newt/DisplayImpl.java | 66 +-
.../classes/jogamp/newt/MonitorDeviceImpl.java | 28 +-
src/newt/classes/jogamp/newt/MonitorModeProps.java | 44 +-
src/newt/classes/jogamp/newt/NEWTJNILibLoader.java | 16 +-
src/newt/classes/jogamp/newt/OffscreenWindow.java | 28 +-
src/newt/classes/jogamp/newt/ScreenImpl.java | 98 +--
.../classes/jogamp/newt/ScreenMonitorState.java | 18 +-
src/newt/classes/jogamp/newt/WindowImpl.java | 554 +++++++--------
.../classes/jogamp/newt/awt/NewtFactoryAWT.java | 16 +-
.../jogamp/newt/awt/event/AWTNewtEventFactory.java | 74 +-
.../newt/awt/event/AWTParentWindowAdapter.java | 20 +-
.../jogamp/newt/driver/DriverClearFocus.java | 6 +-
.../jogamp/newt/driver/DriverUpdatePosition.java | 8 +-
.../classes/jogamp/newt/driver/awt/AWTCanvas.java | 40 +-
.../classes/jogamp/newt/driver/awt/AWTEDTUtil.java | 32 +-
.../jogamp/newt/driver/awt/DisplayDriver.java | 16 +-
.../jogamp/newt/driver/awt/ScreenDriver.java | 28 +-
.../jogamp/newt/driver/awt/WindowDriver.java | 50 +-
.../jogamp/newt/driver/bcm/egl/DisplayDriver.java | 12 +-
.../jogamp/newt/driver/bcm/egl/ScreenDriver.java | 20 +-
.../jogamp/newt/driver/bcm/egl/WindowDriver.java | 22 +-
.../newt/driver/bcm/vc/iv/DisplayDriver.java | 10 +-
.../jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java | 22 +-
.../jogamp/newt/driver/bcm/vc/iv/WindowDriver.java | 30 +-
.../newt/driver/intel/gdl/DisplayDriver.java | 12 +-
.../jogamp/newt/driver/intel/gdl/ScreenDriver.java | 22 +-
.../jogamp/newt/driver/intel/gdl/WindowDriver.java | 18 +-
.../jogamp/newt/driver/kd/DisplayDriver.java | 12 +-
.../jogamp/newt/driver/kd/ScreenDriver.java | 26 +-
.../jogamp/newt/driver/kd/WindowDriver.java | 22 +-
.../newt/driver/linux/LinuxEventDeviceTracker.java | 16 +-
.../newt/driver/linux/LinuxMouseTracker.java | 46 +-
.../jogamp/newt/driver/macosx/DisplayDriver.java | 18 +-
.../jogamp/newt/driver/macosx/MacKeyUtil.java | 38 +-
.../jogamp/newt/driver/macosx/ScreenDriver.java | 32 +-
.../jogamp/newt/driver/macosx/WindowDriver.java | 126 ++--
.../jogamp/newt/driver/windows/DisplayDriver.java | 18 +-
.../jogamp/newt/driver/windows/ScreenDriver.java | 28 +-
.../jogamp/newt/driver/windows/WindowDriver.java | 90 +--
.../jogamp/newt/driver/x11/DisplayDriver.java | 28 +-
src/newt/classes/jogamp/newt/driver/x11/RandR.java | 22 +-
.../classes/jogamp/newt/driver/x11/RandR11.java | 66 +-
.../classes/jogamp/newt/driver/x11/RandR13.java | 60 +-
.../jogamp/newt/driver/x11/ScreenDriver.java | 68 +-
.../jogamp/newt/driver/x11/WindowDriver.java | 92 +--
.../classes/jogamp/newt/event/NEWTEventTask.java | 10 +-
src/newt/classes/jogamp/newt/swt/SWTEDTUtil.java | 46 +-
.../jogamp/newt/swt/event/SWTNewtEventFactory.java | 48 +-
643 files changed, 12269 insertions(+), 12269 deletions(-)
(limited to 'src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java')
diff --git a/src/jogl/classes/com/jogamp/audio/windows/waveout/Audio.java b/src/jogl/classes/com/jogamp/audio/windows/waveout/Audio.java
index 2b51be164..83f5e4ebd 100644
--- a/src/jogl/classes/com/jogamp/audio/windows/waveout/Audio.java
+++ b/src/jogl/classes/com/jogamp/audio/windows/waveout/Audio.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
diff --git a/src/jogl/classes/com/jogamp/audio/windows/waveout/Mixer.java b/src/jogl/classes/com/jogamp/audio/windows/waveout/Mixer.java
index 60972873e..0a502c123 100644
--- a/src/jogl/classes/com/jogamp/audio/windows/waveout/Mixer.java
+++ b/src/jogl/classes/com/jogamp/audio/windows/waveout/Mixer.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -344,7 +344,7 @@ public class Mixer {
e.printStackTrace();
}
}
-
+
if (directByteBufferConstructor != null) {
try {
return (ByteBuffer)
diff --git a/src/jogl/classes/com/jogamp/audio/windows/waveout/SoundBuffer.java b/src/jogl/classes/com/jogamp/audio/windows/waveout/SoundBuffer.java
index c45430d23..01346553c 100644
--- a/src/jogl/classes/com/jogamp/audio/windows/waveout/SoundBuffer.java
+++ b/src/jogl/classes/com/jogamp/audio/windows/waveout/SoundBuffer.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
diff --git a/src/jogl/classes/com/jogamp/audio/windows/waveout/Track.java b/src/jogl/classes/com/jogamp/audio/windows/waveout/Track.java
index b57bf1dc6..98a787478 100644
--- a/src/jogl/classes/com/jogamp/audio/windows/waveout/Track.java
+++ b/src/jogl/classes/com/jogamp/audio/windows/waveout/Track.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -151,7 +151,7 @@ public class Track {
// These are only for use by the Mixer
private float leftGain;
private float rightGain;
-
+
void setLeftGain(float leftGain) {
this.leftGain = leftGain;
}
diff --git a/src/jogl/classes/com/jogamp/audio/windows/waveout/Vec3f.java b/src/jogl/classes/com/jogamp/audio/windows/waveout/Vec3f.java
index 1afdaf081..0726e5762 100644
--- a/src/jogl/classes/com/jogamp/audio/windows/waveout/Vec3f.java
+++ b/src/jogl/classes/com/jogamp/audio/windows/waveout/Vec3f.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java b/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java
index b04f35230..8429fbcfd 100644
--- a/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java
+++ b/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,11 +29,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -67,7 +67,7 @@ public class BuildComposablePipeline {
* By extra command-line argument: prolog_xor_downstream.
*
* If true, either prolog (if exist) is called or downstream's method, but not both.
- * By default, both methods would be called.
+ * By default, both methods would be called.
*
*
Default: false
*/
@@ -81,7 +81,7 @@ public class BuildComposablePipeline {
*
Default: false
*/
public static final int GEN_GL_IDENTITY_BY_ASSIGNABLE_CLASS = 1 << 4;
-
+
int mode;
private String outputDir;
private String outputPackage;
diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/BuildStaticGLInfo.java b/src/jogl/classes/com/jogamp/gluegen/opengl/BuildStaticGLInfo.java
index 5298cc357..a5a26d18f 100644
--- a/src/jogl/classes/com/jogamp/gluegen/opengl/BuildStaticGLInfo.java
+++ b/src/jogl/classes/com/jogamp/gluegen/opengl/BuildStaticGLInfo.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,11 +29,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -68,7 +68,7 @@ import java.util.regex.Pattern;
*
*
*
- *
+ *
* #ifndef GL_XXXX
* GLAPI glFuncName()
* #endif GL_XXXX
@@ -78,7 +78,7 @@ import java.util.regex.Pattern;
* For example, if it parses the following data:
*
*
*
* It will associate
@@ -105,7 +105,7 @@ import java.util.regex.Pattern;
* */
public class BuildStaticGLInfo {
- // Handles function pointer
+ // Handles function pointer
protected static final int funcIdentifierGroup = 9;
protected static Pattern funcPattern =
Pattern.compile("^(GLAPI|GL_API|GL_APICALL|EGLAPI|extern)?(\\s*)((unsigned|const)\\s+)?(\\w+)(\\s+\\*\\s*|\\s*\\*\\s+|\\s+)?(GLAPIENTRY|GL_APIENTRY|APIENTRY|EGLAPIENTRY|WINAPI)?(\\s*)([ew]?gl\\w+)\\s?(\\(.*)");
@@ -119,7 +119,7 @@ public class BuildStaticGLInfo {
Pattern.compile("\\#(elif|else)(.*)");
protected static Pattern endifPattern =
Pattern.compile("\\#endif(.*)");
-
+
protected static final int defineIdentifierGroup = 1;
protected static Pattern definePattern =
Pattern.compile("\\#define ([CEW]?GL[XU]?_[A-Za-z0-9_]+)\\s*([A-Za-z0-9_]+)(.*)");
@@ -203,7 +203,7 @@ public class BuildStaticGLInfo {
Matcher m = null;
int block = 0;
while ((line = reader.readLine()) != null) {
- int type = 0; // 1-define, 2-function
+ int type = 0; // 1-define, 2-function
if ( 0 < block ) { // inside a #ifndef GL_XXX block and matching a function, if block > 0
String identifier = null;
if( 2 >= block ) { // not within sub-blocks > 2, i.e. further typedefs
@@ -216,9 +216,9 @@ public class BuildStaticGLInfo {
}
}
if ( identifier != null &&
- activeAssociation != null &&
- !identifier.equals(activeAssociation) // Handles #ifndef GL_... #define GL_...
- )
+ activeAssociation != null &&
+ !identifier.equals(activeAssociation) // Handles #ifndef GL_... #define GL_...
+ )
{
addAssociation(identifier, activeAssociation);
if (DEBUG) {
@@ -243,7 +243,7 @@ public class BuildStaticGLInfo {
if (DEBUG) {
System.err.println("<"+block+"> END ASSOCIATION BLOCK: <" + activeAssociation + " <-> " + comment + ">");
}
- activeAssociation = null;
+ activeAssociation = null;
} else {
if (DEBUG) {
System.err.println("<"+block+"> END IF BLOCK: <" + comment + ">");
@@ -251,7 +251,7 @@ public class BuildStaticGLInfo {
}
}
}
- } else if ((m = associationPattern.matcher(line)).matches()) {
+ } else if ((m = associationPattern.matcher(line)).matches()) {
// found a new #ifndef GL_XXX block
activeAssociation = m.group(1).trim();
block++;
@@ -387,7 +387,7 @@ public class BuildStaticGLInfo {
declarationToExtensionMap.put(identifier, extensions);
}
extensions.add(association);
-
+
Set identifiers = extensionToDeclarationMap.get(association);
if (identifiers == null) {
identifiers = new HashSet();
diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/GLConfiguration.java b/src/jogl/classes/com/jogamp/gluegen/opengl/GLConfiguration.java
index a00b19abc..f1a32fa9c 100644
--- a/src/jogl/classes/com/jogamp/gluegen/opengl/GLConfiguration.java
+++ b/src/jogl/classes/com/jogamp/gluegen/opengl/GLConfiguration.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,11 +29,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -241,7 +241,7 @@ public class GLConfiguration extends ProcAddressConfiguration {
}
}
if( ignoredExtension ) {
- ignoredExtension = !shouldForceExtension( symbol, true, symbol );
+ ignoredExtension = !shouldForceExtension( symbol, true, symbol );
if( ignoredExtension ) {
final Set origSymbols = getRenamedJavaSymbols( symbol );
if(null != origSymbols) {
@@ -251,7 +251,7 @@ public class GLConfiguration extends ProcAddressConfiguration {
break;
}
}
- }
+ }
}
}
if( ignoredExtension ) {
@@ -274,7 +274,7 @@ public class GLConfiguration extends ProcAddressConfiguration {
}
return false;
}
-
+
public boolean shouldForceExtension(final String symbol, final boolean criteria, final String renamedSymbol) {
if (criteria && glInfo != null) {
final Set extensionNames = glInfo.getExtension(symbol);
@@ -292,7 +292,7 @@ public class GLConfiguration extends ProcAddressConfiguration {
}
return true;
}
- }
+ }
}
}
return false;
@@ -343,9 +343,9 @@ public class GLConfiguration extends ProcAddressConfiguration {
public boolean isBufferObjectFunction(String name) {
return (getBufferObjectKind(name) != null);
}
-
- public boolean isBufferObjectOnly(String name) {
- return bufferObjectOnly.contains(name);
+
+ public boolean isBufferObjectOnly(String name) {
+ return bufferObjectOnly.contains(name);
}
/** Parses any GL headers specified in the configuration file for
diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java b/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java
index fa95049cc..1af632682 100644
--- a/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java
+++ b/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,11 +29,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -125,7 +125,7 @@ public class GLEmitter extends ProcAddressEmitter {
}
if(JavaConfiguration.DEBUG_RENAMES) {
System.err.println("RenameExtensionIntoCore: "+extension+" END>");
- }
+ }
}
}
@@ -279,7 +279,7 @@ public class GLEmitter extends ProcAddressEmitter {
int j=0;
while( j < bindings.size() ) {
final MethodBinding cur = bindings.get(j);
-
+
// Some of these routines (glBitmap) take strongly-typed
// primitive pointers as arguments which are expanded into
// non-void* arguments
@@ -306,7 +306,7 @@ public class GLEmitter extends ProcAddressEmitter {
// Now need to flag this MethodBinding so that we generate the
// correct flags in the emitters later
bufferObjectMethodBindings.put(result, result);
-
+
if( bufferObjectOnly ) {
bindings.remove(j);
} else {
@@ -397,7 +397,7 @@ public class GLEmitter extends ProcAddressEmitter {
}
private int addExtensionListOfAliasedSymbols2Buffer(BuildStaticGLInfo glInfo, StringBuilder buf, String sep1, String sep2, String name, Collection exclude) {
int num = 0;
- if(null != name) {
+ if(null != name) {
num += addExtensionListOfSymbol2Buffer(glInfo, buf, sep1, name); // extensions of given name
boolean needsSep2 = 0 origNames = cfg.getRenamedJavaSymbols(name);
@@ -406,7 +406,7 @@ public class GLEmitter extends ProcAddressEmitter {
if(!exclude.contains(origName)) {
if (needsSep2) {
buf.append(sep2); // diff-name seperator
- }
+ }
int num2 = addExtensionListOfSymbol2Buffer(glInfo, buf, sep1, origName); // extensions of orig-name
needsSep2 = num col) {
BuildStaticGLInfo glInfo = getGLConfig().getGLInfo();
if (null == glInfo) {
@@ -469,16 +469,16 @@ public class GLEmitter extends ProcAddressEmitter {
/**
* {@inheritDoc}
- */
+ */
@Override
protected void endProcAddressTable() throws Exception {
PrintWriter w = tableWriter;
-
+
w.println(" @Override");
w.println(" protected boolean isFunctionAvailableImpl(String functionNameUsr) throws IllegalArgumentException {");
w.println(" final String functionNameBase = "+GLNameResolver.class.getName()+".normalizeVEN(com.jogamp.gluegen.runtime.opengl.GLNameResolver.normalizeARB(functionNameUsr, true), true);");
w.println(" final String addressFieldNameBase = \"" + PROCADDRESS_VAR_PREFIX + "\" + functionNameBase;");
- w.println(" final int funcNamePermNum = "+GLNameResolver.class.getName()+".getFuncNamePermutationNumber(functionNameBase);");
+ w.println(" final int funcNamePermNum = "+GLNameResolver.class.getName()+".getFuncNamePermutationNumber(functionNameBase);");
w.println(" final java.lang.reflect.Field addressField = java.security.AccessController.doPrivileged(new java.security.PrivilegedAction() {");
w.println(" public final java.lang.reflect.Field run() {");
w.println(" java.lang.reflect.Field addressField = null;");
@@ -510,7 +510,7 @@ public class GLEmitter extends ProcAddressEmitter {
w.println(" \"function\", e);");
w.println(" }");
w.println(" }");
-
+
w.println(" @Override");
w.println(" public long getAddressFor(String functionNameUsr) throws SecurityException, IllegalArgumentException {");
w.println(" SecurityUtil.checkAllLinkPermission();");
diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/GLJavaMethodBindingEmitter.java b/src/jogl/classes/com/jogamp/gluegen/opengl/GLJavaMethodBindingEmitter.java
index fdfaee8a6..389d35f99 100644
--- a/src/jogl/classes/com/jogamp/gluegen/opengl/GLJavaMethodBindingEmitter.java
+++ b/src/jogl/classes/com/jogamp/gluegen/opengl/GLJavaMethodBindingEmitter.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,11 +29,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -111,7 +111,7 @@ public class GLJavaMethodBindingEmitter extends ProcAddressJavaMethodBindingEmit
writer.print(" ");
writer.print(funcSym.getType().toString(symbolRenamed, tagNativeBinding));
writer.print(" ");
-
+
newComment.append(" Part of ");
if (0 == glEmitter.addExtensionsOfSymbols2Buffer(newComment, ", ", "; ", symbolRenamed, binding.getAliasedNames())) {
if (glEmitter.getGLConfig().getAllowNonGLExtensions()) {
diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/ant/StaticGLGenTask.java b/src/jogl/classes/com/jogamp/gluegen/opengl/ant/StaticGLGenTask.java
index e3e7cb970..b98f17117 100644
--- a/src/jogl/classes/com/jogamp/gluegen/opengl/ant/StaticGLGenTask.java
+++ b/src/jogl/classes/com/jogamp/gluegen/opengl/ant/StaticGLGenTask.java
@@ -55,13 +55,13 @@ import org.apache.tools.ant.util.JavaEnvUtils;
/**
*
An ANT {@link org.apache.tools.ant.Task}
* for using {@link com.jogamp.gluegen.opengl.BuildStaticGLInfo}.
- *
+ *
*
Usage:
*
- <staticglgen package="[generated files package]"
+ <staticglgen package="[generated files package]"
headers="[file pattern of GL headers]"
outputdir="[directory to output the generated files]" />
- *
+ *
*
* @author Rob Grzywinski rgrzywinski@yahoo.com
*/
@@ -72,7 +72,7 @@ public class StaticGLGenTask extends Task
*
The {@link com.jogamp.gluegen.opengl.BuildStaticGLInfo} classname.
Create and add the VM and classname to {@link org.apache.tools.ant.types.CommandlineJava}.
@@ -104,7 +104,7 @@ public class StaticGLGenTask extends Task
{
// create the CommandlineJava that will be used to call BuildStaticGLInfo
glgenCommandline = new CommandlineJava();
-
+
// set the VM and classname in the commandline
glgenCommandline.setVm(JavaEnvUtils.getJreExecutable("java"));
glgenCommandline.setClassname(GL_GEN);
@@ -114,7 +114,7 @@ public class StaticGLGenTask extends Task
// ANT getters and setters
/**
*
Set the package name for the generated files. This is called by ANT.
- *
+ *
* @param packageName the name of the package for the generated files
*/
public void setPackage(String packageName)
@@ -125,12 +125,12 @@ public class StaticGLGenTask extends Task
/**
*
Set the output directory. This is called by ANT.
- *
+ *
* @param directory the output directory
*/
public void setOutputDir(String directory)
{
- log( ("Setting output directory to: " + directory),
+ log( ("Setting output directory to: " + directory),
Project.MSG_VERBOSE);
this.outputDirectory = directory;
}
@@ -138,7 +138,7 @@ public class StaticGLGenTask extends Task
/**
*
Add a header file to the list. This is called by ANT for a nested
* element.
- *
+ *
* @return {@link org.apache.tools.ant.types.PatternSet.NameEntry}
*/
public PatternSet.NameEntry createHeader()
@@ -149,7 +149,7 @@ public class StaticGLGenTask extends Task
/**
*
Add a header file to the list. This is called by ANT for a nested
* element.
- *
+ *
* @return {@link org.apache.tools.ant.types.PatternSet.NameEntry}
*/
public PatternSet.NameEntry createHeadersFile()
@@ -171,7 +171,7 @@ public class StaticGLGenTask extends Task
/**
*
Add an optional classpath that defines the location of {@link com.jogamp.gluegen.opengl.BuildStaticGLInfo}
* and BuildStaticGLInfo's dependencies.
- *
+ *
* @returns {@link org.apache.tools.ant.types.Path}
*/
public Path createClasspath()
@@ -183,23 +183,23 @@ public class StaticGLGenTask extends Task
/**
*
Run the task. This involves validating the set attributes, creating
* the command line to be executed and finally executing the command.
- *
+ *
* @see org.apache.tools.ant.Task#execute()
*/
- public void execute()
- throws BuildException
+ public void execute()
+ throws BuildException
{
// validate that all of the required attributes have been set
validateAttributes();
-
+
// TODO: add logic to determine if the generated file needs to be
// regenerated
-
+
// add the attributes to the CommandlineJava
addAttributes();
log(glgenCommandline.describeCommand(), Project.MSG_VERBOSE);
-
+
// execute the command and throw on error
final int error = execute(glgenCommandline.getCommandline());
if(error == 1)
@@ -208,11 +208,11 @@ public class StaticGLGenTask extends Task
/**
*
Ensure that the user specified all required arguments.
- *
- * @throws BuildException if there are required arguments that are not
+ *
+ * @throws BuildException if there are required arguments that are not
* present or not valid
*/
- private void validateAttributes()
+ private void validateAttributes()
throws BuildException
{
// validate that the package name is set
@@ -223,29 +223,29 @@ public class StaticGLGenTask extends Task
// TODO: switch to file and ensure that it exists
if(!isValid(outputDirectory))
throw new BuildException("Invalid output directory name: " + outputDirectory);
-
+
// TODO: validate that there are headers set
}
/**
*
Is the specified string valid? A valid string is non-null
* and has a non-zero length.
- *
+ *
* @param string the string to be tested for validity
* @return true if the string is valid. false
- * otherwise.
+ * otherwise.
*/
private boolean isValid(String string)
{
// check for null
if(string == null)
return false;
-
+
// ensure that the string has a non-zero length
// NOTE: must trim() to remove leading and trailing whitespace
if(string.trim().length() < 1)
return false;
-
+
// the string is valid
return true;
}
@@ -258,10 +258,10 @@ public class StaticGLGenTask extends Task
{
// add the package name
glgenCommandline.createArgument().setValue(packageName);
-
+
// add the output directory name
glgenCommandline.createArgument().setValue(outputDirectory);
-
+
// add the header -files- from the FileSet
headerSet.setDir(getProject().getBaseDir());
DirectoryScanner directoryScanner = headerSet.getDirectoryScanner(getProject());
@@ -272,25 +272,25 @@ public class StaticGLGenTask extends Task
}
}
- /**
- *
Execute {@link com.jogamp.gluegen.opengl.BuildStaticGLInfo} in a
+ /**
+ *
Execute {@link com.jogamp.gluegen.opengl.BuildStaticGLInfo} in a
* forked JVM.
- *
+ *
* @throws BuildException
*/
- private int execute(String[] command)
+ private int execute(String[] command)
throws BuildException
{
// create the object that will perform the command execution
Execute execute = new Execute(new LogStreamHandler(this, Project.MSG_INFO,
- Project.MSG_WARN),
+ Project.MSG_WARN),
null);
-
+
// set the project and command line
execute.setAntRun(project);
execute.setCommandline(command);
execute.setWorkingDirectory( project.getBaseDir() );
-
+
// execute the command
try
{
diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureEmitter.java b/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureEmitter.java
index adb1c2ae0..4ac9ae3f3 100644
--- a/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureEmitter.java
+++ b/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureEmitter.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,11 +29,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -55,8 +55,8 @@ import java.util.Set;
/**
* Emitter producing NativeSignature attributes.
- *
- * Review: This Package/Class is not used and subject to be deleted.
+ *
+ * Review: This Package/Class is not used and subject to be deleted.
*/
public class NativeSignatureEmitter extends GLEmitter {
diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureJavaMethodBindingEmitter.java b/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureJavaMethodBindingEmitter.java
index e98478b6e..a17657382 100644
--- a/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureJavaMethodBindingEmitter.java
+++ b/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureJavaMethodBindingEmitter.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,11 +29,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -182,14 +182,14 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding
// Always emit outgoing "this" argument
writer.print("long ");
- writer.print(javaThisArgumentName());
+ writer.print(javaThisArgumentName());
++numEmitted;
needComma = true;
}
for (int i = 0; i < binding.getNumArguments(); i++) {
JavaType type = binding.getJavaArgumentType(i);
- if (type.isVoid()) {
+ if (type.isVoid()) {
// Make sure this is the only param to the method; if it isn't,
// there's something wrong with our parsing of the headers.
if (binding.getNumArguments() != 1) {
@@ -198,7 +198,7 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding
"multi-argument function \"" + binding + "\"");
}
continue;
- }
+ }
if (type.isJNIEnv() || binding.isArgumentThisPointer(i)) {
// Don't need to expose these at the Java level
@@ -229,7 +229,7 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding
if (type.isNIOBuffer()) {
writer.print(", int " + byteOffsetArgName(i));
} else if (type.isNIOBufferArray()) {
- writer.print(", int[] " +
+ writer.print(", int[] " +
byteOffsetArrayArgName(i));
}
}
@@ -246,7 +246,7 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding
writer.print(" ");
JavaType returnType = binding.getJavaReturnType();
boolean needsResultAssignment = false;
-
+
if (!returnType.isVoid()) {
if (returnType.isCompoundTypeWrapper() ||
returnType.isNIOByteBuffer()) {
@@ -375,7 +375,7 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding
// there's something wrong with our parsing of the headers.
assert(binding.getNumArguments() == 1);
continue;
- }
+ }
if (needComma) {
writer.print(", ");
diff --git a/src/jogl/classes/com/jogamp/gluegen/runtime/opengl/GLNameResolver.java b/src/jogl/classes/com/jogamp/gluegen/runtime/opengl/GLNameResolver.java
index 92554776a..9b57a2f2d 100644
--- a/src/jogl/classes/com/jogamp/gluegen/runtime/opengl/GLNameResolver.java
+++ b/src/jogl/classes/com/jogamp/gluegen/runtime/opengl/GLNameResolver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,11 +29,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
*/
package com.jogamp.gluegen.runtime.opengl;
@@ -43,12 +43,12 @@ public class GLNameResolver {
//GL_XYZ : GL_XYZ, GL_GL2_XYZ, GL_ARB_XYZ, GL_OES_XYZ, GL_OML_XYZ
//
// Pass-1 Unify ARB extensions with the same value
- // Pass-2 Unify vendor extensions,
+ // Pass-2 Unify vendor extensions,
// if exist as an ARB extension with the same value.
// Pass-3 Emit
public static final String[] extensionsARB = { "ARB", "GL2", "OES", "KHR", "OML" };
- public static final String[] extensionsVEN = { "3DFX",
+ public static final String[] extensionsVEN = { "3DFX",
"AMD",
"ANGLE",
"ARM",
@@ -158,7 +158,7 @@ public class GLNameResolver {
return str;
}
public static final boolean isExtension(String str, boolean isGLFunc) {
- return isExtension(extensionsARB, str, isGLFunc) ||
+ return isExtension(extensionsARB, str, isGLFunc) ||
isExtension(extensionsVEN, str, isGLFunc);
}
diff --git a/src/jogl/classes/com/jogamp/gluegen/runtime/opengl/GLProcAddressResolver.java b/src/jogl/classes/com/jogamp/gluegen/runtime/opengl/GLProcAddressResolver.java
index 9775de491..f8406075c 100644
--- a/src/jogl/classes/com/jogamp/gluegen/runtime/opengl/GLProcAddressResolver.java
+++ b/src/jogl/classes/com/jogamp/gluegen/runtime/opengl/GLProcAddressResolver.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
/*
* Created on Saturday, April 24 2010 16:44
*/
diff --git a/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java b/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java
index a3749788b..cb2885e0f 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java
@@ -42,13 +42,13 @@ import com.jogamp.opengl.math.geom.AABBox;
/** A Generic shape objects which is defined by a list of Outlines.
* This Shape can be transformed to Triangulations.
* The list of triangles generated are render-able by a Region object.
- * The triangulation produced by this Shape will define the
+ * The triangulation produced by this Shape will define the
* closed region defined by the outlines.
- *
+ *
* One or more OutlineShape Object can be associated to a region
* this is left as a high-level representation of the Objects. For
* optimizations, flexibility requirements for future features.
- *
+ *
*
- *
- * The above will create two outlines each with three vertices. By adding these two outlines to
+ *
+ * The above will create two outlines each with three vertices. By adding these two outlines to
* the OutlineShape, we are stating that the combination of the two outlines represent the shape.
*
- *
- * To specify that the shape is curved at a region, the on-curve flag should be set to false
+ *
+ * To specify that the shape is curved at a region, the on-curve flag should be set to false
* for the vertex that is in the middle of the curved region (if the curved region is defined by 3
* vertices (quadratic curve).
*
- * In case the curved region is defined by 4 or more vertices the middle vertices should both have
+ * In case the curved region is defined by 4 or more vertices the middle vertices should both have
* the on-curve flag set to false.
- *
+ *
* Example:
*
- *
- * The above snippet defines a cubic nurbs curve where (0,1 and 1,1)
+ *
+ * The above snippet defines a cubic nurbs curve where (0,1 and 1,1)
* do not belong to the final rendered shape.
- *
+ *
* Implementation Notes:
*
*
The first vertex of any outline belonging to the shape should be on-curve
*
Intersections between off-curved parts of the outline is not handled
*
- *
+ *
* @see Outline
* @see Region
*/
@@ -104,21 +104,21 @@ public class OutlineShape implements Comparable {
VerticesState(int state){
this.state = state;
}
- }
+ }
public static final int DIRTY_BOUNDS = 1 << 0;
private final Vertex.Factory extends Vertex> vertexFactory;
private VerticesState outlineState;
- /** The list of {@link Outline}s that are part of this
+ /** The list of {@link Outline}s that are part of this
* outline shape.
*/
private ArrayList outlines;
private AABBox bbox;
/** dirty bits DIRTY_BOUNDS */
- private int dirtyBits;
+ private int dirtyBits;
/** Create a new Outline based Shape
*/
@@ -128,7 +128,7 @@ public class OutlineShape implements Comparable {
this.outlines.add(new Outline());
this.outlineState = VerticesState.UNDEFINED;
this.bbox = new AABBox();
- this.dirtyBits = 0;
+ this.dirtyBits = 0;
}
/** Clears all data and reset all states as if this instance was newly created */
@@ -137,7 +137,7 @@ public class OutlineShape implements Comparable {
outlines.add(new Outline());
outlineState = VerticesState.UNDEFINED;
bbox.reset();
- dirtyBits = 0;
+ dirtyBits = 0;
}
/** Returns the associated vertex factory of this outline shape
@@ -149,10 +149,10 @@ public class OutlineShape implements Comparable {
return outlines.size();
}
- /** Add a new empty {@link Outline}
+ /** Add a new empty {@link Outline}
* to the end of this shape's outline list.
*
If the {@link #getLastOutline()} is empty already, no new one will be added.
- *
+ *
* After a call to this function all new vertices added
* will belong to the new outline
*/
@@ -164,26 +164,26 @@ public class OutlineShape implements Comparable {
/** Appends the {@link Outline} element to the end,
* ensuring a clean tail.
- *
+ *
*
A clean tail is ensured, no double empty Outlines are produced
* and a pre-existing empty outline will be replaced with the given one.
- *
+ *
* @param outline Outline object to be added
- * @throws NullPointerException if the {@link Outline} element is null
+ * @throws NullPointerException if the {@link Outline} element is null
*/
public void addOutline(Outline outline) throws NullPointerException {
addOutline(outlines.size(), outline);
}
/** Insert the {@link Outline} element at the given {@code position}.
- *
+ *
*
If the {@code position} indicates the end of this list,
* a clean tail is ensured, no double empty Outlines are produced
* and a pre-existing empty outline will be replaced with the given one.
- *
+ *
* @param position of the added Outline
* @param outline Outline object to be added
- * @throws NullPointerException if the {@link Outline} element is null
+ * @throws NullPointerException if the {@link Outline} element is null
* @throws IndexOutOfBoundsException if position is out of range (position < 0 || position > getOutlineNumber())
*/
public void addOutline(int position, Outline outline) throws NullPointerException, IndexOutOfBoundsException {
@@ -213,7 +213,7 @@ public class OutlineShape implements Comparable {
* using {@link #addOutline(Outline)} for each element.
*
Closes the current last outline via {@link #closeLastOutline()} before adding the new ones.
* @param outlineShape OutlineShape elements to be added.
- * @throws NullPointerException if the {@link OutlineShape} is null
+ * @throws NullPointerException if the {@link OutlineShape} is null
* @throws IndexOutOfBoundsException if position is out of range (position < 0 || position > getOutlineNumber())
*/
public void addOutlineShape(OutlineShape outlineShape) throws NullPointerException {
@@ -228,10 +228,10 @@ public class OutlineShape implements Comparable {
/** Replaces the {@link Outline} element at the given {@code position}.
*
Sets the bounding box dirty, hence a next call to {@link #getBounds()} will validate it.
- *
+ *
* @param position of the replaced Outline
- * @param outline replacement Outline object
- * @throws NullPointerException if the {@link Outline} element is null
+ * @param outline replacement Outline object
+ * @throws NullPointerException if the {@link Outline} element is null
* @throws IndexOutOfBoundsException if position is out of range (position < 0 || position >= getOutlineNumber())
*/
public void setOutline(int position, Outline outline) throws NullPointerException, IndexOutOfBoundsException {
@@ -244,7 +244,7 @@ public class OutlineShape implements Comparable {
/** Removes the {@link Outline} element at the given {@code position}.
*
Sets the bounding box dirty, hence a next call to {@link #getBounds()} will validate it.
- *
+ *
* @param position of the to be removed Outline
* @throws IndexOutOfBoundsException if position is out of range (position < 0 || position >= getOutlineNumber())
*/
@@ -261,15 +261,15 @@ public class OutlineShape implements Comparable {
return outlines.get(outlines.size()-1);
}
- /** @return the {@code Outline} at {@code position}
+ /** @return the {@code Outline} at {@code position}
* @throws IndexOutOfBoundsException if position is out of range (position < 0 || position >= getOutlineNumber())
*/
public Outline getOutline(int position) throws IndexOutOfBoundsException {
return outlines.get(position);
- }
+ }
/** Adds a vertex to the last open outline in the
- * shape.
+ * shape.
* @param v the vertex to be added to the OutlineShape
*/
public final void addVertex(Vertex v) {
@@ -280,9 +280,9 @@ public class OutlineShape implements Comparable {
}
}
- /** Adds a vertex to the last open outline in the shape.
- * at {@code position}
- * @param position indx at which the vertex will be added
+ /** Adds a vertex to the last open outline in the shape.
+ * at {@code position}
+ * @param position indx at which the vertex will be added
* @param v the vertex to be added to the OutlineShape
*/
public final void addVertex(int position, Vertex v) {
@@ -295,7 +295,7 @@ public class OutlineShape implements Comparable {
/** Add a 2D {@link Vertex} to the last outline by defining the coordniate attribute
* of the vertex. The 2D vertex will be represented as Z=0.
- *
+ *
* @param x the x coordinate
* @param y the y coordniate
* @param onCurve flag if this vertex is on the final curve or defines a curved region
@@ -317,10 +317,10 @@ public class OutlineShape implements Comparable {
addVertex(vertexFactory.create(x, y, z, onCurve));
}
- /** Add a vertex to the last outline by passing a float array and specifying the
- * offset and length in which. The attributes of the vertex are located.
+ /** Add a vertex to the last outline by passing a float array and specifying the
+ * offset and length in which. The attributes of the vertex are located.
* The attributes should be continuous (stride = 0).
- * Attributes which value are not set (when length less than 3)
+ * Attributes which value are not set (when length less than 3)
* are set implicitly to zero.
* @param coordsBuffer the coordinate array where the vertex attributes are to be picked from
* @param offset the offset in the buffer to the x coordinate
@@ -330,11 +330,11 @@ public class OutlineShape implements Comparable {
*/
public final void addVertex(float[] coordsBuffer, int offset, int length, boolean onCurve) {
addVertex(vertexFactory.create(coordsBuffer, offset, length, onCurve));
- }
+ }
/** Closes the last outline in the shape.
*
If last vertex is not equal to first vertex.
- * A new temp vertex is added at the end which
+ * A new temp vertex is added at the end which
* is equal to the first.
*/
public void closeLastOutline() {
@@ -351,7 +351,7 @@ public class OutlineShape implements Comparable {
/** Ensure the outlines represent
* the specified destinationType.
* and removes all overlaps in boundary triangles
- * @param destinationType the target outline's vertices state. Currently only
+ * @param destinationType the target outline's vertices state. Currently only
* {@link OutlineShape.VerticesState#QUADRATIC_NURBS} are supported.
*/
public void transformOutlines(VerticesState destinationType) {
@@ -371,7 +371,7 @@ public class OutlineShape implements Comparable {
float[] v2 = VectorUtil.mid(v1, v3);
//drop off-curve vertex to image on the curve
- b.setCoord(v2, 0, 3);
+ b.setCoord(v2, 0, 3);
b.setOnCurve(true);
outline.addVertex(index, vertexFactory.create(v1, 0, 3, false));
@@ -379,19 +379,19 @@ public class OutlineShape implements Comparable {
}
/** Check overlaps between curved triangles
- * first check if any vertex in triangle a is in triangle b
+ * first check if any vertex in triangle a is in triangle b
* second check if edges of triangle a intersect segments of triangle b
* if any of the two tests is true we divide current triangle
* and add the other to the list of overlaps
- *
+ *
* Loop until overlap array is empty. (check only in first pass)
*/
- private void checkOverlaps() {
+ private void checkOverlaps() {
ArrayList overlaps = new ArrayList(3);
int count = getOutlineNumber();
boolean firstpass = true;
do {
- for (int cc = 0; cc < count; cc++) {
+ for (int cc = 0; cc < count; cc++) {
final Outline outline = getOutline(cc);
int vertexCount = outline.getVertexCount();
for(int i=0; i < outline.getVertexCount(); i++) {
@@ -429,7 +429,7 @@ public class OutlineShape implements Comparable {
private Vertex checkTriOverlaps(Vertex a, Vertex b, Vertex c) {
int count = getOutlineNumber();
- for (int cc = 0; cc < count; cc++) {
+ for (int cc = 0; cc < count; cc++) {
final Outline outline = getOutline(cc);
int vertexCount = outline.getVertexCount();
for(int i=0; i < vertexCount; i++) {
@@ -451,7 +451,7 @@ public class OutlineShape implements Comparable {
return current;
}
- if(VectorUtil.tri2SegIntersection(a, b, c, prevV, current)
+ if(VectorUtil.tri2SegIntersection(a, b, c, prevV, current)
|| VectorUtil.tri2SegIntersection(a, b, c, current, nextV)
|| VectorUtil.tri2SegIntersection(a, b, c, prevV, nextV)) {
return current;
@@ -463,7 +463,7 @@ public class OutlineShape implements Comparable {
private void transformOutlines2Quadratic() {
int count = getOutlineNumber();
- for (int cc = 0; cc < count; cc++) {
+ for (int cc = 0; cc < count; cc++) {
final Outline outline = getOutline(cc);
int vertexCount = outline.getVertexCount();
@@ -471,13 +471,13 @@ public class OutlineShape implements Comparable {
final Vertex currentVertex = outline.getVertex(i);
final Vertex nextVertex = outline.getVertex((i+1)%vertexCount);
if ( !currentVertex.isOnCurve() && !nextVertex.isOnCurve() ) {
- final float[] newCoords = VectorUtil.mid(currentVertex.getCoord(),
+ final float[] newCoords = VectorUtil.mid(currentVertex.getCoord(),
nextVertex.getCoord());
final Vertex v = vertexFactory.create(newCoords, 0, 3, true);
i++;
vertexCount++;
outline.addVertex(i, v);
- }
+ }
}
if(vertexCount <= 0) {
outlines.remove(outline);
@@ -487,7 +487,7 @@ public class OutlineShape implements Comparable {
}
if( vertexCount > 0 ) {
- if(VectorUtil.checkEquality(outline.getVertex(0).getCoord(),
+ if(VectorUtil.checkEquality(outline.getVertex(0).getCoord(),
outline.getLastVertex().getCoord())) {
outline.removeVertex(vertexCount-1);
}
@@ -508,7 +508,7 @@ public class OutlineShape implements Comparable {
}
}
- /** @return the list of concatenated vertices associated with all
+ /** @return the list of concatenated vertices associated with all
* {@code Outline}s of this object
*/
public ArrayList getVertices() {
@@ -551,7 +551,7 @@ public class OutlineShape implements Comparable {
}
/** Compare two outline shapes with Bounding Box area
- * as criteria.
+ * as criteria.
* @see java.lang.Comparable#compareTo(java.lang.Object)
*/
public final int compareTo(OutlineShape outline) {
@@ -579,12 +579,12 @@ public class OutlineShape implements Comparable {
validateBoundingBox();
}
return bbox;
- }
+ }
/**
* @param obj the Object to compare this OutlineShape with
- * @return true if {@code obj} is an OutlineShape, not null,
- * same outlineState, equal bounds and equal outlines in the same order
+ * @return true if {@code obj} is an OutlineShape, not null,
+ * same outlineState, equal bounds and equal outlines in the same order
*/
public boolean equals(Object obj) {
if( obj == this) {
@@ -592,7 +592,7 @@ public class OutlineShape implements Comparable {
}
if( null == obj || !(obj instanceof OutlineShape) ) {
return false;
- }
+ }
final OutlineShape o = (OutlineShape) obj;
if(getOutlineState() != o.getOutlineState()) {
return false;
@@ -625,5 +625,5 @@ public class OutlineShape implements Comparable {
o.outlines.add(outlines.get(i).clone());
}
return o;
- }
+ }
}
diff --git a/src/jogl/classes/com/jogamp/graph/curve/Region.java b/src/jogl/classes/com/jogamp/graph/curve/Region.java
index 8b6d000fa..a9779523a 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/Region.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/Region.java
@@ -38,48 +38,48 @@ import com.jogamp.opengl.math.geom.AABBox;
/** Abstract Outline shape GL representation
* define the method an OutlineShape(s) is
* binded rendered.
- *
+ *
* @see GLRegion
*/
public abstract class Region {
-
+
/** Debug flag for region impl (graph.curve)
*/
public static final boolean DEBUG = Debug.debug("graph.curve");
-
+
public static final boolean DEBUG_INSTANCE = false;
- /** View based Anti-Aliasing, A Two pass region rendering, slower
- * and more resource hungry (FBO), but AA is perfect.
- * Otherwise the default fast one pass MSAA region rendering is being used.
+ /** View based Anti-Aliasing, A Two pass region rendering, slower
+ * and more resource hungry (FBO), but AA is perfect.
+ * Otherwise the default fast one pass MSAA region rendering is being used.
*/
public static final int VBAA_RENDERING_BIT = 1 << 0;
/** Use non uniform weights [0.0 .. 1.9] for curve region rendering.
- * Otherwise the default weight 1.0 for uniform curve region rendering is being applied.
+ * Otherwise the default weight 1.0 for uniform curve region rendering is being applied.
*/
public static final int VARIABLE_CURVE_WEIGHT_BIT = 1 << 1;
public static final int TWO_PASS_DEFAULT_TEXTURE_UNIT = 0;
private final int renderModes;
- private boolean dirty = true;
- protected int numVertices = 0;
+ private boolean dirty = true;
+ protected int numVertices = 0;
protected final AABBox box = new AABBox();
protected ArrayList triangles = new ArrayList();
protected ArrayList vertices = new ArrayList();
- public static boolean isVBAA(int renderModes) {
- return 0 != ( renderModes & Region.VBAA_RENDERING_BIT );
+ public static boolean isVBAA(int renderModes) {
+ return 0 != ( renderModes & Region.VBAA_RENDERING_BIT );
}
/** Check if render mode capable of non uniform weights
- * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT},
- * {@link Region#VBAA_RENDERING_BIT}
+ * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT},
+ * {@link Region#VBAA_RENDERING_BIT}
* @return true of capable of non uniform weights
*/
- public static boolean isNonUniformWeight(int renderModes) {
- return 0 != ( renderModes & Region.VARIABLE_CURVE_WEIGHT_BIT );
+ public static boolean isNonUniformWeight(int renderModes) {
+ return 0 != ( renderModes & Region.VARIABLE_CURVE_WEIGHT_BIT );
}
protected Region(int regionRenderModes) {
@@ -87,28 +87,28 @@ public abstract class Region {
}
/** Get current Models
- * @return bit-field of render modes
+ * @return bit-field of render modes
*/
- public final int getRenderModes() {
- return renderModes;
+ public final int getRenderModes() {
+ return renderModes;
}
/** Check if current Region is using VBAA
* @return true if capable of two pass rendering - VBAA
*/
- public boolean isVBAA() {
- return Region.isVBAA(renderModes);
+ public boolean isVBAA() {
+ return Region.isVBAA(renderModes);
}
- /** Check if current instance uses non uniform weights
+ /** Check if current instance uses non uniform weights
* @return true if capable of nonuniform weights
*/
- public boolean isNonUniformWeight() {
- return Region.isNonUniformWeight(renderModes);
+ public boolean isNonUniformWeight() {
+ return Region.isNonUniformWeight(renderModes);
}
/** Get the current number of vertices associated
- * with this region. This number is not necessary equal to
+ * with this region. This number is not necessary equal to
* the OGL bound number of vertices.
* @return vertices count
*/
@@ -117,10 +117,10 @@ public abstract class Region {
}
/** Adds a {@link Triangle} object to the Region
- * This triangle will be bound to OGL objects
+ * This triangle will be bound to OGL objects
* on the next call to {@code update}
* @param tri a triangle object
- *
+ *
* @see update(GL2ES2)
*/
public void addTriangle(Triangle tri) {
@@ -129,10 +129,10 @@ public abstract class Region {
}
/** Adds a list of {@link Triangle} objects to the Region
- * These triangles are to be binded to OGL objects
+ * These triangles are to be binded to OGL objects
* on the next call to {@code update}
* @param tris an arraylist of triangle objects
- *
+ *
* @see update(GL2ES2)
*/
public void addTriangles(ArrayList tris) {
@@ -141,10 +141,10 @@ public abstract class Region {
}
/** Adds a {@link Vertex} object to the Region
- * This vertex will be bound to OGL objects
+ * This vertex will be bound to OGL objects
* on the next call to {@code update}
* @param vert a vertex objects
- *
+ *
* @see update(GL2ES2)
*/
public void addVertex(Vertex vert) {
@@ -154,10 +154,10 @@ public abstract class Region {
}
/** Adds a list of {@link Vertex} objects to the Region
- * These vertices are to be binded to OGL objects
+ * These vertices are to be binded to OGL objects
* on the next call to {@code update}
* @param verts an arraylist of vertex objects
- *
+ *
* @see update(GL2ES2)
*/
public void addVertices(ArrayList verts) {
@@ -175,10 +175,10 @@ public abstract class Region {
}
/** Check if this region is dirty. A region is marked dirty
- * when new Vertices, Triangles, and or Lines are added after a
+ * when new Vertices, Triangles, and or Lines are added after a
* call to update()
* @return true if region is Dirty, false otherwise
- *
+ *
* @see update(GL2ES2)
*/
public final boolean isDirty() {
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java
index 63713887b..dfb7a95b3 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java
@@ -41,32 +41,32 @@ import jogamp.graph.curve.opengl.RegionFactory;
/** A GLRegion is the OGL binding of one or more OutlineShapes
* Defined by its vertices and generated triangles. The Region
- * defines the final shape of the OutlineShape(s), which shall produced a shaded
+ * defines the final shape of the OutlineShape(s), which shall produced a shaded
* region on the screen.
- *
- * Implementations of the GLRegion shall take care of the OGL
+ *
+ * Implementations of the GLRegion shall take care of the OGL
* binding of the depending on its context, profile.
- *
+ *
* @see Region, RegionFactory, OutlineShape
*/
-public abstract class GLRegion extends Region {
-
+public abstract class GLRegion extends Region {
+
/** Create an ogl {@link GLRegion} defining the list of {@link OutlineShape}.
* Combining the Shapes into single buffers.
* @return the resulting Region inclusive the generated region
*/
public static GLRegion create(OutlineShape[] outlineShapes, int renderModes) {
final GLRegion region = RegionFactory.create(renderModes);
-
+
int numVertices = region.getNumVertices();
-
+
for(int index=0; index triangles = outlineShape.triangulate();
region.addTriangles(triangles);
-
+
ArrayList vertices = outlineShape.getVertices();
for(int pos=0; pos < vertices.size(); pos++){
Vertex vert = vertices.get(pos);
@@ -74,42 +74,42 @@ public abstract class GLRegion extends Region {
}
region.addVertices(vertices);
}
-
+
return region;
}
- /**
+ /**
* Create an ogl {@link GLRegion} defining this {@link OutlineShape}
* @return the resulting Region.
*/
public static GLRegion create(OutlineShape outlineShape, int renderModes) {
final GLRegion region = RegionFactory.create(renderModes);
-
+
outlineShape.transformOutlines(OutlineShape.VerticesState.QUADRATIC_NURBS);
ArrayList triangles = (ArrayList) outlineShape.triangulate();
ArrayList vertices = (ArrayList) outlineShape.getVertices();
region.addVertices(vertices);
region.addTriangles(triangles);
return region;
- }
-
+ }
+
protected GLRegion(int renderModes) {
super(renderModes);
}
-
+
/** Updates a graph region by updating the ogl related
* objects for use in rendering if {@link #isDirty()}.
- *
Allocates the ogl related data and initializes it the 1st time.
+ *
Allocates the ogl related data and initializes it the 1st time.
*
Called by {@link #draw(GL2ES2, RenderState, int, int, int)}.
* @param rs TODO
*/
protected abstract void update(GL2ES2 gl, RenderState rs);
-
+
/** Delete and clean the associated OGL
* objects
*/
public abstract void destroy(GL2ES2 gl, RenderState rs);
-
+
/** Renders the associated OGL objects specifying
* current width/hight of window for multi pass rendering
* of the region.
@@ -117,13 +117,13 @@ public abstract class GLRegion extends Region {
* @param rs the RenderState to be used
* @param vp_width current screen width
* @param vp_height current screen height
- * @param texWidth desired texture width for multipass-rendering.
+ * @param texWidth desired texture width for multipass-rendering.
* The actual used texture-width is written back when mp rendering is enabled, otherwise the store is untouched.
*/
public final void draw(GL2ES2 gl, RenderState rs, int vp_width, int vp_height, int[/*1*/] texWidth) {
update(gl, rs);
drawImpl(gl, rs, vp_width, vp_height, texWidth);
}
-
+
protected abstract void drawImpl(GL2ES2 gl, RenderState rs, int vp_width, int vp_height, int[/*1*/] texWidth);
}
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
index 2f078d7bb..f7d4bfd2f 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
@@ -35,26 +35,26 @@ import com.jogamp.graph.curve.Region;
public abstract class RegionRenderer extends Renderer {
- /**
+ /**
* Create a Hardware accelerated Region Renderer.
- * @param rs the used {@link RenderState}
- * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT}, {@link Region#VBAA_RENDERING_BIT}
+ * @param rs the used {@link RenderState}
+ * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT}, {@link Region#VBAA_RENDERING_BIT}
* @return an instance of Region Renderer
*/
public static RegionRenderer create(RenderState rs, int renderModes) {
return new jogamp.graph.curve.opengl.RegionRendererImpl01(rs, renderModes);
}
-
+
protected RegionRenderer(RenderState rs, int renderModes) {
super(rs, renderModes);
}
-
-
+
+
/** Render an {@link OutlineShape} in 3D space at the position provided
* the triangles of the shapes will be generated, if not yet generated
* @param region the OutlineShape to Render.
- * @param position the initial translation of the outlineShape.
- * @param texWidth desired texture width for multipass-rendering.
+ * @param position the initial translation of the outlineShape.
+ * @param texWidth desired texture width for multipass-rendering.
* The actual used texture-width is written back when mp rendering is enabled, otherwise the store is untouched.
* @throws Exception if HwRegionRenderer not initialized
*/
@@ -65,10 +65,10 @@ public abstract class RegionRenderer extends Renderer {
if( !areRenderModesCompatible(region) ) {
throw new GLException("Incompatible render modes, : region modes "+region.getRenderModes()+
" doesn't contain renderer modes "+this.getRenderModes());
- }
+ }
drawImpl(gl, region, position, texWidth);
}
-
+
/**
* Usually just dispatched the draw call to the Region's draw implementation,
* e.g. {@link com.jogamp.graph.curve.opengl.GLRegion#draw(GL2ES2, RenderState, int, int, int[]) GLRegion#draw(GL2ES2, RenderState, int, int, int[])}.
@@ -79,6 +79,6 @@ public abstract class RegionRenderer extends Renderer {
protected void destroyImpl(GL2ES2 gl) {
// nop
}
-
-
+
+
}
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java
index 5e305d664..9c833fd24 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java
@@ -40,7 +40,7 @@ import com.jogamp.opengl.util.glsl.ShaderState;
public abstract class RenderState {
private static final String thisKey = "jogamp.graph.curve.RenderState" ;
-
+
public static RenderState createRenderState(ShaderState st, Vertex.Factory extends Vertex> pointFactory) {
return new RenderStateImpl(st, pointFactory);
}
@@ -48,42 +48,42 @@ public abstract class RenderState {
public static RenderState createRenderState(ShaderState st, Vertex.Factory extends Vertex> pointFactory, PMVMatrix pmvMatrix) {
return new RenderStateImpl(st, pointFactory, pmvMatrix);
}
-
+
public static final RenderState getRenderState(GL2ES2 gl) {
return (RenderState) gl.getContext().getAttachedObject(thisKey);
}
-
+
protected final ShaderState st;
protected final Vertex.Factory extends Vertex> vertexFactory;
protected final PMVMatrix pmvMatrix;
- protected final GLUniformData gcu_PMVMatrix;
-
+ protected final GLUniformData gcu_PMVMatrix;
+
protected RenderState(ShaderState st, Vertex.Factory extends Vertex> vertexFactory, PMVMatrix pmvMatrix) {
this.st = st;
this.vertexFactory = vertexFactory;
- this.pmvMatrix = pmvMatrix;
+ this.pmvMatrix = pmvMatrix;
this.gcu_PMVMatrix = new GLUniformData(UniformNames.gcu_PMVMatrix, 4, 4, pmvMatrix.glGetPMvMatrixf());
- st.ownUniform(gcu_PMVMatrix);
+ st.ownUniform(gcu_PMVMatrix);
}
-
+
public final ShaderState getShaderState() { return st; }
public final Vertex.Factory extends Vertex> getVertexFactory() { return vertexFactory; }
public final PMVMatrix pmvMatrix() { return pmvMatrix; }
public final GLUniformData getPMVMatrix() { return gcu_PMVMatrix; }
-
+
public void destroy(GL2ES2 gl) {
st.destroy(gl);
}
-
+
public abstract GLUniformData getWeight();
public abstract GLUniformData getAlpha();
public abstract GLUniformData getColorStatic();
// public abstract GLUniformData getStrength();
-
+
public final RenderState attachTo(GL2ES2 gl) {
return (RenderState) gl.getContext().attachObject(thisKey, this);
}
-
+
public final boolean detachFrom(GL2ES2 gl) {
RenderState _rs = (RenderState) gl.getContext().getAttachedObject(thisKey);
if(_rs == this) {
@@ -91,8 +91,8 @@ public abstract class RenderState {
return true;
}
return false;
- }
-
+ }
+
public StringBuilder toString(StringBuilder sb, boolean alsoUnlocated) {
if(null==sb) {
sb = new StringBuilder();
@@ -104,8 +104,8 @@ public abstract class RenderState {
return sb;
}
-
+
public String toString() {
return toString(null, false).toString();
- }
+ }
}
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/Renderer.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/Renderer.java
index 998129551..c642fb652 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/Renderer.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/Renderer.java
@@ -52,8 +52,8 @@ public abstract class Renderer {
protected int vp_height;
protected boolean initialized;
protected final RenderState rs;
- private boolean vboSupported = false;
-
+ private boolean vboSupported = false;
+
public final boolean isInitialized() { return initialized; }
public final int getWidth() { return vp_width; }
@@ -62,29 +62,29 @@ public abstract class Renderer {
public float getWeight() { return rs.getWeight().floatValue(); }
public float getAlpha() { return rs.getAlpha().floatValue(); }
public final PMVMatrix getMatrix() { return rs.pmvMatrix(); }
-
+
/**
* Implementation shall load, compile and link the shader program and leave it active.
* @param gl referencing the current GLContext to which the ShaderState is bound to
* @return
*/
protected abstract boolean initShaderProgram(GL2ES2 gl);
-
+
protected abstract void destroyImpl(GL2ES2 gl);
-
+
/**
- * @param rs the used {@link RenderState}
+ * @param rs the used {@link RenderState}
* @param renderModes bit-field of modes
*/
protected Renderer(RenderState rs, int renderModes) {
this.rs = rs;
this.renderModes = renderModes;
}
-
+
public final int getRenderModes() {
return renderModes;
}
-
+
public boolean usesVariableCurveWeight() { return Region.isNonUniformWeight(renderModes); }
/**
@@ -93,17 +93,17 @@ public abstract class Renderer {
*/
public final boolean areRenderModesCompatible(Region region) {
final int cleanRenderModes = getRenderModes() & ( Region.VARIABLE_CURVE_WEIGHT_BIT );
- return cleanRenderModes == ( region.getRenderModes() & cleanRenderModes );
+ return cleanRenderModes == ( region.getRenderModes() & cleanRenderModes );
}
-
+
public final boolean isVBOSupported() { return vboSupported; }
-
- /**
+
+ /**
* Initialize shader and bindings for GPU based rendering bound to the given GL object's GLContext
* if not initialized yet.
*
Leaves the renderer enabled, ie ShaderState.
*
Shall be called by a {@code draw()} method, e.g. {@link RegionRenderer#draw(GL2ES2, Region, float[], int)}
- *
+ *
* @param gl referencing the current GLContext to which the ShaderState is bound to
* @throws GLException if initialization failed
*/
@@ -117,48 +117,48 @@ public abstract class Renderer {
gl.isFunctionAvailable("glDrawElements") &&
gl.isFunctionAvailable("glVertexAttribPointer") &&
gl.isFunctionAvailable("glDeleteBuffers");
-
+
if(DEBUG) {
System.err.println("TextRendererImpl01: VBO Supported = " + isVBOSupported());
}
-
+
if(!vboSupported){
throw new GLException("VBO not supported");
}
-
+
rs.attachTo(gl);
-
+
gl.glEnable(GL2ES2.GL_BLEND);
gl.glBlendFunc(GL2ES2.GL_SRC_ALPHA, GL2ES2.GL_ONE_MINUS_SRC_ALPHA); // FIXME: alpha blending stage ?
-
+
initialized = initShaderProgram(gl);
if(!initialized) {
throw new GLException("Shader initialization failed");
}
-
+
if(!rs.getShaderState().uniform(gl, rs.getPMVMatrix())) {
throw new GLException("Error setting PMVMatrix in shader: "+rs.getShaderState());
}
-
+
if( Region.isNonUniformWeight( getRenderModes() ) ) {
if(!rs.getShaderState().uniform(gl, rs.getWeight())) {
throw new GLException("Error setting weight in shader: "+rs.getShaderState());
}
}
-
+
if(!rs.getShaderState().uniform(gl, rs.getAlpha())) {
throw new GLException("Error setting global alpha in shader: "+rs.getShaderState());
- }
-
+ }
+
if(!rs.getShaderState().uniform(gl, rs.getColorStatic())) {
throw new GLException("Error setting global color in shader: "+rs.getShaderState());
- }
+ }
}
- public final void flushCache(GL2ES2 gl) {
+ public final void flushCache(GL2ES2 gl) {
// FIXME: REMOVE !
}
-
+
public void destroy(GL2ES2 gl) {
if(!initialized){
if(DEBUG_INSTANCE) {
@@ -169,13 +169,13 @@ public abstract class Renderer {
rs.getShaderState().useProgram(gl, false);
destroyImpl(gl);
rs.destroy(gl);
- initialized = false;
+ initialized = false;
}
-
+
public final RenderState getRenderState() { return rs; }
public final ShaderState getShaderState() { return rs.getShaderState(); }
-
- public final void enable(GL2ES2 gl, boolean enable) {
+
+ public final void enable(GL2ES2 gl, boolean enable) {
rs.getShaderState().useProgram(gl, enable);
}
@@ -188,7 +188,7 @@ public abstract class Renderer {
rs.getShaderState().uniform(gl, rs.getWeight());
}
}
-
+
public void setAlpha(GL2ES2 gl, float alpha_t) {
rs.getAlpha().setData(alpha_t);
if(null != gl && rs.getShaderState().inUse()) {
@@ -199,11 +199,11 @@ public abstract class Renderer {
public void getColorStatic(GL2ES2 gl, float[] rgb) {
FloatBuffer fb = (FloatBuffer) rs.getColorStatic().getBuffer();
- rgb[0] = fb.get(0);
- rgb[1] = fb.get(1);
- rgb[2] = fb.get(2);
+ rgb[0] = fb.get(0);
+ rgb[1] = fb.get(1);
+ rgb[2] = fb.get(2);
}
-
+
public void setColorStatic(GL2ES2 gl, float r, float g, float b){
FloatBuffer fb = (FloatBuffer) rs.getColorStatic().getBuffer();
fb.put(0, r);
@@ -213,7 +213,7 @@ public abstract class Renderer {
rs.getShaderState().uniform(gl, rs.getColorStatic());
}
}
-
+
public void rotate(GL2ES2 gl, float angle, float x, float y, float z) {
rs.pmvMatrix().glRotatef(angle, x, y, z);
updateMatrix(gl);
@@ -223,7 +223,7 @@ public abstract class Renderer {
rs.pmvMatrix().glTranslatef(x, y, z);
updateMatrix(gl);
}
-
+
public void scale(GL2ES2 gl, float x, float y, float z) {
rs.pmvMatrix().glScalef(x, y, z);
updateMatrix(gl);
@@ -261,15 +261,15 @@ public abstract class Renderer {
p.glLoadIdentity();
p.glOrthof(0, width, 0, height, near, far);
updateMatrix(gl);
- return true;
+ return true;
}
protected String getVertexShaderName() {
return "curverenderer" + getImplVersion();
}
-
+
protected String getFragmentShaderName() {
- final String version = getImplVersion();
+ final String version = getImplVersion();
final String pass = Region.isVBAA(renderModes) ? "-2pass" : "-1pass" ;
final String weight = Region.isNonUniformWeight(renderModes) ? "-weight" : "" ;
return "curverenderer" + version + pass + weight;
@@ -277,7 +277,7 @@ public abstract class Renderer {
// FIXME: Really required to have sampler2D def. precision ? If not, we can drop getFragmentShaderPrecision(..) and use default ShaderCode ..
public static final String es2_precision_fp = "\nprecision mediump float;\nprecision mediump int;\nprecision mediump sampler2D;\n";
-
+
protected String getFragmentShaderPrecision(GL2ES2 gl) {
if( gl.isGLES2() ) {
return es2_precision_fp;
@@ -287,7 +287,7 @@ public abstract class Renderer {
}
return null;
}
-
+
protected String getImplVersion() {
return "01";
}
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderer.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderer.java
index 8dc41b0c0..f6ce852d8 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderer.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderer.java
@@ -38,28 +38,28 @@ import jogamp.graph.curve.text.GlyphString;
import com.jogamp.graph.font.Font;
public abstract class TextRenderer extends Renderer {
- /**
+ /**
* Create a Hardware accelerated Text Renderer.
- * @param rs the used {@link RenderState}
+ * @param rs the used {@link RenderState}
* @param renderModes either {@link com.jogamp.graph.curve.opengl.GLRegion#SINGLE_PASS} or {@link com.jogamp.graph.curve.Region#VBAA_RENDERING_BIT}
*/
public static TextRenderer create(RenderState rs, int renderModes) {
return new jogamp.graph.curve.opengl.TextRendererImpl01(rs, renderModes);
}
-
+
protected TextRenderer(RenderState rs, int type) {
super(rs, type);
}
-
+
/** Render the String in 3D space wrt to the font provided at the position provided
* the outlines will be generated, if not yet generated
* @param gl the current GL state
* @param font {@link Font} to be used
- * @param str text to be rendered
- * @param position the lower left corner of the string
+ * @param str text to be rendered
+ * @param position the lower left corner of the string
* @param fontSize font size
- * @param texWidth desired texture width for multipass-rendering.
+ * @param texWidth desired texture width for multipass-rendering.
* The actual used texture-width is written back when mp rendering is enabled, otherwise the store is untouched.
* @throws Exception if TextRenderer not initialized
*/
@@ -77,11 +77,11 @@ public abstract class TextRenderer extends Renderer {
if(DEBUG_INSTANCE) {
System.err.println("createString: "+getCacheSize()+"/"+getCacheLimit()+" - "+Font.NAME_UNIQUNAME + " - " + str + " - " + size);
}
- final GlyphString glyphString = GlyphString.createString(null, rs.getVertexFactory(), font, size, str);
- glyphString.createRegion(gl, renderModes);
+ final GlyphString glyphString = GlyphString.createString(null, rs.getVertexFactory(), font, size, str);
+ glyphString.createRegion(gl, renderModes);
return glyphString;
}
-
+
/** FIXME
public void flushCache(GL2ES2 gl) {
Iterator iterator = stringCacheMap.values().iterator();
@@ -89,10 +89,10 @@ public abstract class TextRenderer extends Renderer {
GlyphString glyphString = iterator.next();
glyphString.destroy(gl, rs);
}
- stringCacheMap.clear();
+ stringCacheMap.clear();
stringCacheArray.clear();
} */
-
+
@Override
protected void destroyImpl(GL2ES2 gl) {
// fluchCache(gl) already called
@@ -101,42 +101,42 @@ public abstract class TextRenderer extends Renderer {
GlyphString glyphString = iterator.next();
glyphString.destroy(gl, rs);
}
- stringCacheMap.clear();
+ stringCacheMap.clear();
stringCacheArray.clear();
}
-
+
/**
*
Sets the cache limit for reusing GlyphString's and their Region.
* Default is {@link #DEFAULT_CACHE_LIMIT}, -1 unlimited, 0 turns cache off, >0 limited
- *
+ *
*
The cache will be validate when the next string rendering happens.
- *
+ *
* @param newLimit new cache size
- *
+ *
* @see #DEFAULT_CACHE_LIMIT
*/
public final void setCacheLimit(int newLimit ) { stringCacheLimit = newLimit; }
-
+
/**
* Sets the cache limit, see {@link #setCacheLimit(int)} and validates the cache.
- *
+ *
* @see #setCacheLimit(int)
- *
+ *
* @param gl current GL used to remove cached objects if required
* @param newLimit new cache size
*/
public final void setCacheLimit(GL2ES2 gl, int newLimit ) { stringCacheLimit = newLimit; validateCache(gl, 0); }
-
+
/**
* @return the current cache limit
*/
public final int getCacheLimit() { return stringCacheLimit; }
-
- /**
+
+ /**
* @return the current utilized cache size, <= {@link #getCacheLimit()}
*/
public final int getCacheSize() { return stringCacheArray.size(); }
-
+
protected final void validateCache(GL2ES2 gl, int space) {
if ( getCacheLimit() > 0 ) {
while ( getCacheSize() + space > getCacheLimit() ) {
@@ -144,7 +144,7 @@ public abstract class TextRenderer extends Renderer {
}
}
}
-
+
protected final GlyphString getCachedGlyphString(Font font, String str, int fontSize) {
return stringCacheMap.get(getKey(font, str, fontSize));
}
@@ -160,13 +160,13 @@ public abstract class TextRenderer extends Renderer {
} /// else overwrite is nop ..
}
}
-
+
protected final void removeCachedGlyphString(GL2ES2 gl, Font font, String str, int fontSize) {
final String key = getKey(font, str, fontSize);
GlyphString glyphString = stringCacheMap.remove(key);
if(null != glyphString) {
glyphString.destroy(gl, rs);
- }
+ }
stringCacheArray.remove(key);
}
@@ -177,7 +177,7 @@ public abstract class TextRenderer extends Renderer {
glyphString.destroy(gl, rs);
}
}
-
+
protected final String getKey(Font font, String str, int fontSize) {
final StringBuilder sb = new StringBuilder();
return font.getName(sb, Font.NAME_UNIQUNAME)
@@ -186,8 +186,8 @@ public abstract class TextRenderer extends Renderer {
/** Default cache limit, see {@link #setCacheLimit(int)} */
public static final int DEFAULT_CACHE_LIMIT = 256;
-
+
private HashMap stringCacheMap = new HashMap(DEFAULT_CACHE_LIMIT);
private ArrayList stringCacheArray = new ArrayList(DEFAULT_CACHE_LIMIT);
- private int stringCacheLimit = DEFAULT_CACHE_LIMIT;
+ private int stringCacheLimit = DEFAULT_CACHE_LIMIT;
}
\ No newline at end of file
diff --git a/src/jogl/classes/com/jogamp/graph/curve/tess/Triangulation.java b/src/jogl/classes/com/jogamp/graph/curve/tess/Triangulation.java
index 7728efcaf..ae2849536 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/tess/Triangulation.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/tess/Triangulation.java
@@ -33,7 +33,7 @@ import jogamp.graph.curve.tess.CDTriangulator2D;
public class Triangulation {
/** Create a new instance of a triangulation.
- * Currently only a modified version of Constraint Delaunay
+ * Currently only a modified version of Constraint Delaunay
* is implemented.
* @return instance of a triangulator
* @see Triangulator
diff --git a/src/jogl/classes/com/jogamp/graph/curve/tess/Triangulator.java b/src/jogl/classes/com/jogamp/graph/curve/tess/Triangulator.java
index 1ffaccebc..4e8c400e0 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/tess/Triangulator.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/tess/Triangulator.java
@@ -36,32 +36,32 @@ import com.jogamp.graph.geom.Triangle;
/** Interface to the triangulation algorithms provided
* A triangulation of 2D outlines where you can
* provides an easy one or more outlines to be triangulated
- *
+ *
* example usage:
* addCurve(o1);
* addCurve(o2);
* addCurve(o3);
* generate();
* reset();
- *
+ *
* @see Outline
* @see Triangulation
*/
public interface Triangulator {
-
+
/** Add a curve to the list of Outlines
* describing the shape
* @param outline a bounding {@link Outline}
*/
public void addCurve(Outline outline);
-
- /** Generate the triangulation of the provided
+
+ /** Generate the triangulation of the provided
* List of {@link Outline}s
* @return an arraylist of {@link Triangle}s resembling the
* final shape.
*/
public ArrayList generate();
-
+
/** Reset the triangulation to initial state
* Clearing cached data
*/
diff --git a/src/jogl/classes/com/jogamp/graph/font/Font.java b/src/jogl/classes/com/jogamp/graph/font/Font.java
index 64a3a3e6c..82211da92 100644
--- a/src/jogl/classes/com/jogamp/graph/font/Font.java
+++ b/src/jogl/classes/com/jogamp/graph/font/Font.java
@@ -31,10 +31,10 @@ import com.jogamp.opengl.math.geom.AABBox;
/**
* Interface wrapper for font implementation.
- *
+ *
* TrueType Font Specification:
* http://developer.apple.com/fonts/ttrefman/rm06/Chap6.html
- *
+ *
* TrueType Font Table Introduction:
* http://scripts.sil.org/cms/scripts/page.php?item_id=IWS-Chapter08
*/
@@ -50,22 +50,22 @@ public interface Font {
public static final int NAME_VERSION = 5;
public static final int NAME_MANUFACTURER = 8;
public static final int NAME_DESIGNER = 9;
-
-
+
+
/**
* Metrics for font
- *
+ *
* Depending on the font's direction, horizontal or vertical,
* the following tables shall be used:
- *
+ *
* Vertical http://developer.apple.com/fonts/TTRefMan/RM06/Chap6vhea.html
* Horizontal http://developer.apple.com/fonts/TTRefMan/RM06/Chap6hhea.html
*/
- public interface Metrics {
+ public interface Metrics {
float getAscent(float pixelSize);
float getDescent(float pixelSize);
float getLineGap(float pixelSize);
- float getMaxExtend(float pixelSize);
+ float getMaxExtend(float pixelSize);
float getScale(float pixelSize);
AABBox getBBox(float pixelSize);
}
@@ -74,12 +74,12 @@ public interface Font {
* Glyph for font
*/
public interface Glyph {
- // reserved special glyph IDs
+ // reserved special glyph IDs
// http://scripts.sil.org/cms/scripts/page.php?item_id=IWS-Chapter08#ba57949e
public static final int ID_UNKNOWN = 0;
public static final int ID_CR = 2;
public static final int ID_SPACE = 3;
-
+
public Font getFont();
public char getSymbol();
public AABBox getBBox(float pixelSize);
@@ -89,25 +89,25 @@ public interface Font {
public String getName(int nameIndex);
public StringBuilder getName(StringBuilder string, int nameIndex);
-
+
/** Shall return the family and subfamily name, separated a dash.
*
{@link #getName(StringBuilder, int)} w/ {@link #NAME_FAMILY} and {@link #NAME_SUBFAMILY}
*
Example: "{@code Ubuntu-Regular}"
*/
public StringBuilder getFullFamilyName(StringBuilder buffer);
-
+
public StringBuilder getAllNames(StringBuilder string, String separator);
-
+
public float getAdvanceWidth(int i, float pixelSize);
public Metrics getMetrics();
public Glyph getGlyph(char symbol);
public int getNumGlyphs();
-
+
public float getStringWidth(CharSequence string, float pixelSize);
public float getStringHeight(CharSequence string, float pixelSize);
public AABBox getStringBounds(CharSequence string, float pixelSize);
-
- public boolean isPrintableChar( char c );
-
+
+ public boolean isPrintableChar( char c );
+
/** Shall return {@link #getFullFamilyName()} */
public String toString();
}
\ No newline at end of file
diff --git a/src/jogl/classes/com/jogamp/graph/font/FontFactory.java b/src/jogl/classes/com/jogamp/graph/font/FontFactory.java
index d2824b9dc..884662e6e 100644
--- a/src/jogl/classes/com/jogamp/graph/font/FontFactory.java
+++ b/src/jogl/classes/com/jogamp/graph/font/FontFactory.java
@@ -49,13 +49,13 @@ import jogamp.graph.font.UbuntuFontLoader;
public class FontFactory {
private static final String FontConstructorPropKey = "jogamp.graph.font.ctor";
private static final String DefaultFontConstructor = "jogamp.graph.font.typecast.TypecastFontConstructor";
-
+
/** Ubuntu is the default font family */
public static final int UBUNTU = 0;
-
+
/** Java fonts are optional */
public static final int JAVA = 1;
-
+
private static final FontConstructor fontConstr;
static {
@@ -63,18 +63,18 @@ public class FontFactory {
* For example:
* "jogamp.graph.font.typecast.TypecastFontFactory" (default)
* "jogamp.graph.font.ttf.TTFFontImpl"
- */
+ */
String fontImplName = PropertyAccess.getProperty(FontConstructorPropKey, true);
if(null == fontImplName) {
fontImplName = DefaultFontConstructor;
}
fontConstr = (FontConstructor) ReflectionUtil.createInstance(fontImplName, FontFactory.class.getClassLoader());
}
-
+
public static final FontSet getDefault() {
return get(UBUNTU);
}
-
+
public static final FontSet get(int font) {
switch (font) {
case JAVA:
@@ -83,15 +83,15 @@ public class FontFactory {
return UbuntuFontLoader.get();
}
}
-
+
public static final Font get(File file) throws IOException {
return fontConstr.create(file);
}
public static final Font get(final URLConnection conn) throws IOException {
return fontConstr.create(conn);
- }
-
+ }
+
public static boolean isPrintableChar( char c ) {
if( Character.isWhitespace(c) ) {
return true;
@@ -101,5 +101,5 @@ public class FontFactory {
}
final Character.UnicodeBlock block = Character.UnicodeBlock.of( c );
return block != null && block != Character.UnicodeBlock.SPECIALS;
- }
+ }
}
diff --git a/src/jogl/classes/com/jogamp/graph/font/FontSet.java b/src/jogl/classes/com/jogamp/graph/font/FontSet.java
index d376922ab..17b8b2136 100644
--- a/src/jogl/classes/com/jogamp/graph/font/FontSet.java
+++ b/src/jogl/classes/com/jogamp/graph/font/FontSet.java
@@ -34,29 +34,29 @@ public interface FontSet {
/** Font family REGULAR **/
public static final int FAMILY_REGULAR = 0;
-
+
/** Font family LIGHT **/
public static final int FAMILY_LIGHT = 1;
-
+
/** Font family MEDIUM **/
public static final int FAMILY_MEDIUM = 2;
-
+
/** Font family CONDENSED **/
public static final int FAMILY_CONDENSED = 3;
-
+
/** Font family MONO **/
public static final int FAMILY_MONOSPACED = 4;
-
+
/** SERIF style/family bit flag. Fallback to Sans Serif. */
public static final int STYLE_SERIF = 1 << 1;
-
+
/** BOLD style bit flag */
public static final int STYLE_BOLD = 1 << 2;
-
+
/** ITALIC style bit flag */
public static final int STYLE_ITALIC = 1 << 3;
Font getDefault() throws IOException ;
-
+
Font get(int family, int stylebits) throws IOException ;
}
diff --git a/src/jogl/classes/com/jogamp/graph/geom/Outline.java b/src/jogl/classes/com/jogamp/graph/geom/Outline.java
index 12c45860b..dfa6a8635 100644
--- a/src/jogl/classes/com/jogamp/graph/geom/Outline.java
+++ b/src/jogl/classes/com/jogamp/graph/geom/Outline.java
@@ -36,12 +36,12 @@ import com.jogamp.opengl.math.geom.AABBox;
/** Define a single continuous stroke by control vertices.
- * The vertices define the shape of the region defined by this
+ * The vertices define the shape of the region defined by this
* outline. The Outline can contain a list of off-curve and on-curve
* vertices which define curved regions.
- *
+ *
* Note: An outline should be closed to be rendered as a region.
- *
+ *
* @see OutlineShape, Region
*/
public class Outline implements Cloneable, Comparable {
@@ -55,7 +55,7 @@ public class Outline implements Cloneable, Comparable {
* An outline can contain off Curve vertices which define curved
* regions in the outline.
*/
- public Outline() {
+ public Outline() {
}
public final int getVertexCount() {
@@ -64,7 +64,7 @@ public class Outline implements Cloneable, Comparable {
/** Appends a vertex to the outline loop/strip.
* @param vertex Vertex to be added
- * @throws NullPointerException if the {@link Vertex} element is null
+ * @throws NullPointerException if the {@link Vertex} element is null
*/
public final void addVertex(Vertex vertex) throws NullPointerException {
addVertex(vertices.size(), vertex);
@@ -73,7 +73,7 @@ public class Outline implements Cloneable, Comparable {
/** Insert the {@link Vertex} element at the given {@code position} to the outline loop/strip.
* @param position of the added Vertex
* @param vertex Vertex object to be added
- * @throws NullPointerException if the {@link Vertex} element is null
+ * @throws NullPointerException if the {@link Vertex} element is null
* @throws IndexOutOfBoundsException if position is out of range (position < 0 || position > getVertexNumber())
*/
public final void addVertex(int position, Vertex vertex) throws NullPointerException, IndexOutOfBoundsException {
@@ -88,10 +88,10 @@ public class Outline implements Cloneable, Comparable {
/** Replaces the {@link Vertex} element at the given {@code position}.
*
Sets the bounding box dirty, hence a next call to {@link #getBounds()} will validate it.
- *
+ *
* @param position of the replaced Vertex
- * @param vertex replacement Vertex object
- * @throws NullPointerException if the {@link Outline} element is null
+ * @param vertex replacement Vertex object
+ * @throws NullPointerException if the {@link Outline} element is null
* @throws IndexOutOfBoundsException if position is out of range (position < 0 || position >= getVertexNumber())
*/
public final void setVertex(int position, Vertex vertex) throws NullPointerException, IndexOutOfBoundsException {
@@ -112,12 +112,12 @@ public class Outline implements Cloneable, Comparable {
/** Removes the {@link Vertex} element at the given {@code position}.
*
Sets the bounding box dirty, hence a next call to {@link #getBounds()} will validate it.
- *
+ *
* @param position of the to be removed Vertex
* @throws IndexOutOfBoundsException if position is out of range (position < 0 || position >= getVertexNumber())
*/
public final Vertex removeVertex(int position) throws IndexOutOfBoundsException {
- dirtyBBox = true;
+ dirtyBBox = true;
return vertices.remove(position);
}
@@ -139,7 +139,7 @@ public class Outline implements Cloneable, Comparable {
/**
* Use the given outline loop/strip.
*
Validates the bounding box.
- *
+ *
* @param vertices the new outline loop/strip
*/
public final void setVertices(ArrayList vertices) {
@@ -152,7 +152,7 @@ public class Outline implements Cloneable, Comparable {
}
/** define if this outline is closed or not.
- * if set to closed, checks if the last vertex is
+ * if set to closed, checks if the last vertex is
* equal to the first vertex. If not Equal adds a
* vertex at the end to the list.
* @param closed
@@ -170,7 +170,7 @@ public class Outline implements Cloneable, Comparable {
}
/** Compare two outlines with Bounding Box area
- * as criteria.
+ * as criteria.
* @see java.lang.Comparable#compareTo(java.lang.Object)
*/
public final int compareTo(Outline outline) {
@@ -198,11 +198,11 @@ public class Outline implements Cloneable, Comparable {
validateBoundingBox();
}
return bbox;
- }
+ }
/**
* @param obj the Object to compare this Outline with
- * @return true if {@code obj} is an Outline, not null, equals bounds and equal vertices in the same order
+ * @return true if {@code obj} is an Outline, not null, equals bounds and equal vertices in the same order
*/
public boolean equals(Object obj) {
if( obj == this) {
@@ -210,7 +210,7 @@ public class Outline implements Cloneable, Comparable {
}
if( null == obj || !(obj instanceof Outline) ) {
return false;
- }
+ }
final Outline o = (Outline) obj;
if(getVertexCount() != o.getVertexCount()) {
return false;
@@ -240,5 +240,5 @@ public class Outline implements Cloneable, Comparable {
o.vertices.add(vertices.get(i).clone());
}
return o;
- }
+ }
}
diff --git a/src/jogl/classes/com/jogamp/graph/geom/Triangle.java b/src/jogl/classes/com/jogamp/graph/geom/Triangle.java
index fb34de221..bd0900495 100644
--- a/src/jogl/classes/com/jogamp/graph/geom/Triangle.java
+++ b/src/jogl/classes/com/jogamp/graph/geom/Triangle.java
@@ -48,11 +48,11 @@ public class Triangle {
public Vertex[] getVertices() {
return vertices;
}
-
+
public boolean isEdgesBoundary() {
return boundaryEdges[0] || boundaryEdges[1] || boundaryEdges[2];
}
-
+
public boolean isVerticesBoundary() {
return boundaryVertices[0] || boundaryVertices[1] || boundaryVertices[2];
}
@@ -60,11 +60,11 @@ public class Triangle {
public void setEdgesBoundary(boolean[] boundary) {
this.boundaryEdges = boundary;
}
-
+
public boolean[] getEdgeBoundary() {
return boundaryEdges;
}
-
+
public boolean[] getVerticesBoundary() {
return boundaryVertices;
}
@@ -72,7 +72,7 @@ public class Triangle {
public void setVerticesBoundary(boolean[] boundaryVertices) {
this.boundaryVertices = boundaryVertices;
}
-
+
public String toString() {
return "Tri ID: " + id + "\n" + vertices[0] + "\n" + vertices[1] + "\n" + vertices[2];
}
diff --git a/src/jogl/classes/com/jogamp/graph/geom/Vertex.java b/src/jogl/classes/com/jogamp/graph/geom/Vertex.java
index e3df86de1..40048235e 100644
--- a/src/jogl/classes/com/jogamp/graph/geom/Vertex.java
+++ b/src/jogl/classes/com/jogamp/graph/geom/Vertex.java
@@ -30,7 +30,7 @@ package com.jogamp.graph.geom;
import com.jogamp.opengl.math.Vert3fImmutable;
/**
- * A Vertex with custom memory layout using custom factory.
+ * A Vertex with custom memory layout using custom factory.
*/
public interface Vertex extends Vert3fImmutable, Cloneable {
@@ -39,16 +39,16 @@ public interface Vertex extends Vert3fImmutable, Cloneable {
T create(float x, float y, float z, boolean onCurve);
- T create(float[] coordsBuffer, int offset, int length, boolean onCurve);
+ T create(float[] coordsBuffer, int offset, int length, boolean onCurve);
}
-
+
void setCoord(float x, float y, float z);
/**
* @see System#arraycopy(Object, int, Object, int, int) for thrown IndexOutOfBoundsException
*/
void setCoord(float[] coordsBuffer, int offset, int length);
-
+
void setX(float x);
void setY(float y);
@@ -60,24 +60,24 @@ public interface Vertex extends Vert3fImmutable, Cloneable {
void setOnCurve(boolean onCurve);
int getId();
-
+
void setId(int id);
-
+
float[] getTexCoord();
-
+
void setTexCoord(float s, float t);
-
+
/**
* @see System#arraycopy(Object, int, Object, int, int) for thrown IndexOutOfBoundsException
*/
void setTexCoord(float[] texCoordsBuffer, int offset, int length);
-
+
/**
* @param obj the Object to compare this Vertex with
- * @return true if {@code obj} is a Vertex and not null, on-curve flag is equal and has same vertex- and tex-coords.
+ * @return true if {@code obj} is a Vertex and not null, on-curve flag is equal and has same vertex- and tex-coords.
*/
boolean equals(Object obj);
-
+
/**
* @return deep clone of this Vertex
*/
diff --git a/src/jogl/classes/com/jogamp/graph/geom/opengl/SVertex.java b/src/jogl/classes/com/jogamp/graph/geom/opengl/SVertex.java
index 97e438b63..6b07688a7 100644
--- a/src/jogl/classes/com/jogamp/graph/geom/opengl/SVertex.java
+++ b/src/jogl/classes/com/jogamp/graph/geom/opengl/SVertex.java
@@ -39,11 +39,11 @@ public class SVertex implements Vertex {
protected float[] coord = new float[3];
protected boolean onCurve;
private float[] texCoord = new float[2];
-
+
static final Factory factory = new Factory();
-
- public static Factory factory() { return factory; }
-
+
+ public static Factory factory() { return factory; }
+
public static class Factory implements Vertex.Factory {
public SVertex create() {
return new SVertex();
@@ -55,9 +55,9 @@ public class SVertex implements Vertex {
public SVertex create(float[] coordsBuffer, int offset, int length, boolean onCurve) {
return new SVertex(coordsBuffer, offset, length, onCurve);
- }
+ }
}
-
+
public SVertex() {
}
@@ -65,19 +65,19 @@ public class SVertex implements Vertex {
setCoord(x, y, z);
setOnCurve(onCurve);
}
-
+
public SVertex(float[] coordsBuffer, int offset, int length, boolean onCurve) {
setCoord(coordsBuffer, offset, length);
setOnCurve(onCurve);
}
-
- public SVertex(float[] coordsBuffer, int offset, int length,
+
+ public SVertex(float[] coordsBuffer, int offset, int length,
float[] texCoordsBuffer, int offsetTC, int lengthTC, boolean onCurve) {
setCoord(coordsBuffer, offset, length);
setTexCoord(texCoordsBuffer, offsetTC, lengthTC);
setOnCurve(onCurve);
}
-
+
public final void setCoord(float x, float y, float z) {
this.coord[0] = x;
this.coord[1] = y;
@@ -87,12 +87,12 @@ public class SVertex implements Vertex {
public final void setCoord(float[] coordsBuffer, int offset, int length) {
System.arraycopy(coordsBuffer, offset, coord, 0, length);
}
-
+
@Override
public int getCoordCount() {
return 3;
}
-
+
@Override
public final float[] getCoord() {
return coord;
@@ -133,11 +133,11 @@ public class SVertex implements Vertex {
public final int getId(){
return id;
}
-
+
public final void setId(int id){
this.id = id;
}
-
+
public boolean equals(Object obj) {
if( obj == this) {
return true;
@@ -146,12 +146,12 @@ public class SVertex implements Vertex {
return false;
}
final Vertex v = (Vertex) obj;
- return this == v ||
- isOnCurve() == v.isOnCurve() &&
+ return this == v ||
+ isOnCurve() == v.isOnCurve() &&
VectorUtil.checkEqualityVec2(getTexCoord(), v.getTexCoord()) &&
VectorUtil.checkEquality(getCoord(), v.getCoord()) ;
}
-
+
public final float[] getTexCoord() {
return texCoord;
}
@@ -164,16 +164,16 @@ public class SVertex implements Vertex {
public final void setTexCoord(float[] texCoordsBuffer, int offset, int length) {
System.arraycopy(texCoordsBuffer, offset, texCoord, 0, length);
}
-
+
/**
* @return deep clone of this Vertex, but keeping the id blank
*/
public SVertex clone(){
return new SVertex(this.coord, 0, 3, this.texCoord, 0, 2, this.onCurve);
}
-
+
public String toString() {
- return "[ID: " + id + ", onCurve: " + onCurve +
+ return "[ID: " + id + ", onCurve: " + onCurve +
": p " + coord[0] + ", " + coord[1] + ", " + coord[2] +
", t " + texCoord[0] + ", " + texCoord[1] + "]";
}
diff --git a/src/jogl/classes/com/jogamp/opengl/FBObject.java b/src/jogl/classes/com/jogamp/opengl/FBObject.java
index 7060bb7d1..c78b2b83d 100644
--- a/src/jogl/classes/com/jogamp/opengl/FBObject.java
+++ b/src/jogl/classes/com/jogamp/opengl/FBObject.java
@@ -46,7 +46,7 @@ import com.jogamp.opengl.FBObject.Attachment.Type;
/**
* Core utility class simplifying usage of framebuffer objects (FBO)
- * with all {@link GLProfile}s.
+ * with all {@link GLProfile}s.
*
* Supports on-the-fly reconfiguration of dimension and multisample buffers via {@link #reset(GL, int, int, int, boolean)}
* while preserving the {@link Attachment} references.
@@ -55,50 +55,50 @@ import com.jogamp.opengl.FBObject.Attachment.Type;
* Integrates default read/write framebuffers via {@link GLContext#getDefaultReadFramebuffer()} and {@link GLContext#getDefaultReadFramebuffer()},
* which is being hooked at {@link GL#glBindFramebuffer(int, int)} when the default (zero) framebuffer is selected.
*
- *
+ *
*
FIXME: Implement support for {@link Type#DEPTH_TEXTURE}, {@link Type#STENCIL_TEXTURE} .
*/
public class FBObject {
protected static final boolean DEBUG = Debug.debug("FBObject");
private static final boolean FBOResizeQuirk = false;
-
+
private static enum DetachAction { NONE, DISPOSE, RECREATE };
-
- /**
+
+ /**
* Marker interface, denotes a color buffer attachment.
*
Always an instance of {@link Attachment}.
- *
Either an instance of {@link ColorAttachment} or {@link TextureAttachment}.
+ *
Either an instance of {@link ColorAttachment} or {@link TextureAttachment}.
*/
- public static interface Colorbuffer {
- /**
+ public static interface Colorbuffer {
+ /**
* Initializes the color buffer and set it's parameter, if uninitialized, i.e. name is zero.
* @return true if newly initialized, otherwise false.
- * @throws GLException if buffer generation or setup fails. The just created buffer name will be deleted in this case.
+ * @throws GLException if buffer generation or setup fails. The just created buffer name will be deleted in this case.
*/
public boolean initialize(GL gl) throws GLException;
-
- /**
+
+ /**
* Releases the color buffer if initialized, i.e. name is not zero.
- * @throws GLException if buffer release fails.
+ * @throws GLException if buffer release fails.
*/
public void free(GL gl) throws GLException;
-
+
/**
* Writes the internal format to the given GLCapabilities object.
* @param caps the destination for format bits
* @param rgba8Avail whether rgba8 is available
*/
- public void formatToGLCapabilities(GLCapabilities caps, boolean rgba8Avail);
+ public void formatToGLCapabilities(GLCapabilities caps, boolean rgba8Avail);
}
-
+
/** Common super class of all attachments */
public static abstract class Attachment {
- public enum Type {
+ public enum Type {
NONE, DEPTH, STENCIL, DEPTH_STENCIL, COLOR, COLOR_TEXTURE, DEPTH_TEXTURE, STENCIL_TEXTURE;
-
- /**
+
+ /**
* Returns {@link #COLOR}, {@link #DEPTH}, {@link #STENCIL} or {@link #DEPTH_STENCIL}
- * @throws IllegalArgumentException if format cannot be handled.
+ * @throws IllegalArgumentException if format cannot be handled.
*/
public static Type determine(int format) throws IllegalArgumentException {
switch(format) {
@@ -120,20 +120,20 @@ public class FBObject {
return Type.DEPTH_STENCIL;
default:
throw new IllegalArgumentException("format invalid: "+toHexString(format));
- }
+ }
}
};
-
+
/** immutable type [{@link #COLOR}, {@link #DEPTH}, {@link #STENCIL}, {@link #COLOR_TEXTURE}, {@link #DEPTH_TEXTURE}, {@link #STENCIL_TEXTURE} ] */
public final Type type;
-
+
/** immutable the internal format */
public final int format;
-
+
private int width, height;
-
+
private int name;
-
+
protected Attachment(Type type, int iFormat, int width, int height, int name) {
this.type = type;
this.format = iFormat;
@@ -141,18 +141,18 @@ public class FBObject {
this.height = height;
this.name = name;
}
-
+
/**
* Writes the internal format to the given GLCapabilities object.
* @param caps the destination for format bits
* @param rgba8Avail whether rgba8 is available
*/
- public final void formatToGLCapabilities(GLCapabilities caps, boolean rgba8Avail) {
+ public final void formatToGLCapabilities(GLCapabilities caps, boolean rgba8Avail) {
final int _format;
switch(format) {
case GL.GL_RGBA:
case 4:
- _format = rgba8Avail ? GL.GL_RGBA8 : GL.GL_RGBA4;
+ _format = rgba8Avail ? GL.GL_RGBA8 : GL.GL_RGBA4;
break;
case GL.GL_RGB:
case 3:
@@ -191,7 +191,7 @@ public class FBObject {
caps.setGreenBits(8);
caps.setBlueBits(8);
caps.setAlphaBits(8);
- break;
+ break;
case GL.GL_DEPTH_COMPONENT16:
caps.setDepthBits(16);
break;
@@ -218,18 +218,18 @@ public class FBObject {
throw new IllegalArgumentException("format invalid: "+toHexString(format));
}
}
-
+
/** width of attachment */
public final int getWidth() { return width; }
/** height of attachment */
public final int getHeight() { return height; }
/* pp */ final void setSize(int w, int h) { width = w; height = h; }
-
+
/** buffer name [1..max], maybe a texture or renderbuffer name, depending on type. */
- public final int getName() { return name; }
+ public final int getName() { return name; }
/* pp */ final void setName(int n) { name = n; }
-
- /**
+
+ /**
* Initializes the attachment and set it's parameter, if uninitialized, i.e. name is zero.
*
final boolean init = 0 == name;
@@ -239,11 +239,11 @@ public class FBObject {
return init;
*
* @return true if newly initialized, otherwise false.
- * @throws GLException if buffer generation or setup fails. The just created buffer name will be deleted in this case.
+ * @throws GLException if buffer generation or setup fails. The just created buffer name will be deleted in this case.
*/
public abstract boolean initialize(GL gl) throws GLException;
-
- /**
+
+ /**
* Releases the attachment if initialized, i.e. name is not zero.
*
if(0 != name) {
@@ -251,10 +251,10 @@ public class FBObject {
name = 0;
}
*
- * @throws GLException if buffer release fails.
+ * @throws GLException if buffer release fails.
*/
public abstract void free(GL gl) throws GLException;
-
+
/**
*
* Comparison by {@link #type}, {@link #format}, {@link #width}, {@link #height} and {@link #name}.
@@ -272,7 +272,7 @@ public class FBObject {
height== a.height &&
name == a.name ;
}
-
+
/**
*
* Hashed by {@link #type}, {@link #format}, {@link #width}, {@link #height} and {@link #name}.
@@ -289,14 +289,14 @@ public class FBObject {
hash = ((hash << 5) - hash) + name;
return hash;
}
-
+
int objectHashCode() { return super.hashCode(); }
-
+
public String toString() {
return getClass().getSimpleName()+"[type "+type+", format "+toHexString(format)+", "+width+"x"+height+
"; name "+toHexString(name)+", obj "+toHexString(objectHashCode())+"]";
}
-
+
public static Type getType(int attachmentPoint, int maxColorAttachments) {
if( GL.GL_COLOR_ATTACHMENT0 <= attachmentPoint && attachmentPoint < GL.GL_COLOR_ATTACHMENT0+maxColorAttachments ) {
return Type.COLOR;
@@ -304,9 +304,9 @@ public class FBObject {
switch(attachmentPoint) {
case GL.GL_DEPTH_ATTACHMENT:
return Type.DEPTH;
- case GL.GL_STENCIL_ATTACHMENT:
+ case GL.GL_STENCIL_ATTACHMENT:
return Type.STENCIL;
- default:
+ default:
throw new IllegalArgumentException("Invalid attachment point "+toHexString(attachmentPoint));
}
}
@@ -315,7 +315,7 @@ public class FBObject {
/** Other renderbuffer attachment which maybe a colorbuffer, depth or stencil. */
public static class RenderAttachment extends Attachment {
private int samples;
-
+
/**
* @param type allowed types are {@link Type#DEPTH_STENCIL} {@link Type#DEPTH}, {@link Type#STENCIL} or {@link Type#COLOR}
* @param iFormat
@@ -328,11 +328,11 @@ public class FBObject {
super(validateType(type), iFormat, width, height, name);
this.samples = samples;
}
-
+
/** number of samples, or zero for no multisampling */
public final int getSamples() { return samples; }
/* pp */ final void setSamples(int s) { samples = s; }
-
+
private static Type validateType(Type type) {
switch(type) {
case DEPTH_STENCIL:
@@ -340,11 +340,11 @@ public class FBObject {
case STENCIL:
case COLOR:
return type;
- default:
+ default:
throw new IllegalArgumentException("Invalid type: "+type);
}
}
-
+
/**
*
* Comparison by {@link #type}, {@link #format}, {@link #samples}, {@link #width}, {@link #height} and {@link #name}.
@@ -358,7 +358,7 @@ public class FBObject {
return super.equals(o) &&
samples == ((RenderAttachment)o).samples;
}
-
+
/**
*
* Hashed by {@link #type}, {@link #format}, {@link #samples}, {@link #width}, {@link #height} and {@link #name}.
@@ -378,14 +378,14 @@ public class FBObject {
final boolean init = 0 == getName();
if( init ) {
checkPreGLError(gl);
-
+
final int[] name = new int[] { -1 };
gl.glGenRenderbuffers(1, name, 0);
setName(name[0]);
-
+
gl.glBindRenderbuffer(GL.GL_RENDERBUFFER, getName());
if( samples > 0 ) {
- ((GL2GL3)gl).glRenderbufferStorageMultisample(GL.GL_RENDERBUFFER, samples, format, getWidth(), getHeight());
+ ((GL2GL3)gl).glRenderbufferStorageMultisample(GL.GL_RENDERBUFFER, samples, format, getWidth(), getHeight());
} else {
gl.glRenderbufferStorage(GL.GL_RENDERBUFFER, format, getWidth(), getHeight());
}
@@ -401,7 +401,7 @@ public class FBObject {
}
return init;
}
-
+
@Override
public void free(GL gl) {
final int[] name = new int[] { getName() };
@@ -413,20 +413,20 @@ public class FBObject {
setName(0);
}
}
-
+
public String toString() {
return getClass().getSimpleName()+"[type "+type+", format "+toHexString(format)+", samples "+samples+", "+getWidth()+"x"+getHeight()+
", name "+toHexString(getName())+", obj "+toHexString(objectHashCode())+"]";
}
}
-
+
/** Color render buffer attachment */
public static class ColorAttachment extends RenderAttachment implements Colorbuffer {
public ColorAttachment(int iFormat, int samples, int width, int height, int name) {
super(Type.COLOR, iFormat, samples, width, height, name);
- }
+ }
}
-
+
/** Texture attachment */
public static class TextureAttachment extends Attachment implements Colorbuffer {
/** details of the texture setup */
@@ -445,7 +445,7 @@ public class FBObject {
* @param wrapT
* @param name
*/
- public TextureAttachment(Type type, int iFormat, int width, int height, int dataFormat, int dataType,
+ public TextureAttachment(Type type, int iFormat, int width, int height, int dataFormat, int dataType,
int magFilter, int minFilter, int wrapS, int wrapT, int name) {
super(validateType(type), iFormat, width, height, name);
this.dataFormat = dataFormat;
@@ -455,35 +455,35 @@ public class FBObject {
this.wrapS = wrapS;
this.wrapT = wrapT;
}
-
+
private static Type validateType(Type type) {
switch(type) {
case COLOR_TEXTURE:
case DEPTH_TEXTURE:
case STENCIL_TEXTURE:
return type;
- default:
+ default:
throw new IllegalArgumentException("Invalid type: "+type);
}
}
-
- /**
+
+ /**
* Initializes the texture and set it's parameter, if uninitialized, i.e. name is zero.
- * @throws GLException if texture generation and setup fails. The just created texture name will be deleted in this case.
+ * @throws GLException if texture generation and setup fails. The just created texture name will be deleted in this case.
*/
@Override
public boolean initialize(GL gl) throws GLException {
final boolean init = 0 == getName();
if( init ) {
checkPreGLError(gl);
-
- final int[] name = new int[] { -1 };
+
+ final int[] name = new int[] { -1 };
gl.glGenTextures(1, name, 0);
if(0 == name[0]) {
throw new GLException("null texture, "+this);
}
setName(name[0]);
-
+
gl.glBindTexture(GL.GL_TEXTURE_2D, name[0]);
if( 0 < magFilter ) {
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, magFilter);
@@ -495,7 +495,7 @@ public class FBObject {
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, wrapS);
}
if( 0 < wrapT ) {
- gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, wrapT);
+ gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, wrapT);
}
boolean preTexImage2D = true;
int glerr = gl.glGetError();
@@ -534,50 +534,50 @@ public class FBObject {
"; min/mag "+toHexString(minFilter)+"/"+toHexString(magFilter)+
", wrap S/T "+toHexString(wrapS)+"/"+toHexString(wrapT)+
"; name "+toHexString(getName())+", obj "+toHexString(objectHashCode())+"]";
- }
+ }
}
static String toHexString(int v) {
return "0x"+Integer.toHexString(v);
}
-
+
/**
- * Creates a color {@link TextureAttachment}, i.e. type {@link Type#COLOR_TEXTURE},
+ * Creates a color {@link TextureAttachment}, i.e. type {@link Type#COLOR_TEXTURE},
* selecting the texture data type and format automatically.
- *
+ *
*
Using default min/mag filter {@link GL#GL_NEAREST} and default wrapS/wrapT {@link GL#GL_CLAMP_TO_EDGE}.
- *
+ *
* @param glp the chosen {@link GLProfile}
* @param alpha set to true if you request alpha channel, otherwise false;
- * @param width texture width
+ * @param width texture width
* @param height texture height
* @return the created and uninitialized color {@link TextureAttachment}
*/
public static final TextureAttachment createColorTextureAttachment(GLProfile glp, boolean alpha, int width, int height) {
return createColorTextureAttachment(glp, alpha, width, height, GL.GL_NEAREST, GL.GL_NEAREST, GL.GL_CLAMP_TO_EDGE, GL.GL_CLAMP_TO_EDGE);
}
-
+
/**
- * Creates a color {@link TextureAttachment}, i.e. type {@link Type#COLOR_TEXTURE},
+ * Creates a color {@link TextureAttachment}, i.e. type {@link Type#COLOR_TEXTURE},
* selecting the texture data type and format automatically.
- *
+ *
* @param glp the chosen {@link GLProfile}
* @param alpha set to true if you request alpha channel, otherwise false;
- * @param width texture width
+ * @param width texture width
* @param height texture height
* @param magFilter if > 0 value for {@link GL#GL_TEXTURE_MAG_FILTER}
- * @param minFilter if > 0 value for {@link GL#GL_TEXTURE_MIN_FILTER}
+ * @param minFilter if > 0 value for {@link GL#GL_TEXTURE_MIN_FILTER}
* @param wrapS if > 0 value for {@link GL#GL_TEXTURE_WRAP_S}
* @param wrapT if > 0 value for {@link GL#GL_TEXTURE_WRAP_T}
* @return the created and uninitialized color {@link TextureAttachment}
*/
- public static final TextureAttachment createColorTextureAttachment(GLProfile glp, boolean alpha, int width, int height,
+ public static final TextureAttachment createColorTextureAttachment(GLProfile glp, boolean alpha, int width, int height,
int magFilter, int minFilter, int wrapS, int wrapT) {
final int textureInternalFormat, textureDataFormat, textureDataType;
- if(glp.isGLES()) {
+ if(glp.isGLES()) {
textureInternalFormat = alpha ? GL.GL_RGBA : GL.GL_RGB;
textureDataFormat = alpha ? GL.GL_RGBA : GL.GL_RGB;
textureDataType = GL.GL_UNSIGNED_BYTE;
- } else {
+ } else {
textureInternalFormat = alpha ? GL.GL_RGBA8 : GL.GL_RGB8;
// textureInternalFormat = alpha ? GL.GL_RGBA : GL.GL_RGB;
// textureInternalFormat = alpha ? 4 : 3;
@@ -586,27 +586,27 @@ public class FBObject {
}
return createColorTextureAttachment(textureInternalFormat, width, height, textureDataFormat, textureDataType, magFilter, minFilter, wrapS, wrapT);
}
-
+
/**
- * Creates a color {@link TextureAttachment}, i.e. type {@link Type#COLOR_TEXTURE}.
+ * Creates a color {@link TextureAttachment}, i.e. type {@link Type#COLOR_TEXTURE}.
*
* @param internalFormat internalFormat parameter to {@link GL#glTexImage2D(int, int, int, int, int, int, int, int, long)}
- * @param width texture width
+ * @param width texture width
* @param height texture height
* @param dataFormat format parameter to {@link GL#glTexImage2D(int, int, int, int, int, int, int, int, long)}
* @param dataType type parameter to {@link GL#glTexImage2D(int, int, int, int, int, int, int, int, long)}
* @param magFilter if > 0 value for {@link GL#GL_TEXTURE_MAG_FILTER}
- * @param minFilter if > 0 value for {@link GL#GL_TEXTURE_MIN_FILTER}
+ * @param minFilter if > 0 value for {@link GL#GL_TEXTURE_MIN_FILTER}
* @param wrapS if > 0 value for {@link GL#GL_TEXTURE_WRAP_S}
* @param wrapT if > 0 value for {@link GL#GL_TEXTURE_WRAP_T}
* @return the created and uninitialized color {@link TextureAttachment}
*/
public static final TextureAttachment createColorTextureAttachment(int internalFormat, int width, int height, int dataFormat, int dataType,
int magFilter, int minFilter, int wrapS, int wrapT) {
- return new TextureAttachment(Type.COLOR_TEXTURE, internalFormat, width, height, dataFormat, dataType,
+ return new TextureAttachment(Type.COLOR_TEXTURE, internalFormat, width, height, dataFormat, dataType,
magFilter, minFilter, wrapS, wrapT, 0 /* name */);
}
-
+
private static boolean hasAlpha(int format) {
switch(format) {
case GL.GL_RGBA8:
@@ -619,7 +619,7 @@ public class FBObject {
return false;
}
}
-
+
private boolean initialized;
private boolean fullFBOSupport;
private boolean rgba8Avail;
@@ -629,7 +629,7 @@ public class FBObject {
private boolean stencil04Avail;
private boolean stencil08Avail;
private boolean stencil16Avail;
- private boolean packedDepthStencilAvail;
+ private boolean packedDepthStencilAvail;
private int maxColorAttachments, maxSamples, maxTextureSize, maxRenderbufferSize;
private int width, height, samples;
@@ -639,21 +639,21 @@ public class FBObject {
private boolean bound;
private int colorAttachmentCount;
- private Colorbuffer[] colorAttachmentPoints; // colorbuffer attachment points
+ private Colorbuffer[] colorAttachmentPoints; // colorbuffer attachment points
private RenderAttachment depth, stencil; // depth and stencil maybe equal in case of packed-depth-stencil
private FBObject samplingSink; // MSAA sink
- private TextureAttachment samplingSinkTexture;
+ private TextureAttachment samplingSinkTexture;
private boolean samplingSinkDirty;
//
// ColorAttachment helper ..
//
-
+
private final void validateColorAttachmentPointRange(int point) {
if(!initialized) {
throw new GLException("FBO not initialized");
- }
+ }
if(maxColorAttachments != colorAttachmentPoints.length) {
throw new InternalError("maxColorAttachments "+maxColorAttachments+", array.lenght "+colorAttachmentPoints);
}
@@ -661,14 +661,14 @@ public class FBObject {
throw new IllegalArgumentException("attachment point out of range: "+point+", should be within [0.."+(maxColorAttachments-1)+"], "+this);
}
}
-
+
private final void validateAddColorAttachment(int point, Colorbuffer ca) {
validateColorAttachmentPointRange(point);
if( null != colorAttachmentPoints[point] ) {
throw new IllegalArgumentException("Cannot attach "+ca+", attachment point already in use by "+colorAttachmentPoints[point]+", "+this);
- }
+ }
}
-
+
private final void addColorAttachment(int point, Colorbuffer ca) {
validateColorAttachmentPointRange(point);
final Colorbuffer c = colorAttachmentPoints[point];
@@ -678,7 +678,7 @@ public class FBObject {
colorAttachmentPoints[point] = ca;
colorAttachmentCount++;
}
-
+
private final void removeColorAttachment(int point, Colorbuffer ca) {
validateColorAttachmentPointRange(point);
final Colorbuffer c = colorAttachmentPoints[point];
@@ -688,20 +688,20 @@ public class FBObject {
colorAttachmentPoints[point] = null;
colorAttachmentCount--;
}
-
+
/**
* Return the {@link Colorbuffer} attachment at attachmentPoint if it is attached to this FBO, otherwise null.
- *
+ *
* @see #attachColorbuffer(GL, boolean)
* @see #attachColorbuffer(GL, boolean)
* @see #attachTexture2D(GL, int, boolean, int, int, int, int)
- * @see #attachTexture2D(GL, int, int, int, int, int, int, int, int)
+ * @see #attachTexture2D(GL, int, int, int, int, int, int, int, int)
*/
public final Colorbuffer getColorbuffer(int attachmentPoint) {
- validateColorAttachmentPointRange(attachmentPoint);
+ validateColorAttachmentPointRange(attachmentPoint);
return colorAttachmentPoints[attachmentPoint];
}
-
+
/**
* Finds the passed {@link Colorbuffer} within the valid range of attachment points
* using reference comparison only.
@@ -709,36 +709,36 @@ public class FBObject {
* Note: Slow. Implementation uses a logN array search to save resources, i.e. not using a HashMap.
*
* @param ca the {@link Colorbuffer} to look for.
- * @return -1 if the {@link Colorbuffer} could not be found, otherwise [0..{@link #getMaxColorAttachments()}-1]
+ * @return -1 if the {@link Colorbuffer} could not be found, otherwise [0..{@link #getMaxColorAttachments()}-1]
*/
public final int getColorbufferAttachmentPoint(Colorbuffer ca) {
for(int i=0; ireference only.
- *
+ *
*
* Note: Slow. Uses {@link #getColorbufferAttachmentPoint(Colorbuffer)} to determine it's attachment point
* to be used for {@link #getColorbuffer(int)}
*
- *
+ *
* @param gl the current GL context
* @param newWidth
* @param newHeight
@@ -911,7 +911,7 @@ public class FBObject {
public final void reset(GL gl, int newWidth, int newHeight) {
reset(gl, newWidth, newHeight, 0, false);
}
-
+
/**
* Initializes or resets this FBO's instance.
*
@@ -920,21 +920,21 @@ public class FBObject {
* to match the new given parameters.
*
*
- * Currently incompatibility and hence recreation of the attachments will be performed
+ * Currently incompatibility and hence recreation of the attachments will be performed
* if the size or sample count doesn't match for subsequent calls.
*
- *
+ *
*
Leaves the FBO bound state untouched
- *
+ *
* @param gl the current GL context
* @param newWidth the new width, it's minimum is capped to 1
* @param newHeight the new height, it's minimum is capped to 1
* @param newSamples if > 0, MSAA will be used, otherwise no multisampling. Will be capped to {@link #getMaxSamples()}.
- * @param resetSamplingSink true calls {@link #resetSamplingSink(GL)} immediatly.
+ * @param resetSamplingSink true calls {@link #resetSamplingSink(GL)} immediatly.
* false postpones resetting the sampling sink until {@link #use(GL, TextureAttachment)} or {@link #syncSamplingSink(GL)},
- * allowing to use the samples sink's FBO and texture until then. The latter is useful to benefit
- * from implicit double buffering while resetting the sink just before it's being used, eg. at swap-buffer.
- *
+ * allowing to use the samples sink's FBO and texture until then. The latter is useful to benefit
+ * from implicit double buffering while resetting the sink just before it's being used, eg. at swap-buffer.
+ *
* @throws GLException in case of an error, i.e. size too big, etc ..
*/
public final void reset(GL gl, int newWidth, int newHeight, int newSamples, boolean resetSamplingSink) {
@@ -942,9 +942,9 @@ public class FBObject {
init(gl, newWidth, newHeight, newSamples);
return;
}
-
+
newSamples = newSamples <= maxSamples ? newSamples : maxSamples; // clamp
-
+
if( newWidth != width || newHeight != height || newSamples != samples ) {
if( 0 >= newWidth ) { newWidth = 1; }
if( 0 >= newHeight ) { newHeight = 1; }
@@ -952,39 +952,39 @@ public class FBObject {
newWidth > maxRenderbufferSize || newHeight > maxRenderbufferSize ) {
throw new GLException("size "+width+"x"+height+" exceeds on of the maxima [texture "+maxTextureSize+", renderbuffer "+maxRenderbufferSize+"]");
}
-
+
if(DEBUG) {
System.err.println("FBObject.reset - START - "+width+"x"+height+", "+samples+" -> "+newWidth+"x"+newHeight+", "+newSamples+"; "+this);
- }
-
+ }
+
final boolean wasBound = isBound();
-
+
width = newWidth;
height = newHeight;
samples = newSamples;
-
+
if(0 < samples && null == samplingSink ) {
// needs valid samplingSink for detach*() -> bind()
samplingSink = new FBObject();
samplingSink.init(gl, width, height, 0);
}
- detachAllImpl(gl, true , true);
+ detachAllImpl(gl, true , true);
if(resetSamplingSink) {
resetSamplingSink(gl);
}
-
+
samplingSinkDirty = true;
if(!wasBound) {
unbind(gl);
}
-
+
if(DEBUG) {
System.err.println("FBObject.reset - END - "+this);
}
- }
+ }
}
-
+
/**
* Writes the internal format of the attachments to the given GLCapabilities object.
* @param caps the destination for format bits
@@ -994,11 +994,11 @@ public class FBObject {
caps.setNumSamples(samples);
caps.setDepthBits(0);
caps.setStencilBits(0);
-
+
final Colorbuffer cb = samples > 0 ? getSamplingSink() : getColorbuffer(0);
if(null != cb) {
cb.formatToGLCapabilities(caps, rgba8Avail);
- }
+ }
if(null != depth) {
depth.formatToGLCapabilities(caps, rgba8Avail);
}
@@ -1006,11 +1006,11 @@ public class FBObject {
stencil.formatToGLCapabilities(caps, rgba8Avail);
}
}
-
- /**
+
+ /**
* Note that the status may reflect an incomplete state during transition of attachments.
* @return The FB status. {@link GL.GL_FRAMEBUFFER_COMPLETE} if ok, otherwise return GL FBO error state or -1
- * @see #validateStatus()
+ * @see #validateStatus()
*/
public final int getStatus() {
return vStatus;
@@ -1020,15 +1020,15 @@ public class FBObject {
public final String getStatusString() {
return getStatusString(vStatus);
}
-
+
public static final String getStatusString(int fbStatus) {
switch(fbStatus) {
case -1:
return "NOT A FBO";
-
+
case GL.GL_FRAMEBUFFER_COMPLETE:
return "OK";
-
+
case GL.GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
return("FBO incomplete attachment\n");
case GL.GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
@@ -1043,21 +1043,21 @@ public class FBObject {
return("FBO missing read buffer");
case GL2GL3.GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:
return("FBO missing multisample buffer");
- case GL3.GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS:
+ case GL3.GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS:
return("FBO missing layer targets");
-
+
case GL.GL_FRAMEBUFFER_UNSUPPORTED:
return("Unsupported FBO format");
case GL2GL3.GL_FRAMEBUFFER_UNDEFINED:
return("FBO undefined");
-
+
case 0:
return("FBO implementation fault");
default:
return("FBO incomplete, implementation ERROR "+toHexString(fbStatus));
}
}
-
+
/**
* The status may even be valid if incomplete during transition of attachments.
* @see #getStatus()
@@ -1066,7 +1066,7 @@ public class FBObject {
switch(vStatus) {
case GL.GL_FRAMEBUFFER_COMPLETE:
return true;
-
+
case GL.GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
case GL.GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
case GL.GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS:
@@ -1079,29 +1079,29 @@ public class FBObject {
// we are in transition
return true;
}
-
+
case GL.GL_FRAMEBUFFER_UNSUPPORTED:
case GL2GL3.GL_FRAMEBUFFER_UNDEFINED:
-
- case 0:
+
+ case 0:
default:
if(DEBUG) {
- System.err.println("Framebuffer " + fbName + " is incomplete, status = " + toHexString(vStatus) +
+ System.err.println("Framebuffer " + fbName + " is incomplete, status = " + toHexString(vStatus) +
" : " + getStatusString(vStatus));
}
return false;
}
}
-
+
private static int checkPreGLError(GL gl) {
int glerr = gl.glGetError();
if(DEBUG && GL.GL_NO_ERROR != glerr) {
System.err.println("Pre-existing GL error: "+toHexString(glerr));
Thread.dumpStack();
}
- return glerr;
+ return glerr;
}
-
+
private final boolean checkNoError(GL gl, int err, String exceptionMessage) throws GLException {
if(GL.GL_NO_ERROR != err) {
if(null != gl) {
@@ -1118,17 +1118,17 @@ public class FBObject {
private final void checkInitialized() throws GLException {
if(!initialized) {
throw new GLException("FBO not initialized, call init(GL) first.");
- }
+ }
}
-
+
/**
* Attaches a {@link Colorbuffer}, i.e. {@link TextureAttachment}, to this FBO's instance at the given attachment point,
* selecting the texture data type and format automatically.
- *
+ *
*
Using default min/mag filter {@link GL#GL_NEAREST} and default wrapS/wrapT {@link GL#GL_CLAMP_TO_EDGE}.
- *
+ *
*
Leaves the FBO bound.
- *
+ *
* @param gl the current GL context
* @param attachmentPoint the color attachment point ranging from [0..{@link #getMaxColorAttachments()}-1]
* @param alpha set to true if you request alpha channel, otherwise false;
@@ -1140,18 +1140,18 @@ public class FBObject {
return (TextureAttachment)attachColorbuffer(gl, attachmentPoint,
createColorTextureAttachment(gl.getGLProfile(), alpha, width, height));
}
-
+
/**
* Attaches a {@link Colorbuffer}, i.e. {@link TextureAttachment}, to this FBO's instance at the given attachment point,
* selecting the texture data type and format automatically.
- *
+ *
*
Leaves the FBO bound.
- *
+ *
* @param gl the current GL context
* @param attachmentPoint the color attachment point ranging from [0..{@link #getMaxColorAttachments()}-1]
* @param alpha set to true if you request alpha channel, otherwise false;
* @param magFilter if > 0 value for {@link GL#GL_TEXTURE_MAG_FILTER}
- * @param minFilter if > 0 value for {@link GL#GL_TEXTURE_MIN_FILTER}
+ * @param minFilter if > 0 value for {@link GL#GL_TEXTURE_MIN_FILTER}
* @param wrapS if > 0 value for {@link GL#GL_TEXTURE_WRAP_S}
* @param wrapT if > 0 value for {@link GL#GL_TEXTURE_WRAP_T}
* @return TextureAttachment instance describing the new attached texture colorbuffer if bound and configured successfully, otherwise GLException is thrown
@@ -1162,19 +1162,19 @@ public class FBObject {
return (TextureAttachment)attachColorbuffer(gl, attachmentPoint,
createColorTextureAttachment(gl.getGLProfile(), alpha, width, height, magFilter, minFilter, wrapS, wrapT));
}
-
+
/**
* Attaches a {@link Colorbuffer}, i.e. {@link TextureAttachment}, to this FBO's instance at the given attachment point.
- *
+ *
*
Leaves the FBO bound.
- *
+ *
* @param gl the current GL context
* @param attachmentPoint the color attachment point ranging from [0..{@link #getMaxColorAttachments()}-1]
* @param internalFormat internalFormat parameter to {@link GL#glTexImage2D(int, int, int, int, int, int, int, int, long)}
* @param dataFormat format parameter to {@link GL#glTexImage2D(int, int, int, int, int, int, int, int, long)}
* @param dataType type parameter to {@link GL#glTexImage2D(int, int, int, int, int, int, int, int, long)}
* @param magFilter if > 0 value for {@link GL#GL_TEXTURE_MAG_FILTER}
- * @param minFilter if > 0 value for {@link GL#GL_TEXTURE_MIN_FILTER}
+ * @param minFilter if > 0 value for {@link GL#GL_TEXTURE_MIN_FILTER}
* @param wrapS if > 0 value for {@link GL#GL_TEXTURE_WRAP_S}
* @param wrapT if > 0 value for {@link GL#GL_TEXTURE_WRAP_T}
* @return TextureAttachment instance describing the new attached texture colorbuffer if bound and configured successfully, otherwise GLException is thrown
@@ -1187,10 +1187,10 @@ public class FBObject {
return (TextureAttachment)attachColorbuffer(gl, attachmentPoint,
createColorTextureAttachment(internalFormat, width, height, dataFormat, dataType, magFilter, minFilter, wrapS, wrapT));
}
-
+
/**
* Creates a {@link ColorAttachment}, selecting the format automatically.
- *
+ *
* @param alpha set to true if you request alpha channel, otherwise false;
* @return uninitialized ColorAttachment instance describing the new attached colorbuffer
*/
@@ -1203,13 +1203,13 @@ public class FBObject {
}
return new ColorAttachment(internalFormat, samples, width, height, 0);
}
-
+
/**
* Attaches a {@link Colorbuffer}, i.e. {@link ColorAttachment}, to this FBO's instance at the given attachment point,
* selecting the format automatically.
- *
+ *
*
Leaves the FBO bound.
- *
+ *
* @param gl the current GL context
* @param attachmentPoint the color attachment point ranging from [0..{@link #getMaxColorAttachments()}-1]
* @param alpha set to true if you request alpha channel, otherwise false;
@@ -1220,15 +1220,15 @@ public class FBObject {
public final ColorAttachment attachColorbuffer(GL gl, int attachmentPoint, boolean alpha) throws GLException {
return (ColorAttachment) attachColorbuffer(gl, attachmentPoint, createColorAttachment(alpha));
}
-
+
/**
* Attaches a {@link Colorbuffer}, i.e. {@link ColorAttachment}, to this FBO's instance at the given attachment point.
- *
+ *
*
Leaves the FBO bound.
- *
+ *
* @param gl the current GL context
* @param attachmentPoint the color attachment point ranging from [0..{@link #getMaxColorAttachments()}-1]
- * @param internalFormat usually {@link GL#GL_RGBA4}, {@link GL#GL_RGB5_A1}, {@link GL#GL_RGB565}, {@link GL#GL_RGB8} or {@link GL#GL_RGBA8}
+ * @param internalFormat usually {@link GL#GL_RGBA4}, {@link GL#GL_RGB5_A1}, {@link GL#GL_RGB565}, {@link GL#GL_RGB8} or {@link GL#GL_RGBA8}
* @return ColorAttachment instance describing the new attached colorbuffer if bound and configured successfully, otherwise GLException is thrown
* @throws GLException in case the colorbuffer couldn't be allocated
* @throws IllegalArgumentException if internalFormat doesn't reflect a colorbuffer
@@ -1238,28 +1238,28 @@ public class FBObject {
if( Attachment.Type.COLOR != atype ) {
throw new IllegalArgumentException("colorformat invalid: "+toHexString(internalFormat)+", "+this);
}
-
+
return (ColorAttachment) attachColorbuffer(gl, attachmentPoint, new ColorAttachment(internalFormat, samples, width, height, 0));
}
-
+
/**
- * Attaches a {@link Colorbuffer}, i.e. {@link ColorAttachment} or {@link TextureAttachment},
+ * Attaches a {@link Colorbuffer}, i.e. {@link ColorAttachment} or {@link TextureAttachment},
* to this FBO's instance at the given attachment point.
- *
+ *
*
* If {@link Colorbuffer} is a {@link TextureAttachment} and is uninitialized, i.e. it's texture name is zero,
* a new texture name is generated and setup w/ the texture parameter.
* Otherwise, i.e. texture name is not zero, the passed TextureAttachment texA is
- * considered complete and assumed matching this FBO requirement. A GL error may occur is the latter is untrue.
+ * considered complete and assumed matching this FBO requirement. A GL error may occur is the latter is untrue.
*
- *
+ *
*
Leaves the FBO bound.
- *
+ *
* @param gl
* @param attachmentPoint the color attachment point ranging from [0..{@link #getMaxColorAttachments()}-1]
- * @param colbuf the to be attached {@link Colorbuffer}
+ * @param colbuf the to be attached {@link Colorbuffer}
* @return newly attached {@link Colorbuffer} instance if bound and configured successfully, otherwise GLException is thrown
- * @throws GLException in case the colorbuffer couldn't be allocated or MSAA has been chosen in case of a {@link TextureAttachment}
+ * @throws GLException in case the colorbuffer couldn't be allocated or MSAA has been chosen in case of a {@link TextureAttachment}
*/
public final Colorbuffer attachColorbuffer(GL gl, int attachmentPoint, Colorbuffer colbuf) throws GLException {
bind(gl);
@@ -1268,13 +1268,13 @@ public class FBObject {
private final Colorbuffer attachColorbufferImpl(GL gl, int attachmentPoint, Colorbuffer colbuf) throws GLException {
validateAddColorAttachment(attachmentPoint, colbuf);
-
+
final boolean initializedColorbuf = colbuf.initialize(gl);
addColorAttachment(attachmentPoint, colbuf);
-
+
if(colbuf instanceof TextureAttachment) {
final TextureAttachment texA = (TextureAttachment) colbuf;
-
+
if(samples>0) {
removeColorAttachment(attachmentPoint, texA);
if(initializedColorbuf) {
@@ -1282,14 +1282,14 @@ public class FBObject {
}
throw new GLException("Texture2D not supported w/ MSAA. If you have enabled MSAA with exisiting texture attachments, you may want to detach them via detachAllTexturebuffer(gl).");
}
-
+
// Set up the color buffer for use as a renderable texture:
gl.glFramebufferTexture2D(GL.GL_FRAMEBUFFER,
GL.GL_COLOR_ATTACHMENT0 + attachmentPoint,
GL.GL_TEXTURE_2D, texA.getName(), 0);
-
+
if(!ignoreStatus) {
- updateStatus(gl);
+ updateStatus(gl);
if(!isStatusValid()) {
detachColorbuffer(gl, attachmentPoint, true);
throw new GLException("attachTexture2D "+texA+" at "+attachmentPoint+" failed "+getStatusString()+", "+this);
@@ -1297,12 +1297,12 @@ public class FBObject {
}
} else if(colbuf instanceof ColorAttachment) {
final ColorAttachment colA = (ColorAttachment) colbuf;
-
+
// Attach the color buffer
- gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER,
- GL.GL_COLOR_ATTACHMENT0 + attachmentPoint,
+ gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER,
+ GL.GL_COLOR_ATTACHMENT0 + attachmentPoint,
GL.GL_RENDERBUFFER, colA.getName());
-
+
if(!ignoreStatus) {
updateStatus(gl);
if(!isStatusValid()) {
@@ -1316,7 +1316,7 @@ public class FBObject {
}
return colbuf;
}
-
+
/**
* Attaches one depth, stencil or packed-depth-stencil buffer to this FBO's instance,
* selecting the internalFormat automatically.
@@ -1325,30 +1325,30 @@ public class FBObject {
*
*
* In case the desired type or bit-number is not supported, the next available one is chosen.
- *
+ *
*
* Use {@link #getDepthAttachment()} and/or {@link #getStencilAttachment()} to retrieve details
* about the attached buffer. The details cannot be returned, since it's possible 2 buffers
* are being created, depth and stencil.
*
- *
+ *
*
Leaves the FBO bound.
- *
+ *
* @param gl
- * @param atype either {@link Type#DEPTH}, {@link Type#STENCIL} or {@link Type#DEPTH_STENCIL}
+ * @param atype either {@link Type#DEPTH}, {@link Type#STENCIL} or {@link Type#DEPTH_STENCIL}
* @param reqBits desired bits for depth or -1 for default (24 bits)
* @throws GLException in case the renderbuffer couldn't be allocated or one is already attached.
* @throws IllegalArgumentException
* @see #getDepthAttachment()
* @see #getStencilAttachment()
*/
- public final void attachRenderbuffer(GL gl, Attachment.Type atype, int reqBits) throws GLException, IllegalArgumentException {
+ public final void attachRenderbuffer(GL gl, Attachment.Type atype, int reqBits) throws GLException, IllegalArgumentException {
if( 0 > reqBits ) {
reqBits = 24;
- }
+ }
final int internalFormat;
int internalStencilFormat = -1;
-
+
switch ( atype ) {
case DEPTH:
if( 32 <= reqBits && depth32Avail ) {
@@ -1356,10 +1356,10 @@ public class FBObject {
} else if( 24 <= reqBits && depth24Avail ) {
internalFormat = GL.GL_DEPTH_COMPONENT24;
} else {
- internalFormat = GL.GL_DEPTH_COMPONENT16;
+ internalFormat = GL.GL_DEPTH_COMPONENT16;
}
break;
-
+
case STENCIL:
if( 16 <= reqBits && stencil16Avail ) {
internalFormat = GL2GL3.GL_STENCIL_INDEX16;
@@ -1370,10 +1370,10 @@ public class FBObject {
} else if( 1 <= reqBits && stencil01Avail ) {
internalFormat = GL.GL_STENCIL_INDEX1;
} else {
- throw new GLException("stencil buffer n/a");
+ throw new GLException("stencil buffer n/a");
}
break;
-
+
case DEPTH_STENCIL:
if( packedDepthStencilAvail ) {
internalFormat = GL.GL_DEPTH24_STENCIL8;
@@ -1381,7 +1381,7 @@ public class FBObject {
if( 24 <= reqBits && depth24Avail ) {
internalFormat = GL.GL_DEPTH_COMPONENT24;
} else {
- internalFormat = GL.GL_DEPTH_COMPONENT16;
+ internalFormat = GL.GL_DEPTH_COMPONENT16;
}
if( stencil08Avail ) {
internalStencilFormat = GL.GL_STENCIL_INDEX8;
@@ -1397,17 +1397,17 @@ public class FBObject {
default:
throw new IllegalArgumentException("only depth/stencil types allowed, was "+atype+", "+this);
}
-
+
attachRenderbufferImpl(gl, atype, internalFormat);
-
+
if(0<=internalStencilFormat) {
attachRenderbufferImpl(gl, Attachment.Type.STENCIL, internalStencilFormat);
}
}
-
+
/**
* Attaches one depth, stencil or packed-depth-stencil buffer to this FBO's instance,
- * depending on the internalFormat.
+ * depending on the internalFormat.
*
* Stencil and depth buffer can be attached only once.
*
@@ -1416,9 +1416,9 @@ public class FBObject {
* about the attached buffer. The details cannot be returned, since it's possible 2 buffers
* are being created, depth and stencil.
*
- *
+ *
*
- *
+ *
* @param gl
* @param attachmentPoint
* @param dispose true if the Colorbuffer shall be disposed
@@ -1515,26 +1515,26 @@ public class FBObject {
*/
public final Colorbuffer detachColorbuffer(GL gl, int attachmentPoint, boolean dispose) throws IllegalArgumentException {
bind(gl);
-
+
final Colorbuffer res = detachColorbufferImpl(gl, attachmentPoint, dispose ? DetachAction.DISPOSE : DetachAction.NONE);
if(null == res) {
- throw new IllegalArgumentException("ColorAttachment at "+attachmentPoint+", not attached, "+this);
+ throw new IllegalArgumentException("ColorAttachment at "+attachmentPoint+", not attached, "+this);
}
if(DEBUG) {
System.err.println("FBObject.detachColorbuffer.X: [attachmentPoint "+attachmentPoint+", dispose "+dispose+"]: "+res+", "+this);
}
return res;
}
-
+
private final Colorbuffer detachColorbufferImpl(GL gl, int attachmentPoint, DetachAction detachAction) {
Colorbuffer colbuf = colorAttachmentPoints[attachmentPoint]; // shortcut, don't validate here
-
+
if(null == colbuf) {
return null;
}
-
+
removeColorAttachment(attachmentPoint, colbuf);
-
+
if(colbuf instanceof TextureAttachment) {
final TextureAttachment texA = (TextureAttachment) colbuf;
if( 0 != texA.getName() ) {
@@ -1553,7 +1553,7 @@ public class FBObject {
if(DetachAction.RECREATE == detachAction) {
if(samples == 0) {
// stay non MSAA
- texA.setSize(width, height);
+ texA.setSize(width, height);
} else {
// switch to MSAA
colbuf = createColorAttachment(hasAlpha(texA.format));
@@ -1563,8 +1563,8 @@ public class FBObject {
} else if(colbuf instanceof ColorAttachment) {
final ColorAttachment colA = (ColorAttachment) colbuf;
if( 0 != colA.getName() ) {
- gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER,
- GL.GL_COLOR_ATTACHMENT0+attachmentPoint,
+ gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER,
+ GL.GL_COLOR_ATTACHMENT0+attachmentPoint,
GL.GL_RENDERBUFFER, 0);
switch(detachAction) {
case DISPOSE:
@@ -1582,9 +1582,9 @@ public class FBObject {
} else {
// switch to non MSAA
if(null != samplingSinkTexture) {
- colbuf = createColorTextureAttachment(samplingSinkTexture.format, width, height,
- samplingSinkTexture.dataFormat, samplingSinkTexture.dataType,
- samplingSinkTexture.magFilter, samplingSinkTexture.minFilter,
+ colbuf = createColorTextureAttachment(samplingSinkTexture.format, width, height,
+ samplingSinkTexture.dataFormat, samplingSinkTexture.dataType,
+ samplingSinkTexture.magFilter, samplingSinkTexture.minFilter,
samplingSinkTexture.wrapS, samplingSinkTexture.wrapT);
} else {
colbuf = createColorTextureAttachment(gl.getGLProfile(), true, width, height);
@@ -1595,15 +1595,15 @@ public class FBObject {
}
return colbuf;
}
-
+
private final void freeAllColorbufferImpl(GL gl) {
for(int i=0; iLeaves the FBO bound, if initialized!
*
* An attached sampling sink texture will be detached as well, see {@link #getSamplingSink()}.
- *
+ *
* @param gl the current GL context
*/
public final void detachAll(GL gl) {
if(null != samplingSink) {
samplingSink.detachAll(gl);
- }
+ }
detachAllImpl(gl, true/* detachNonColorbuffer */, false /* recreate */);
}
-
- /**
- * Detaches all {@link ColorAttachment}s and {@link TextureAttachment}s
+
+ /**
+ * Detaches all {@link ColorAttachment}s and {@link TextureAttachment}s
* and disposes them.
*
Leaves the FBO bound, if initialized!
*
* An attached sampling sink texture will be detached as well, see {@link #getSamplingSink()}.
- *
+ *
* @param gl the current GL context
*/
public final void detachAllColorbuffer(GL gl) {
if(null != samplingSink) {
samplingSink.detachAllColorbuffer(gl);
- }
+ }
detachAllImpl(gl, false/* detachNonColorbuffer */, false /* recreate */);
}
-
- /**
+
+ /**
* Detaches all {@link TextureAttachment}s and disposes them.
*
Leaves the FBO bound, if initialized!
*
* An attached sampling sink texture will be detached as well, see {@link #getSamplingSink()}.
- *
+ *
* @param gl the current GL context
*/
public final void detachAllTexturebuffer(GL gl) {
@@ -1826,7 +1826,7 @@ public class FBObject {
if(null != samplingSink) {
samplingSink.detachAllTexturebuffer(gl);
}
- bind(gl);
+ bind(gl);
for(int i=0; i0 ) {
throw new InternalError("Non zero ColorAttachments "+this);
}
-
+
if(detachNonColorbuffer) {
detachRenderbufferImpl(gl, Attachment.Type.DEPTH_STENCIL, recreate ? DetachAction.RECREATE : DetachAction.DISPOSE);
}
@@ -1888,7 +1888,7 @@ public class FBObject {
System.err.println("FBObject.detachAll.X: [resetNonColorbuffer "+detachNonColorbuffer+", recreate "+recreate+"]: "+this);
}
}
-
+
/**
* @param gl the current GL context
*/
@@ -1903,9 +1903,9 @@ public class FBObject {
if( null != samplingSink && samplingSink.isInitialized() ) {
samplingSink.destroy(gl);
}
-
+
detachAllImpl(gl, true /* detachNonColorbuffer */, false /* recreate */);
-
+
// cache FB names, preset exposed to zero,
// braking ties w/ GL/GLContext link to getReadFramebuffer()/getWriteFramebuffer()
final int fb_cache = fbName;
@@ -1915,7 +1915,7 @@ public class FBObject {
if(0!=fb_cache) {
name[0] = fb_cache;
gl.glDeleteFramebuffers(1, name, 0);
- }
+ }
initialized = false;
bound = false;
if(DEBUG) {
@@ -1933,14 +1933,14 @@ public class FBObject {
final boolean depthMismatch = ( null != depth && null == samplingSink.depth ) ||
( null != depth && null != samplingSink.depth &&
depth.format != samplingSink.depth.format );
-
+
final boolean stencilMismatch = ( null != stencil && null == samplingSink.stencil ) ||
( null != stencil && null != samplingSink.stencil &&
- stencil.format != samplingSink.stencil.format );
-
- return depthMismatch || stencilMismatch;
+ stencil.format != samplingSink.stencil.format );
+
+ return depthMismatch || stencilMismatch;
}
-
+
/**
* Manually reset the MSAA sampling sink, if used.
*
@@ -1948,7 +1948,7 @@ public class FBObject {
* a new sampling sink is being created.
*
*
- * Automatically called by {@link #reset(GL, int, int, int, boolean)}
+ * Automatically called by {@link #reset(GL, int, int, int, boolean)}
* and {@link #syncSamplingSink(GL)}.
*
*
@@ -1967,58 +1967,58 @@ public class FBObject {
}
return;
}
-
+
if(null == samplingSink ) {
samplingSink = new FBObject();
}
-
+
if(!samplingSink.initialized) {
samplingSink.init(gl, width, height, 0);
}
-
+
boolean sampleSinkSizeMismatch = sampleSinkSizeMismatch();
boolean sampleSinkTexMismatch = sampleSinkTexMismatch();
boolean sampleSinkDepthStencilMismatch = sampleSinkDepthStencilMismatch();
-
+
/** if(DEBUG) {
System.err.println("FBObject.resetSamplingSink.0: \n\tTHIS "+this+",\n\tSINK "+samplesSink+
"\n\t size "+sampleSinkSizeMismatch +", tex "+sampleSinkTexMismatch +", depthStencil "+sampleSinkDepthStencilMismatch);
} */
-
+
if(!sampleSinkSizeMismatch && !sampleSinkTexMismatch && !sampleSinkDepthStencilMismatch) {
- // all properties match ..
- return;
+ // all properties match ..
+ return;
}
-
+
unbind(gl);
-
+
if(DEBUG) {
System.err.println("FBObject.resetSamplingSink: BEGIN\n\tTHIS "+this+",\n\tSINK "+samplingSink+
"\n\t size "+sampleSinkSizeMismatch +", tex "+sampleSinkTexMismatch +", depthStencil "+sampleSinkDepthStencilMismatch);
}
-
+
if( sampleSinkDepthStencilMismatch ) {
samplingSink.detachAllRenderbuffer(gl);
}
-
+
if( sampleSinkSizeMismatch ) {
samplingSink.reset(gl, width, height);
}
-
+
if(null == samplingSinkTexture) {
samplingSinkTexture = samplingSink.attachTexture2D(gl, 0, true);
} else if( 0 == samplingSinkTexture.getName() ) {
samplingSinkTexture.setSize(width, height);
samplingSink.attachColorbuffer(gl, 0, samplingSinkTexture);
}
-
+
if( sampleSinkDepthStencilMismatch ) {
samplingSink.attachRenderbuffer(gl, depth.format);
if( null != stencil && !isDepthStencilPackedFormat() ) {
samplingSink.attachRenderbuffer(gl, stencil.format);
}
- }
-
+ }
+
sampleSinkSizeMismatch = sampleSinkSizeMismatch();
sampleSinkTexMismatch = sampleSinkTexMismatch();
sampleSinkDepthStencilMismatch = sampleSinkDepthStencilMismatch();
@@ -2026,21 +2026,21 @@ public class FBObject {
throw new InternalError("Samples sink mismatch after reset: \n\tTHIS "+this+",\n\t SINK "+samplingSink+
"\n\t size "+sampleSinkSizeMismatch +", tex "+sampleSinkTexMismatch +", depthStencil "+sampleSinkDepthStencilMismatch);
}
-
+
if(DEBUG) {
System.err.println("FBObject.resetSamplingSink: END\n\tTHIS "+this+",\n\tSINK "+samplingSink+
"\n\t size "+sampleSinkSizeMismatch +", tex "+sampleSinkTexMismatch +", depthStencil "+sampleSinkDepthStencilMismatch);
}
}
-
+
/**
* Setting this FBO sampling sink.
* @param newSamplingSink the new FBO sampling sink to use, or null to remove current sampling sink
- * @return the previous sampling sink or null if none was attached
+ * @return the previous sampling sink or null if none was attached
* @throws GLException if this FBO doesn't use MSAA or the given sink uses MSAA itself
*/
public FBObject setSamplingSink(FBObject newSamplingSink) throws GLException {
- final FBObject prev = samplingSink;
+ final FBObject prev = samplingSink;
if( null == newSamplingSink) {
samplingSink = null;
samplingSinkTexture = null;
@@ -2056,14 +2056,14 @@ public class FBObject {
samplingSinkDirty = true;
return prev;
}
-
- /**
+
+ /**
* Bind this FBO, i.e. bind write framebuffer to {@link #getWriteFramebuffer()}.
- *
- *
If multisampling is used, it sets the read framebuffer to the sampling sink {@link #getWriteFramebuffer()},
+ *
+ *
If multisampling is used, it sets the read framebuffer to the sampling sink {@link #getWriteFramebuffer()},
* if full FBO is supported.
- *
- *
+ *
+ *
* In case you have attached more than one color buffer,
* you may want to setup {@link GL2GL3#glDrawBuffers(int, int[], int)}.
*
@@ -2079,7 +2079,7 @@ public class FBObject {
gl.glBindFramebuffer(GL2GL3.GL_READ_FRAMEBUFFER, getReadFramebuffer());
} else {
// one for all
- gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, getWriteFramebuffer());
+ gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, getWriteFramebuffer());
}
bound = true;
@@ -2087,29 +2087,29 @@ public class FBObject {
}
}
- /**
+ /**
* Unbind this FBO, i.e. bind read and write framebuffer to default, see {@link GLBase#getDefaultDrawFramebuffer()}.
- *
- *
If full FBO is supported, sets the read and write framebuffer individually to default, hence not disturbing
+ *
+ *
If full FBO is supported, sets the read and write framebuffer individually to default, hence not disturbing
* an optional operating MSAA FBO, see {@link GLBase#getDefaultReadFramebuffer()} and {@link GLBase#getDefaultDrawFramebuffer()}
- *
+ *
* @param gl the current GL context
* @throws GLException
*/
public final void unbind(GL gl) throws GLException {
if(bound) {
if(fullFBOSupport) {
- // default read/draw buffers, may utilize GLContext/GLDrawable override of
+ // default read/draw buffers, may utilize GLContext/GLDrawable override of
// GLContext.getDefaultDrawFramebuffer() and GLContext.getDefaultReadFramebuffer()
gl.glBindFramebuffer(GL2GL3.GL_DRAW_FRAMEBUFFER, 0);
gl.glBindFramebuffer(GL2GL3.GL_READ_FRAMEBUFFER, 0);
} else {
- gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, 0); // default draw buffer
+ gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, 0); // default draw buffer
}
bound = false;
}
}
-
+
/**
* Method simply marks this FBO unbound w/o interfering w/ the bound framebuffer as perfomed by {@link #unbind(GL)}.
*
@@ -2121,22 +2121,22 @@ public class FBObject {
bound = false;
}
- /**
+ /**
* Returns true if framebuffer object is bound via {@link #bind(GL)}, otherwise false.
*
* Method verifies the bound state via {@link GL#getBoundFramebuffer(int)}.
*
* @param gl the current GL context
*/
- public final boolean isBound(GL gl) {
+ public final boolean isBound(GL gl) {
bound = bound && fbName != gl.getBoundFramebuffer(GL.GL_FRAMEBUFFER) ;
return bound;
}
-
+
/** Returns true if framebuffer object is bound via {@link #bind(GL)}, otherwise false. */
public final boolean isBound() { return bound; }
-
- /**
+
+ /**
* If multisampling is being used and flagged dirty by a previous call of {@link #bind(GL)} or after initialization,
* the msaa-buffers are sampled to it's sink {@link #getSamplingSink()}.
*
@@ -2147,7 +2147,7 @@ public class FBObject {
*
*
* Method always resets the framebuffer binding to default in the end.
- * If full FBO is supported, sets the read and write framebuffer individually to default after sampling, hence not disturbing
+ * If full FBO is supported, sets the read and write framebuffer individually to default after sampling, hence not disturbing
* an optional operating MSAA FBO, see {@link GLBase#getDefaultReadFramebuffer()} and {@link GLBase#getDefaultDrawFramebuffer()}
*
*
@@ -2155,10 +2155,10 @@ public class FBObject {
* you may want to call {@link GL#glBindFramebuffer(int, int) glBindFramebuffer}({@link GL2GL3#GL_READ_FRAMEBUFFER}, {@link #getReadFramebuffer()});
*
*
Leaves the FBO unbound.
- *
+ *
* @param gl the current GL context
* @param ta {@link TextureAttachment} to use, prev. attached w/ {@link #attachTexture2D(GL, int, boolean, int, int, int, int) attachTexture2D(..)}
- * @throws IllegalArgumentException
+ * @throws IllegalArgumentException
*/
public final void syncSamplingSink(GL gl) {
markUnbound();
@@ -2170,30 +2170,30 @@ public class FBObject {
gl.glBindFramebuffer(GL2GL3.GL_DRAW_FRAMEBUFFER, samplingSink.getWriteFramebuffer());
((GL2GL3)gl).glBlitFramebuffer(0, 0, width, height, 0, 0, width, height, // since MSAA is supported, casting to GL2GL3 is OK
GL.GL_COLOR_BUFFER_BIT, GL.GL_NEAREST);
- checkNoError(null, gl.glGetError(), "FBObject syncSampleSink"); // throws GLException if error
+ checkNoError(null, gl.glGetError(), "FBObject syncSampleSink"); // throws GLException if error
}
if(fullFBOSupport) {
- // default read/draw buffers, may utilize GLContext/GLDrawable override of
+ // default read/draw buffers, may utilize GLContext/GLDrawable override of
// GLContext.getDefaultDrawFramebuffer() and GLContext.getDefaultReadFramebuffer()
gl.glBindFramebuffer(GL2GL3.GL_DRAW_FRAMEBUFFER, 0);
gl.glBindFramebuffer(GL2GL3.GL_READ_FRAMEBUFFER, 0);
} else {
- gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, 0); // default draw buffer
+ gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, 0); // default draw buffer
}
}
-
- /**
+
+ /**
* Bind the given texture colorbuffer.
- *
+ *
*
If using multiple texture units, ensure you call {@link GL#glActiveTexture(int)} first!
- *
+ *
*
{@link #syncSamplingSink(GL)} is being called
- *
+ *
*
Leaves the FBO unbound!
- *
+ *
* @param gl the current GL context
* @param ta {@link TextureAttachment} to use, prev. attached w/ {@link #attachTexture2D(GL, int, boolean, int, int, int, int) attachTexture2D(..)}
- * @throws IllegalArgumentException
+ * @throws IllegalArgumentException
*/
public final void use(GL gl, TextureAttachment ta) throws IllegalArgumentException {
if(null == ta) { throw new IllegalArgumentException("Null TextureAttachment, this: "+toString()); }
@@ -2201,26 +2201,26 @@ public class FBObject {
gl.glBindTexture(GL.GL_TEXTURE_2D, ta.getName()); // use it ..
}
- /**
+ /**
* Unbind texture, ie bind 'non' texture 0
- *
+ *
*
Leaves the FBO unbound.
- */
+ */
public final void unuse(GL gl) {
unbind(gl);
gl.glBindTexture(GL.GL_TEXTURE_2D, 0); // don't use it
}
- /** @see GL#hasFullFBOSupport() */
+ /** @see GL#hasFullFBOSupport() */
public final boolean hasFullFBOSupport() throws GLException { checkInitialized(); return this.fullFBOSupport; }
-
- /**
+
+ /**
* Returns true if renderbuffer accepts internal format {@link GL#GL_RGB8} and {@link GL#GL_RGBA8}, otherwise false.
* @throws GLException if {@link #init(GL)} hasn't been called.
*/
public final boolean supportsRGBA8() throws GLException { checkInitialized(); return rgba8Avail; }
-
- /**
+
+ /**
* Returns true if {@link GL#GL_DEPTH_COMPONENT16}, {@link GL#GL_DEPTH_COMPONENT24} or {@link GL#GL_DEPTH_COMPONENT32} is supported, otherwise false.
* @param bits 16, 24 or 32 bits
* @throws GLException if {@link #init(GL)} hasn't been called.
@@ -2228,14 +2228,14 @@ public class FBObject {
public final boolean supportsDepth(int bits) throws GLException {
checkInitialized();
switch(bits) {
- case 16: return true;
+ case 16: return true;
case 24: return depth24Avail;
case 32: return depth32Avail;
- default: return false;
+ default: return false;
}
}
-
- /**
+
+ /**
* Returns true if {@link GL#GL_STENCIL_INDEX1}, {@link GL#GL_STENCIL_INDEX4}, {@link GL#GL_STENCIL_INDEX8} or {@link GL2GL3#GL_STENCIL_INDEX16} is supported, otherwise false.
* @param bits 1, 4, 8 or 16 bits
* @throws GLException if {@link #init(GL)} hasn't been called.
@@ -2243,34 +2243,34 @@ public class FBObject {
public final boolean supportsStencil(int bits) throws GLException {
checkInitialized();
switch(bits) {
- case 1: return stencil01Avail;
+ case 1: return stencil01Avail;
case 4: return stencil04Avail;
case 8: return stencil08Avail;
case 16: return stencil16Avail;
- default: return false;
+ default: return false;
}
}
-
- /**
+
+ /**
* Returns true if {@link GL#GL_DEPTH24_STENCIL8} is supported, otherwise false.
* @throws GLException if {@link #init(GL)} hasn't been called.
*/
public final boolean supportsPackedDepthStencil() throws GLException { checkInitialized(); return packedDepthStencilAvail; }
-
+
/**
* Returns the maximum number of colorbuffer attachments.
* @throws GLException if {@link #init(GL)} hasn't been called.
*/
public final int getMaxColorAttachments() throws GLException { checkInitialized(); return maxColorAttachments; }
-
+
public final int getMaxTextureSize() throws GLException { checkInitialized(); return this.maxTextureSize; }
public final int getMaxRenderbufferSize() throws GLException { checkInitialized(); return this.maxRenderbufferSize; }
-
+
/** @see GL#getMaxRenderbufferSamples() */
public final int getMaxSamples() throws GLException { checkInitialized(); return this.maxSamples; }
-
+
/**
- * Returns true if this instance has been initialized with {@link #reset(GL, int, int)}
+ * Returns true if this instance has been initialized with {@link #reset(GL, int, int)}
* or {@link #reset(GL, int, int, int, boolean)}, otherwise false
*/
public final boolean isInitialized() { return initialized; }
@@ -2283,43 +2283,43 @@ public class FBObject {
/** Returns the framebuffer name to render to. */
public final int getWriteFramebuffer() { return fbName; }
/** Returns the framebuffer name to read from. Depending on multisampling, this may be a different framebuffer. */
- public final int getReadFramebuffer() { return ( samples > 0 ) ? samplingSink.getReadFramebuffer() : fbName; }
- public final int getDefaultReadBuffer() { return GL.GL_COLOR_ATTACHMENT0; }
+ public final int getReadFramebuffer() { return ( samples > 0 ) ? samplingSink.getReadFramebuffer() : fbName; }
+ public final int getDefaultReadBuffer() { return GL.GL_COLOR_ATTACHMENT0; }
/** Return the number of color/texture attachments */
public final int getColorAttachmentCount() { return colorAttachmentCount; }
- /** Return the stencil {@link RenderAttachment} attachment, if exist. Maybe share the same {@link Attachment#getName()} as {@link #getDepthAttachment()}, if packed depth-stencil is being used. */
+ /** Return the stencil {@link RenderAttachment} attachment, if exist. Maybe share the same {@link Attachment#getName()} as {@link #getDepthAttachment()}, if packed depth-stencil is being used. */
public final RenderAttachment getStencilAttachment() { return stencil; }
- /** Return the depth {@link RenderAttachment} attachment. Maybe share the same {@link Attachment#getName()} as {@link #getStencilAttachment()}, if packed depth-stencil is being used. */
+ /** Return the depth {@link RenderAttachment} attachment. Maybe share the same {@link Attachment#getName()} as {@link #getStencilAttachment()}, if packed depth-stencil is being used. */
public final RenderAttachment getDepthAttachment() { return depth; }
-
- /** Return the complete multisampling {@link FBObject} sink, if using multisampling. */
+
+ /** Return the complete multisampling {@link FBObject} sink, if using multisampling. */
public final FBObject getSamplingSinkFBO() { return samplingSink; }
-
- /** Return the multisampling {@link TextureAttachment} sink, if using multisampling. */
+
+ /** Return the multisampling {@link TextureAttachment} sink, if using multisampling. */
public final TextureAttachment getSamplingSink() { return samplingSinkTexture; }
- /**
- * Returns true if the multisampling colorbuffer (msaa-buffer)
+ /**
+ * Returns true if the multisampling colorbuffer (msaa-buffer)
* has been flagged dirty by a previous call of {@link #bind(GL)},
* otherwise false.
*/
public final boolean isSamplingBufferDirty() { return samplingSinkDirty; }
-
+
int objectHashCode() { return super.hashCode(); }
-
+
public final String toString() {
- final String caps = null != colorAttachmentPoints ? Arrays.asList(colorAttachmentPoints).toString() : null ;
+ final String caps = null != colorAttachmentPoints ? Arrays.asList(colorAttachmentPoints).toString() : null ;
return "FBO[name r/w "+fbName+"/"+getReadFramebuffer()+", init "+initialized+", bound "+bound+", size "+width+"x"+height+
", samples "+samples+"/"+maxSamples+", depth "+depth+", stencil "+stencil+
", color attachments: "+colorAttachmentCount+"/"+maxColorAttachments+
": "+caps+", msaa-sink "+samplingSinkTexture+", hasSamplesSink "+(null != samplingSink)+
", state "+getStatusString()+", obj "+toHexString(objectHashCode())+"]";
}
-
+
private final void updateStatus(GL gl) {
if( 0 == fbName ) {
vStatus = -1;
} else {
vStatus = gl.glCheckFramebufferStatus(GL.GL_FRAMEBUFFER);
}
- }
+ }
}
diff --git a/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java b/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java
index bec05a0bd..ce58d29c1 100644
--- a/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.opengl;
import javax.media.nativewindow.AbstractGraphicsDevice;
@@ -58,14 +58,14 @@ import jogamp.opengl.GLDrawableImpl;
*
* and setup a {@link com.jogamp.newt.Window#setWindowDestroyNotifyAction(Runnable) custom toolkit destruction} issuing {@link #windowDestroyNotifyOp()}.
*
- *
+ *
* See example {@link com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableDelegateNEWT TestGLAutoDrawableDelegateNEWT}.
*
*/
public class GLAutoDrawableDelegate extends GLAutoDrawableBase implements GLAutoDrawable {
/**
* @param drawable a valid {@link GLDrawable}, may not be {@link GLDrawable#isRealized() realized} yet.
- * @param context a valid {@link GLContext},
+ * @param context a valid {@link GLContext},
* may not have been made current (created) yet,
* may not be associated w/ drawable yet,
* may be null for lazy initialization
@@ -84,7 +84,7 @@ public class GLAutoDrawableDelegate extends GLAutoDrawableBase implements GLAuto
this.upstreamWidget = upstreamWidget;
this.lock = ( null != lock ) ? lock : LockFactory.createRecursiveLock() ;
}
-
+
//
// expose default methods
//
@@ -93,40 +93,40 @@ public class GLAutoDrawableDelegate extends GLAutoDrawableBase implements GLAuto
public final void windowRepaintOp() {
super.defaultWindowRepaintOp();
}
-
+
/** Implementation to handle resize events from the windowing system. All required locks are being claimed. */
public final void windowResizedOp(int newWidth, int newHeight) {
super.defaultWindowResizedOp(newWidth, newHeight);
}
-
- /**
+
+ /**
* Implementation to handle destroy notifications from the windowing system.
- *
+ *
*
- * If the {@link NativeSurface} does not implement {@link WindowClosingProtocol}
+ * If the {@link NativeSurface} does not implement {@link WindowClosingProtocol}
* or {@link WindowClosingMode#DISPOSE_ON_CLOSE} is enabled (default),
* a thread safe destruction is being induced.
- *
+ *
*/
public final void windowDestroyNotifyOp() {
super.defaultWindowDestroyNotifyOp();
}
-
+
//
// Complete GLAutoDrawable
//
-
+
private Object upstreamWidget;
private final RecursiveLock lock;
-
+
@Override
protected final RecursiveLock getLock() { return lock; }
-
+
@Override
public final Object getUpstreamWidget() {
return upstreamWidget;
}
-
+
/**
* Set the upstream UI toolkit object.
* @see #getUpstreamWidget()
@@ -134,7 +134,7 @@ public class GLAutoDrawableDelegate extends GLAutoDrawableBase implements GLAuto
public final void setUpstreamWidget(Object newUpstreamWidget) {
upstreamWidget = newUpstreamWidget;
}
-
+
/**
* {@inheritDoc}
*
@@ -142,7 +142,7 @@ public class GLAutoDrawableDelegate extends GLAutoDrawableBase implements GLAuto
*
*
* User still needs to destroy the upstream window, which details are hidden from this aspect.
- * This can be performed by overriding {@link #destroyImplInLock()}.
+ * This can be performed by overriding {@link #destroyImplInLock()}.
*
*/
@Override
@@ -154,29 +154,29 @@ public class GLAutoDrawableDelegate extends GLAutoDrawableBase implements GLAuto
protected void destroyImplInLock() {
super.destroyImplInLock();
}
-
+
@Override
- public void display() {
+ public void display() {
defaultDisplay();
}
-
+
//
// GLDrawable delegation
//
-
+
@Override
public final GLDrawableFactory getFactory() {
return drawable.getFactory();
}
-
+
@Override
public final void swapBuffers() throws GLException {
defaultSwapBuffers();
}
-
+
@Override
public String toString() {
return getClass().getSimpleName()+"[ \n\tHelper: " + helper + ", \n\tDrawable: " + drawable +
", \n\tContext: " + context + ", \n\tUpstreamWidget: "+upstreamWidget+ /** ", \n\tFactory: "+factory+ */ "]";
- }
+ }
}
diff --git a/src/jogl/classes/com/jogamp/opengl/GLEventListenerState.java b/src/jogl/classes/com/jogamp/opengl/GLEventListenerState.java
index 21dafecb1..1b4187668 100644
--- a/src/jogl/classes/com/jogamp/opengl/GLEventListenerState.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLEventListenerState.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -48,7 +48,7 @@ import jogamp.opengl.Debug;
import com.jogamp.nativewindow.MutableGraphicsConfiguration;
/**
- * GLEventListenerState is holding {@link GLAutoDrawable} components crucial
+ * GLEventListenerState is holding {@link GLAutoDrawable} components crucial
* to relocating all its {@link GLEventListener} w/ their operating {@link GLContext}, etc.
* The components are:
*
@@ -69,8 +69,8 @@ import com.jogamp.nativewindow.MutableGraphicsConfiguration;
*/
public class GLEventListenerState {
private static final boolean DEBUG = Debug.debug("GLDrawable") || Debug.debug("GLEventListenerState");
-
- private GLEventListenerState(AbstractGraphicsDevice upstreamDevice, boolean proxyOwnsUpstreamDevice, AbstractGraphicsDevice device,
+
+ private GLEventListenerState(AbstractGraphicsDevice upstreamDevice, boolean proxyOwnsUpstreamDevice, AbstractGraphicsDevice device,
GLCapabilitiesImmutable caps,
GLContext context, int count, GLAnimatorControl anim, boolean animStarted) {
this.upstreamDevice = upstreamDevice;
@@ -82,19 +82,19 @@ public class GLEventListenerState {
this.listenersInit = new boolean[count];
this.anim = anim;
this.animStarted = animStarted;
-
+
this.owner = true;
}
/**
- * Returns true, if this instance is the current owner of the components,
+ * Returns true, if this instance is the current owner of the components,
* otherwise false.
*
* Ownership is lost if {@link #moveTo(GLAutoDrawable)} is being called successfully
- * and all components are transferred to the new {@link GLAutoDrawable}.
+ * and all components are transferred to the new {@link GLAutoDrawable}.
*
*/
public final boolean isOwner() { return owner; }
-
+
public final int listenerCount() { return listeners.length; }
public final AbstractGraphicsDevice upstreamDevice;
@@ -103,10 +103,10 @@ public class GLEventListenerState {
public final GLCapabilitiesImmutable caps;
public final GLContext context;
public final GLEventListener[] listeners;
- public final boolean[] listenersInit;
+ public final boolean[] listenersInit;
public final GLAnimatorControl anim;
public final boolean animStarted;
-
+
private boolean owner;
/**
@@ -127,25 +127,25 @@ public class GLEventListenerState {
private static AbstractGraphicsDevice cloneDevice(AbstractGraphicsDevice aDevice) {
return (AbstractGraphicsDevice) aDevice.clone();
}
-
+
/**
- * Moves all GLEventListenerState components from the given {@link GLAutoDrawable}
+ * Moves all GLEventListenerState components from the given {@link GLAutoDrawable}
* to a newly created instance.
*
* Note that all components are removed from the {@link GLAutoDrawable},
* i.e. the {@link GLContext}, all {@link GLEventListener}.
*
- *
+ *
* If the {@link GLAutoDrawable} was added to a {@link GLAnimatorControl}, it is removed
* and the {@link GLAnimatorControl} added to the GLEventListenerState.
*
*
- * The returned GLEventListenerState instance is the {@link #isOwner() owner of the components}.
+ * The returned GLEventListenerState instance is the {@link #isOwner() owner of the components}.
*
- *
+ *
* @param a {@link GLAutoDrawable} source to move components from
* @return new GLEventListenerState instance {@link #isOwner() owning} moved components.
- *
+ *
* @see #moveTo(GLAutoDrawable)
*/
public static GLEventListenerState moveFrom(GLAutoDrawable a) {
@@ -154,16 +154,16 @@ public class GLEventListenerState {
if( null != aAnim ) {
aAnimStarted = aAnim.isStarted();
aAnim.remove(a); // also handles ECT
- } else {
+ } else {
aAnimStarted = false;
}
-
+
final GLEventListenerState glls;
final NativeSurface aSurface = a.getNativeSurface();
final boolean surfaceLocked = false; // NativeSurface.LOCK_SURFACE_NOT_READY < aSurface.lockSurface();
try {
final int aSz = a.getGLEventListenerCount();
-
+
// Create new AbstractGraphicsScreen w/ cloned AbstractGraphicsDevice for future GLAutoDrawable
// allowing this AbstractGraphicsDevice to loose ownership -> not closing display/device!
final AbstractGraphicsConfiguration aCfg = aSurface.getGraphicsConfiguration();
@@ -171,7 +171,7 @@ public class GLEventListenerState {
final AbstractGraphicsDevice aDevice1 = aCfg.getScreen().getDevice();
final AbstractGraphicsDevice aDevice2 = cloneDevice(aDevice1);
aDevice1.clearHandleOwner(); // don't close device handle
- if( DEBUG ) {
+ if( DEBUG ) {
System.err.println("GLEventListenerState.moveFrom.0a: orig 0x"+Integer.toHexString(aDevice1.hashCode())+", "+aDevice1);
System.err.println("GLEventListenerState.moveFrom.0b: pres 0x"+Integer.toHexString(aDevice2.hashCode())+", "+aDevice2);
System.err.println("GLEventListenerState.moveFrom.1: "+aSurface.getClass().getName()/*+", "+aSurface*/);
@@ -203,9 +203,9 @@ public class GLEventListenerState {
}
aUpDevice2 = _aUpDevice2;
}
-
- glls = new GLEventListenerState(aUpDevice2, proxyOwnsUpstreamDevice, aDevice2, caps, a.getContext(), aSz, aAnim, aAnimStarted);
-
+
+ glls = new GLEventListenerState(aUpDevice2, proxyOwnsUpstreamDevice, aDevice2, caps, a.getContext(), aSz, aAnim, aAnimStarted);
+
//
// remove and cache all GLEventListener and their init-state
//
@@ -213,41 +213,41 @@ public class GLEventListenerState {
final GLEventListener l = a.getGLEventListener(0);
glls.listenersInit[i] = a.getGLEventListenerInitState(l);
glls.listeners[i] = a.removeGLEventListener( l );
- }
-
+ }
+
//
// trigger glFinish to sync GL ctx
//
a.invoke(true, glFinish);
-
+
a.setContext( null, false );
-
+
} finally {
if( surfaceLocked ) {
aSurface.unlockSurface();
}
- }
-
+ }
+
return glls;
}
/**
- * Moves all GLEventListenerState components to the given {@link GLAutoDrawable}
+ * Moves all GLEventListenerState components to the given {@link GLAutoDrawable}
* from this instance, while loosing {@link #isOwner() ownership}.
- *
+ *
* If the previous {@link GLAutoDrawable} was removed from a {@link GLAnimatorControl} by previous {@link #moveFrom(GLAutoDrawable)},
* the given {@link GLAutoDrawable} is added to the cached {@link GLAnimatorControl}.
- * This operation is skipped, if the given {@link GLAutoDrawable} is already added to a {@link GLAnimatorControl} instance.
+ * This operation is skipped, if the given {@link GLAutoDrawable} is already added to a {@link GLAnimatorControl} instance.
*
*
- * Note: After this operation, the GLEventListenerState reference should be released.
+ * Note: After this operation, the GLEventListenerState reference should be released.
*
- *
+ *
* @param a {@link GLAutoDrawable} destination to move GLEventListenerState components to
- *
+ *
*
* @throws GLException if this preserved {@link AbstractGraphicsDevice} is incompatible w/ the given destination one.
- *
+ *
* @see #moveFrom(GLAutoDrawable)
* @see #isOwner()
*/
@@ -261,22 +261,22 @@ public class GLEventListenerState {
if( aPaused ) {
aAnim.resume();
}
- } else {
+ } else {
aPaused = false;
}
-
+
final List aGLCmds = new ArrayList();
final int aSz = listenerCount();
-
+
final NativeSurface aSurface = a.getNativeSurface();
final boolean surfaceLocked = false; // NativeSurface.LOCK_SURFACE_NOT_READY < aSurface.lockSurface();
final boolean aRealized;
try {
-
+
final MutableGraphicsConfiguration aCfg = (MutableGraphicsConfiguration) aSurface.getGraphicsConfiguration();
/**
final GLCapabilitiesImmutable aCaps = (GLCapabilitiesImmutable) aCfg.getChosenCapabilities();
- if( caps.getVisualID(VisualIDHolder.VIDType.INTRINSIC) != aCaps.getVisualID(VisualIDHolder.VIDType.INTRINSIC) ||
+ if( caps.getVisualID(VisualIDHolder.VIDType.INTRINSIC) != aCaps.getVisualID(VisualIDHolder.VIDType.INTRINSIC) ||
caps.getVisualID(VisualIDHolder.VIDType.NATIVE) != aCaps.getVisualID(VisualIDHolder.VIDType.NATIVE) ) {
throw new GLException("Incompatible Capabilities - Prev-Holder: "+caps+", New-Holder "+caps);
} */
@@ -285,8 +285,8 @@ public class GLEventListenerState {
if( !aDevice1.getUniqueID().equals( aDevice2.getUniqueID() ) ) {
throw new GLException("Incompatible devices: Preserved <"+aDevice2.getUniqueID()+">, target <"+aDevice1.getUniqueID()+">");
}
-
- // collect optional upstream surface info
+
+ // collect optional upstream surface info
final ProxySurface aProxy;
final NativeSurface aUpSurface;
if(aSurface instanceof ProxySurface) {
@@ -302,8 +302,8 @@ public class GLEventListenerState {
}
if( null==aUpSurface && null != upstreamDevice ) {
throw new GLException("Incompatible Surface config - Has Upstream-Surface: Prev-Holder = true, New-Holder = false");
- }
-
+ }
+
// Destroy and remove currently associated GLContext, if any (will be replaced)
a.setContext( null, true );
aRealized = a.isRealized();
@@ -311,7 +311,7 @@ public class GLEventListenerState {
// Unrealize due to device dependencies of an upstream surface, e.g. EGLUpstreamSurfaceHook
a.getDelegatedDrawable().setRealized(false);
}
-
+
// Set new Screen and close previous one
{
if( DEBUG ) {
@@ -319,13 +319,13 @@ public class GLEventListenerState {
System.err.println("GLEventListenerState.moveTo.0b: pres 0x"+Integer.toHexString(aDevice2.hashCode())+", "+aDevice2);
}
DefaultGraphicsDevice.swapDeviceHandleAndOwnership(aDevice1, aDevice2);
- aDevice2.close();
+ aDevice2.close();
if( DEBUG ) {
System.err.println("GLEventListenerState.moveTo.1a: orig 0x"+Integer.toHexString(aDevice1.hashCode())+", "+aDevice1);
System.err.println("GLEventListenerState.moveTo.1b: pres 0x"+Integer.toHexString(aDevice2.hashCode())+", "+aDevice2);
}
}
-
+
// If using a ProxySurface w/ an upstream surface, set new Screen and close previous one on it
if( null != aUpSurface ) {
final MutableGraphicsConfiguration aUpCfg = (MutableGraphicsConfiguration) aUpSurface.getGraphicsConfiguration();
@@ -339,9 +339,9 @@ public class GLEventListenerState {
System.err.println("GLEventListenerState.moveTo.2a: up-orig 0x"+Integer.toHexString(aUpDevice1.hashCode())+", "+aUpDevice1);
System.err.println("GLEventListenerState.moveTo.2b: up-pres 0x"+Integer.toHexString(aUpDevice2.hashCode())+", "+aUpDevice2);
System.err.println("GLEventListenerState.moveTo.2c: "+aUpSurface.getClass().getName()/*+", "+aUpSurface+", "*/+aProxy.getUpstreamOptionBits(null).toString());
- }
+ }
DefaultGraphicsDevice.swapDeviceHandleAndOwnership(aUpDevice1, aUpDevice2);
- aUpDevice2.close();
+ aUpDevice2.close();
if( proxyOwnsUpstreamDevice ) {
aProxy.addUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_DEVICE );
}
@@ -354,7 +354,7 @@ public class GLEventListenerState {
throw new GLException("Incompatible Surface config - Has Upstream-Surface: Prev-Holder = false, New-Holder = true");
}
}
-
+
if( aRealized && null != aUpSurface ) {
a.getDelegatedDrawable().setRealized(true);
}
@@ -369,7 +369,7 @@ public class GLEventListenerState {
}
}
owner = false;
-
+
//
// Trigger GL-Viewport reset and reshape of all initialized GLEventListeners
//
@@ -389,7 +389,7 @@ public class GLEventListenerState {
a.setGLEventListenerInitState(l, listenersInit[i]);
listeners[i] = null;
}
-
+
if( hasAnimator ) {
// prefer already bound animator
aAnim.add(a);
@@ -410,7 +410,7 @@ public class GLEventListenerState {
public boolean run(GLAutoDrawable drawable) {
drawable.getGL().glViewport(0, 0, drawable.getWidth(), drawable.getHeight());
return true;
- }
+ }
};
public static GLRunnable glFinish = new GLRunnable() {
@@ -418,7 +418,7 @@ public class GLEventListenerState {
public boolean run(GLAutoDrawable drawable) {
drawable.getGL().glFinish();
return true;
- }
+ }
};
public static class ReshapeGLEventListener implements GLRunnable {
@@ -430,6 +430,6 @@ public class GLEventListenerState {
public boolean run(GLAutoDrawable drawable) {
listener.reshape(drawable, 0, 0, drawable.getWidth(), drawable.getHeight());
return true;
- }
+ }
}
}
diff --git a/src/jogl/classes/com/jogamp/opengl/GLExtensions.java b/src/jogl/classes/com/jogamp/opengl/GLExtensions.java
index 14f4be96a..c7aadcd14 100644
--- a/src/jogl/classes/com/jogamp/opengl/GLExtensions.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLExtensions.java
@@ -28,17 +28,17 @@
package com.jogamp.opengl;
/**
- * Class holding OpenGL extension strings, commonly used by JOGL's implementation.
+ * Class holding OpenGL extension strings, commonly used by JOGL's implementation.
*/
public class GLExtensions {
public static final String VERSION_1_2 = "GL_VERSION_1_2";
public static final String VERSION_1_4 = "GL_VERSION_1_4";
public static final String VERSION_1_5 = "GL_VERSION_1_5";
public static final String VERSION_2_0 = "GL_VERSION_2_0";
-
+
public static final String ARB_debug_output = "GL_ARB_debug_output";
public static final String AMD_debug_output = "GL_AMD_debug_output";
-
+
public static final String ARB_framebuffer_object = "GL_ARB_framebuffer_object";
public static final String OES_framebuffer_object = "GL_OES_framebuffer_object";
public static final String EXT_framebuffer_object = "GL_EXT_framebuffer_object";
@@ -49,17 +49,17 @@ public class GLExtensions {
public static final String OES_depth32 = "GL_OES_depth32";
public static final String OES_packed_depth_stencil = "GL_OES_packed_depth_stencil";
public static final String NV_fbo_color_attachments = "GL_NV_fbo_color_attachments";
-
+
public static final String ARB_ES2_compatibility = "GL_ARB_ES2_compatibility";
public static final String ARB_ES3_compatibility = "GL_ARB_ES3_compatibility";
-
+
public static final String EXT_abgr = "GL_EXT_abgr";
public static final String OES_rgb8_rgba8 = "GL_OES_rgb8_rgba8";
public static final String OES_stencil1 = "GL_OES_stencil1";
public static final String OES_stencil4 = "GL_OES_stencil4";
public static final String OES_stencil8 = "GL_OES_stencil8";
public static final String APPLE_float_pixels = "GL_APPLE_float_pixels";
-
+
public static final String ARB_texture_non_power_of_two = "GL_ARB_texture_non_power_of_two";
public static final String ARB_texture_rectangle = "GL_ARB_texture_rectangle";
public static final String EXT_texture_rectangle = "GL_EXT_texture_rectangle";
@@ -72,15 +72,15 @@ public class GLExtensions {
public static final String OES_read_format = "GL_OES_read_format";
public static final String OES_single_precision = "GL_OES_single_precision";
public static final String OES_EGL_image_external = "GL_OES_EGL_image_external";
-
+
public static final String ARB_gpu_shader_fp64 = "GL_ARB_gpu_shader_fp64";
- public static final String ARB_shader_objects = "GL_ARB_shader_objects";
+ public static final String ARB_shader_objects = "GL_ARB_shader_objects";
public static final String ARB_geometry_shader4 = "GL_ARB_geometry_shader4";
-
+
//
// Aliased GLX/WGL/.. extensions
//
-
- public static final String ARB_pixel_format = "GL_ARB_pixel_format";
+
+ public static final String ARB_pixel_format = "GL_ARB_pixel_format";
public static final String ARB_pbuffer = "GL_ARB_pbuffer";
}
diff --git a/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java b/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java
index 6ef1e0805..ee77f8d2d 100644
--- a/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java
@@ -29,20 +29,20 @@ package com.jogamp.opengl;
import java.util.List;
-/**
- * GLRendererQuirks contains information of known bugs of various GL renderer.
+/**
+ * GLRendererQuirks contains information of known bugs of various GL renderer.
* This information allows us to workaround them.
*
* Using centralized quirk identifier enables us to
- * locate code dealing w/ it and hence eases it's maintenance.
+ * locate code dealing w/ it and hence eases it's maintenance.
*
*
* SomeGL_VENDOR and GL_RENDERER strings are
- * listed here .
+ * listed here .
*
*/
public class GLRendererQuirks {
- /**
+ /**
* Crashes XServer when using double buffered PBuffer with GL_RENDERER:
*
*
Mesa DRI Intel(R) Sandybridge Desktop
@@ -52,23 +52,23 @@ public class GLRendererQuirks {
* For now, it is safe to disable it w/ hw-acceleration.
*/
public static final int NoDoubleBufferedPBuffer = 0;
-
+
/** On Windows no double buffered bitmaps are guaranteed to be available. */
public static final int NoDoubleBufferedBitmap = 1;
/** Crashes application when trying to set EGL swap interval on Android 4.0.3 / Pandaboard ES / PowerVR SGX 540 */
public static final int NoSetSwapInterval = 2;
-
+
/** No offscreen bitmap available, currently true for JOGL's OSX implementation. */
public static final int NoOffscreenBitmap = 3;
-
+
/** SIGSEGV on setSwapInterval() after changing the context's drawable w/ 'Mesa 8.0.4' dri2SetSwapInterval/DRI2 (soft & intel) */
public static final int NoSetSwapIntervalPostRetarget = 4;
/** GLSL discard command leads to undefined behavior or won't get compiled if being used. Appears to have happened on Nvidia Tegra2, but seems to be fine now. FIXME: Constrain version. */
public static final int GLSLBuggyDiscard = 5;
-
- /**
+
+ /**
* Non compliant GL context due to a buggy implementation not suitable for use.
*
* Currently, Mesa >= 9.1.3 (may extend back as far as 9.0) OpenGL 3.1 compatibility
@@ -82,19 +82,19 @@ public class GLRendererQuirks {
*
*
*
- * It still has to be verified whether the AMD OpenGL 3.1 core driver is compliant enought.
+ * It still has to be verified whether the AMD OpenGL 3.1 core driver is compliant enought.
*/
public static final int GLNonCompliant = 6;
-
+
/**
* The OpenGL Context needs a glFlush() before releasing it, otherwise driver may freeze:
*
*/
public static final int GLFlushBeforeRelease = 7;
-
- /**
+
+ /**
* Closing X11 displays may cause JVM crashes or X11 errors with some buggy drivers
* while being used in concert w/ OpenGL.
*
@@ -123,14 +123,14 @@ public class GLRendererQuirks {
*
*/
public static final int DontCloseX11Display = 8;
-
+
/**
- * Need current GL Context when calling new ARB pixel format query functions,
+ * Need current GL Context when calling new ARB pixel format query functions,
* otherwise driver crashes the VM.
*
* Drivers known exposing such bug:
*
- *
ATI proprietary Catalyst driver on Windows version ≤ XP.
+ *
ATI proprietary Catalyst driver on Windows version ≤ XP.
* TODO: Validate if bug actually relates to 'old' ATI Windows drivers for old GPU's like X300
* regardless of the Windows version.
*
@@ -139,7 +139,7 @@ public class GLRendererQuirks {
*
*/
public static final int NeedCurrCtx4ARBPixFmtQueries = 9;
-
+
/**
* Need current GL Context when calling new ARB CreateContext function,
* otherwise driver crashes the VM.
@@ -159,14 +159,14 @@ public class GLRendererQuirks {
*
*/
public static final int NeedCurrCtx4ARBCreateContext = 10;
-
+
/**
* No full FBO support, i.e. not compliant w/
- *
+ *
*
GL_ARB_framebuffer_object
- *
EXT_framebuffer_object
- *
EXT_framebuffer_multisample
- *
EXT_framebuffer_blit
+ *
EXT_framebuffer_object
+ *
EXT_framebuffer_multisample
+ *
EXT_framebuffer_blit
*
EXT_packed_depth_stencil
*
.
* Drivers known exposing such bug:
@@ -180,18 +180,18 @@ public class GLRendererQuirks {
* Quirk can also be enabled via property: jogl.fbo.force.min.
*/
public static final int NoFullFBOSupport = 11;
-
+
/**
* GLSL is not compliant or even not stable (crash)
*
*/
public static final int GLSLNonCompliant = 12;
-
+
/** Number of quirks known. */
public static final int COUNT = 13;
-
+
private static final String[] _names = new String[] { "NoDoubleBufferedPBuffer", "NoDoubleBufferedBitmap", "NoSetSwapInterval",
"NoOffscreenBitmap", "NoSetSwapIntervalPostRetarget", "GLSLBuggyDiscard",
"GLNonCompliant", "GLFlushBeforeRelease", "DontCloseX11Display",
@@ -218,7 +218,7 @@ public class GLRendererQuirks {
bitmask |= 1 << quirk;
}
_bitmask = bitmask;
- }
+ }
/**
* @param quirks a list of valid quirks
@@ -233,7 +233,7 @@ public class GLRendererQuirks {
}
_bitmask = bitmask;
}
-
+
/**
* @param quirk the quirk to be tested
* @return true if quirk exist, otherwise false
@@ -261,7 +261,7 @@ public class GLRendererQuirks {
sb.append("]");
return sb;
}
-
+
public final String toString() {
return toString(null).toString();
}
@@ -273,7 +273,7 @@ public class GLRendererQuirks {
public static void validateQuirk(int quirk) throws IllegalArgumentException {
if( !( 0 <= quirk && quirk < COUNT ) ) {
throw new IllegalArgumentException("Quirks must be in range [0.."+COUNT+"[, but quirk: "+quirk);
- }
+ }
}
/**
diff --git a/src/jogl/classes/com/jogamp/opengl/GLStateKeeper.java b/src/jogl/classes/com/jogamp/opengl/GLStateKeeper.java
index 321d4ee57..b98c4431d 100644
--- a/src/jogl/classes/com/jogamp/opengl/GLStateKeeper.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLStateKeeper.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -31,12 +31,12 @@ package com.jogamp.opengl;
* Interface adding a {@link GLEventListenerState} protocol to {@link GLAutoDrawable}s
* or other self-contained compound types combining {@link GLDrawable}, {@link GLContext} and {@link GLEventListener}.
*
- * Implementing classes {@link #isGLStatePreservationSupported() may support} preservation
- * of the {@link GLContext} state and it's associated {@link GLEventListener}.
- *
+ * Implementing classes {@link #isGLStatePreservationSupported() may support} preservation
+ * of the {@link GLContext} state and it's associated {@link GLEventListener}.
+ *
*/
public interface GLStateKeeper {
-
+
/** Listener for preserve and restore notifications. */
public static interface Listener {
/** Invoked before preservation. */
@@ -44,14 +44,14 @@ public interface GLStateKeeper {
/** Invoked after restoration. */
void glStateRestored(GLStateKeeper glsk);
}
-
- /**
+
+ /**
* Sets a {@link Listener}, overriding the old one.
* @param l the new {@link Listener}.
* @return the previous {@link Listener}.
*/
public Listener setGLStateKeeperListener(Listener l);
-
+
/**
* @return true if GL state preservation is supported in implementation and on current platform, false otherwise.
* @see #preserveGLStateAtDestroy(boolean)
@@ -59,7 +59,7 @@ public interface GLStateKeeper {
* @see #clearPreservedGLState()
*/
public boolean isGLStatePreservationSupported();
-
+
/**
* If set to true, the next {@link GLAutoDrawable#destroy()} operation will
* {@link #pullGLEventListenerState() pull} to preserve the {@link GLEventListenerState}.
@@ -68,8 +68,8 @@ public interface GLStateKeeper {
* the flag is cleared.
*
*
- * A preserved {@link GLEventListenerState} will be {@link #pushGLEventListenerState() pushed}
- * if realized again.
+ * A preserved {@link GLEventListenerState} will be {@link #pushGLEventListenerState() pushed}
+ * if realized again.
*
* @return true if supported and successful, false otherwise.
* @see #isGLStatePreservationSupported()
@@ -77,21 +77,21 @@ public interface GLStateKeeper {
* @see #clearPreservedGLState()
*/
public boolean preserveGLStateAtDestroy(boolean value);
-
+
/**
* Returns the preserved {@link GLEventListenerState} if preservation was performed,
- * otherwise null.
+ * otherwise null.
* @see #isGLStatePreservationSupported()
* @see #preserveGLStateAtDestroy(boolean)
* @see #clearPreservedGLState()
*/
public GLEventListenerState getPreservedGLState();
-
+
/**
* Clears the preserved {@link GLEventListenerState} from this {@link GLStateKeeper}, without destroying it.
- *
+ *
* @return the preserved and cleared {@link GLEventListenerState} if preservation was performed,
- * otherwise null.
+ * otherwise null.
* @see #isGLStatePreservationSupported()
* @see #preserveGLStateAtDestroy(boolean)
* @see #getPreservedGLState()
diff --git a/src/jogl/classes/com/jogamp/opengl/GenericGLCapabilitiesChooser.java b/src/jogl/classes/com/jogamp/opengl/GenericGLCapabilitiesChooser.java
index 73ec10886..3693f647a 100644
--- a/src/jogl/classes/com/jogamp/opengl/GenericGLCapabilitiesChooser.java
+++ b/src/jogl/classes/com/jogamp/opengl/GenericGLCapabilitiesChooser.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -37,7 +37,7 @@ import javax.media.opengl.DefaultGLCapabilitiesChooser;
* otherwise uses {@link DefaultGLCapabilitiesChooser} implementation.
*/
public class GenericGLCapabilitiesChooser extends DefaultGLCapabilitiesChooser {
-
+
@Override
public int chooseCapabilities(final CapabilitiesImmutable desired,
final List extends CapabilitiesImmutable> available,
diff --git a/src/jogl/classes/com/jogamp/opengl/JoglVersion.java b/src/jogl/classes/com/jogamp/opengl/JoglVersion.java
index 1f0189aa3..1f715c21a 100644
--- a/src/jogl/classes/com/jogamp/opengl/JoglVersion.java
+++ b/src/jogl/classes/com/jogamp/opengl/JoglVersion.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.opengl;
import com.jogamp.common.GlueGenVersion;
@@ -90,16 +90,16 @@ public class JoglVersion extends JogampVersion {
sb.append("\tnone").append(Platform.getNewline());
}
sb.append(Platform.getNewline());
- return sb;
+ return sb;
}
-
+
public static StringBuilder getAllAvailableCapabilitiesInfo(AbstractGraphicsDevice device, StringBuilder sb) {
if(null==sb) {
sb = new StringBuilder();
}
if(null == device) {
device = GLProfile.getDefaultDevice();
- }
+ }
sb.append(Platform.getNewline()).append(Platform.getNewline());
sb.append("Desktop Capabilities: ").append(Platform.getNewline());
getAvailableCapabilitiesInfo(GLDrawableFactory.getDesktopFactory(), device, sb);
@@ -107,7 +107,7 @@ public class JoglVersion extends JogampVersion {
getAvailableCapabilitiesInfo(GLDrawableFactory.getEGLFactory(), device, sb);
return sb;
}
-
+
public static StringBuilder getDefaultOpenGLInfo(AbstractGraphicsDevice device, StringBuilder sb, boolean withCapabilitiesInfo) {
if(null==sb) {
sb = new StringBuilder();
@@ -126,7 +126,7 @@ public class JoglVersion extends JogampVersion {
}
return sb;
}
-
+
public static StringBuilder getGLInfo(GL gl, StringBuilder sb) {
return getGLInfo(gl, sb, false);
}
@@ -136,26 +136,26 @@ public class JoglVersion extends JogampVersion {
if(null==sb) {
sb = new StringBuilder();
}
-
+
sb.append(VersionUtil.SEPERATOR).append(Platform.getNewline());
sb.append(device.getClass().getSimpleName()).append("[type ")
.append(device.getType()).append(", connection ").append(device.getConnection()).append("]: ").append(Platform.getNewline());
- GLProfile.glAvailabilityToString(device, sb, "\t", 1);
+ GLProfile.glAvailabilityToString(device, sb, "\t", 1);
sb.append(Platform.getNewline());
sb = getGLStrings(gl, sb, withCapabilitiesAndExtensionInfo);
-
+
if( withCapabilitiesAndExtensionInfo ) {
- sb = getAllAvailableCapabilitiesInfo(device, sb);
+ sb = getAllAvailableCapabilitiesInfo(device, sb);
}
return sb;
}
-
+
public static StringBuilder getGLStrings(GL gl, StringBuilder sb) {
return getGLStrings(gl, sb, true);
}
-
- public static StringBuilder getGLStrings(GL gl, StringBuilder sb, boolean withExtensions) {
+
+ public static StringBuilder getGLStrings(GL gl, StringBuilder sb, boolean withExtensions) {
if(null==sb) {
sb = new StringBuilder();
}
@@ -175,7 +175,7 @@ public class JoglVersion extends JogampVersion {
sb.append("GL_RENDERER ").append(gl.glGetString(GL.GL_RENDERER));
sb.append(Platform.getNewline());
sb.append("GL_VERSION ").append(gl.glGetString(GL.GL_VERSION));
- sb.append(Platform.getNewline());
+ sb.append(Platform.getNewline());
sb.append("GLSL ").append(gl.hasGLSL()).append(", has-compiler-func: ").append(gl.isFunctionAvailable("glCompileShader"));
if(gl.hasGLSL()) {
sb.append(", version: ").append(gl.glGetString(GL2ES2.GL_SHADING_LANGUAGE_VERSION)).append(" / ").append(ctx.getGLSLVersionNumber());
@@ -200,7 +200,7 @@ public class JoglVersion extends JogampVersion {
return sb;
}
- public StringBuilder getBriefOSGLBuildInfo(GL gl, StringBuilder sb) {
+ public StringBuilder getBriefOSGLBuildInfo(GL gl, StringBuilder sb) {
if(null==sb) {
sb = new StringBuilder();
}
@@ -216,7 +216,7 @@ public class JoglVersion extends JogampVersion {
sb.append(Platform.getNewline());
return sb;
}
-
+
public static void main(String args[]) {
System.err.println(VersionUtil.getPlatformInfo());
System.err.println(GlueGenVersion.getInstance());
diff --git a/src/jogl/classes/com/jogamp/opengl/cg/CgDynamicLibraryBundleInfo.java b/src/jogl/classes/com/jogamp/opengl/cg/CgDynamicLibraryBundleInfo.java
index ca4846939..8d2d07d58 100644
--- a/src/jogl/classes/com/jogamp/opengl/cg/CgDynamicLibraryBundleInfo.java
+++ b/src/jogl/classes/com/jogamp/opengl/cg/CgDynamicLibraryBundleInfo.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.opengl.cg;
import com.jogamp.common.jvm.JNILibLoaderBase;
@@ -45,15 +45,15 @@ public final class CgDynamicLibraryBundleInfo implements DynamicLibraryBundleInf
AccessController.doPrivileged(new PrivilegedAction's current position
@@ -469,14 +469,14 @@ public class FloatUtil {
for(int i=0; ia's current position
@@ -493,14 +493,14 @@ public class FloatUtil {
for(int i=0; ia's current position
@@ -521,14 +521,14 @@ public class FloatUtil {
matrixRowToString(sb, f, a, aOffset, rows, columns, rowMajorOrder, i);
sb.append("=?= ");
matrixRowToString(sb, f, b, bOffset, rows, columns, rowMajorOrder, i);
- sb.append("]").append(Platform.getNewline());
+ sb.append("]").append(Platform.getNewline());
}
return sb;
}
- /**
+ /**
* @param sb optional passed StringBuilder instance to be used
- * @param rowPrefix optional prefix for each row
+ * @param rowPrefix optional prefix for each row
* @param f the format string of one floating point, i.e. "%10.5f", see {@link java.util.Formatter}
* @param a 4x4 matrix in column major order (OpenGL)
* @param aOffset offset to a's current position
@@ -549,11 +549,11 @@ public class FloatUtil {
matrixRowToString(sb, f, a, aOffset, rows, columns, rowMajorOrder, i);
sb.append("=?= ");
matrixRowToString(sb, f, b, bOffset, rows, columns, rowMajorOrder, i);
- sb.append("]").append(Platform.getNewline());
+ sb.append("]").append(Platform.getNewline());
}
return sb;
}
-
+
public static final float E = 2.7182818284590452354f;
public static final float PI = 3.14159265358979323846f;
@@ -569,5 +569,5 @@ public class FloatUtil {
public static float acos(float a) { return (float) java.lang.Math.acos(a); }
public static float sqrt(float a) { return (float) java.lang.Math.sqrt(a); }
-
+
}
\ No newline at end of file
diff --git a/src/jogl/classes/com/jogamp/opengl/math/Quaternion.java b/src/jogl/classes/com/jogamp/opengl/math/Quaternion.java
index c6bf44f6d..78cbb18cf 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/Quaternion.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/Quaternion.java
@@ -33,7 +33,7 @@ public class Quaternion {
public Quaternion() {
setIdentity();
}
-
+
public Quaternion(Quaternion q) {
x = q.x;
y = q.y;
@@ -50,7 +50,7 @@ public class Quaternion {
/**
* Constructor to create a rotation based quaternion from two vectors
- *
+ *
* @param vector1
* @param vector2
*/
@@ -59,7 +59,7 @@ public class Quaternion {
final float[] cross = VectorUtil.cross(vector1, vector2);
fromAxis(cross, theta);
}
-
+
/***
* Constructor to create a rotation based quaternion from axis vector and angle
* @param vector axis vector
@@ -69,10 +69,10 @@ public class Quaternion {
public Quaternion(float[] vector, float angle) {
fromAxis(vector, angle);
}
-
+
/***
* Initialize this quaternion with given axis vector and rotation angle
- *
+ *
* @param vector axis vector
* @param angle rotation angle (rads)
*/
@@ -88,7 +88,7 @@ public class Quaternion {
/**
* Transform the rotational quaternion to axis based rotation angles
- *
+ *
* @return new float[4] with ,theta,Rx,Ry,Rz
*/
public float[] toAxis() {
@@ -135,7 +135,7 @@ public class Quaternion {
/**
* Add a quaternion
- *
+ *
* @param q quaternion
*/
public void add(Quaternion q) {
@@ -146,7 +146,7 @@ public class Quaternion {
/**
* Subtract a quaternion
- *
+ *
* @param q quaternion
*/
public void subtract(Quaternion q) {
@@ -157,7 +157,7 @@ public class Quaternion {
/**
* Divide a quaternion by a constant
- *
+ *
* @param n a float to divide by
*/
public void divide(float n) {
@@ -168,7 +168,7 @@ public class Quaternion {
/**
* Multiply this quaternion by the param quaternion
- *
+ *
* @param q a quaternion to multiply with
*/
public void mult(Quaternion q) {
@@ -186,7 +186,7 @@ public class Quaternion {
/**
* Multiply a quaternion by a constant
- *
+ *
* @param n a float constant
*/
public void mult(float n) {
@@ -194,10 +194,10 @@ public class Quaternion {
y *= n;
z *= n;
}
-
+
/***
* Rotate given vector by this quaternion
- *
+ *
* @param vector input vector
* @return rotated vector
*/
@@ -250,7 +250,7 @@ public class Quaternion {
/**
* Transform this quaternion to a 4x4 column matrix representing the
* rotation
- *
+ *
* @return new float[16] column matrix 4x4
*/
public float[] toMatrix() {
@@ -287,7 +287,7 @@ public class Quaternion {
* See http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/
* quaternions/slerp/
*
- *
+ *
* @param a initial quaternion
* @param b target quaternion
* @param t float between 0 and 1 representing interp.
@@ -332,13 +332,13 @@ public class Quaternion {
/**
* Check if this quaternion represents an identity matrix for rotation,
* , ie (0,0,0,1).
- *
+ *
* @return true if it is an identity rep., false otherwise
*/
public boolean isIdentity() {
return w == 1 && x == 0 && y == 0 && z == 0;
}
-
+
/***
* Set this quaternion to identity (x=0,y=0,z=0,w=1)
*/
@@ -349,7 +349,7 @@ public class Quaternion {
/**
* compute the quaternion from a 3x3 column matrix
- *
+ *
* @param m 3x3 column matrix
*/
public void setFromMatrix(float[] m) {
@@ -386,7 +386,7 @@ public class Quaternion {
/**
* Check if the the 3x3 matrix (param) is in fact an affine rotational
* matrix
- *
+ *
* @param m 3x3 column matrix
* @return true if representing a rotational matrix, false otherwise
*/
diff --git a/src/jogl/classes/com/jogamp/opengl/math/VectorUtil.java b/src/jogl/classes/com/jogamp/opengl/math/VectorUtil.java
index 0033afeaa..508f1aafd 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/VectorUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/VectorUtil.java
@@ -39,7 +39,7 @@ public class VectorUtil {
Winding(int dir) {
this.dir = dir;
}
- }
+ }
public static final int COLLINEAR = 0;
@@ -119,15 +119,15 @@ public class VectorUtil {
/** Column Matrix Vector multiplication
* @param colMatrix column matrix (4x4)
* @param vec vector(x,y,z)
- * @return result new float[3]
+ * @return result new float[3]
*/
public static float[] colMatrixVectorMult(float[] colMatrix, float[] vec)
{
final float[] out = new float[3];
- out[0] = vec[0]*colMatrix[0] + vec[1]*colMatrix[4] + vec[2]*colMatrix[8] + colMatrix[12];
- out[1] = vec[0]*colMatrix[1] + vec[1]*colMatrix[5] + vec[2]*colMatrix[9] + colMatrix[13];
- out[2] = vec[0]*colMatrix[2] + vec[1]*colMatrix[6] + vec[2]*colMatrix[10] + colMatrix[14];
+ out[0] = vec[0]*colMatrix[0] + vec[1]*colMatrix[4] + vec[2]*colMatrix[8] + colMatrix[12];
+ out[1] = vec[0]*colMatrix[1] + vec[1]*colMatrix[5] + vec[2]*colMatrix[9] + colMatrix[13];
+ out[2] = vec[0]*colMatrix[2] + vec[1]*colMatrix[6] + vec[2]*colMatrix[10] + colMatrix[14];
return out;
}
@@ -135,15 +135,15 @@ public class VectorUtil {
/** Matrix Vector multiplication
* @param rawMatrix column matrix (4x4)
* @param vec vector(x,y,z)
- * @return result new float[3]
+ * @return result new float[3]
*/
public static float[] rowMatrixVectorMult(float[] rawMatrix, float[] vec)
{
final float[] out = new float[3];
- out[0] = vec[0]*rawMatrix[0] + vec[1]*rawMatrix[1] + vec[2]*rawMatrix[2] + rawMatrix[3];
- out[1] = vec[0]*rawMatrix[4] + vec[1]*rawMatrix[5] + vec[2]*rawMatrix[6] + rawMatrix[7];
- out[2] = vec[0]*rawMatrix[8] + vec[1]*rawMatrix[9] + vec[2]*rawMatrix[10] + rawMatrix[11];
+ out[0] = vec[0]*rawMatrix[0] + vec[1]*rawMatrix[1] + vec[2]*rawMatrix[2] + rawMatrix[3];
+ out[1] = vec[0]*rawMatrix[4] + vec[1]*rawMatrix[5] + vec[2]*rawMatrix[6] + rawMatrix[7];
+ out[2] = vec[0]*rawMatrix[8] + vec[1]*rawMatrix[9] + vec[2]*rawMatrix[10] + rawMatrix[11];
return out;
}
@@ -157,7 +157,7 @@ public class VectorUtil {
{
return (p1+p2)/2.0f;
}
-
+
/** Calculate the midpoint of two points
* @param p1 first point
* @param p2 second point
@@ -172,7 +172,7 @@ public class VectorUtil {
return midPoint;
}
-
+
/** Compute the norm of a vector
* @param vec vector
* @return vorm
@@ -181,7 +181,7 @@ public class VectorUtil {
{
return FloatUtil.sqrt(vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2]);
}
-
+
/** Compute distance between 2 points
* @param p0 a ref point on the line
* @param vec vector representing the direction of the line
@@ -216,7 +216,7 @@ public class VectorUtil {
*/
public static boolean checkEqualityVec2(float[] v1, float[] v2)
{
- return Float.compare(v1[0], v2[0]) == 0 &&
+ return Float.compare(v1[0], v2[0]) == 0 &&
Float.compare(v1[1], v2[1]) == 0 ;
}
@@ -261,7 +261,7 @@ public class VectorUtil {
* @param b triangle vertex 2
* @param c triangle vertex 3
* @param d vertex in question
- * @return true if the vertex d is inside the circle defined by the
+ * @return true if the vertex d is inside the circle defined by the
* vertices a, b, c. from paper by Guibas and Stolfi (1985).
*/
public static boolean inCircle(Vert2fImmutable a, Vert2fImmutable b, Vert2fImmutable c, Vert2fImmutable d){
@@ -282,8 +282,8 @@ public class VectorUtil {
return (b.getX() - a.getX()) * (c.getY() - a.getY()) - (b.getY() - a.getY())*(c.getX() - a.getX());
}
- /** Check if a vertex is in triangle using
- * barycentric coordinates computation.
+ /** Check if a vertex is in triangle using
+ * barycentric coordinates computation.
* @param a first triangle vertex
* @param b second triangle vertex
* @param c third triangle vertex
@@ -291,7 +291,7 @@ public class VectorUtil {
* @return true if p is in triangle (a, b, c), false otherwise.
*/
public static boolean vertexInTriangle(float[] a, float[] b, float[] c, float[] p){
- // Compute vectors
+ // Compute vectors
final float[] ac = computeVector(a, c); //v0
final float[] ab = computeVector(a, b); //v1
final float[] ap = computeVector(a, p); //v2
@@ -362,13 +362,13 @@ public class VectorUtil {
* @param b vertex 2 of first segment
* @param c vertex 1 of second segment
* @param d vertex 2 of second segment
- * @return the intersection coordinates if the segments intersect, otherwise
- * returns null
+ * @return the intersection coordinates if the segments intersect, otherwise
+ * returns null
*/
public static float[] seg2SegIntersection(Vert2fImmutable a, Vert2fImmutable b, Vert2fImmutable c, Vert2fImmutable d) {
final float determinant = (a.getX()-b.getX())*(c.getY()-d.getY()) - (a.getY()-b.getY())*(c.getX()-d.getX());
- if (determinant == 0)
+ if (determinant == 0)
return null;
final float alpha = (a.getX()*b.getY()-a.getY()*b.getX());
@@ -389,13 +389,13 @@ public class VectorUtil {
* @param b vertex 2 of first line
* @param c vertex 1 of second line
* @param d vertex 2 of second line
- * @return the intersection coordinates if the lines intersect, otherwise
- * returns null
+ * @return the intersection coordinates if the lines intersect, otherwise
+ * returns null
*/
public static float[] line2lineIntersection(Vert2fImmutable a, Vert2fImmutable b, Vert2fImmutable c, Vert2fImmutable d) {
final float determinant = (a.getX()-b.getX())*(c.getY()-d.getY()) - (a.getY()-b.getY())*(c.getX()-d.getX());
- if (determinant == 0)
+ if (determinant == 0)
return null;
final float alpha = (a.getX()*b.getY()-a.getY()*b.getX());
diff --git a/src/jogl/classes/com/jogamp/opengl/math/Vert2fImmutable.java b/src/jogl/classes/com/jogamp/opengl/math/Vert2fImmutable.java
index 13349884c..ec90b401f 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/Vert2fImmutable.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/Vert2fImmutable.java
@@ -33,7 +33,7 @@ public interface Vert2fImmutable {
float getY();
int getCoordCount();
-
+
float[] getCoord();
-
+
}
diff --git a/src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java b/src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java
index b6e8ede2e..f1880a61b 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java
@@ -32,23 +32,23 @@ import com.jogamp.opengl.math.VectorUtil;
/**
* Axis Aligned Bounding Box. Defined by two 3D coordinates (low and high)
- * The low being the the lower left corner of the box, and the high being the upper
+ * The low being the the lower left corner of the box, and the high being the upper
* right corner of the box.
- *
+ *
*/
public class AABBox implements Cloneable {
private float[] low = new float[3];
private float[] high = new float[3];
private float[] center = new float[3];
- /** Create a Axis Aligned bounding box (AABBox)
+ /** Create a Axis Aligned bounding box (AABBox)
* where the low and and high MAX float Values.
*/
public AABBox() {
reset();
}
- /** Create an AABBox specifying the coordinates
+ /** Create an AABBox specifying the coordinates
* of the low and high
* @param lx min x-coordinate
* @param ly min y-coordnate
@@ -61,7 +61,7 @@ public class AABBox implements Cloneable {
float hx, float hy, float hz) {
setSize(lx, ly, lz, hx, hy, hz);
}
-
+
/** Create a AABBox defining the low and high
* @param low min xyz-coordinates
* @param high max xyz-coordinates
@@ -78,27 +78,27 @@ public class AABBox implements Cloneable {
center[1] = 0f;
center[2] = 0f;
}
-
+
/** Get the max xyz-coordinates
* @return a float array containing the max xyz coordinates
*/
public final float[] getHigh() {
return high;
}
-
+
private final void setHigh(float hx, float hy, float hz) {
this.high[0] = hx;
this.high[1] = hy;
this.high[2] = hz;
}
-
+
/** Get the min xyz-coordinates
* @return a float array containing the min xyz coordinates
*/
public final float[] getLow() {
return low;
}
-
+
private final void setLow(float lx, float ly, float lz) {
this.low[0] = lx;
this.low[1] = ly;
@@ -111,10 +111,10 @@ public class AABBox implements Cloneable {
center[2] = (high[2] + low[2])/2;
}
- /**
- * Set size of the AABBox specifying the coordinates
+ /**
+ * Set size of the AABBox specifying the coordinates
* of the low and high.
- *
+ *
* @param lx min x-coordinate
* @param ly min y-coordnate
* @param lz min z-coordinate
@@ -123,7 +123,7 @@ public class AABBox implements Cloneable {
* @param hz max z-coordinate
*/
public final void setSize(float lx, float ly, float lz,
- float hx, float hy, float hz) {
+ float hx, float hy, float hz) {
this.low[0] = lx;
this.low[1] = ly;
this.low[2] = lz;
@@ -132,7 +132,7 @@ public class AABBox implements Cloneable {
this.high[2] = hz;
computeCenter();
}
-
+
/** Resize the AABBox to encapsulate another AABox
* @param newBox AABBox to be encapsulated in
*/
@@ -160,12 +160,12 @@ public class AABBox implements Cloneable {
}
/** Resize the AABBox to encapsulate the passed
- * xyz-coordinates.
+ * xyz-coordinates.
* @param x x-axis coordinate value
* @param y y-axis coordinate value
* @param z z-axis coordinate value
*/
- public final void resize(float x, float y, float z) {
+ public final void resize(float x, float y, float z) {
/** test low */
if (x < low[0])
low[0] = x;
@@ -181,12 +181,12 @@ public class AABBox implements Cloneable {
high[1] = y;
if (z > high[2])
high[2] = z;
-
+
computeCenter();
}
/** Resize the AABBox to encapsulate the passed
- * xyz-coordinates.
+ * xyz-coordinates.
* @param xyz xyz-axis coordinate values
* @param offset of the array
*/
@@ -210,7 +210,7 @@ public class AABBox implements Cloneable {
}
return true;
}
-
+
/** Check if the xyz coordinates are bounded/contained
* by this AABBox.
* @param x x-axis coordinate value
@@ -231,7 +231,7 @@ public class AABBox implements Cloneable {
}
return true;
}
-
+
/** Check if there is a common region between this AABBox and the passed
* 2D region irrespective of z range
* @param x lower left x-coord
@@ -244,13 +244,13 @@ public class AABBox implements Cloneable {
if (w <= 0 || h <= 0) {
return false;
}
-
+
final float _w = getWidth();
- final float _h = getHeight();
+ final float _h = getHeight();
if (_w <= 0 || _h <= 0) {
return false;
}
-
+
final float x0 = getMinX();
final float y0 = getMinY();
return (x + w > x0 &&
@@ -259,8 +259,8 @@ public class AABBox implements Cloneable {
y < y0 + _h);
}
-
- /** Get the size of the Box where the size is represented by the
+
+ /** Get the size of the Box where the size is represented by the
* length of the vector between low and high.
* @return a float representing the size of the AABBox
*/
@@ -283,16 +283,16 @@ public class AABBox implements Cloneable {
diffH[0] = high[0] - center[0];
diffH[1] = high[1] - center[1];
diffH[2] = high[2] - center[2];
-
+
diffH = VectorUtil.scale(diffH, size);
-
+
float[] diffL = new float[3];
diffL[0] = low[0] - center[0];
diffL[1] = low[1] - center[1];
diffL[2] = low[2] - center[2];
-
+
diffL = VectorUtil.scale(diffL, size);
-
+
high = VectorUtil.vectorAdd(center, diffH);
low = VectorUtil.vectorAdd(center, diffL);
}
@@ -300,43 +300,43 @@ public class AABBox implements Cloneable {
public final float getMinX() {
return low[0];
}
-
+
public final float getMinY() {
return low[1];
}
-
+
public final float getMinZ() {
return low[2];
}
-
+
public final float getMaxX() {
return high[0];
}
-
+
public final float getMaxY() {
return high[1];
}
-
+
public final float getMaxZ() {
return high[2];
}
-
+
public final float getWidth(){
return high[0] - low[0];
}
-
+
public final float getHeight() {
return high[1] - low[1];
}
-
+
public final float getDepth() {
return high[2] - low[2];
}
-
+
public final AABBox clone() {
return new AABBox(this.low, this.high);
}
-
+
public final boolean equals(Object obj) {
if( obj == this ) {
return true;
@@ -344,11 +344,11 @@ public class AABBox implements Cloneable {
if( null == obj || !(obj instanceof AABBox) ) {
return false;
}
- final AABBox other = (AABBox) obj;
- return VectorUtil.checkEquality(low, other.low) &&
+ final AABBox other = (AABBox) obj;
+ return VectorUtil.checkEquality(low, other.low) &&
VectorUtil.checkEquality(high, other.high) ;
}
-
+
public final String toString() {
return "[ "+low[0]+"/"+low[1]+"/"+low[1]+" .. "+high[0]+"/"+high[0]+"/"+high[0]+", ctr "+
center[0]+"/"+center[1]+"/"+center[1]+" ]";
diff --git a/src/jogl/classes/com/jogamp/opengl/math/geom/Frustum.java b/src/jogl/classes/com/jogamp/opengl/math/geom/Frustum.java
index 93e68a1d6..fb311083f 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/geom/Frustum.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/geom/Frustum.java
@@ -30,11 +30,11 @@ package com.jogamp.opengl.math.geom;
import com.jogamp.common.os.Platform;
/**
- * Providing frustum {@link #getPlanes() planes} derived by different inputs
+ * Providing frustum {@link #getPlanes() planes} derived by different inputs
* ({@link #updateByPMV(float[], int) P*MV}, ..)
- * used to {@link #classifySphere(float[], float) classify objects} and to test
+ * used to {@link #classifySphere(float[], float) classify objects} and to test
* whether they are {@link #isOutside(AABBox) outside}.
- *
+ *
*
* Extracting the world-frustum planes from the P*Mv:
*
- *
+ *
* Fundamentals about Planes, Half-Spaces and Frustum-Culling:
*
* Planes and Half-Spaces, Max Wagner
@@ -69,7 +69,7 @@ import com.jogamp.common.os.Platform;
public class Frustum {
/** Normalized planes[l, r, b, t, n, f] */
protected Plane[] planes = new Plane[6];
-
+
/**
* Creates an undefined instance w/o calculating the frustum.
*
@@ -83,35 +83,35 @@ public class Frustum {
planes[i] = new Plane();
}
}
-
- /**
+
+ /**
* Plane equation := dot(n, x - p) = 0 -> ax + bc + cx + d == 0
*
* In order to work w/ {@link Frustum#isOutside(AABBox) isOutside(..)} methods,
* the normals have to point to the inside of the frustum.
- *
+ *
*/
public static class Plane {
/** Normal of the plane */
public final float[] n = new float[3];
-
+
/** Distance to origin */
public float d;
- /**
+ /**
* Return signed distance of plane to given point.
*
*
If dist < 0 , then the point p lies in the negative halfspace.
*
If dist = 0 , then the point p lies in the plane.
*
If dist > 0 , then the point p lies in the positive halfspace.
- *
+ *
* A plane cuts 3D space into 2 half spaces.
*
* Positive halfspace is where the plane’s normals vector points into.
- *
+ *
*
* Negative halfspace is the other side of the plane, i.e. *-1
- *
+ *
**/
public final float distanceTo(float x, float y, float z) {
return n[0] * x + n[1] * y + n[2] * z + d;
@@ -121,13 +121,13 @@ public class Frustum {
public final float distanceTo(float[] p) {
return n[0] * p[0] + n[1] * p[1] + n[2] * p[2] + d;
}
-
+
@Override
public String toString() {
return "Plane[ [ " + n[0] + ", " + n[1] + ", " + n[2] + " ], " + d + "]";
}
}
-
+
/** Index for left plane: {@value} */
public static final int LEFT = 0;
/** Index for right plane: {@value} */
@@ -140,7 +140,7 @@ public class Frustum {
public static final int NEAR = 4;
/** Index for far plane: {@value} */
public static final int FAR = 5;
-
+
/**
* {@link Plane}s are ordered in the returned array as follows:
*
@@ -154,17 +154,17 @@ public class Frustum {
*
* {@link Plane}'s normals are pointing to the inside of the frustum
* in order to work w/ {@link #isOutside(AABBox) isOutside(..)} methods.
- *
- *
- * @return array of normalized {@link Plane}s, order see above.
+ *
+ *
+ * @return array of normalized {@link Plane}s, order see above.
*/
public final Plane[] getPlanes() { return planes; }
-
+
/**
* Copy the given src planes into this this instance's planes.
* @param src the 6 source planes
*/
- public final void updateByPlanes(Plane[] src) {
+ public final void updateByPlanes(Plane[] src) {
for (int i = 0; i < 6; ++i) {
final Plane p0 = planes[i];
final float[] p0_n = p0.n;
@@ -176,7 +176,7 @@ public class Frustum {
p0.d = p1.d;
}
}
-
+
/**
* Calculate the frustum planes in world coordinates
* using the passed float[16] as premultiplied P*MV (column major order).
@@ -185,7 +185,7 @@ public class Frustum {
* as required by this class.
*
*/
- public void updateByPMV(float[] pmv, int pmv_off) {
+ public void updateByPMV(float[] pmv, int pmv_off) {
// Left: a = m41 + m11, b = m42 + m12, c = m43 + m13, d = m44 + m14 - [1..4] row-major
// Left: a = m30 + m00, b = m31 + m01, c = m32 + m02, d = m33 + m03 - [0..3] row-major
{
@@ -264,11 +264,11 @@ public class Frustum {
p.d /= invl;
}
}
-
+
private static final boolean isOutsideImpl(Plane p, AABBox box) {
final float[] low = box.getLow();
final float[] high = box.getHigh();
-
+
if ( p.distanceTo(low[0], low[1], low[2]) > 0.0f ||
p.distanceTo(high[0], low[1], low[2]) > 0.0f ||
p.distanceTo(low[0], high[1], low[2]) > 0.0f ||
@@ -298,19 +298,19 @@ public class Frustum {
// We make no attempt to determine whether it's fully inside or not.
return false;
}
-
-
+
+
public static enum Location { OUTSIDE, INSIDE, INTERSECT };
-
+
/**
* Check to see if a point is outside, inside or on a plane of the frustum.
- *
+ *
* @param p the point
* @return {@link Location} of point related to frustum planes
*/
public final Location classifyPoint(float[] p) {
Location res = Location.INSIDE;
-
+
for (int i = 0; i < 6; ++i) {
final float d = planes[i].distanceTo(p);
if ( d < 0.0f ) {
@@ -321,43 +321,43 @@ public class Frustum {
}
return res;
}
-
+
/**
* Check to see if a point is outside of the frustum.
- *
+ *
* @param p the point
* @return true if outside of the frustum, otherwise inside or on a plane
*/
public final boolean isPointOutside(float[] p) {
return Location.OUTSIDE == classifyPoint(p);
}
-
+
/**
* Check to see if a sphere is outside, intersecting or inside of the frustum.
- *
+ *
* @param p center of the sphere
* @param radius radius of the sphere
* @return {@link Location} of point related to frustum planes
*/
public final Location classifySphere(float[] p, float radius) {
Location res = Location.INSIDE; // fully inside
-
+
for (int i = 0; i < 6; ++i) {
final float d = planes[i].distanceTo(p);
- if ( d < -radius ) {
+ if ( d < -radius ) {
// fully outside
return Location.OUTSIDE;
} else if (d < radius ) {
// intersecting
res = Location.INTERSECT;
}
- }
+ }
return res;
}
-
+
/**
* Check to see if a sphere is outside of the frustum.
- *
+ *
* @param p center of the sphere
* @param radius radius of the sphere
* @return true if outside of the frustum, otherwise inside or intersecting
@@ -365,7 +365,7 @@ public class Frustum {
public final boolean isSphereOutside(float[] p, float radius) {
return Location.OUTSIDE == classifySphere(p, radius);
}
-
+
public StringBuilder toString(StringBuilder sb) {
if( null == sb ) {
sb = new StringBuilder();
@@ -380,7 +380,7 @@ public class Frustum {
.append("]");
return sb;
}
-
+
@Override
public String toString() {
return toString(null).toString();
diff --git a/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java b/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java
index ff764d849..33941a407 100644
--- a/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java
+++ b/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java
@@ -102,11 +102,11 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
/* GL Stuff */
private final RecursiveLock lock = LockFactory.createRecursiveLock();
private final GLDrawableHelper helper = new GLDrawableHelper();
-
+
private final GLContext shareWith;
private final GLCapabilitiesImmutable capsRequested;
- private final GLCapabilitiesChooser capsChooser;
-
+ private final GLCapabilitiesChooser capsChooser;
+
private volatile Rectangle clientArea;
private volatile GLDrawableImpl drawable; // volatile: avoid locking for read-only access
private volatile GLContextImpl context;
@@ -156,7 +156,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
public void run() {
final RecursiveLock _lock = lock;
_lock.lock();
- try {
+ try {
if( !GLCanvas.this.isDisposed() ) {
helper.invokeGL(drawable, context, displayAction, initAction);
}
@@ -215,7 +215,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
gle.printStackTrace();
}
}
- context = null;
+ context = null;
}
if ( null != drawable ) {
drawable.setRealized(false);
@@ -261,11 +261,11 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
}
}
};
-
- /**
- * Creates an instance using {@link #GLCanvas(Composite, int, GLCapabilitiesImmutable, GLCapabilitiesChooser, GLContext)}
+
+ /**
+ * Creates an instance using {@link #GLCanvas(Composite, int, GLCapabilitiesImmutable, GLCapabilitiesChooser, GLContext)}
* on the SWT thread.
- *
+ *
* @param parent
* Required (non-null) parent Composite.
* @param style
@@ -284,7 +284,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
*/
public static GLCanvas create(final Composite parent, final int style, final GLCapabilitiesImmutable caps,
final GLCapabilitiesChooser chooser, final GLContext shareWith) {
- final GLCanvas[] res = new GLCanvas[] { null };
+ final GLCanvas[] res = new GLCanvas[] { null };
parent.getDisplay().syncExec(new Runnable() {
public void run() {
res[0] = new GLCanvas( parent, style, caps, chooser, shareWith );
@@ -319,22 +319,22 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
GLProfile.initSingleton(); // ensure JOGL is completly initialized
SWTAccessor.setRealized(this, true);
-
+
clientArea = GLCanvas.this.getClientArea();
- /* Get the nativewindow-Graphics Device associated with this control (which is determined by the parent Composite).
+ /* Get the nativewindow-Graphics Device associated with this control (which is determined by the parent Composite).
* Note: SWT is owner of the native handle, hence closing operation will be a NOP. */
final AbstractGraphicsDevice swtDevice = SWTAccessor.getDevice(this);
-
+
useX11GTK = SWTAccessor.useX11GTK();
if(useX11GTK) {
- // Decoupled X11 Device/Screen allowing X11 display lock-free off-thread rendering
+ // Decoupled X11 Device/Screen allowing X11 display lock-free off-thread rendering
final long x11DeviceHandle = X11Util.openDisplay(swtDevice.getConnection());
if( 0 == x11DeviceHandle ) {
throw new RuntimeException("Error creating display(EDT): "+swtDevice.getConnection());
}
final AbstractGraphicsDevice x11Device = new X11GraphicsDevice(x11DeviceHandle, AbstractGraphicsDevice.DEFAULT_UNIT, true /* owner */);
- screen = SWTAccessor.getScreen(x11Device, -1 /* default */);
+ screen = SWTAccessor.getScreen(x11Device, -1 /* default */);
} else {
screen = SWTAccessor.getScreen(swtDevice, -1 /* default */);
}
@@ -343,7 +343,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
if(null == capsReqUser) {
capsReqUser = new GLCapabilities(GLProfile.getDefault(screen.getDevice()));
}
-
+
this.capsRequested = capsReqUser;
this.capsChooser = capsChooser;
this.shareWith = shareWith;
@@ -353,7 +353,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
x11Window = 0;
drawable = null;
context = null;
-
+
final Listener listener = new Listener () {
@Override
public void handleEvent (Event event) {
@@ -374,7 +374,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
addListener (SWT.Paint, listener);
addListener (SWT.Dispose, listener);
}
-
+
private final UpstreamSurfaceHook swtCanvasUpStreamHook = new UpstreamSurfaceHook() {
@Override
public final void create(ProxySurface s) { /* nop */ }
@@ -401,11 +401,11 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
protected final void updateSizeCheck() {
final Rectangle oClientArea = clientArea;
final Rectangle nClientArea = GLCanvas.this.getClientArea();
- if ( nClientArea != null &&
+ if ( nClientArea != null &&
( nClientArea.width != oClientArea.width || nClientArea.height != oClientArea.height )
) {
clientArea = nClientArea; // write back new value
-
+
final GLDrawableImpl _drawable = drawable;
final boolean drawableOK = null != _drawable && _drawable.isRealized();
if(DEBUG) {
@@ -419,14 +419,14 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
try {
final GLDrawableImpl _drawableNew = GLDrawableHelper.resizeOffscreenDrawable(_drawable, context, nClientArea.width, nClientArea.height);
if(_drawable != _drawableNew) {
- // write back
+ // write back
drawable = _drawableNew;
}
} finally {
_lock.unlock();
}
- }
- }
+ }
+ }
if(0 != x11Window) {
SWTAccessor.resizeX11Window(screen.getDevice(), clientArea, x11Window);
} else if(0 != gdkWindow) {
@@ -435,36 +435,36 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
sendReshape = true; // async if display() doesn't get called below, but avoiding deadlock
}
}
-
+
private boolean isValidAndVisibleOnEDTActionResult;
private final Runnable isValidAndVisibleOnEDTAction = new Runnable() {
@Override
- public void run() {
+ public void run() {
isValidAndVisibleOnEDTActionResult = !GLCanvas.this.isDisposed() && GLCanvas.this.isVisible();
} };
-
+
private final boolean isValidAndVisibleOnEDT() {
synchronized(isValidAndVisibleOnEDTAction) {
runOnEDTIfAvail(true, isValidAndVisibleOnEDTAction);
return isValidAndVisibleOnEDTActionResult;
}
}
-
+
/** assumes drawable == null || !drawable.isRealized() ! Checks of !isDispose() and isVisible() */
protected final boolean validateDrawableAndContextWithCheck() {
if( !isValidAndVisibleOnEDT() ) {
return false;
}
- return validateDrawableAndContextPostCheck();
+ return validateDrawableAndContextPostCheck();
}
-
+
/** assumes drawable == null || !drawable.isRealized() ! No check of !isDispose() and isVisible() */
protected final boolean validateDrawableAndContextPostCheck() {
final Rectangle nClientArea = clientArea;
if(0 >= nClientArea.width || 0 >= nClientArea.height) {
return false;
}
-
+
final boolean res;
final RecursiveLock _lock = lock;
_lock.lock();
@@ -480,18 +480,18 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
}
} finally {
_lock.unlock();
- }
-
+ }
+
if(res) {
sendReshape = true;
if(DEBUG) {
System.err.println("SWT GLCanvas realized! "+this+", "+drawable);
// Thread.dumpStack();
- }
+ }
}
- return res;
+ return res;
}
-
+
private final void createDrawableAndContext() {
final AbstractGraphicsDevice device = screen.getDevice();
device.open();
@@ -503,14 +503,14 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
capsRequested, capsRequested, capsChooser, screen, VisualIDHolder.VID_UNDEFINED);
if(DEBUG) {
System.err.println("SWT.GLCanvas.X11 factory: "+factory+", chosen config: "+cfg);
- }
+ }
if (null == cfg) {
throw new NativeWindowException("Error choosing GraphicsConfiguration creating window: "+this);
}
final int visualID = cfg.getVisualID(VIDType.NATIVE);
if( VisualIDHolder.VID_UNDEFINED != visualID ) {
// gdkWindow = SWTAccessor.createCompatibleGDKChildWindow(this, visualID, clientArea.width, clientArea.height);
- // nativeWindowHandle = SWTAccessor.gdk_window_get_xwindow(gdkWindow);
+ // nativeWindowHandle = SWTAccessor.gdk_window_get_xwindow(gdkWindow);
x11Window = SWTAccessor.createCompatibleX11ChildWindow(screen, this, visualID, clientArea.width, clientArea.height);
nativeWindowHandle = x11Window;
} else {
@@ -520,16 +520,16 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
nativeWindowHandle = SWTAccessor.getWindowHandle(this);
}
final GLDrawableFactory glFactory = GLDrawableFactory.getFactory(capsRequested.getGLProfile());
-
+
// Create a NativeWindow proxy for the SWT canvas
- ProxySurface proxySurface = glFactory.createProxySurface(device, screen.getIndex(), nativeWindowHandle,
+ ProxySurface proxySurface = glFactory.createProxySurface(device, screen.getIndex(), nativeWindowHandle,
capsRequested, capsChooser, swtCanvasUpStreamHook);
// Associate a GL surface with the proxy
drawable = (GLDrawableImpl) glFactory.createGLDrawable(proxySurface);
context = (GLContextImpl) drawable.createContext(shareWith);
- context.setContextCreationFlags(additionalCtxCreationFlags);
+ context.setContextCreationFlags(additionalCtxCreationFlags);
}
-
+
@Override
public void update() {
// don't paint background etc .. nop avoids flickering
@@ -543,13 +543,13 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
if(r && 0 != gdkWindow) {
SWTGTKUtil.focusGDKWindow(gdkWindow);
}
- return r;
+ return r;
} */
-
+
@Override
public void dispose() {
runInGLThread(disposeOnEDTGLAction);
- super.dispose();
+ super.dispose();
}
private final void displayIfNoAnimatorNoCheck() {
@@ -557,14 +557,14 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
final boolean drawableOK = null != drawable && drawable.isRealized();
if( drawableOK || validateDrawableAndContextPostCheck() ) {
runInGLThread(makeCurrentAndDisplayOnGLAction);
- }
+ }
}
}
-
+
//
// GL[Auto]Drawable
//
-
+
@Override
public void display() {
final boolean drawableOK = null != drawable && drawable.isRealized();
@@ -577,7 +577,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
public final Object getUpstreamWidget() {
return this;
}
-
+
@Override
public int getWidth() {
return clientArea.width;
@@ -593,7 +593,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
final GLDrawable _drawable = drawable;
return null != _drawable ? _drawable.isGLOriented() : true;
}
-
+
@Override
public void addGLEventListener(final GLEventListener listener) {
helper.addGLEventListener(listener);
@@ -608,29 +608,29 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
public int getGLEventListenerCount() {
return helper.getGLEventListenerCount();
}
-
+
@Override
public GLEventListener getGLEventListener(int index) throws IndexOutOfBoundsException {
return helper.getGLEventListener(index);
}
-
+
@Override
public boolean getGLEventListenerInitState(GLEventListener listener) {
return helper.getGLEventListenerInitState(listener);
}
-
+
@Override
public void setGLEventListenerInitState(GLEventListener listener, boolean initialized) {
helper.setGLEventListenerInitState(listener, initialized);
}
-
+
@Override
public GLEventListener disposeGLEventListener(GLEventListener listener, boolean remove) {
final DisposeGLEventListenerAction r = new DisposeGLEventListenerAction(listener, remove);
runInGLThread(r);
return r.listener;
}
-
+
@Override
public GLEventListener removeGLEventListener(final GLEventListener listener) {
return helper.removeGLEventListener(listener);
@@ -673,7 +673,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
public final GLDrawable getDelegatedDrawable() {
return drawable;
}
-
+
@Override
public GLContext getContext() {
return null != drawable ? context : null;
@@ -694,12 +694,12 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
public boolean invoke(final boolean wait, final GLRunnable runnable) {
return helper.invoke(this, wait, runnable);
}
-
+
@Override
public boolean invoke(final boolean wait, final List runnables) {
return helper.invoke(this, wait, runnables);
}
-
+
@Override
public void setAnimator(final GLAnimatorControl arg0) throws GLException {
helper.setAnimator(arg0);
@@ -714,7 +714,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
public GLContext setContext(GLContext newCtx, boolean destroyPrevCtx) {
final RecursiveLock _lock = lock;
_lock.lock();
- try {
+ try {
final GLContext oldCtx = context;
GLDrawableHelper.switchContext(drawable, oldCtx, destroyPrevCtx, newCtx, additionalCtxCreationFlags);
context=(GLContextImpl)newCtx;
@@ -761,7 +761,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
@Override
public GLCapabilitiesImmutable getChosenGLCapabilities() {
- final GLDrawable _drawable = drawable;
+ final GLDrawable _drawable = drawable;
return null != _drawable ? (GLCapabilitiesImmutable)_drawable.getChosenGLCapabilities() : null;
}
@@ -771,7 +771,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
* @return Non-null GLCapabilities.
*/
public GLCapabilitiesImmutable getRequestedGLCapabilities() {
- final GLDrawable _drawable = drawable;
+ final GLDrawable _drawable = drawable;
return null != _drawable ? (GLCapabilitiesImmutable)_drawable.getNativeSurface().getGraphicsConfiguration().getRequestedCapabilities() : null;
}
@@ -788,7 +788,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
@Override
public long getHandle() {
- final GLDrawable _drawable = drawable;
+ final GLDrawable _drawable = drawable;
return (_drawable != null) ? _drawable.getHandle() : 0;
}
@@ -827,12 +827,12 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
*
*
*
Current thread
- *
+ *
*
- * The current thread seems to be valid for all platforms,
+ * The current thread seems to be valid for all platforms,
* since no SWT lifecycle tasks are being performed w/ this call.
* Only GL task, which are independent from the SWT threading model.
- *
+ *
* @see Platform#AWT_AVAILABLE
* @see Platform#getOSType()
*/
@@ -854,8 +854,8 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
} */
action.run();
}
-
- private void runOnEDTIfAvail(boolean wait, final Runnable action) {
+
+ private void runOnEDTIfAvail(boolean wait, final Runnable action) {
final Display d = isDisposed() ? null : getDisplay();
if( null == d || d.isDisposed() || d.getThread() == Thread.currentThread() ) {
action.run();
@@ -879,7 +879,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
",\n\tDrawable size "+dw+"x"+dh+
",\n\tSWT size "+getWidth()+"x"+getHeight()+"]";
}
-
+
public static void main(final String[] args) {
System.err.println(VersionUtil.getPlatformInfo());
System.err.println(GlueGenVersion.getInstance());
diff --git a/src/jogl/classes/com/jogamp/opengl/util/AWTAnimatorImpl.java b/src/jogl/classes/com/jogamp/opengl/util/AWTAnimatorImpl.java
index 8de178e49..80289acf3 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/AWTAnimatorImpl.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/AWTAnimatorImpl.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
diff --git a/src/jogl/classes/com/jogamp/opengl/util/Animator.java b/src/jogl/classes/com/jogamp/opengl/util/Animator.java
index 80d980492..cdfb73b21 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/Animator.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/Animator.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,11 +29,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -57,7 +57,7 @@ import javax.media.opengl.GLException;
* Call {@link #stop() } to terminate the animation and it's execution thread.
*
*/
-public class Animator extends AnimatorBase {
+public class Animator extends AnimatorBase {
protected ThreadGroup threadGroup;
private Runnable runnable;
private boolean runAsFastAsPossible;
@@ -75,7 +75,7 @@ public class Animator extends AnimatorBase {
}
}
- /**
+ /**
* Creates a new Animator w/ an associated ThreadGroup.
*/
public Animator(ThreadGroup tg) {
@@ -86,7 +86,7 @@ public class Animator extends AnimatorBase {
}
}
- /**
+ /**
* Creates a new Animator for a particular drawable.
*/
public Animator(GLAutoDrawable drawable) {
@@ -97,7 +97,7 @@ public class Animator extends AnimatorBase {
}
}
- /**
+ /**
* Creates a new Animator w/ an associated ThreadGroup for a particular drawable.
*/
public Animator(ThreadGroup tg, GLAutoDrawable drawable) {
@@ -127,7 +127,7 @@ public class Animator extends AnimatorBase {
stateSync.unlock();
}
}
-
+
private final void setIsAnimatingSynced(boolean v) {
stateSync.lock();
try {
@@ -185,7 +185,7 @@ public class Animator extends AnimatorBase {
}
if (!stopIssued && !isAnimating) {
// Wakes up 'waitForStartedCondition' sync
- // - and -
+ // - and -
// Resume from pause or drawablesEmpty,
// implies !pauseIssued and !drawablesEmpty
setIsAnimatingSynced(true); // barrier
@@ -251,7 +251,7 @@ public class Animator extends AnimatorBase {
/**
* Set a {@link ThreadGroup} for the {@link #getThread() animation thread}.
- *
+ *
* @param tg the {@link ThreadGroup}
* @throws GLException if the animator has already been started
*/
@@ -261,7 +261,7 @@ public class Animator extends AnimatorBase {
}
threadGroup = tg;
}
-
+
public synchronized boolean start() {
if ( isStartedImpl() ) {
return false;
@@ -277,7 +277,7 @@ public class Animator extends AnimatorBase {
} else {
thread = new Thread(threadGroup, runnable, threadName);
}
- thread.setDaemon(false); // force to be non daemon, regardless of parent thread
+ thread.setDaemon(false); // force to be non daemon, regardless of parent thread
if(DEBUG) {
final Thread ct = Thread.currentThread();
System.err.println("Animator "+ct.getName()+"[daemon "+ct.isDaemon()+"]: starting "+thread.getName()+"[daemon "+thread.isDaemon()+"]");
@@ -288,7 +288,7 @@ public class Animator extends AnimatorBase {
private final Condition waitForStartedCondition = new Condition() {
public boolean eval() {
return !isStartedImpl() || (!drawablesEmpty && !isAnimating) ;
- } };
+ } };
public synchronized boolean stop() {
if ( !isStartedImpl() ) {
diff --git a/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java b/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java
index ef92100ad..b447a339b 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java
@@ -52,14 +52,14 @@ import javax.media.opengl.GLProfile;
*/
public abstract class AnimatorBase implements GLAnimatorControl {
protected static final boolean DEBUG = Debug.debug("Animator");
-
+
/** A 1s timeout while waiting for a native action response, limiting {@link #finishLifecycleAction(Condition, long)} */
protected static final long TO_WAIT_FOR_FINISH_LIFECYCLE_ACTION = 1000;
-
+
protected static final long POLLP_WAIT_FOR_FINISH_LIFECYCLE_ACTION = 32; // 2 frames @ 60Hz
-
+
/**
- * If present in modeBits field and
+ * If present in modeBits field and
* {@link GLProfile#isAWTAvailable() AWT is available},
* implementation is aware of the AWT EDT, otherwise not.
*
@@ -67,8 +67,8 @@ public abstract class AnimatorBase implements GLAnimatorControl {
*
* @see #setModeBits(boolean, int)
*/
- public static final int MODE_EXPECT_AWT_RENDERING_THREAD = 1 << 0;
-
+ public static final int MODE_EXPECT_AWT_RENDERING_THREAD = 1 << 0;
+
public interface AnimatorImpl {
void display(ArrayList drawables, boolean ignoreExceptions, boolean printExceptions);
boolean blockUntilDone(Thread thread);
@@ -77,7 +77,7 @@ public abstract class AnimatorBase implements GLAnimatorControl {
protected int modeBits;
protected AnimatorImpl impl;
protected String baseName;
-
+
protected ArrayList drawables = new ArrayList();
protected boolean drawablesEmpty;
protected Thread animThread;
@@ -85,10 +85,10 @@ public abstract class AnimatorBase implements GLAnimatorControl {
protected boolean printExceptions;
protected boolean exclusiveContext;
protected Thread userExclusiveContextThread;
- protected FPSCounterImpl fpsCounter = new FPSCounterImpl();
+ protected FPSCounterImpl fpsCounter = new FPSCounterImpl();
protected RecursiveLock stateSync = LockFactory.createRecursiveLock();
-
- private final static Class> awtAnimatorImplClazz;
+
+ private final static Class> awtAnimatorImplClazz;
static {
GLProfile.initSingleton();
if( GLProfile.isAWTAvailable() ) {
@@ -96,7 +96,7 @@ public abstract class AnimatorBase implements GLAnimatorControl {
try {
clazz = Class.forName("com.jogamp.opengl.util.AWTAnimatorImpl");
} catch (Exception e) {
- clazz = null;
+ clazz = null;
}
awtAnimatorImplClazz = clazz;
} else {
@@ -105,29 +105,29 @@ public abstract class AnimatorBase implements GLAnimatorControl {
}
/**
- * Creates a new, empty Animator instance
+ * Creates a new, empty Animator instance
* while expecting an AWT rendering thread if AWT is available.
- *
+ *
* @see GLProfile#isAWTAvailable()
*/
public AnimatorBase() {
- modeBits = MODE_EXPECT_AWT_RENDERING_THREAD; // default!
+ modeBits = MODE_EXPECT_AWT_RENDERING_THREAD; // default!
drawablesEmpty = true;
}
-
+
private static final boolean useAWTAnimatorImpl(int modeBits) {
return 0 != ( MODE_EXPECT_AWT_RENDERING_THREAD & modeBits ) && null != awtAnimatorImplClazz;
}
-
+
/**
* Initializes implementation details post setup,
* invoked at {@link #add(GLAutoDrawable)}, {@link #start()}, ..
*
- * Operation is a NOP if force is false
+ * Operation is a NOP if force is false
* and this instance is already initialized.
- *
- *
- * @throws GLException if Animator is {@link #isStarted()}
+ *
+ *
+ * @throws GLException if Animator is {@link #isStarted()}
*/
protected synchronized void initImpl(boolean force) {
if( force || null == impl ) {
@@ -153,8 +153,8 @@ public abstract class AnimatorBase implements GLAnimatorControl {
* in this Animators modeBits.
* @param enable
* @param bitValues
- *
- * @throws GLException if Animator is {@link #isStarted()} and {@link #MODE_EXPECT_AWT_RENDERING_THREAD} about to change
+ *
+ * @throws GLException if Animator is {@link #isStarted()} and {@link #MODE_EXPECT_AWT_RENDERING_THREAD} about to change
* @see AnimatorBase#MODE_EXPECT_AWT_RENDERING_THREAD
*/
public synchronized void setModeBits(boolean enable, int bitValues) throws GLException {
@@ -172,8 +172,8 @@ public abstract class AnimatorBase implements GLAnimatorControl {
}
}
public synchronized int getModeBits() { return modeBits; }
-
-
+
+
@Override
public synchronized void add(final GLAutoDrawable drawable) {
if(DEBUG) {
@@ -190,7 +190,7 @@ public abstract class AnimatorBase implements GLAnimatorControl {
drawables.add(drawable);
drawablesEmpty = drawables.size() == 0;
drawable.setAnimator(this);
- if( isPaused() ) { // either paused by pause() above, or if previously drawablesEmpty==true
+ if( isPaused() ) { // either paused by pause() above, or if previously drawablesEmpty==true
resume();
}
final Condition waitForAnimatingAndECTCondition = new Condition() {
@@ -213,7 +213,7 @@ public abstract class AnimatorBase implements GLAnimatorControl {
if( !drawables.contains(drawable) ) {
throw new IllegalArgumentException("Drawable not added to animator: "+this+", "+drawable);
}
-
+
if( exclusiveContext && isAnimating() ) {
drawable.setExclusiveContextThread( null );
final Condition waitForNullECTCondition = new Condition() {
@@ -244,7 +244,7 @@ public abstract class AnimatorBase implements GLAnimatorControl {
return isStarted() && drawablesEmpty && isAnimating();
} };
-
+
/**
* Dedicate all {@link GLAutoDrawable}'s context to the given exclusive context thread.
*
@@ -252,14 +252,14 @@ public abstract class AnimatorBase implements GLAnimatorControl {
*
*
* If already started and disabling, method waits
- * until change is propagated to all {@link GLAutoDrawable} if not
+ * until change is propagated to all {@link GLAutoDrawable} if not
* called from the animator thread or {@link #getExclusiveContextThread() exclusive context thread}.
*
*
* Note: Utilizing this feature w/ AWT could lead to an AWT-EDT deadlock, depending on the AWT implementation.
* Hence it is advised not to use it with native AWT GLAutoDrawable like GLCanvas.
*
- *
+ *
* @param enable
* @return previous value
* @see #setExclusiveContext(boolean)
@@ -272,7 +272,7 @@ public abstract class AnimatorBase implements GLAnimatorControl {
final boolean enable = null != t;
stateSync.lock();
try {
- old = userExclusiveContextThread;
+ old = userExclusiveContextThread;
if( enable && t != animThread ) { // disable: will be cleared at end after propagation && filter out own animThread usae
userExclusiveContextThread=t;
}
@@ -282,7 +282,7 @@ public abstract class AnimatorBase implements GLAnimatorControl {
setExclusiveContext(enable);
return old;
}
-
+
/**
* Dedicate all {@link GLAutoDrawable}'s context to this animator thread.
*
@@ -290,14 +290,14 @@ public abstract class AnimatorBase implements GLAnimatorControl {
*
*
* If already started and disabling, method waits
- * until change is propagated to all {@link GLAutoDrawable} if not
+ * until change is propagated to all {@link GLAutoDrawable} if not
* called from the animator thread or {@link #getExclusiveContextThread() exclusive context thread}.
*
*
* Note: Utilizing this feature w/ AWT could lead to an AWT-EDT deadlock, depending on the AWT implementation.
* Hence it is advised not to use it with native AWT GLAutoDrawable like GLCanvas.
*
- *
+ *
* @param enable
* @return previous value
* @see #setExclusiveContext(Thread)
@@ -349,24 +349,24 @@ public abstract class AnimatorBase implements GLAnimatorControl {
System.err.println("AnimatorBase.setExclusiveContextThread: all-GLAD Ok: "+validateDrawablesExclCtxState(dECT)+", "+this);
}
return oldExclusiveContext;
- }
-
+ }
+
/**
* Returns true, if the exclusive context thread is enabled, otherwise false.
- *
+ *
* @see #setExclusiveContext(boolean)
* @see #setExclusiveContext(Thread)
*/
// @Override
- public final boolean isExclusiveContextEnabled() {
+ public final boolean isExclusiveContextEnabled() {
stateSync.lock();
try {
- return exclusiveContext;
+ return exclusiveContext;
} finally {
stateSync.unlock();
}
}
-
+
/**
* Returns the exclusive context thread if {@link #isExclusiveContextEnabled()} and {@link #isStarted()}, otherwise null.
*
@@ -381,7 +381,7 @@ public abstract class AnimatorBase implements GLAnimatorControl {
* @see #setExclusiveContext(Thread)
*/
// @Override
- public final Thread getExclusiveContextThread() {
+ public final Thread getExclusiveContextThread() {
stateSync.lock();
try {
return ( isStartedImpl() && exclusiveContext ) ? ( null != userExclusiveContextThread ? userExclusiveContextThread : animThread ) : null ;
@@ -389,7 +389,7 @@ public abstract class AnimatorBase implements GLAnimatorControl {
stateSync.unlock();
}
}
-
+
/**
* Should be called at {@link #start()} and {@link #stop()}
* from within the animator thread.
@@ -407,7 +407,7 @@ public abstract class AnimatorBase implements GLAnimatorControl {
for (int i=0; ifalse
.
- * @param pollPeriod if 0, method will wait until TO is reached or being notified.
+ * @param pollPeriod if 0, method will wait until TO is reached or being notified.
* if > 0, method will wait for the given pollPeriod in milliseconds.
* @return true if {@link Condition#eval() waitCondition.eval()} returned false, otherwise false.
*/
@@ -545,11 +545,11 @@ public abstract class AnimatorBase implements GLAnimatorControl {
if( remaining<=0 && nok ) {
System.err.println("finishLifecycleAction(" + waitCondition.getClass().getName() + "): ++++++ timeout reached ++++++ " + getThreadName());
}
- stateSync.lock(); // avoid too many lock/unlock ops
+ stateSync.lock(); // avoid too many lock/unlock ops
try {
System.err.println("finishLifecycleAction(" + waitCondition.getClass().getName() + "): OK "+(!nok)+
"- pollPeriod "+pollPeriod+", blocking "+blocking+
- ", waited " + (blocking ? ( TO_WAIT_FOR_FINISH_LIFECYCLE_ACTION - remaining ) : 0 ) + "/" + TO_WAIT_FOR_FINISH_LIFECYCLE_ACTION +
+ ", waited " + (blocking ? ( TO_WAIT_FOR_FINISH_LIFECYCLE_ACTION - remaining ) : 0 ) + "/" + TO_WAIT_FOR_FINISH_LIFECYCLE_ACTION +
" - " + getThreadName());
System.err.println(" - "+toString());
} finally {
diff --git a/src/jogl/classes/com/jogamp/opengl/util/DefaultAnimatorImpl.java b/src/jogl/classes/com/jogamp/opengl/util/DefaultAnimatorImpl.java
index bbd2951b9..0477e1903 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/DefaultAnimatorImpl.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/DefaultAnimatorImpl.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
diff --git a/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java b/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java
index 7613efec6..b48169c27 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,11 +29,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -45,10 +45,10 @@ import java.util.TimerTask;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLException;
-/**
+/**
* An Animator subclass which attempts to achieve a target
* frames-per-second rate to avoid using all CPU time. The target FPS
- * is only an estimate and is not guaranteed.
+ * is only an estimate and is not guaranteed.
*
* The Animator execution thread does not run as a daemon thread,
* so it is able to keep an application from terminating.
@@ -105,45 +105,45 @@ public class FPSAnimator extends AnimatorBase {
* @param fps
* @throws GLException if the animator has already been started
*/
- public final synchronized void setFPS(int fps) throws GLException {
+ public final synchronized void setFPS(int fps) throws GLException {
if ( isStartedImpl() ) {
throw new GLException("Animator already started.");
}
- this.fps = fps;
+ this.fps = fps;
}
public final int getFPS() { return fps; }
-
+
class MainTask extends TimerTask {
private boolean justStarted;
private boolean alreadyStopped;
private boolean alreadyPaused;
-
+
public MainTask() {
}
-
+
public void start(Timer timer) {
fpsCounter.resetFPSCounter();
shouldRun = true;
shouldStop = false;
-
+
justStarted = true;
alreadyStopped = false;
alreadyPaused = false;
- final long period = 0 < fps ? (long) (1000.0f / (float) fps) : 1; // 0 -> 1: IllegalArgumentException: Non-positive period
+ final long period = 0 < fps ? (long) (1000.0f / (float) fps) : 1; // 0 -> 1: IllegalArgumentException: Non-positive period
if (scheduleAtFixedRate) {
timer.scheduleAtFixedRate(this, 0, period);
} else {
timer.schedule(this, 0, period);
}
}
-
+
public boolean isActive() { return !alreadyStopped && !alreadyPaused; }
-
+
public String toString() {
return "Task[thread "+animThread+", stopped "+alreadyStopped+", paused "+alreadyPaused+" shouldRun "+shouldRun+", shouldStop "+shouldStop+" -- started "+isStartedImpl()+", animating "+isAnimatingImpl()+", paused "+isPausedImpl()+", drawable "+drawables.size()+", drawablesEmpty "+drawablesEmpty+"]";
}
-
+
public void run() {
if( justStarted ) {
justStarted = false;
@@ -167,8 +167,8 @@ public class FPSAnimator extends AnimatorBase {
display();
} else if( shouldStop ) { // STOP
System.err.println("FPSAnimator P4: "+alreadyStopped+", "+ Thread.currentThread() + ": " + toString());
- this.cancel();
-
+ this.cancel();
+
if( !alreadyStopped ) {
alreadyStopped = true;
if( exclusiveContext && !drawablesEmpty ) {
@@ -184,23 +184,23 @@ public class FPSAnimator extends AnimatorBase {
FPSAnimator.this.notifyAll();
}
}
- } else {
+ } else {
System.err.println("FPSAnimator P5: "+alreadyPaused+", "+ Thread.currentThread() + ": " + toString());
this.cancel();
-
+
if( !alreadyPaused ) { // PAUSE
alreadyPaused = true;
if( exclusiveContext && !drawablesEmpty ) {
setDrawablesExclCtxState(false);
display(); // propagate exclusive change!
}
- synchronized (FPSAnimator.this) {
+ synchronized (FPSAnimator.this) {
if(DEBUG) {
System.err.println("FPSAnimator pause " + Thread.currentThread() + ": " + toString());
}
isAnimating = false;
FPSAnimator.this.notifyAll();
- }
+ }
}
}
}
@@ -230,7 +230,7 @@ public class FPSAnimator extends AnimatorBase {
}
static int timerNo = 0;
-
+
public synchronized boolean start() {
if ( null != timer || null != task || isStartedImpl() ) {
return false;
@@ -241,8 +241,8 @@ public class FPSAnimator extends AnimatorBase {
System.err.println("FPSAnimator.start() START: "+task+", "+ Thread.currentThread() + ": " + toString());
}
task.start(timer);
-
- final boolean res = finishLifecycleAction( drawablesEmpty ? waitForStartedEmptyCondition : waitForStartedAddedCondition,
+
+ final boolean res = finishLifecycleAction( drawablesEmpty ? waitForStartedEmptyCondition : waitForStartedAddedCondition,
POLLP_WAIT_FOR_FINISH_LIFECYCLE_ACTION);
if(DEBUG) {
System.err.println("FPSAnimator.start() END: "+task+", "+ Thread.currentThread() + ": " + toString());
@@ -256,11 +256,11 @@ public class FPSAnimator extends AnimatorBase {
private final Condition waitForStartedAddedCondition = new Condition() {
public boolean eval() {
return !isStartedImpl() || !isAnimating ;
- } };
+ } };
private final Condition waitForStartedEmptyCondition = new Condition() {
public boolean eval() {
return !isStartedImpl() || isAnimating ;
- } };
+ } };
/** Stops this FPSAnimator. Due to the implementation of the
FPSAnimator it is not guaranteed that the FPSAnimator will be
@@ -268,7 +268,7 @@ public class FPSAnimator extends AnimatorBase {
public synchronized boolean stop() {
if ( null == timer || !isStartedImpl() ) {
return false;
- }
+ }
if(DEBUG) {
System.err.println("FPSAnimator.stop() START: "+task+", "+ Thread.currentThread() + ": " + toString());
}
@@ -281,7 +281,7 @@ public class FPSAnimator extends AnimatorBase {
shouldStop = true;
res = finishLifecycleAction(waitForStoppedCondition, POLLP_WAIT_FOR_FINISH_LIFECYCLE_ACTION);
}
-
+
if(DEBUG) {
System.err.println("FPSAnimator.stop() END: "+task+", "+ Thread.currentThread() + ": " + toString());
}
@@ -316,7 +316,7 @@ public class FPSAnimator extends AnimatorBase {
shouldRun = false;
res = finishLifecycleAction(waitForPausedCondition, POLLP_WAIT_FOR_FINISH_LIFECYCLE_ACTION);
}
-
+
if(DEBUG) {
System.err.println("FPSAnimator.pause() END: "+task+", "+ Thread.currentThread() + ": " + toString());
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java
index e0bbbc33c..2d685a1a8 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java
@@ -53,13 +53,13 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
* and starting with a new created Buffer object with initialElementCount size
*
* On profiles GL2 and ES1 the fixed function pipeline behavior is as expected.
- * On profile ES2 the fixed function emulation will transform these calls to
+ * On profile ES2 the fixed function emulation will transform these calls to
* EnableVertexAttribArray and VertexAttribPointer calls,
* and a predefined vertex attribute variable name will be chosen.
- *
- * The default name mapping will be used,
+ *
+ * The default name mapping will be used,
* see {@link GLPointerFuncUtil#getPredefinedArrayIndexName(int)}.
- *
+ *
* @param index The GL array index
* @param comps The array component number
* @param dataType The array index GL data type
@@ -67,7 +67,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
* @param initialElementCount
*
* @see javax.media.opengl.GLContext#getPredefinedArrayIndexName(int)
- */
+ */
public static GLArrayDataClient createFixed(int index, int comps, int dataType, boolean normalized, int initialElementCount)
throws GLException
{
@@ -82,13 +82,13 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
* and starting with a given Buffer object incl it's stride
*
* On profiles GL2 and ES1 the fixed function pipeline behavior is as expected.
- * On profile ES2 the fixed function emulation will transform these calls to
+ * On profile ES2 the fixed function emulation will transform these calls to
* EnableVertexAttribArray and VertexAttribPointer calls,
* and a predefined vertex attribute variable name will be chosen.
- *
- * The default name mapping will be used,
+ *
+ * The default name mapping will be used,
* see {@link GLPointerFuncUtil#getPredefinedArrayIndexName(int)}.
- *
+ *
* @param index The GL array index
* @param comps The array component number
* @param dataType The array index GL data type
@@ -97,8 +97,8 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
* @param buffer the user define data
*
* @see javax.media.opengl.GLContext#getPredefinedArrayIndexName(int)
- */
- public static GLArrayDataClient createFixed(int index, int comps, int dataType, boolean normalized, int stride,
+ */
+ public static GLArrayDataClient createFixed(int index, int comps, int dataType, boolean normalized, int stride,
Buffer buffer)
throws GLException
{
@@ -111,13 +111,13 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
/**
* Create a client side buffer object, using a custom GLSL array attribute name
* and starting with a new created Buffer object with initialElementCount size
- * @param name The custom name for the GL attribute.
+ * @param name The custom name for the GL attribute.
* @param comps The array component number
* @param dataType The array index GL data type
* @param normalized Whether the data shall be normalized
* @param initialElementCount
*/
- public static GLArrayDataClient createGLSL(String name, int comps,
+ public static GLArrayDataClient createGLSL(String name, int comps,
int dataType, boolean normalized, int initialElementCount)
throws GLException
{
@@ -130,7 +130,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
/**
* Create a client side buffer object, using a custom GLSL array attribute name
* and starting with a given Buffer object incl it's stride
- * @param name The custom name for the GL attribute.
+ * @param name The custom name for the GL attribute.
* @param comps The array component number
* @param dataType The array index GL data type
* @param normalized Whether the data shall be normalized
@@ -157,8 +157,8 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
}
}
}
-
- //
+
+ //
// Data read access
//
@@ -167,7 +167,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
@Override
public final boolean sealed() { return sealed; }
-
+
@Override
public final boolean enabled() { return bufferEnabled; }
@@ -195,10 +195,10 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
seal(seal);
enableBuffer(gl, seal);
}
-
+
@Override
public void enableBuffer(GL gl, boolean enable) {
- if( enableBufferAlways || bufferEnabled != enable ) {
+ if( enableBufferAlways || bufferEnabled != enable ) {
if(enable) {
checkSeal(true);
// init/generate VBO name if not done yet
@@ -208,7 +208,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
bufferEnabled = enable;
}
}
-
+
@Override
public boolean bindBuffer(GL gl, boolean bind) {
if(bind) {
@@ -218,7 +218,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
}
return glArrayHandler.bindBuffer(gl, bind);
}
-
+
@Override
public void setEnableAlways(boolean always) {
enableBufferAlways = always;
@@ -328,15 +328,15 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
", isVertexAttribute "+isVertexAttribute+
", usesGLSL "+usesGLSL+
", usesShaderState "+(null!=shaderState)+
- ", dataType 0x"+Integer.toHexString(componentType)+
- ", bufferClazz "+componentClazz+
+ ", dataType 0x"+Integer.toHexString(componentType)+
+ ", bufferClazz "+componentClazz+
", elements "+getElementCount()+
- ", components "+components+
+ ", components "+components+
", stride "+strideB+"b "+strideL+"c"+
- ", initialElementCount "+initialElementCount+
- ", sealed "+sealed+
- ", bufferEnabled "+bufferEnabled+
- ", bufferWritten "+bufferWritten+
+ ", initialElementCount "+initialElementCount+
+ ", sealed "+sealed+
+ ", bufferEnabled "+bufferEnabled+
+ ", bufferWritten "+bufferWritten+
", buffer "+buffer+
", alive "+alive+
"]";
@@ -345,16 +345,16 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
// non public matters
protected final boolean growBufferIfNecessary(int spare) {
- if(buffer==null || buffer.remaining()enable
is true,
+ * Enables the buffer if enable is true,
* and transfers the data if required.
* In case {@link #isVBO() VBO is used}, it is bound accordingly for the data transfer and association,
* i.e. it issued {@link #bindBuffer(GL, boolean)}.
- * The VBO buffer is unbound when the method returns.
+ * The VBO buffer is unbound when the method returns.
*
- * Disables the buffer if enable is false.
+ * Disables the buffer if enable is false.
*
- *
+ *
*
The action will only be executed,
- * if the internal enable state differs,
+ * if the internal enable state differs,
* or 'setEnableAlways' was called with 'true'.
- *
+ *
*
It is up to the user to enable/disable the array properly,
* ie in case of multiple data sets for the same vertex attribute (VA).
* Meaning in such case usage of one set while expecting another one
@@ -68,7 +68,7 @@ public interface GLArrayDataEditable extends GLArrayData {
public void enableBuffer(GL gl, boolean enable);
/**
- * if bind is true and the data uses {@link #isVBO() VBO},
+ * if bind is true and the data uses {@link #isVBO() VBO},
* the latter will be bound and data written to the GPU if required.
*
* If bind is false and the data uses {@link #isVBO() VBO},
@@ -79,11 +79,11 @@ public interface GLArrayDataEditable extends GLArrayData {
* to be bounded and written while keeping the VBO bound. The latter is in contrast to {@link #enableBuffer(GL, boolean)},
* which leaves the VBO unbound, since it's not required for vertex attributes or pointers.
*
- *
+ *
* @param gl current GL object
- * @param bind true if VBO shall be bound and data written,
- * otherwise clear VBO binding.
- * @return true if data uses VBO and action was performed, otherwise false
+ * @param bind true if VBO shall be bound and data written,
+ * otherwise clear VBO binding.
+ * @return true if data uses VBO and action was performed, otherwise false
*/
public boolean bindBuffer(GL gl, boolean bind);
@@ -92,7 +92,7 @@ public interface GLArrayDataEditable extends GLArrayData {
*
* The default is 'false'
*
- * This is useful when you mix up
+ * This is useful when you mix up
* GLArrayData usage with conventional GL array calls
* or in case of a buggy GL VBO implementation.
*
@@ -117,7 +117,7 @@ public interface GLArrayDataEditable extends GLArrayData {
* ie position:=limit and limit:=capacity.
*
* @see #seal(boolean)
- */
+ */
public void seal(boolean seal);
public void rewind();
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java
index 7e7d27b36..80639c5c7 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java
@@ -57,13 +57,13 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE
* and starting with a given Buffer object incl it's stride
*
* On profiles GL2 and ES1 the fixed function pipeline behavior is as expected.
- * On profile ES2 the fixed function emulation will transform these calls to
+ * On profile ES2 the fixed function emulation will transform these calls to
* EnableVertexAttribArray and VertexAttribPointer calls,
* and a predefined vertex attribute variable name will be chosen.
- *
- * The default name mapping will be used,
+ *
+ * The default name mapping will be used,
* see {@link GLPointerFuncUtil#getPredefinedArrayIndexName(int)}.
- *
+ *
* @param index The GL array index
* @param comps The array component number
* @param dataType The array index GL data type
@@ -90,13 +90,13 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE
* and starting with a new created Buffer object with initialElementCount size
*
* On profiles GL2 and ES1 the fixed function pipeline behavior is as expected.
- * On profile ES2 the fixed function emulation will transform these calls to
+ * On profile ES2 the fixed function emulation will transform these calls to
* EnableVertexAttribArray and VertexAttribPointer calls,
* and a predefined vertex attribute variable name will be chosen.
- *
- * The default name mapping will be used,
+ *
+ * The default name mapping will be used,
* see {@link GLPointerFuncUtil#getPredefinedArrayIndexName(int)}.
- *
+ *
* @param index The GL array index
* @param comps The array component number
* @param dataType The array index GL data type
@@ -106,7 +106,7 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE
*
* @see javax.media.opengl.GLContext#getPredefinedArrayIndexName(int)
*/
- public static GLArrayDataServer createFixed(int index, int comps, int dataType, boolean normalized, int initialElementCount,
+ public static GLArrayDataServer createFixed(int index, int comps, int dataType, boolean normalized, int initialElementCount,
int vboUsage)
throws GLException
{
@@ -120,7 +120,7 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE
/**
* Create a VBO, using a custom GLSL array attribute name
* and starting with a new created Buffer object with initialElementCount size
- * @param name The custom name for the GL attribute
+ * @param name The custom name for the GL attribute
* @param comps The array component number
* @param dataType The array index GL data type
* @param normalized Whether the data shall be normalized
@@ -128,20 +128,20 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE
* @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW}
*/
public static GLArrayDataServer createGLSL(String name, int comps,
- int dataType, boolean normalized, int initialElementCount, int vboUsage)
- throws GLException
+ int dataType, boolean normalized, int initialElementCount, int vboUsage)
+ throws GLException
{
GLArrayDataServer ads = new GLArrayDataServer();
GLArrayHandler glArrayHandler = new GLSLArrayHandler(ads);
ads.init(name, -1, comps, dataType, normalized, 0, null, initialElementCount,
true, glArrayHandler, 0, 0, vboUsage, GL.GL_ARRAY_BUFFER, true);
return ads;
- }
-
+ }
+
/**
* Create a VBO, using a custom GLSL array attribute name
* and starting with a given Buffer object incl it's stride
- * @param name The custom name for the GL attribute
+ * @param name The custom name for the GL attribute
* @param comps The array component number
* @param dataType The array index GL data type
* @param normalized Whether the data shall be normalized
@@ -151,7 +151,7 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE
*/
public static GLArrayDataServer createGLSL(String name, int comps,
int dataType, boolean normalized, int stride, Buffer buffer,
- int vboUsage)
+ int vboUsage)
throws GLException
{
GLArrayDataServer ads = new GLArrayDataServer();
@@ -160,12 +160,12 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE
0, 0, vboUsage, GL.GL_ARRAY_BUFFER, true);
return ads;
}
-
+
/**
* Create a VBO data object for any target w/o render pipeline association, ie {@link GL#GL_ELEMENT_ARRAY_BUFFER}.
- *
+ *
* Hence no index, name for a fixed function pipeline nor vertex attribute is given.
- *
+ *
* @param comps The array component number
* @param dataType The array index GL data type
* @param stride
@@ -187,16 +187,16 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE
/**
* Create a VBO data object for any target w/o render pipeline association, ie {@link GL#GL_ELEMENT_ARRAY_BUFFER}.
- *
+ *
* Hence no index, name for a fixed function pipeline nor vertex attribute is given.
- *
+ *
* @param comps The array component number
* @param dataType The array index GL data type
* @param initialElementCount
* @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW}
* @param vboTarget {@link GL#GL_ELEMENT_ARRAY_BUFFER}, ..
*/
- public static GLArrayDataServer createData(int comps, int dataType, int initialElementCount,
+ public static GLArrayDataServer createData(int comps, int dataType, int initialElementCount,
int vboUsage, int vboTarget)
throws GLException
{
@@ -207,19 +207,19 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE
return ads;
}
-
+
/**
* Create a VBO for fixed function interleaved array data
* starting with a new created Buffer object with initialElementCount size.
*
User needs to configure the interleaved segments via {@link #addFixedSubArray(int, int, int)}.
- *
+ *
* @param comps The total number of all interleaved components.
* @param dataType The array index GL data type
* @param normalized Whether the data shall be normalized
- * @param initialElementCount
+ * @param initialElementCount
* @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW}
*/
- public static GLArrayDataServer createFixedInterleaved(int comps, int dataType, boolean normalized, int initialElementCount,
+ public static GLArrayDataServer createFixedInterleaved(int comps, int dataType, boolean normalized, int initialElementCount,
int vboUsage)
throws GLException
{
@@ -239,7 +239,7 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE
* The memory of the the interleaved array is being used.
*
* Must be called before using the array, eg: {@link #seal(boolean)}, {@link #putf(float)}, ..
- *
+ *
* @param index The GL array index, maybe -1 if vboTarget is {@link GL#GL_ELEMENT_ARRAY_BUFFER}
* @param comps This interleaved array segment's component number
* @param vboTarget {@link GL#GL_ARRAY_BUFFER} or {@link GL#GL_ELEMENT_ARRAY_BUFFER}
@@ -250,32 +250,32 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE
throw new GLException("Interleaved offset > total components ("+iOffC+" > "+getComponentCount()+")");
}
if(usesGLSL) {
- throw new GLException("buffer uses GLSL");
+ throw new GLException("buffer uses GLSL");
}
final GLArrayDataWrapper ad = GLArrayDataWrapper.createFixed(
- index, comps, getComponentType(),
- getNormalized(), getStride(), getBuffer(),
+ index, comps, getComponentType(),
+ getNormalized(), getStride(), getBuffer(),
getVBOName(), interleavedOffset, getVBOUsage(), vboTarget);
ad.setVBOEnabled(isVBO());
interleavedOffset += comps * getComponentSizeInBytes();
- if(GL.GL_ARRAY_BUFFER == vboTarget) {
+ if(GL.GL_ARRAY_BUFFER == vboTarget) {
glArrayHandler.addSubHandler(new GLFixedArrayHandlerFlat(ad));
}
return ad;
}
-
+
/**
* Create a VBO for GLSL interleaved array data
* starting with a new created Buffer object with initialElementCount size.
*
User needs to configure the interleaved segments via {@link #addGLSLSubArray(int, int, int)}.
- *
+ *
* @param comps The total number of all interleaved components.
* @param dataType The array index GL data type
* @param normalized Whether the data shall be normalized
- * @param initialElementCount
+ * @param initialElementCount
* @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW}
*/
- public static GLArrayDataServer createGLSLInterleaved(int comps, int dataType, boolean normalized, int initialElementCount,
+ public static GLArrayDataServer createGLSLInterleaved(int comps, int dataType, boolean normalized, int initialElementCount,
int vboUsage)
throws GLException
{
@@ -285,7 +285,7 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE
0, 0, vboUsage, GL.GL_ARRAY_BUFFER, true);
return ads;
}
-
+
/**
* Configure a segment of this GLSL interleaved array (see {@link #createGLSLInterleaved(int, int, boolean, int, int)}).
*
@@ -305,20 +305,20 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE
throw new GLException("Interleaved offset > total components ("+iOffC+" > "+getComponentCount()+")");
}
if(!usesGLSL) {
- throw new GLException("buffer uses fixed function");
+ throw new GLException("buffer uses fixed function");
}
final GLArrayDataWrapper ad = GLArrayDataWrapper.createGLSL(
- name, comps, getComponentType(),
- getNormalized(), getStride(), getBuffer(),
- getVBOName(), interleavedOffset, getVBOUsage(), vboTarget);
+ name, comps, getComponentType(),
+ getNormalized(), getStride(), getBuffer(),
+ getVBOName(), interleavedOffset, getVBOUsage(), vboTarget);
ad.setVBOEnabled(isVBO());
interleavedOffset += comps * getComponentSizeInBytes();
- if(GL.GL_ARRAY_BUFFER == vboTarget) {
+ if(GL.GL_ARRAY_BUFFER == vboTarget) {
glArrayHandler.addSubHandler(new GLSLArrayHandlerFlat(ad));
}
return ad;
}
-
+
//
// Data matters GLArrayData
//
@@ -341,15 +341,15 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE
}
//
- // data matters
+ // data matters
//
/**
- * Convenient way do disable the VBO behavior and
+ * Convenient way do disable the VBO behavior and
* switch to client side data one
* Only possible if buffer is defined.
*/
- public void setVBOEnabled(boolean vboUsage) {
+ public void setVBOEnabled(boolean vboUsage) {
checkSeal(false);
super.setVBOEnabled(vboUsage);
}
@@ -361,22 +361,22 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE
", isVertexAttribute "+isVertexAttribute+
", usesGLSL "+usesGLSL+
", usesShaderState "+(null!=shaderState)+
- ", dataType 0x"+Integer.toHexString(componentType)+
- ", bufferClazz "+componentClazz+
+ ", dataType 0x"+Integer.toHexString(componentType)+
+ ", bufferClazz "+componentClazz+
", elements "+getElementCount()+
- ", components "+components+
+ ", components "+components+
", stride "+strideB+"b "+strideL+"c"+
", initialElementCount "+initialElementCount+
- ", vboEnabled "+vboEnabled+
- ", vboName "+vboName+
- ", vboUsage 0x"+Integer.toHexString(vboUsage)+
- ", vboTarget 0x"+Integer.toHexString(vboTarget)+
- ", vboOffset "+vboOffset+
- ", sealed "+sealed+
- ", bufferEnabled "+bufferEnabled+
- ", bufferWritten "+bufferWritten+
- ", buffer "+buffer+
- ", alive "+alive+
+ ", vboEnabled "+vboEnabled+
+ ", vboName "+vboName+
+ ", vboUsage 0x"+Integer.toHexString(vboUsage)+
+ ", vboTarget 0x"+Integer.toHexString(vboTarget)+
+ ", vboOffset "+vboOffset+
+ ", sealed "+sealed+
+ ", bufferEnabled "+bufferEnabled+
+ ", bufferWritten "+bufferWritten+
+ ", buffer "+buffer+
+ ", alive "+alive+
"]";
}
@@ -384,7 +384,7 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE
// non public matters ..
//
- protected void init(String name, int index, int comps, int dataType, boolean normalized,
+ protected void init(String name, int index, int comps, int dataType, boolean normalized,
int stride, Buffer data, int initialElementCount, boolean isVertexAttribute,
GLArrayHandler glArrayHandler,
int vboName, long vboOffset, int vboUsage, int vboTarget, boolean usesGLSL)
@@ -407,7 +407,7 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE
}
}
}
-
- private int interleavedOffset = 0;
+
+ private int interleavedOffset = 0;
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java
index f8b17501e..290f47a6d 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java
@@ -49,7 +49,7 @@ public class GLArrayDataWrapper implements GLArrayData {
/**
* Create a VBO, using a predefined fixed function array index, wrapping the given data.
- *
+ *
* @param index The GL array index
* @param comps The array component number
* @param dataType The array index GL data type
@@ -61,23 +61,23 @@ public class GLArrayDataWrapper implements GLArrayData {
* @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW}
* @param vboTarget {@link GL#GL_ARRAY_BUFFER} or {@link GL#GL_ELEMENT_ARRAY_BUFFER}
* @return the new create instance
- *
+ *
* @throws GLException
*/
- public static GLArrayDataWrapper createFixed(int index, int comps, int dataType, boolean normalized, int stride,
+ public static GLArrayDataWrapper createFixed(int index, int comps, int dataType, boolean normalized, int stride,
Buffer buffer, int vboName, long vboOffset, int vboUsage, int vboTarget)
throws GLException
{
GLArrayDataWrapper adc = new GLArrayDataWrapper();
- adc.init(null, index, comps, dataType, normalized, stride, buffer, false,
+ adc.init(null, index, comps, dataType, normalized, stride, buffer, false,
vboName, vboOffset, vboUsage, vboTarget);
return adc;
}
/**
* Create a VBO, using a custom GLSL array attribute name, wrapping the given data.
- *
- * @param name The custom name for the GL attribute, maybe null if gpuBufferTarget is {@link GL#GL_ELEMENT_ARRAY_BUFFER}
+ *
+ * @param name The custom name for the GL attribute, maybe null if gpuBufferTarget is {@link GL#GL_ELEMENT_ARRAY_BUFFER}
* @param comps The array component number
* @param dataType The array index GL data type
* @param normalized Whether the data shall be normalized
@@ -90,7 +90,7 @@ public class GLArrayDataWrapper implements GLArrayData {
* @return the new create instance
* @throws GLException
*/
- public static GLArrayDataWrapper createGLSL(String name, int comps, int dataType, boolean normalized, int stride,
+ public static GLArrayDataWrapper createGLSL(String name, int comps, int dataType, boolean normalized, int stride,
Buffer buffer, int vboName, long vboOffset, int vboUsage, int vboTarget)
throws GLException
{
@@ -102,8 +102,8 @@ public class GLArrayDataWrapper implements GLArrayData {
/**
* Validates this instance's parameter. Called automatically by {@link GLArrayDataClient} and {@link GLArrayDataServer}.
- * {@link GLArrayDataWrapper} does not validate it's instance by itself.
- *
+ * {@link GLArrayDataWrapper} does not validate it's instance by itself.
+ *
* @param glp the GLProfile to use
* @param throwException whether to throw an exception if this instance has invalid parameter or not
* @return true if this instance has invalid parameter, otherwise false
@@ -113,7 +113,7 @@ public class GLArrayDataWrapper implements GLArrayData {
if(throwException) {
throw new GLException("Instance !alive "+this);
}
- return false;
+ return false;
}
if(this.isVertexAttribute() && !glp.hasGLSL()) {
if(throwException) {
@@ -123,13 +123,13 @@ public class GLArrayDataWrapper implements GLArrayData {
}
return glp.isValidArrayDataType(getIndex(), getComponentCount(), getComponentType(), isVertexAttribute(), throwException);
}
-
+
@Override
public void associate(Object obj, boolean enable) {
// nop
}
-
- //
+
+ //
// Data read access
//
@@ -150,14 +150,14 @@ public class GLArrayDataWrapper implements GLArrayData {
location = gl.glGetAttribLocation(program, name);
return location;
}
-
+
@Override
public final int setLocation(GL2ES2 gl, int program, int location) {
this.location = location;
gl.glBindAttribLocation(program, location, name);
return location;
}
-
+
@Override
public final String getName() { return name; }
@@ -172,10 +172,10 @@ public class GLArrayDataWrapper implements GLArrayData {
@Override
public final int getVBOUsage() { return vboEnabled?vboUsage:0; }
-
+
@Override
public final int getVBOTarget() { return vboEnabled?vboTarget:0; }
-
+
@Override
public final Buffer getBuffer() { return buffer; }
@@ -187,19 +187,19 @@ public class GLArrayDataWrapper implements GLArrayData {
@Override
public final int getComponentSizeInBytes() { return componentByteSize; }
-
+
@Override
public final int getElementCount() {
if(null==buffer) return 0;
return ( buffer.position()==0 ) ? ( buffer.limit() / components ) : ( buffer.position() / components ) ;
}
-
+
@Override
public final int getSizeInBytes() {
if(null==buffer) return 0;
- return ( buffer.position()==0 ) ? ( buffer.limit() * componentByteSize ) : ( buffer.position() * componentByteSize ) ;
+ return ( buffer.position()==0 ) ? ( buffer.limit() * componentByteSize ) : ( buffer.position() * componentByteSize ) ;
}
-
+
@Override
public final boolean getNormalized() { return normalized; }
@@ -223,18 +223,18 @@ public class GLArrayDataWrapper implements GLArrayData {
", index "+index+
", location "+location+
", isVertexAttribute "+isVertexAttribute+
- ", dataType 0x"+Integer.toHexString(componentType)+
- ", bufferClazz "+componentClazz+
+ ", dataType 0x"+Integer.toHexString(componentType)+
+ ", bufferClazz "+componentClazz+
", elements "+getElementCount()+
- ", components "+components+
+ ", components "+components+
", stride "+strideB+"b "+strideL+"c"+
- ", buffer "+buffer+
- ", vboEnabled "+vboEnabled+
- ", vboName "+vboName+
- ", vboUsage 0x"+Integer.toHexString(vboUsage)+
- ", vboTarget 0x"+Integer.toHexString(vboTarget)+
- ", vboOffset "+vboOffset+
- ", alive "+alive+
+ ", buffer "+buffer+
+ ", vboEnabled "+vboEnabled+
+ ", vboName "+vboName+
+ ", vboUsage 0x"+Integer.toHexString(vboUsage)+
+ ", vboTarget 0x"+Integer.toHexString(vboTarget)+
+ ", vboOffset "+vboOffset+
+ ", alive "+alive+
"]";
}
@@ -252,12 +252,12 @@ public class GLArrayDataWrapper implements GLArrayData {
return IntBuffer.class;
case GL.GL_FLOAT:
return FloatBuffer.class;
- default:
+ default:
throw new GLException("Given OpenGL data type not supported: "+dataType);
}
}
- @Override
+ @Override
public void setName(String newName) {
location = -1;
name = newName;
@@ -267,7 +267,7 @@ public class GLArrayDataWrapper implements GLArrayData {
* Enable or disable use of VBO.
* Only possible if a VBO buffer name is defined.
* @see #setVBOName(int)
- */
+ */
public void setVBOEnabled(boolean vboEnabled) {
this.vboEnabled=vboEnabled;
}
@@ -275,31 +275,31 @@ public class GLArrayDataWrapper implements GLArrayData {
/**
* Set the VBO buffer name, if valid (!= 0) enable use of VBO,
* otherwise (==0) disable VBO usage.
- *
+ *
* @see #setVBOEnabled(boolean)
- */
+ */
public void setVBOName(int vboName) {
this.vboName=vboName;
setVBOEnabled(0!=vboName);
}
- /**
+ /**
* @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW}
- */
- public void setVBOUsage(int vboUsage) {
- this.vboUsage = vboUsage;
+ */
+ public void setVBOUsage(int vboUsage) {
+ this.vboUsage = vboUsage;
}
-
- /**
+
+ /**
* @param vboTarget either {@link GL#GL_ARRAY_BUFFER} or {@link GL#GL_ELEMENT_ARRAY_BUFFER}
- */
+ */
public void setVBOTarget(int vboTarget) {
this.vboTarget = vboTarget;
- }
+ }
- protected void init(String name, int index, int components, int componentType,
- boolean normalized, int stride, Buffer data,
- boolean isVertexAttribute,
+ protected void init(String name, int index, int components, int componentType,
+ boolean normalized, int stride, Buffer data,
+ boolean isVertexAttribute,
int vboName, long vboOffset, int vboUsage, int vboTarget)
throws GLException
{
@@ -307,19 +307,19 @@ public class GLArrayDataWrapper implements GLArrayData {
this.index = index;
this.location = -1;
// We can't have any dependence on the FixedFuncUtil class here for build bootstrapping reasons
-
+
if( GL.GL_ELEMENT_ARRAY_BUFFER == vboTarget ) {
// OK ..
} else if( ( 0 == vboUsage && 0 == vboTarget ) || GL.GL_ARRAY_BUFFER == vboTarget ) {
- // Set/Check name .. - Required for GLSL case. Validation and debug-name for FFP.
+ // Set/Check name .. - Required for GLSL case. Validation and debug-name for FFP.
this.name = ( null == name ) ? GLPointerFuncUtil.getPredefinedArrayIndexName(index) : name ;
if(null == this.name ) {
throw new GLException("Not a valid array buffer index: "+index);
- }
+ }
} else if( 0 < vboTarget ) {
throw new GLException("Invalid GPUBuffer target: 0x"+Integer.toHexString(vboTarget));
}
-
+
this.componentType = componentType;
componentClazz = getBufferClass(componentType);
if( GLBuffers.isGLTypeFixedPoint(componentType) ) {
@@ -329,7 +329,7 @@ public class GLArrayDataWrapper implements GLArrayData {
}
componentByteSize = GLBuffers.sizeOfGLType(componentType);
if(0 > componentByteSize) {
- throw new GLException("Given componentType not supported: "+componentType+":\n\t"+this);
+ throw new GLException("Given componentType not supported: "+componentType+":\n\t"+this);
}
if(0 >= components) {
throw new GLException("Invalid number of components: " + components);
@@ -348,7 +348,7 @@ public class GLArrayDataWrapper implements GLArrayData {
this.vboName= vboName;
this.vboEnabled= 0 != vboName ;
this.vboOffset=vboOffset;
-
+
switch(vboUsage) {
case 0: // nop
case GL.GL_STATIC_DRAW:
@@ -356,7 +356,7 @@ public class GLArrayDataWrapper implements GLArrayData {
case GL2ES2.GL_STREAM_DRAW:
break;
default:
- throw new GLException("invalid gpuBufferUsage: "+vboUsage+":\n\t"+this);
+ throw new GLException("invalid gpuBufferUsage: "+vboUsage+":\n\t"+this);
}
switch(vboTarget) {
case 0: // nop
@@ -367,7 +367,7 @@ public class GLArrayDataWrapper implements GLArrayData {
throw new GLException("invalid gpuBufferTarget: "+vboTarget+":\n\t"+this);
}
this.vboUsage=vboUsage;
- this.vboTarget=vboTarget;
+ this.vboTarget=vboTarget;
this.alive=true;
}
@@ -390,6 +390,6 @@ public class GLArrayDataWrapper implements GLArrayData {
protected int vboName;
protected boolean vboEnabled;
protected int vboUsage;
- protected int vboTarget;
+ protected int vboTarget;
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java b/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java
index 6bdea4518..418d7fa81 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -52,7 +52,7 @@ import com.jogamp.common.nio.Buffers;
/**
* Utility routines for dealing with direct buffers.
- *
+ *
* @author Kenneth Russel, et.al.
*/
public class GLBuffers extends Buffers {
@@ -72,11 +72,11 @@ public class GLBuffers extends Buffers {
case GL.GL_UNSIGNED_INT:
case GL2.GL_HILO16_NV:
return false;
-
+
}
return true;
}
-
+
/**
* @param glType GL primitive type
* @return false if one of GL primitive floating point types, otherwise true
@@ -92,19 +92,19 @@ public class GLBuffers extends Buffers {
case GLES2.GL_HALF_FLOAT_OES:
case GL2GL3.GL_DOUBLE:
return false;
-
+
default:
return true;
- }
+ }
}
-
+
/**
* @param glType shall be one of (31)
* GL_BYTE, GL_UNSIGNED_BYTE,
* GL_UNSIGNED_BYTE_3_3_2, GL_UNSIGNED_BYTE_2_3_3_REV,
*
* GL_SHORT, GL_UNSIGNED_SHORT,
- * GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV,
+ * GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV,
* GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_4_4_4_4_REV,
* GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_SHORT_1_5_5_5_REV,
* GL_UNSIGNED_SHORT_8_8_APPLE, GL_UNSIGNED_SHORT_8_8_REV_APPLE,
@@ -112,16 +112,16 @@ public class GLBuffers extends Buffers {
*
* GL_FIXED, GL_INT
* GL_UNSIGNED_INT, GL_UNSIGNED_INT_8_8_8_8,
- * GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2,
+ * GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2,
* GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_INT_24_8,
- * GL_UNSIGNED_INT_10F_11F_11F_REV, GL_UNSIGNED_INT_5_9_9_9_REV
+ * GL_UNSIGNED_INT_10F_11F_11F_REV, GL_UNSIGNED_INT_5_9_9_9_REV
* GL_HILO16_NV, GL_SIGNED_HILO16_NV
*
* GL2GL3.GL_FLOAT_32_UNSIGNED_INT_24_8_REV
*
- * GL_FLOAT, GL_DOUBLE
- *
- * @return -1 if glType is unhandled, otherwise the actual value > 0
+ * GL_FLOAT, GL_DOUBLE
+ *
+ * @return -1 if glType is unhandled, otherwise the actual value > 0
*/
public static final int sizeOfGLType(int glType) {
switch (glType) { // 29
@@ -131,7 +131,7 @@ public class GLBuffers extends Buffers {
case GL2GL3.GL_UNSIGNED_BYTE_3_3_2:
case GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV:
return SIZEOF_BYTE;
-
+
case GL.GL_SHORT:
case GL.GL_UNSIGNED_SHORT:
case GL.GL_UNSIGNED_SHORT_5_6_5:
@@ -145,40 +145,40 @@ public class GLBuffers extends Buffers {
case GL.GL_HALF_FLOAT:
case GLES2.GL_HALF_FLOAT_OES:
return SIZEOF_SHORT;
-
+
case GL.GL_FIXED:
case GL2ES2.GL_INT:
case GL.GL_UNSIGNED_INT:
case GL2GL3.GL_UNSIGNED_INT_8_8_8_8:
case GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV:
case GL2GL3.GL_UNSIGNED_INT_10_10_10_2:
- case GL2GL3.GL_UNSIGNED_INT_2_10_10_10_REV:
+ case GL2GL3.GL_UNSIGNED_INT_2_10_10_10_REV:
case GL2GL3.GL_UNSIGNED_INT_24_8:
case GL2GL3.GL_UNSIGNED_INT_10F_11F_11F_REV:
case GL2GL3.GL_UNSIGNED_INT_5_9_9_9_REV:
case GL2.GL_HILO16_NV:
case GL2.GL_SIGNED_HILO16_NV:
return SIZEOF_INT;
-
+
case GL2GL3.GL_FLOAT_32_UNSIGNED_INT_24_8_REV:
return SIZEOF_LONG;
-
+
case GL.GL_FLOAT:
return SIZEOF_FLOAT;
-
+
case GL2GL3.GL_DOUBLE:
return SIZEOF_DOUBLE;
}
return -1;
}
-
+
/**
* @param glType shall be one of (31)
* GL_BYTE, GL_UNSIGNED_BYTE,
* GL_UNSIGNED_BYTE_3_3_2, GL_UNSIGNED_BYTE_2_3_3_REV,
*
* GL_SHORT, GL_UNSIGNED_SHORT,
- * GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV,
+ * GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV,
* GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_4_4_4_4_REV,
* GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_SHORT_1_5_5_5_REV,
* GL_UNSIGNED_SHORT_8_8_APPLE, GL_UNSIGNED_SHORT_8_8_REV_APPLE,
@@ -186,16 +186,16 @@ public class GLBuffers extends Buffers {
*
* GL_FIXED, GL_INT
* GL_UNSIGNED_INT, GL_UNSIGNED_INT_8_8_8_8,
- * GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2,
+ * GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2,
* GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_INT_24_8,
- * GL_UNSIGNED_INT_10F_11F_11F_REV, GL_UNSIGNED_INT_5_9_9_9_REV
+ * GL_UNSIGNED_INT_10F_11F_11F_REV, GL_UNSIGNED_INT_5_9_9_9_REV
* GL_HILO16_NV, GL_SIGNED_HILO16_NV
*
* GL_FLOAT_32_UNSIGNED_INT_24_8_REV
*
- * GL_FLOAT, GL_DOUBLE
- *
- * @return null if glType is unhandled, otherwise the new Buffer object
+ * GL_FLOAT, GL_DOUBLE
+ *
+ * @return null if glType is unhandled, otherwise the new Buffer object
*/
public static final Buffer newDirectGLBuffer(int glType, int numElements) {
switch (glType) { // 29
@@ -204,7 +204,7 @@ public class GLBuffers extends Buffers {
case GL2GL3.GL_UNSIGNED_BYTE_3_3_2:
case GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV:
return newDirectByteBuffer(numElements);
-
+
case GL.GL_SHORT:
case GL.GL_UNSIGNED_SHORT:
case GL.GL_UNSIGNED_SHORT_5_6_5:
@@ -218,7 +218,7 @@ public class GLBuffers extends Buffers {
case GL.GL_HALF_FLOAT:
case GLES2.GL_HALF_FLOAT_OES:
return newDirectShortBuffer(numElements);
-
+
case GL.GL_FIXED:
case GL2ES2.GL_INT:
case GL.GL_UNSIGNED_INT:
@@ -232,13 +232,13 @@ public class GLBuffers extends Buffers {
case GL2.GL_HILO16_NV:
case GL2.GL_SIGNED_HILO16_NV:
return newDirectIntBuffer(numElements);
-
+
case GL2GL3.GL_FLOAT_32_UNSIGNED_INT_24_8_REV:
return newDirectLongBuffer(numElements);
-
+
case GL.GL_FLOAT:
return newDirectFloatBuffer(numElements);
-
+
case GL2.GL_DOUBLE:
return newDirectDoubleBuffer(numElements);
}
@@ -251,7 +251,7 @@ public class GLBuffers extends Buffers {
* GL_UNSIGNED_BYTE_3_3_2, GL_UNSIGNED_BYTE_2_3_3_REV,
*
* GL_SHORT, GL_UNSIGNED_SHORT,
- * GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV,
+ * GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV,
* GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_4_4_4_4_REV,
* GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_SHORT_1_5_5_5_REV,
* GL_UNSIGNED_SHORT_8_8_APPLE, GL_UNSIGNED_SHORT_8_8_REV_APPLE,
@@ -259,15 +259,15 @@ public class GLBuffers extends Buffers {
*
* GL_FIXED, GL_INT
* GL_UNSIGNED_INT, GL_UNSIGNED_INT_8_8_8_8,
- * GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2,
+ * GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2,
* GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_INT_24_8,
- * GL_UNSIGNED_INT_10F_11F_11F_REV, GL_UNSIGNED_INT_5_9_9_9_REV
+ * GL_UNSIGNED_INT_10F_11F_11F_REV, GL_UNSIGNED_INT_5_9_9_9_REV
* GL_HILO16_NV, GL_SIGNED_HILO16_NV
*
* GL_FLOAT_32_UNSIGNED_INT_24_8_REV
*
- * GL_FLOAT, GL_DOUBLE
- * @return null if glType is unhandled or parent is null or bufLen is 0, otherwise the new Buffer object
+ * GL_FLOAT, GL_DOUBLE
+ * @return null if glType is unhandled or parent is null or bufLen is 0, otherwise the new Buffer object
*/
public static final Buffer sliceGLBuffer(ByteBuffer parent, int bytePos, int byteLen, int glType) {
if (parent == null || byteLen == 0) {
@@ -275,11 +275,11 @@ public class GLBuffers extends Buffers {
}
final int parentPos = parent.position();
final int parentLimit = parent.limit();
-
+
parent.position(bytePos);
parent.limit(bytePos + byteLen);
Buffer res = null;
-
+
switch (glType) { // 29
case GL.GL_BYTE:
case GL.GL_UNSIGNED_BYTE:
@@ -287,7 +287,7 @@ public class GLBuffers extends Buffers {
case GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV:
res = parent.slice().order(parent.order()); // slice and duplicate may change byte order
break;
-
+
case GL.GL_SHORT:
case GL.GL_UNSIGNED_SHORT:
case GL.GL_UNSIGNED_SHORT_5_6_5:
@@ -302,7 +302,7 @@ public class GLBuffers extends Buffers {
case GLES2.GL_HALF_FLOAT_OES:
res = parent.slice().order(parent.order()).asShortBuffer(); // slice and duplicate may change byte order
break;
-
+
case GL.GL_FIXED:
case GL2GL3.GL_INT:
case GL2ES2.GL_UNSIGNED_INT:
@@ -317,15 +317,15 @@ public class GLBuffers extends Buffers {
case GL2.GL_SIGNED_HILO16_NV:
res = parent.slice().order(parent.order()).asIntBuffer(); // slice and duplicate may change byte order
break;
-
+
case GL2GL3.GL_FLOAT_32_UNSIGNED_INT_24_8_REV:
res = parent.slice().order(parent.order()).asLongBuffer(); // slice and duplicate may change byte order
break;
-
+
case GL.GL_FLOAT:
res = parent.slice().order(parent.order()).asFloatBuffer(); // slice and duplicate may change byte order
break;
-
+
case GL2.GL_DOUBLE:
res = parent.slice().order(parent.order()).asDoubleBuffer(); // slice and duplicate may change byte order
break;
@@ -338,29 +338,29 @@ public class GLBuffers extends Buffers {
gl.glGetIntegerv(pname, tmp, 0);
return tmp[0];
}
-
- /**
+
+ /**
* Returns the number of bytes required to read/write a memory buffer via OpenGL
* using the current GL pixel storage state and the given parameters.
- *
+ *
*
This method is security critical, hence it throws an exception (fail-fast)
- * in case of an invalid alignment. In case we forgot to handle
- * proper values, please contact the maintainer.
- *
+ * in case of an invalid alignment. In case we forgot to handle
+ * proper values, please contact the maintainer.
+ *
* @param gl the current GL object
- *
+ *
* @param tmp a pass through integer array of size >= 1 used to store temp data (performance)
- *
+ *
* @param bytesPerPixel bytes per pixel, i.e. via {@link #bytesPerPixel(int, int)}.
* @param width in pixels
* @param height in pixels
* @param depth in pixels
- * @param pack true for read mode GPU -> CPU (pack), otherwise false for write mode CPU -> GPU (unpack)
+ * @param pack true for read mode GPU -> CPU (pack), otherwise false for write mode CPU -> GPU (unpack)
* @return required minimum size of the buffer in bytes
* @throws GLException if alignment is invalid. Please contact the maintainer if this is our bug.
*/
- public static final int sizeof(GL gl, int tmp[],
- int bytesPerPixel, int width, int height, int depth,
+ public static final int sizeof(GL gl, int tmp[],
+ int bytesPerPixel, int width, int height, int depth,
boolean pack) {
int rowLength = 0;
int skipRows = 0;
@@ -368,31 +368,31 @@ public class GLBuffers extends Buffers {
int alignment = 1;
int imageHeight = 0;
int skipImages = 0;
-
- if (pack) {
+
+ if (pack) {
alignment = glGetInteger(gl, GL.GL_PACK_ALIGNMENT, tmp);
if(gl.isGL2GL3()) {
rowLength = glGetInteger(gl, GL2GL3.GL_PACK_ROW_LENGTH, tmp);
- skipRows = glGetInteger(gl, GL2GL3.GL_PACK_SKIP_ROWS, tmp);
+ skipRows = glGetInteger(gl, GL2GL3.GL_PACK_SKIP_ROWS, tmp);
skipPixels = glGetInteger(gl, GL2GL3.GL_PACK_SKIP_PIXELS, tmp);
- if (depth > 1) {
- imageHeight = glGetInteger(gl, GL2GL3.GL_PACK_IMAGE_HEIGHT, tmp);
+ if (depth > 1) {
+ imageHeight = glGetInteger(gl, GL2GL3.GL_PACK_IMAGE_HEIGHT, tmp);
skipImages = glGetInteger(gl, GL2GL3.GL_PACK_SKIP_IMAGES, tmp);
}
}
- } else {
+ } else {
alignment = glGetInteger(gl, GL.GL_UNPACK_ALIGNMENT, tmp);
- if(gl.isGL2GL3 ()) {
- rowLength = glGetInteger(gl, GL2GL3.GL_UNPACK_ROW_LENGTH, tmp);
- skipRows = glGetInteger(gl, GL2GL3.GL_UNPACK_SKIP_ROWS, tmp);
+ if(gl.isGL2GL3 ()) {
+ rowLength = glGetInteger(gl, GL2GL3.GL_UNPACK_ROW_LENGTH, tmp);
+ skipRows = glGetInteger(gl, GL2GL3.GL_UNPACK_SKIP_ROWS, tmp);
skipPixels = glGetInteger(gl, GL2GL3.GL_UNPACK_SKIP_PIXELS, tmp);
- if (depth > 1) {
- imageHeight = glGetInteger(gl, GL2GL3.GL_UNPACK_IMAGE_HEIGHT, tmp);
+ if (depth > 1) {
+ imageHeight = glGetInteger(gl, GL2GL3.GL_UNPACK_IMAGE_HEIGHT, tmp);
skipImages = glGetInteger(gl, GL2GL3.GL_UNPACK_SKIP_IMAGES, tmp);
}
}
}
-
+
// Try to deal somewhat correctly with potentially invalid values
width = Math.max(0, width );
height = Math.max(1, height); // min 1D
@@ -401,13 +401,13 @@ public class GLBuffers extends Buffers {
skipPixels = Math.max(0, skipPixels);
alignment = Math.max(1, alignment);
skipImages = Math.max(0, skipImages);
-
+
imageHeight = ( imageHeight > 0 ) ? imageHeight : height;
rowLength = ( rowLength > 0 ) ? rowLength : width;
-
+
int rowLengthInBytes = rowLength * bytesPerPixel;
int skipBytes = skipPixels * bytesPerPixel;
-
+
switch(alignment) {
case 1:
break;
@@ -423,71 +423,71 @@ public class GLBuffers extends Buffers {
if (remainder > 0) {
skipBytes += alignment - remainder;
}
- }
+ }
break;
default:
- throw new GLException("Invalid alignment "+alignment+", must be 2**n (1,2,4,8). Pls notify the maintainer in case this is our bug.");
+ throw new GLException("Invalid alignment "+alignment+", must be 2**n (1,2,4,8). Pls notify the maintainer in case this is our bug.");
}
-
+
/**
* skipImages, depth, skipPixels and skipRows are static offsets.
*
* skipImages and depth are in multiples of image size.
*
* skipBytes and rowLengthInBytes are aligned
- *
- * rowLengthInBytes is the aligned byte offset
+ *
+ * rowLengthInBytes is the aligned byte offset
* from line n to line n+1 at the same x-axis position.
*/
return
skipBytes + // aligned skipPixels * bpp
- ( skipImages + depth - 1 ) * imageHeight * rowLengthInBytes + // aligned whole images
+ ( skipImages + depth - 1 ) * imageHeight * rowLengthInBytes + // aligned whole images
( skipRows + height - 1 ) * rowLengthInBytes + // aligned lines
- width * bytesPerPixel; // last line
+ width * bytesPerPixel; // last line
}
-
- /**
+
+ /**
* Returns the number of bytes required to read/write a memory buffer via OpenGL
* using the current GL pixel storage state and the given parameters.
- *
+ *
*
This method is security critical, hence it throws an exception (fail-fast)
- * in case either the format, type or alignment is unhandled. In case we forgot to handle
- * proper values, please contact the maintainer.
- *
+ * in case either the format, type or alignment is unhandled. In case we forgot to handle
+ * proper values, please contact the maintainer.
+ *
*
See {@link #bytesPerPixel(int, int)}.
- *
+ *
* @param gl the current GL object
- *
+ *
* @param tmp a pass through integer array of size >= 1 used to store temp data (performance)
- *
- * @param format must be one of (27)
- * GL_COLOR_INDEX GL_STENCIL_INDEX
- * GL_DEPTH_COMPONENT GL_DEPTH_STENCIL
- * GL_RED GL_RED_INTEGER
- * GL_GREEN GL_GREEN_INTEGER
- * GL_BLUE GL_BLUE_INTEGER
- * GL_ALPHA GL_LUMINANCE (12)
- *
+ *
+ * @param format must be one of (27)
+ * GL_COLOR_INDEX GL_STENCIL_INDEX
+ * GL_DEPTH_COMPONENT GL_DEPTH_STENCIL
+ * GL_RED GL_RED_INTEGER
+ * GL_GREEN GL_GREEN_INTEGER
+ * GL_BLUE GL_BLUE_INTEGER
+ * GL_ALPHA GL_LUMINANCE (12)
+ *
* GL_LUMINANCE_ALPHA GL_RG
- * GL_RG_INTEGER GL_HILO_NV
- * GL_SIGNED_HILO_NV (5)
- *
- * GL_YCBCR_422_APPLE
- *
- * GL_RGB GL_RGB_INTEGER
- * GL_BGR GL_BGR_INTEGER (4)
- *
- * GL_RGBA GL_RGBA_INTEGER
+ * GL_RG_INTEGER GL_HILO_NV
+ * GL_SIGNED_HILO_NV (5)
+ *
+ * GL_YCBCR_422_APPLE
+ *
+ * GL_RGB GL_RGB_INTEGER
+ * GL_BGR GL_BGR_INTEGER (4)
+ *
+ * GL_RGBA GL_RGBA_INTEGER
* GL_BGRA GL_BGRA_INTEGER
- * GL_ABGR_EXT (5)
- *
- * @param type must be one of (32)
- * GL_BITMAP,
+ * GL_ABGR_EXT (5)
+ *
+ * @param type must be one of (32)
+ * GL_BITMAP,
* GL_BYTE, GL_UNSIGNED_BYTE,
* GL_UNSIGNED_BYTE_3_3_2, GL_UNSIGNED_BYTE_2_3_3_REV,
*
* GL_SHORT, GL_UNSIGNED_SHORT,
- * GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV,
+ * GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV,
* GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_4_4_4_4_REV,
* GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_SHORT_1_5_5_5_REV,
* GL_UNSIGNED_SHORT_8_8_APPLE, GL_UNSIGNED_SHORT_8_8_REV_APPLE,
@@ -495,70 +495,70 @@ public class GLBuffers extends Buffers {
*
* GL_FIXED, GL_INT
* GL_UNSIGNED_INT, GL_UNSIGNED_INT_8_8_8_8,
- * GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2,
+ * GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2,
* GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_INT_24_8,
- * GL_UNSIGNED_INT_10F_11F_11F_REV, GL_UNSIGNED_INT_5_9_9_9_REV
+ * GL_UNSIGNED_INT_10F_11F_11F_REV, GL_UNSIGNED_INT_5_9_9_9_REV
* GL_HILO16_NV, GL_SIGNED_HILO16_NV
*
* GL_FLOAT_32_UNSIGNED_INT_24_8_REV
*
- * GL_FLOAT, GL_DOUBLE
- *
+ * GL_FLOAT, GL_DOUBLE
+ *
* @param width in pixels
* @param height in pixels
* @param depth in pixels
- * @param pack true for read mode GPU -> CPU, otherwise false for write mode CPU -> GPU
+ * @param pack true for read mode GPU -> CPU, otherwise false for write mode CPU -> GPU
* @return required minimum size of the buffer in bytes
* @throws GLException if format, type or alignment is not handled. Please contact the maintainer if this is our bug.
*/
- public static final int sizeof(GL gl, int tmp[],
+ public static final int sizeof(GL gl, int tmp[],
int format, int type, int width, int height, int depth,
boolean pack) throws GLException {
if (width < 0) return 0;
if (height < 0) return 0;
if (depth < 0) return 0;
-
+
final int bytesPerPixel = bytesPerPixel(format, type);
return sizeof(gl, tmp, bytesPerPixel, width, height, depth, pack);
}
-
- /**
+
+ /**
* Returns the number of bytes required for one pixel with the the given OpenGL format and type.
- *
+ *
*
This method is security critical, hence it throws an exception (fail-fast)
- * in case either the format, type or alignment is unhandled. In case we forgot to handle
- * proper values, please contact the maintainer.
- *
+ * in case either the format, type or alignment is unhandled. In case we forgot to handle
+ * proper values, please contact the maintainer.
+ *
*
See {@link #componentCount(int)}.
- *
- * @param format must be one of (27)
- * GL_COLOR_INDEX GL_STENCIL_INDEX
- * GL_DEPTH_COMPONENT GL_DEPTH_STENCIL
- * GL_RED GL_RED_INTEGER
- * GL_GREEN GL_GREEN_INTEGER
- * GL_BLUE GL_BLUE_INTEGER
- * GL_ALPHA GL_LUMINANCE (12)
- *
+ *
+ * @param format must be one of (27)
+ * GL_COLOR_INDEX GL_STENCIL_INDEX
+ * GL_DEPTH_COMPONENT GL_DEPTH_STENCIL
+ * GL_RED GL_RED_INTEGER
+ * GL_GREEN GL_GREEN_INTEGER
+ * GL_BLUE GL_BLUE_INTEGER
+ * GL_ALPHA GL_LUMINANCE (12)
+ *
* GL_LUMINANCE_ALPHA GL_RG
- * GL_RG_INTEGER GL_HILO_NV
- * GL_SIGNED_HILO_NV (5)
- *
- * GL_YCBCR_422_APPLE
- *
- * GL_RGB GL_RGB_INTEGER
- * GL_BGR GL_BGR_INTEGER (4)
- *
- * GL_RGBA GL_RGBA_INTEGER
+ * GL_RG_INTEGER GL_HILO_NV
+ * GL_SIGNED_HILO_NV (5)
+ *
+ * GL_YCBCR_422_APPLE
+ *
+ * GL_RGB GL_RGB_INTEGER
+ * GL_BGR GL_BGR_INTEGER (4)
+ *
+ * GL_RGBA GL_RGBA_INTEGER
* GL_BGRA GL_BGRA_INTEGER
- * GL_ABGR_EXT (5)
- *
- * @param type must be one of (32)
- * GL_BITMAP,
+ * GL_ABGR_EXT (5)
+ *
+ * @param type must be one of (32)
+ * GL_BITMAP,
* GL_BYTE, GL_UNSIGNED_BYTE,
* GL_UNSIGNED_BYTE_3_3_2, GL_UNSIGNED_BYTE_2_3_3_REV,
*
* GL_SHORT, GL_UNSIGNED_SHORT,
- * GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV,
+ * GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV,
* GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_4_4_4_4_REV,
* GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_SHORT_1_5_5_5_REV,
* GL_UNSIGNED_SHORT_8_8_APPLE, GL_UNSIGNED_SHORT_8_8_REV_APPLE,
@@ -566,15 +566,15 @@ public class GLBuffers extends Buffers {
*
* GL_FIXED, GL_INT
* GL_UNSIGNED_INT, GL_UNSIGNED_INT_8_8_8_8,
- * GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2,
+ * GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2,
* GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_INT_24_8,
- * GL_UNSIGNED_INT_10F_11F_11F_REV, GL_UNSIGNED_INT_5_9_9_9_REV
+ * GL_UNSIGNED_INT_10F_11F_11F_REV, GL_UNSIGNED_INT_5_9_9_9_REV
* GL_HILO16_NV, GL_SIGNED_HILO16_NV
*
* GL_FLOAT_32_UNSIGNED_INT_24_8_REV
*
- * GL_FLOAT, GL_DOUBLE
- *
+ * GL_FLOAT, GL_DOUBLE
+ *
* @return required size of one pixel in bytes
* @throws GLException if format or type alignment is not handled. Please contact the maintainer if this is our bug.
*/
@@ -582,14 +582,14 @@ public class GLBuffers extends Buffers {
int compSize = 0;
int compCount = componentCount(format);
-
+
switch (type) /* 30 */ {
case GL2.GL_BITMAP:
if (GL2.GL_COLOR_INDEX == format || GL2GL3.GL_STENCIL_INDEX == format) {
compSize = 1;
}
case GL.GL_BYTE:
- case GL.GL_UNSIGNED_BYTE:
+ case GL.GL_UNSIGNED_BYTE:
compSize = 1;
break;
case GL.GL_SHORT:
@@ -607,7 +607,7 @@ public class GLBuffers extends Buffers {
case GL2GL3.GL_DOUBLE:
compSize = 8;
break;
-
+
case GL2GL3.GL_UNSIGNED_BYTE_3_3_2:
case GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV:
compSize = 1;
@@ -630,7 +630,7 @@ public class GLBuffers extends Buffers {
case GL2.GL_SIGNED_HILO16_NV:
compSize = 2;
compCount = 2;
- break;
+ break;
case GL2GL3.GL_UNSIGNED_INT_8_8_8_8:
case GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV:
case GL2GL3.GL_UNSIGNED_INT_10_10_10_2:
@@ -640,52 +640,52 @@ public class GLBuffers extends Buffers {
case GL2GL3.GL_UNSIGNED_INT_5_9_9_9_REV:
compSize = 4;
compCount = 1;
- break;
+ break;
case GL2GL3.GL_FLOAT_32_UNSIGNED_INT_24_8_REV:
compSize = 8;
compCount = 1;
- break;
-
+ break;
+
default:
throw new GLException("type 0x"+Integer.toHexString(type)+"/"+"format 0x"+Integer.toHexString(format)+" not supported [yet], pls notify the maintainer in case this is our bug.");
- }
+ }
return compCount * compSize;
}
-
- /**
+
+ /**
* Returns the number of components required for the given OpenGL format.
- *
+ *
*
This method is security critical, hence it throws an exception (fail-fast)
- * in case either the format, type or alignment is unhandled. In case we forgot to handle
- * proper values, please contact the maintainer.
- *
- * @param format must be one of (27)
- * GL_COLOR_INDEX GL_STENCIL_INDEX
- * GL_DEPTH_COMPONENT GL_DEPTH_STENCIL
- * GL_RED GL_RED_INTEGER
- * GL_GREEN GL_GREEN_INTEGER
- * GL_BLUE GL_BLUE_INTEGER
- * GL_ALPHA GL_LUMINANCE (12)
- *
+ * in case either the format, type or alignment is unhandled. In case we forgot to handle
+ * proper values, please contact the maintainer.
+ *
+ * @param format must be one of (27)
+ * GL_COLOR_INDEX GL_STENCIL_INDEX
+ * GL_DEPTH_COMPONENT GL_DEPTH_STENCIL
+ * GL_RED GL_RED_INTEGER
+ * GL_GREEN GL_GREEN_INTEGER
+ * GL_BLUE GL_BLUE_INTEGER
+ * GL_ALPHA GL_LUMINANCE (12)
+ *
* GL_LUMINANCE_ALPHA GL_RG
- * GL_RG_INTEGER GL_HILO_NV
- * GL_SIGNED_HILO_NV (5)
- *
- * GL_YCBCR_422_APPLE
- *
- * GL_RGB GL_RGB_INTEGER
- * GL_BGR GL_BGR_INTEGER (4)
- *
- * GL_RGBA GL_RGBA_INTEGER
+ * GL_RG_INTEGER GL_HILO_NV
+ * GL_SIGNED_HILO_NV (5)
+ *
+ * GL_YCBCR_422_APPLE
+ *
+ * GL_RGB GL_RGB_INTEGER
+ * GL_BGR GL_BGR_INTEGER (4)
+ *
+ * GL_RGBA GL_RGBA_INTEGER
* GL_BGRA GL_BGRA_INTEGER
- * GL_ABGR_EXT (5)
- *
+ * GL_ABGR_EXT (5)
+ *
* @return number of components required for the given OpenGL format
* @throws GLException if format is not handled. Please contact the maintainer if this is our bug.
*/
public static final int componentCount(int format) throws GLException {
final int compCount;
-
+
switch (format) /* 26 */ {
case GL2.GL_COLOR_INDEX:
case GL2GL3.GL_STENCIL_INDEX:
@@ -711,10 +711,10 @@ public class GLBuffers extends Buffers {
case GL.GL_RGB:
case GL2GL3.GL_RGB_INTEGER:
case GL2GL3.GL_BGR:
- case GL2GL3.GL_BGR_INTEGER:
+ case GL2GL3.GL_BGR_INTEGER:
compCount = 3;
break;
- case GL2.GL_YCBCR_422_APPLE:
+ case GL2.GL_YCBCR_422_APPLE:
compCount = 3;
break;
case GL.GL_RGBA:
@@ -724,16 +724,16 @@ public class GLBuffers extends Buffers {
case GL2.GL_ABGR_EXT:
compCount = 4;
break;
- /* FIXME ??
+ /* FIXME ??
case GL.GL_HILO_NV:
elements = 2;
- break; */
+ break; */
default:
throw new GLException("format 0x"+Integer.toHexString(format)+" not supported [yet], pls notify the maintainer in case this is our bug.");
}
return compCount;
}
-
+
public static final int getNextPowerOf2(int number) {
if (((number-1) & number) == 0) {
//ex: 8 -> 0b1000; 8-1=7 -> 0b0111; 0b1000&0b0111 == 0
@@ -745,8 +745,8 @@ public class GLBuffers extends Buffers {
power++;
}
return (1<src to dest.
* If preserveInitState is true, it's initialized state is preserved
@@ -86,7 +86,7 @@ public class GLDrawableUtil {
dest.invoke(false, new GLEventListenerState.ReshapeGLEventListener(listener));
} // else .. !init state is default
}
-
+
/**
* Moves all {@link GLEventListener} from {@link GLAutoDrawable} src to dest.
* If preserveInitState is true, it's initialized state is preserved
@@ -113,12 +113,12 @@ public class GLDrawableUtil {
/**
* Swaps the {@link GLContext} and all {@link GLEventListener} between {@link GLAutoDrawable} a and b,
* while preserving it's initialized state, resets the GL-Viewport and issuing {@link GLEventListener#reshape(GLAutoDrawable, int, int, int, int) reshape(..)}.
- *
- * The {@link GLAutoDrawable} to {@link GLAnimatorControl} association
- * is also swapped.
+ *
+ * The {@link GLAutoDrawable} to {@link GLAnimatorControl} association
+ * is also swapped.
*
*
- * If an {@link GLAnimatorControl} is being attached to {@link GLAutoDrawable} a or b
+ * If an {@link GLAnimatorControl} is being attached to {@link GLAutoDrawable} a or b
* and the current thread is different than {@link GLAnimatorControl#getThread() the animator's thread}, it is paused during the operation.
*
* @param a
@@ -128,31 +128,31 @@ public class GLDrawableUtil {
public static final void swapGLContextAndAllGLEventListener(GLAutoDrawable a, GLAutoDrawable b) {
final GLEventListenerState gllsA = GLEventListenerState.moveFrom(a);
final GLEventListenerState gllsB = GLEventListenerState.moveFrom(b);
-
+
gllsA.moveTo(b);
gllsB.moveTo(a);
}
-
- /**
- * Swaps the {@link GLContext} of given {@link GLAutoDrawable}
- * and {@link GLAutoDrawable#disposeGLEventListener(GLEventListener, boolean) disposes}
+
+ /**
+ * Swaps the {@link GLContext} of given {@link GLAutoDrawable}
+ * and {@link GLAutoDrawable#disposeGLEventListener(GLEventListener, boolean) disposes}
* each {@link GLEventListener} w/o removing it.
*
* The GL-Viewport is reset and {@link GLEventListener#reshape(GLAutoDrawable, int, int, int, int) reshape(..)} issued implicit.
- *
+ *
*
- * If an {@link GLAnimatorControl} is being attached to GLAutoDrawable src or dest and the current thread is different
+ * If an {@link GLAnimatorControl} is being attached to GLAutoDrawable src or dest and the current thread is different
* than {@link GLAnimatorControl#getThread() the animator's thread}, it is paused during the operation.
*
* @param src
* @param dest
*/
- public static final void swapGLContext(GLAutoDrawable src, GLAutoDrawable dest) {
+ public static final void swapGLContext(GLAutoDrawable src, GLAutoDrawable dest) {
final GLAnimatorControl aAnim = src.getAnimator();
- final GLAnimatorControl bAnim = dest.getAnimator();
+ final GLAnimatorControl bAnim = dest.getAnimator();
final boolean aIsPaused = isAnimatorAnimatingOnOtherThread(aAnim) && aAnim.pause();
final boolean bIsPaused = isAnimatorAnimatingOnOtherThread(bAnim) && bAnim.pause();
-
+
for(int i = src.getGLEventListenerCount() - 1; 0 <= i; i--) {
src.disposeGLEventListener(src.getGLEventListener(i), false);
}
@@ -160,12 +160,12 @@ public class GLDrawableUtil {
dest.disposeGLEventListener(dest.getGLEventListener(i), false);
}
dest.setContext( src.setContext( dest.getContext(), false ), false );
-
+
src.invoke(true, GLEventListenerState.setViewport);
dest.invoke(true, GLEventListenerState.setViewport);
-
+
if(aIsPaused) { aAnim.resume(); }
if(bIsPaused) { bAnim.resume(); }
}
-
+
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java b/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java
index 71e284101..f0c6be44f 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -39,78 +39,78 @@ import javax.media.opengl.GLException;
import com.jogamp.common.nio.Buffers;
import com.jogamp.opengl.util.texture.TextureData;
-/**
+/**
* OpenGL pixel data buffer, allowing user to provide buffers via their {@link GLPixelBufferProvider} implementation.
*
* {@link GLPixelBufferProvider} produces a {@link GLPixelBuffer}.
- *
+ *
*
* You may use {@link #defaultProviderNoRowStride}.
*
*/
public class GLPixelBuffer {
-
- /** Allows user to interface with another toolkit to define {@link GLPixelAttributes} and memory buffer to produce {@link TextureData}. */
+
+ /** Allows user to interface with another toolkit to define {@link GLPixelAttributes} and memory buffer to produce {@link TextureData}. */
public static interface GLPixelBufferProvider {
/** Allow {@link GL2ES3#GL_PACK_ROW_LENGTH}, or {@link GL2ES2#GL_UNPACK_ROW_LENGTH}. */
boolean getAllowRowStride();
-
+
/** Called first to determine {@link GLPixelAttributes}. */
GLPixelAttributes getAttributes(GL gl, int componentCount);
-
- /**
+
+ /**
* Allocates a new {@link GLPixelBuffer} object.
*
* Being called to gather the initial {@link GLPixelBuffer},
* or a new replacement {@link GLPixelBuffer} if {@link GLPixelBuffer#requiresNewBuffer(GL, int, int, int)}.
*
*
- * The minimum required {@link Buffer#remaining() remaining} byte size equals to minByteSize, if > 0,
+ * The minimum required {@link Buffer#remaining() remaining} byte size equals to minByteSize, if > 0,
* otherwise utilize {@link GLBuffers#sizeof(GL, int[], int, int, int, int, int, boolean)}
* to calculate it.
*
- *
+ *
* @param gl the corresponding current GL context object
* @param pixelAttributes the desired {@link GLPixelAttributes}
* @param width in pixels
* @param height in pixels
* @param depth in pixels
* @param pack true for read mode GPU -> CPU, otherwise false for write mode CPU -> GPU
- * @param minByteSize if > 0, the pre-calculated minimum byte-size for the resulting buffer, otherwise ignore.
+ * @param minByteSize if > 0, the pre-calculated minimum byte-size for the resulting buffer, otherwise ignore.
*/
GLPixelBuffer allocate(GL gl, GLPixelAttributes pixelAttributes, int width, int height, int depth, boolean pack, int minByteSize);
}
- /** Single {@link GLPixelBuffer} provider. */
+ /** Single {@link GLPixelBuffer} provider. */
public static interface SingletonGLPixelBufferProvider extends GLPixelBufferProvider {
- /** Return the last {@link #allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocated} {@link GLPixelBuffer} w/ {@link GLPixelAttributes#componentCount}. */
+ /** Return the last {@link #allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocated} {@link GLPixelBuffer} w/ {@link GLPixelAttributes#componentCount}. */
GLPixelBuffer getSingleBuffer(GLPixelAttributes pixelAttributes);
- /**
+ /**
* Initializes the single {@link GLPixelBuffer} w/ a given size, if not yet {@link #allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocated}.
* @return the newly initialized single {@link GLPixelBuffer}, or null if already allocated.
*/
- GLPixelBuffer initSingleton(int componentCount, int width, int height, int depth, boolean pack);
+ GLPixelBuffer initSingleton(int componentCount, int width, int height, int depth, boolean pack);
}
public static class DefaultGLPixelBufferProvider implements GLPixelBufferProvider {
private final boolean allowRowStride;
-
+
/**
- * @param allowRowStride If true, allow row-stride, otherwise not.
+ * @param allowRowStride If true, allow row-stride, otherwise not.
* See {@link #getAllowRowStride()} and {@link GLPixelBuffer#requiresNewBuffer(GL, int, int, int)}.
*/
public DefaultGLPixelBufferProvider(boolean allowRowStride) {
- this.allowRowStride = allowRowStride;
+ this.allowRowStride = allowRowStride;
}
-
+
@Override
public boolean getAllowRowStride() { return allowRowStride; }
-
+
@Override
public GLPixelAttributes getAttributes(GL gl, int componentCount) {
final GLContext ctx = gl.getContext();
final int dFormat, dType;
-
+
if( 1 == componentCount ) {
if( gl.isGL3ES3() ) {
// RED is supported on ES3 and >= GL3 [core]; ALPHA is deprecated on core
@@ -122,7 +122,7 @@ public class GLPixelBuffer {
dType = GL.GL_UNSIGNED_BYTE;
} else if( 3 == componentCount ) {
dFormat = GL.GL_RGB;
- dType = GL.GL_UNSIGNED_BYTE;
+ dType = GL.GL_UNSIGNED_BYTE;
} else if( 4 == componentCount ) {
int _dFormat = ctx.getDefaultPixelDataFormat();
final int dComps = GLBuffers.componentCount(_dFormat);
@@ -131,14 +131,14 @@ public class GLPixelBuffer {
dType = ctx.getDefaultPixelDataType();
} else {
dFormat = GL.GL_RGBA;
- dType = GL.GL_UNSIGNED_BYTE;
+ dType = GL.GL_UNSIGNED_BYTE;
}
} else {
throw new GLException("Unsupported componentCount "+componentCount+", contact maintainer to enhance");
}
return new GLPixelAttributes(componentCount, dFormat, dType);
}
-
+
/**
* {@inheritDoc}
*
@@ -148,7 +148,7 @@ public class GLPixelBuffer {
@Override
public GLPixelBuffer allocate(GL gl, GLPixelAttributes pixelAttributes, int width, int height, int depth, boolean pack, int minByteSize) {
if( minByteSize > 0 ) {
- return new GLPixelBuffer(pixelAttributes, width, height, depth, pack, Buffers.newDirectByteBuffer(minByteSize), getAllowRowStride());
+ return new GLPixelBuffer(pixelAttributes, width, height, depth, pack, Buffers.newDirectByteBuffer(minByteSize), getAllowRowStride());
} else {
int[] tmp = { 0 };
final int byteSize = GLBuffers.sizeof(gl, tmp, pixelAttributes.bytesPerPixel, width, height, depth, pack);
@@ -156,26 +156,26 @@ public class GLPixelBuffer {
}
}
}
-
- /**
+
+ /**
* Default {@link GLPixelBufferProvider} with {@link GLPixelBufferProvider#getAllowRowStride()} == false,
* utilizing best match for {@link GLPixelAttributes}
* and {@link GLPixelBufferProvider#allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocating} a {@link ByteBuffer}.
*/
public static GLPixelBufferProvider defaultProviderNoRowStride = new DefaultGLPixelBufferProvider(false);
-
- /**
+
+ /**
* Default {@link GLPixelBufferProvider} with {@link GLPixelBufferProvider#getAllowRowStride()} == true,
* utilizing best match for {@link GLPixelAttributes}
* and {@link GLPixelBufferProvider#allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocating} a {@link ByteBuffer}.
*/
public static GLPixelBufferProvider defaultProviderWithRowStride = new DefaultGLPixelBufferProvider(true);
-
- /** Pixel attributes. */
+
+ /** Pixel attributes. */
public static class GLPixelAttributes {
- /** Undefined instance of {@link GLPixelAttributes}, having componentCount:=0, format:=0 and type:= 0. */
+ /** Undefined instance of {@link GLPixelAttributes}, having componentCount:=0, format:=0 and type:= 0. */
public static final GLPixelAttributes UNDEF = new GLPixelAttributes(0, 0, 0, false);
-
+
/** Pixel source component count, i.e. number of meaningful components. */
public final int componentCount;
/** The OpenGL pixel data format */
@@ -184,7 +184,7 @@ public class GLPixelBuffer {
public final int type;
/** The OpenGL pixel size in bytes */
public final int bytesPerPixel;
-
+
/**
* Deriving {@link #componentCount} via GL dataFormat, i.e. {@link GLBuffers#componentCount(int)} if > 0.
* @param dataFormat GL data format
@@ -194,7 +194,7 @@ public class GLPixelBuffer {
this(0 < dataFormat ? GLBuffers.componentCount(dataFormat) : 0, dataFormat, dataType);
}
/**
- * Using user specified source {@link #componentCount}.
+ * Using user specified source {@link #componentCount}.
* @param componentCount source component count
* @param dataFormat GL data format
* @param dataType GL data type
@@ -220,7 +220,7 @@ public class GLPixelBuffer {
return "PixelAttributes[comp "+componentCount+", fmt 0x"+Integer.toHexString(format)+", type 0x"+Integer.toHexString(type)+", bytesPerPixel "+bytesPerPixel+"]";
}
}
-
+
/** The {@link GLPixelAttributes}. */
public final GLPixelAttributes pixelAttributes;
/** Width in pixels. */
@@ -233,22 +233,22 @@ public class GLPixelBuffer {
public final boolean pack;
/** Byte size of the buffer. Actually the number of {@link Buffer#remaining()} bytes when passed in ctor. */
public final int byteSize;
- /**
- * Buffer holding the pixel data. If {@link #rewind()}, it holds byteSize {@link Buffer#remaining()} bytes.
+ /**
+ * Buffer holding the pixel data. If {@link #rewind()}, it holds byteSize {@link Buffer#remaining()} bytes.
*
* By default the {@link Buffer} is a {@link ByteBuffer}, due to {@link DefProvider#allocate(GL, GLPixelAttributes, int, int, int, boolean, int)}.
* However, other {@link GLPixelBufferProvider} may utilize different {@link Buffer} types.
*
- */
+ */
public final Buffer buffer;
/** Buffer element size in bytes. */
public final int bufferElemSize;
-
+
/** Allow {@link GL2ES3#GL_PACK_ROW_LENGTH}, or {@link GL2ES2#GL_UNPACK_ROW_LENGTH}. See {@link #requiresNewBuffer(GL, int, int, int)}. */
public final boolean allowRowStride;
-
+
private boolean disposed = false;
-
+
public StringBuilder toString(StringBuilder sb) {
if(null == sb) {
sb = new StringBuilder();
@@ -272,7 +272,7 @@ public class GLPixelBuffer {
* @param allowRowStride If true, allow row-stride, otherwise not. See {@link #requiresNewBuffer(GL, int, int, int)}.
*/
public GLPixelBuffer(GLPixelAttributes pixelAttributes, int width, int height, int depth, boolean pack, Buffer buffer, boolean allowRowStride) {
- this.pixelAttributes = pixelAttributes;
+ this.pixelAttributes = pixelAttributes;
this.width = width;
this.height = height;
this.depth = depth;
@@ -282,15 +282,15 @@ public class GLPixelBuffer {
this.bufferElemSize = Buffers.sizeOfBufferElem(buffer);
this.allowRowStride = allowRowStride;
}
-
+
/** Allow {@link GL2ES3#GL_PACK_ROW_LENGTH}, or {@link GL2ES2#GL_UNPACK_ROW_LENGTH}. */
public final boolean getAllowRowStride() { return allowRowStride; }
-
+
/** Is not {@link #dispose() disposed} and has {@link #byteSize} > 0. */
public boolean isValid() {
return !disposed && 0 < byteSize;
}
-
+
/** See {@link Buffer#rewind()}. */
public Buffer rewind() {
return buffer.rewind();
@@ -300,40 +300,40 @@ public class GLPixelBuffer {
public int position() {
return buffer.position() * bufferElemSize;
}
-
+
/** Sets the byte position of the {@link #buffer}. */
public Buffer position(int bytePos) {
return buffer.position( bytePos / bufferElemSize );
}
-
+
/** Returns the byte capacity of the {@link #buffer}. */
public int capacity() {
return buffer.capacity() * bufferElemSize;
}
-
+
/** Returns the byte limit of the {@link #buffer}. */
public int limit() {
return buffer.limit() * bufferElemSize;
}
-
+
/** See {@link Buffer#flip()}. */
public Buffer flip() {
- return buffer.flip();
+ return buffer.flip();
}
-
+
/** See {@link Buffer#clear()}. */
public Buffer clear() {
- return buffer.clear();
+ return buffer.clear();
}
-
- /**
+
+ /**
* Returns true, if {@link #isValid() invalid} or implementation requires a new buffer based on the new size
* due to pixel alignment or byte size, otherwise false.
*
* It is assumed that pixelAttributes, depth and pack stays the same!
*
*
- * The minimum required byte size equals to minByteSize, if > 0,
+ * The minimum required byte size equals to minByteSize, if > 0,
* otherwise {@link GLBuffers#sizeof(GL, int[], int, int, int, int, int, boolean) GLBuffers.sizeof(..)}
* is being used to calculate it. This value is referred to newByteSize.
*
@@ -341,16 +341,16 @@ public class GLPixelBuffer {
* If {@link #allowRowStride} = false,
* method returns true if the newByteSize > currentByteSize
* or the newWidth != currentWidth.
- *
+ *
*
* If {@link #allowRowStride} = true, see {@link GLPixelBufferProvider#getAllowRowStride()},
- * method returns true only if the newByteSize > currentByteSize.
+ * method returns true only if the newByteSize > currentByteSize.
* Assuming user utilizes the row-stride when dealing w/ the data, i.e. {@link GL2ES3#GL_PACK_ROW_LENGTH}.
*
* @param gl the corresponding current GL context object
* @param newWidth new width in pixels
* @param newHeight new height in pixels
- * @param newByteSize if > 0, the pre-calculated minimum byte-size for the resulting buffer, otherwise ignore.
+ * @param newByteSize if > 0, the pre-calculated minimum byte-size for the resulting buffer, otherwise ignore.
* @see GLPixelBufferProvider#allocate(GL, GLPixelAttributes, int, int, int, boolean, int)
*/
public boolean requiresNewBuffer(GL gl, int newWidth, int newHeight, int newByteSize) {
@@ -366,7 +366,7 @@ public class GLPixelBuffer {
}
return byteSize < newByteSize || width != newWidth;
}
-
+
/** Dispose resources. See {@link #isValid()}. */
public void dispose() {
disposed = true;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLPixelStorageModes.java b/src/jogl/classes/com/jogamp/opengl/util/GLPixelStorageModes.java
index f512a3aae..1c6e97450 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLPixelStorageModes.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLPixelStorageModes.java
@@ -46,35 +46,35 @@ public class GLPixelStorageModes {
/** Create instance w/o {@link #save(GL)} */
public GLPixelStorageModes() {}
-
+
/** Create instance w/ {@link #save(GL)} */
public GLPixelStorageModes(GL gl) { save(gl); }
-
+
/**
* Sets the {@link GL#GL_PACK_ALIGNMENT}.
- *
+ *
* Saves the pixel storage modes if not saved yet.
*
*/
public final void setPackAlignment(GL gl, int packAlignment) {
save(gl);
- gl.glPixelStorei(GL.GL_PACK_ALIGNMENT, packAlignment);
+ gl.glPixelStorei(GL.GL_PACK_ALIGNMENT, packAlignment);
}
/**
* Sets the {@link GL#GL_UNPACK_ALIGNMENT}.
- *
+ *
* Saves the pixel storage modes if not saved yet.
*
*/
public final void setUnpackAlignment(GL gl, int unpackAlignment) {
save(gl);
- gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, unpackAlignment);
+ gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, unpackAlignment);
}
-
+
/**
- * Sets the {@link GL#GL_PACK_ALIGNMENT} and {@link GL#GL_UNPACK_ALIGNMENT}.
- *
+ * Sets the {@link GL#GL_PACK_ALIGNMENT} and {@link GL#GL_UNPACK_ALIGNMENT}.
+ *
* Saves the pixel storage modes if not saved yet.
*
*/
@@ -82,32 +82,32 @@ public class GLPixelStorageModes {
setPackAlignment(gl, packAlignment);
setUnpackAlignment(gl, unpackAlignment);
}
-
+
/**
* Sets the {@link GL2ES3#GL_PACK_ROW_LENGTH}.
- *
+ *
* Saves the pixel storage modes if not saved yet.
*
*/
public final void setPackRowLength(GL2ES3 gl, int packRowLength) {
save(gl);
- gl.glPixelStorei(GL2ES3.GL_PACK_ROW_LENGTH, packRowLength);
+ gl.glPixelStorei(GL2ES3.GL_PACK_ROW_LENGTH, packRowLength);
}
/**
* Sets the {@link GL2ES2#GL_UNPACK_ROW_LENGTH}.
- *
+ *
* Saves the pixel storage modes if not saved yet.
*
*/
public final void setUnpackRowLength(GL2ES2 gl, int unpackRowLength) {
save(gl);
- gl.glPixelStorei(GL2ES2.GL_UNPACK_ROW_LENGTH, unpackRowLength);
+ gl.glPixelStorei(GL2ES2.GL_UNPACK_ROW_LENGTH, unpackRowLength);
}
-
+
/**
* Sets the {@link GL2ES3#GL_PACK_ROW_LENGTH} and {@link GL2ES2#GL_UNPACK_ROW_LENGTH}.
- *
+ *
* Saves the pixel storage modes if not saved yet.
*
*/
@@ -115,7 +115,7 @@ public class GLPixelStorageModes {
setPackRowLength(gl, packRowLength);
setUnpackRowLength(gl, unpackRowLength);
}
-
+
/**
* Save the pixel storage mode, if not saved yet.
*
@@ -126,8 +126,8 @@ public class GLPixelStorageModes {
if(saved) {
return;
}
-
- if(gl.isGL2GL3()) {
+
+ if(gl.isGL2GL3()) {
if(gl.isGL2()) {
gl.getGL2().glPushClientAttrib(GL2.GL_CLIENT_PIXEL_STORE_BIT);
} else {
@@ -154,7 +154,7 @@ public class GLPixelStorageModes {
// embedded deals with pack/unpack alignment only
gl.glGetIntegerv(GL2ES2.GL_PACK_ALIGNMENT, savedAlignment, 0);
gl.glGetIntegerv(GL2ES2.GL_UNPACK_ALIGNMENT, savedAlignment, 1);
- }
+ }
saved = true;
}
@@ -166,8 +166,8 @@ public class GLPixelStorageModes {
if(!saved) {
throw new GLException("pixel storage modes not saved");
}
-
- if(gl.isGL2GL3()) {
+
+ if(gl.isGL2GL3()) {
if(gl.isGL2()) {
gl.getGL2().glPopClientAttrib();
} else {
@@ -186,9 +186,9 @@ public class GLPixelStorageModes {
// embedded deals with pack/unpack alignment only
gl.glPixelStorei(GL2ES2.GL_PACK_ALIGNMENT, savedAlignment[0]);
gl.glPixelStorei(GL2ES2.GL_UNPACK_ALIGNMENT, savedAlignment[1]);
- }
+ }
saved = false;
- }
+ }
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java b/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java
index 65d1b6906..b942c9ab2 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.opengl.util;
import java.io.File;
@@ -51,45 +51,45 @@ import com.jogamp.opengl.util.texture.TextureIO;
*/
public class GLReadBufferUtil {
protected final GLPixelBufferProvider pixelBufferProvider;
- protected final int componentCount, alignment;
+ protected final int componentCount, alignment;
protected final Texture readTexture;
- protected final GLPixelStorageModes psm;
-
+ protected final GLPixelStorageModes psm;
+
protected GLPixelBuffer readPixelBuffer = null;
protected TextureData readTextureData = null;
/**
- * @param alpha true for RGBA readPixels, otherwise RGB readPixels. Disclaimer: Alpha maybe forced on ES platforms!
+ * @param alpha true for RGBA readPixels, otherwise RGB readPixels. Disclaimer: Alpha maybe forced on ES platforms!
* @param write2Texture true if readPixel's TextureData shall be written to a 2d Texture
*/
public GLReadBufferUtil(boolean alpha, boolean write2Texture) {
this(GLPixelBuffer.defaultProviderNoRowStride, alpha, write2Texture);
}
-
+
public GLReadBufferUtil(GLPixelBufferProvider pixelBufferProvider, boolean alpha, boolean write2Texture) {
this.pixelBufferProvider = pixelBufferProvider;
this.componentCount = alpha ? 4 : 3 ;
- this.alignment = alpha ? 4 : 1 ;
+ this.alignment = alpha ? 4 : 1 ;
this.readTexture = write2Texture ? new Texture(GL.GL_TEXTURE_2D) : null ;
this.psm = new GLPixelStorageModes();
}
-
+
/** Returns the {@link GLPixelBufferProvider} used by this instance. */
public GLPixelBufferProvider getPixelBufferProvider() { return pixelBufferProvider; }
-
+
public boolean isValid() {
return null!=readTextureData && null!=readPixelBuffer && readPixelBuffer.isValid();
}
-
+
public boolean hasAlpha() { return 4 == componentCount ? true : false ; }
-
+
public GLPixelStorageModes getGLPixelStorageModes() { return psm; }
-
+
/**
* Returns the {@link GLPixelBuffer}, created and filled by {@link #readPixels(GLAutoDrawable, boolean)}.
*/
public GLPixelBuffer getPixelBuffer() { return readPixelBuffer; }
-
+
/**
* rewind the raw pixel ByteBuffer
*/
@@ -99,7 +99,7 @@ public class GLReadBufferUtil {
* @return the resulting TextureData, filled by {@link #readPixels(GLAutoDrawable, boolean)}
*/
public TextureData getTextureData() { return readTextureData; }
-
+
/**
* @return the Texture object filled by {@link #readPixels(GLAutoDrawable, boolean)},
* if this instance writes to a 2d Texture, otherwise null.
@@ -121,27 +121,27 @@ public class GLReadBufferUtil {
/**
* Read the drawable's pixels to TextureData and Texture, if requested at construction.
- *
+ *
* @param gl the current GL context object. It's read drawable is being used as the pixel source.
* @param mustFlipVertically indicates whether to flip the data vertically or not.
* The context's drawable {@link GLDrawable#isGLOriented()} state
* is taken into account.
* Vertical flipping is propagated to TextureData
* and handled in a efficient manner there (TextureCoordinates and TextureIO writer).
- *
+ *
* @see #GLReadBufferUtil(boolean, boolean)
*/
public boolean readPixels(GL gl, boolean mustFlipVertically) {
return readPixels(gl, 0, 0, 0, 0, mustFlipVertically);
}
-
+
/**
* Read the drawable's pixels to TextureData and Texture, if requested at construction.
- *
+ *
* @param gl the current GL context object. It's read drawable is being used as the pixel source.
* @param inX readPixel x offset
* @param inY readPixel y offset
- * @param inWidth optional readPixel width value, used if [1 .. drawable.width], otherwise using drawable.width
+ * @param inWidth optional readPixel width value, used if [1 .. drawable.width], otherwise using drawable.width
* @param inHeight optional readPixel height, used if [1 .. drawable.height], otherwise using drawable.height
* @param mustFlipVertically indicates whether to flip the data vertically or not.
* The context's drawable {@link GLDrawable#isGLOriented()} state
@@ -174,17 +174,17 @@ public class GLReadBufferUtil {
} else {
height= inHeight;
}
-
+
final boolean flipVertically;
if( drawable.isGLOriented() ) {
flipVertically = mustFlipVertically;
} else {
flipVertically = !mustFlipVertically;
}
-
+
final int tmp[] = new int[1];
final int readPixelSize = GLBuffers.sizeof(gl, tmp, pixelAttribs.bytesPerPixel, width, height, 1, true);
-
+
boolean newData = false;
if( null == readPixelBuffer || readPixelBuffer.requiresNewBuffer(gl, width, height, readPixelSize) ) {
readPixelBuffer = pixelBufferProvider.allocate(gl, pixelAttribs, width, height, 1, true, readPixelSize);
@@ -194,9 +194,9 @@ public class GLReadBufferUtil {
gl.getGLProfile(),
internalFormat,
width, height,
- 0,
+ 0,
pixelAttribs,
- false, false,
+ false, false,
flipVertically,
readPixelBuffer.buffer,
null /* Flusher */);
@@ -230,13 +230,13 @@ public class GLReadBufferUtil {
" "+width+"x"+height+
", "+pixelAttribs+
", "+readPixelBuffer+", sz "+readPixelSize);
- res = false;
+ res = false;
}
if(res && null != readTexture) {
if(newData) {
readTexture.updateImage(gl, readTextureData);
} else {
- readTexture.updateSubImage(gl, readTextureData, 0,
+ readTexture.updateSubImage(gl, readTextureData, 0,
0, 0, // src offset
0, 0, // dst offset
width, height);
@@ -248,7 +248,7 @@ public class GLReadBufferUtil {
return res;
}
- public void dispose(GL gl) {
+ public void dispose(GL gl) {
if(null != readTexture) {
readTexture.destroy(gl);
readTextureData = null;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/Gamma.java b/src/jogl/classes/com/jogamp/opengl/util/Gamma.java
index c649d1c6a..966781906 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/Gamma.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/Gamma.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
diff --git a/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java b/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java
index 111e2509e..697b7cca0 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java
@@ -34,28 +34,28 @@ import com.jogamp.opengl.util.glsl.ShaderState;
* to be either rendered directly via {@link #glEnd(GL)} or to be added to an internal display list
* via {@link #glEnd(GL, boolean) glEnd(gl, false)} for deferred rendering via {@link #draw(GL, boolean)}.
*
- * If unsure whether colors, normals and textures will be used,
+ * If unsure whether colors, normals and textures will be used,
* simply add them with an expected component count.
* This implementation will only render buffers which are being filled.
* The buffer growing implementation will only grow the exceeded buffers, unused buffers are not resized.
*
*
- * Note: Optional types, i.e. color, must be either not used or used w/ the same element count as vertex, etc.
+ * Note: Optional types, i.e. color, must be either not used or used w/ the same element count as vertex, etc.
* This is a semantic constraint, same as in the original OpenGL spec.
*
*/
public class ImmModeSink {
protected static final boolean DEBUG_BEGIN_END;
- protected static final boolean DEBUG_DRAW;
+ protected static final boolean DEBUG_DRAW;
protected static final boolean DEBUG_BUFFER;
-
+
static {
Debug.initSingleton();
DEBUG_BEGIN_END = Debug.isPropertyDefined("jogl.debug.ImmModeSink.BeginEnd", true);
- DEBUG_DRAW = Debug.isPropertyDefined("jogl.debug.ImmModeSink.Draw", true);
+ DEBUG_DRAW = Debug.isPropertyDefined("jogl.debug.ImmModeSink.Draw", true);
DEBUG_BUFFER = Debug.isPropertyDefined("jogl.debug.ImmModeSink.Buffer", true);
}
@@ -68,7 +68,7 @@ public class ImmModeSink {
*
- *
+ *
* @param initialElementCount initial buffer size, if subsequent mutable operations are about to exceed the buffer size, the buffer will grow about the initial size.
* @param vComps mandatory vertex component count, should be 2, 3 or 4.
* @param vDataType mandatory vertex data type, e.g. {@link GL#GL_FLOAT}
@@ -78,17 +78,17 @@ public class ImmModeSink {
* @param nDataType optional normal data type, e.g. {@link GL#GL_FLOAT}
* @param tComps optional texture-coordinate component count, may be 0, 2 or 3
* @param tDataType optional texture-coordinate data type, e.g. {@link GL#GL_FLOAT}
- * @param glBufferUsage VBO usage parameter for {@link GL#glBufferData(int, long, Buffer, int)}, e.g. {@link GL#GL_STATIC_DRAW},
+ * @param glBufferUsage VBO usage parameter for {@link GL#glBufferData(int, long, Buffer, int)}, e.g. {@link GL#GL_STATIC_DRAW},
* set to 0 for no VBO usage
*/
- public static ImmModeSink createFixed(int initialElementCount,
+ public static ImmModeSink createFixed(int initialElementCount,
int vComps, int vDataType,
int cComps, int cDataType,
- int nComps, int nDataType,
- int tComps, int tDataType,
+ int nComps, int nDataType,
+ int tComps, int tDataType,
int glBufferUsage) {
- return new ImmModeSink(initialElementCount,
- vComps, vDataType, cComps, cDataType, nComps, nDataType, tComps, tDataType,
+ return new ImmModeSink(initialElementCount,
+ vComps, vDataType, cComps, cDataType, nComps, nDataType, tComps, tDataType,
false, glBufferUsage, null, 0);
}
@@ -97,7 +97,7 @@ public class ImmModeSink {
*
- *
+ *
* @param initialElementCount initial buffer size, if subsequent mutable operations are about to exceed the buffer size, the buffer will grow about the initial size.
* @param vComps mandatory vertex component count, should be 2, 3 or 4.
* @param vDataType mandatory vertex data type, e.g. {@link GL#GL_FLOAT}
@@ -107,21 +107,21 @@ public class ImmModeSink {
* @param nDataType optional normal data type, e.g. {@link GL#GL_FLOAT}
* @param tComps optional texture-coordinate component count, may be 0, 2 or 3
* @param tDataType optional texture-coordinate data type, e.g. {@link GL#GL_FLOAT}
- * @param glBufferUsage VBO usage parameter for {@link GL#glBufferData(int, long, Buffer, int)}, e.g. {@link GL#GL_STATIC_DRAW},
+ * @param glBufferUsage VBO usage parameter for {@link GL#glBufferData(int, long, Buffer, int)}, e.g. {@link GL#GL_STATIC_DRAW},
* set to 0 for no VBO usage
* @param st ShaderState to locate the vertex attributes
* @see #draw(GL, boolean)
* @see com.jogamp.opengl.util.glsl.ShaderState#useProgram(GL2ES2, boolean)
* @see com.jogamp.opengl.util.glsl.ShaderState#getCurrentShaderState()
*/
- public static ImmModeSink createGLSL(int initialElementCount,
+ public static ImmModeSink createGLSL(int initialElementCount,
int vComps, int vDataType,
int cComps, int cDataType,
- int nComps, int nDataType,
- int tComps, int tDataType,
+ int nComps, int nDataType,
+ int tComps, int tDataType,
int glBufferUsage, ShaderState st) {
- return new ImmModeSink(initialElementCount,
- vComps, vDataType, cComps, cDataType, nComps, nDataType, tComps, tDataType,
+ return new ImmModeSink(initialElementCount,
+ vComps, vDataType, cComps, cDataType, nComps, nDataType, tComps, tDataType,
true, glBufferUsage, st, 0);
}
@@ -130,7 +130,7 @@ public class ImmModeSink {
*
- *
+ *
* @param initialElementCount initial buffer size, if subsequent mutable operations are about to exceed the buffer size, the buffer will grow about the initial size.
* @param vComps mandatory vertex component count, should be 2, 3 or 4.
* @param vDataType mandatory vertex data type, e.g. {@link GL#GL_FLOAT}
@@ -140,24 +140,24 @@ public class ImmModeSink {
* @param nDataType optional normal data type, e.g. {@link GL#GL_FLOAT}
* @param tComps optional texture-coordinate component count, may be 0, 2 or 3
* @param tDataType optional texture-coordinate data type, e.g. {@link GL#GL_FLOAT}
- * @param glBufferUsage VBO usage parameter for {@link GL#glBufferData(int, long, Buffer, int)}, e.g. {@link GL#GL_STATIC_DRAW},
+ * @param glBufferUsage VBO usage parameter for {@link GL#glBufferData(int, long, Buffer, int)}, e.g. {@link GL#GL_STATIC_DRAW},
* set to 0 for no VBO usage
* @param shaderProgram shader-program name to locate the vertex attributes
* @see #draw(GL, boolean)
* @see com.jogamp.opengl.util.glsl.ShaderState#useProgram(GL2ES2, boolean)
* @see com.jogamp.opengl.util.glsl.ShaderState#getCurrentShaderState()
*/
- public static ImmModeSink createGLSL(int initialElementCount,
+ public static ImmModeSink createGLSL(int initialElementCount,
int vComps, int vDataType,
int cComps, int cDataType,
- int nComps, int nDataType,
- int tComps, int tDataType,
+ int nComps, int nDataType,
+ int tComps, int tDataType,
int glBufferUsage, int shaderProgram) {
- return new ImmModeSink(initialElementCount,
- vComps, vDataType, cComps, cDataType, nComps, nDataType, tComps, tDataType,
+ return new ImmModeSink(initialElementCount,
+ vComps, vDataType, cComps, cDataType, nComps, nDataType, tComps, tDataType,
true, glBufferUsage, null, shaderProgram);
}
-
+
public void destroy(GL gl) {
destroyList(gl);
@@ -346,7 +346,7 @@ public class ImmModeSink {
public final void glColor3ub(byte x, byte y, byte z) {
vboSet.glColor3ub(x,y,z);
}
-
+
public final void glColor4b(byte x, byte y, byte z, byte a) {
vboSet.glColor4b(x,y,z,a);
}
@@ -354,7 +354,7 @@ public class ImmModeSink {
public final void glColor4ub(byte x, byte y, byte z, byte a) {
vboSet.glColor4ub(x,y,z,a);
}
-
+
public final void glTexCoord2b(byte x, byte y) {
vboSet.glTexCoord2b(x,y);
}
@@ -363,26 +363,26 @@ public class ImmModeSink {
vboSet.glTexCoord3b(x,y,z);
}
- protected ImmModeSink(int initialElementCount,
- int vComps, int vDataType,
- int cComps, int cDataType,
- int nComps, int nDataType,
- int tComps, int tDataType,
+ protected ImmModeSink(int initialElementCount,
+ int vComps, int vDataType,
+ int cComps, int cDataType,
+ int nComps, int nDataType,
+ int tComps, int tDataType,
boolean useGLSL, int glBufferUsage, ShaderState st, int shaderProgram) {
- vboSet = new VBOSet(initialElementCount,
- vComps, vDataType, cComps, cDataType, nComps, nDataType, tComps, tDataType,
+ vboSet = new VBOSet(initialElementCount,
+ vComps, vDataType, cComps, cDataType, nComps, nDataType, tComps, tDataType,
useGLSL, glBufferUsage, st, shaderProgram);
this.vboSetList = new ArrayList();
}
-
+
public boolean getUseVBO() { return vboSet.getUseVBO(); }
-
+
/**
* Returns the additional element count if buffer resize is required.
* @see #setResizeElementCount(int)
*/
public int getResizeElementCount() { return vboSet.getResizeElementCount(); }
-
+
/**
* Sets the additional element count if buffer resize is required,
* defaults to initialElementCount of factory method.
@@ -390,7 +390,7 @@ public class ImmModeSink {
* @see #createGLSL(int, int, int, int, int, int, int, int, int, int, ShaderState)
*/
public void setResizeElementCount(int v) { vboSet.setResizeElementCount(v); }
-
+
private void destroyList(GL gl) {
for(int i=0; i vboSetList;
protected static class VBOSet {
- protected VBOSet (int initialElementCount,
- int vComps, int vDataType,
- int cComps, int cDataType,
- int nComps, int nDataType,
- int tComps, int tDataType,
+ protected VBOSet (int initialElementCount,
+ int vComps, int vDataType,
+ int cComps, int cDataType,
+ int nComps, int nDataType,
+ int tComps, int tDataType,
boolean useGLSL, int glBufferUsage, ShaderState st, int shaderProgram) {
// final ..
this.glBufferUsage=glBufferUsage;
@@ -415,7 +415,7 @@ public class ImmModeSink {
this.useGLSL=useGLSL;
this.shaderState = st;
this.shaderProgram = shaderProgram;
-
+
if(useGLSL && null == shaderState && 0 == shaderProgram) {
throw new IllegalArgumentException("Using GLSL but neither a valid shader-program nor ShaderState has been passed!");
}
@@ -436,9 +436,9 @@ public class ImmModeSink {
this.tDataType=tDataType;
this.tDataTypeSigned=GLBuffers.isSignedGLType(tDataType);
this.tComps=tComps;
- this.tCompsBytes=tComps * GLBuffers.sizeOfGLType(tDataType);
+ this.tCompsBytes=tComps * GLBuffers.sizeOfGLType(tDataType);
this.vboName = 0;
-
+
this.vCount=0;
this.cCount=0;
this.nCount=0;
@@ -447,9 +447,9 @@ public class ImmModeSink {
this.cElems=0;
this.nElems=0;
this.tElems=0;
-
+
this.pageSize = Platform.getMachineDescription().pageSizeInBytes();
-
+
reallocateBuffer(initialElementCount);
rewind();
@@ -465,30 +465,30 @@ public class ImmModeSink {
protected int getResizeElementCount() { return resizeElementCount; }
protected void setResizeElementCount(int v) { resizeElementCount=v; }
-
+
protected boolean getUseVBO() { return useVBO; }
-
+
protected final VBOSet regenerate(GL gl) {
- return new VBOSet(initialElementCount, vComps,
- vDataType, cComps, cDataType, nComps, nDataType, tComps, tDataType,
+ return new VBOSet(initialElementCount, vComps,
+ vDataType, cComps, cDataType, nComps, nDataType, tComps, tDataType,
useGLSL, glBufferUsage, shaderState, shaderProgram);
}
protected void checkSeal(boolean test) throws GLException {
if(0==mode) {
- throw new GLException("No mode set yet, call glBegin(mode) first:\n\t"+this);
+ throw new GLException("No mode set yet, call glBegin(mode) first:\n\t"+this);
}
if(sealed!=test) {
if(test) {
- throw new GLException("Not Sealed yet, call glEnd() first:\n\t"+this);
+ throw new GLException("Not Sealed yet, call glEnd() first:\n\t"+this);
} else {
- throw new GLException("Already Sealed, can't modify VBO after glEnd():\n\t"+this);
+ throw new GLException("Already Sealed, can't modify VBO after glEnd():\n\t"+this);
}
}
}
private boolean usingShaderProgram = false;
-
+
protected void useShaderProgram(GL2ES2 gl, boolean force) {
if( force || !usingShaderProgram ) {
if(null != shaderState) {
@@ -499,19 +499,19 @@ public class ImmModeSink {
usingShaderProgram = true;
}
}
-
+
protected void draw(GL gl, Buffer indices, boolean disableBufferAfterDraw, int i)
{
enableBuffer(gl, true);
-
+
if(null != shaderState || 0 != shaderProgram) {
useShaderProgram(gl.getGL2ES2(), false);
}
-
+
if(DEBUG_DRAW) {
System.err.println("ImmModeSink.draw["+i+"].0 (disableBufferAfterDraw: "+disableBufferAfterDraw+"):\n\t"+this);
}
-
+
if (buffer!=null) {
if(null==indices) {
if ( GL_QUADS == mode && !gl.isGL2() ) {
@@ -523,7 +523,7 @@ public class ImmModeSink {
}
} else {
// FIXME: Impl. VBO usage .. or unroll.
- if( !gl.getContext().isCPUDataSourcingAvail() ) {
+ if( !gl.getContext().isCPUDataSourcingAvail() ) {
throw new GLException("CPU data sourcing n/a w/ "+gl.getContext());
}
final int type;
@@ -538,23 +538,23 @@ public class ImmModeSink {
}
final int idxLen = indices.remaining();
final int idx0 = indices.position();
-
+
if ( GL_QUADS == mode && !gl.isGL2() ) {
if( GL.GL_UNSIGNED_BYTE == type ) {
final ByteBuffer b = (ByteBuffer) indices;
for (int j = 0; j < idxLen; j++) {
gl.glDrawArrays(GL.GL_TRIANGLE_FAN, (int)(0x000000ff & b.get(idx0+j)), 4);
- }
+ }
} else if( GL.GL_UNSIGNED_SHORT == type ){
final ShortBuffer b = (ShortBuffer) indices;
for (int j = 0; j < idxLen; j++) {
gl.glDrawArrays(GL.GL_TRIANGLE_FAN, (int)(0x0000ffff & b.get(idx0+j)), 4);
- }
+ }
} else {
final IntBuffer b = (IntBuffer) indices;
for (int j = 0; j < idxLen; j++) {
gl.glDrawArrays(GL.GL_TRIANGLE_FAN, (int)(0xffffffff & b.get(idx0+j)), 4);
- }
+ }
}
} else {
((GL2ES1)gl).glDrawElements(mode, idxLen, type, indices);
@@ -566,7 +566,7 @@ public class ImmModeSink {
if(disableBufferAfterDraw) {
enableBuffer(gl, false);
}
-
+
if(DEBUG_DRAW) {
System.err.println("ImmModeSink.draw["+i+"].X (disableBufferAfterDraw: "+disableBufferAfterDraw+")");
}
@@ -592,7 +592,7 @@ public class ImmModeSink {
public void glVertex2b(byte x, byte y) {
checkSeal(false);
growBuffer(VERTEX);
- if(vComps>0)
+ if(vComps>0)
Buffers.putNb(vertexArray, vDataTypeSigned, x, true);
if(vComps>1)
Buffers.putNb(vertexArray, vDataTypeSigned, y, true);
@@ -614,7 +614,7 @@ public class ImmModeSink {
growBuffer(VERTEX);
if(vComps>0)
Buffers.putNs(vertexArray, vDataTypeSigned, x, true);
- if(vComps>1)
+ if(vComps>1)
Buffers.putNs(vertexArray, vDataTypeSigned, y, true);
countAndPadding(VERTEX, vComps-2);
}
@@ -623,16 +623,16 @@ public class ImmModeSink {
growBuffer(VERTEX);
if(vComps>0)
Buffers.putNs(vertexArray, vDataTypeSigned, x, true);
- if(vComps>1)
+ if(vComps>1)
Buffers.putNs(vertexArray, vDataTypeSigned, y, true);
- if(vComps>2)
+ if(vComps>2)
Buffers.putNs(vertexArray, vDataTypeSigned, z, true);
countAndPadding(VERTEX, vComps-3);
}
public void glVertex2f(float x, float y) {
checkSeal(false);
growBuffer(VERTEX);
- if(vComps>0)
+ if(vComps>0)
Buffers.putNf(vertexArray, vDataTypeSigned, x);
if(vComps>1)
Buffers.putNf(vertexArray, vDataTypeSigned, y);
@@ -641,11 +641,11 @@ public class ImmModeSink {
public void glVertex3f(float x, float y, float z) {
checkSeal(false);
growBuffer(VERTEX);
- if(vComps>0)
+ if(vComps>0)
Buffers.putNf(vertexArray, vDataTypeSigned, x);
if(vComps>1)
Buffers.putNf(vertexArray, vDataTypeSigned, y);
- if(vComps>2)
+ if(vComps>2)
Buffers.putNf(vertexArray, vDataTypeSigned, z);
countAndPadding(VERTEX, vComps-3);
}
@@ -653,33 +653,33 @@ public class ImmModeSink {
public void glNormal3b(byte x, byte y, byte z) {
checkSeal(false);
growBuffer(NORMAL);
- if(nComps>0)
+ if(nComps>0)
Buffers.putNb(normalArray, nDataTypeSigned, x, true);
- if(nComps>1)
+ if(nComps>1)
Buffers.putNb(normalArray, nDataTypeSigned, y, true);
- if(nComps>2)
+ if(nComps>2)
Buffers.putNb(normalArray, nDataTypeSigned, z, true);
countAndPadding(NORMAL, nComps-3);
}
public void glNormal3s(short x, short y, short z) {
checkSeal(false);
growBuffer(NORMAL);
- if(nComps>0)
+ if(nComps>0)
Buffers.putNs(normalArray, nDataTypeSigned, x, true);
- if(nComps>1)
+ if(nComps>1)
Buffers.putNs(normalArray, nDataTypeSigned, y, true);
- if(nComps>2)
+ if(nComps>2)
Buffers.putNs(normalArray, nDataTypeSigned, z, true);
countAndPadding(NORMAL, nComps-3);
}
public void glNormal3f(float x, float y, float z) {
checkSeal(false);
growBuffer(NORMAL);
- if(nComps>0)
+ if(nComps>0)
Buffers.putNf(normalArray, nDataTypeSigned, x);
if(nComps>1)
Buffers.putNf(normalArray, nDataTypeSigned, y);
- if(nComps>2)
+ if(nComps>2)
Buffers.putNf(normalArray, nDataTypeSigned, z);
countAndPadding(NORMAL, nComps-3);
}
@@ -687,96 +687,96 @@ public class ImmModeSink {
public void glColor3b(byte r, byte g, byte b) {
checkSeal(false);
growBuffer(COLOR);
- if(cComps>0)
+ if(cComps>0)
Buffers.putNb(colorArray, cDataTypeSigned, r, true);
- if(cComps>1)
+ if(cComps>1)
Buffers.putNb(colorArray, cDataTypeSigned, g, true);
- if(cComps>2)
+ if(cComps>2)
Buffers.putNb(colorArray, cDataTypeSigned, b, true);
countAndPadding(COLOR, cComps-3);
}
public void glColor3ub(byte r, byte g, byte b) {
checkSeal(false);
growBuffer(COLOR);
- if(cComps>0)
+ if(cComps>0)
Buffers.putNb(colorArray, cDataTypeSigned, r, false);
- if(cComps>1)
+ if(cComps>1)
Buffers.putNb(colorArray, cDataTypeSigned, g, false);
- if(cComps>2)
+ if(cComps>2)
Buffers.putNb(colorArray, cDataTypeSigned, b, false);
countAndPadding(COLOR, cComps-3);
}
public void glColor4b(byte r, byte g, byte b, byte a) {
checkSeal(false);
growBuffer(COLOR);
- if(cComps>0)
+ if(cComps>0)
Buffers.putNb(colorArray, cDataTypeSigned, r, true);
- if(cComps>1)
+ if(cComps>1)
Buffers.putNb(colorArray, cDataTypeSigned, g, true);
- if(cComps>2)
+ if(cComps>2)
Buffers.putNb(colorArray, cDataTypeSigned, b, true);
- if(cComps>3)
+ if(cComps>3)
Buffers.putNb(colorArray, cDataTypeSigned, a, true);
countAndPadding(COLOR, cComps-4);
}
public void glColor4ub(byte r, byte g, byte b, byte a) {
checkSeal(false);
growBuffer(COLOR);
- if(cComps>0)
+ if(cComps>0)
Buffers.putNb(colorArray, cDataTypeSigned, r, false);
- if(cComps>1)
+ if(cComps>1)
Buffers.putNb(colorArray, cDataTypeSigned, g, false);
- if(cComps>2)
+ if(cComps>2)
Buffers.putNb(colorArray, cDataTypeSigned, b, false);
- if(cComps>3)
+ if(cComps>3)
Buffers.putNb(colorArray, cDataTypeSigned, a, false);
countAndPadding(COLOR, cComps-4);
}
public void glColor3s(short r, short g, short b) {
checkSeal(false);
growBuffer(COLOR);
- if(cComps>0)
+ if(cComps>0)
Buffers.putNs(colorArray, cDataTypeSigned, r, true);
- if(cComps>1)
+ if(cComps>1)
Buffers.putNs(colorArray, cDataTypeSigned, g, true);
- if(cComps>2)
+ if(cComps>2)
Buffers.putNs(colorArray, cDataTypeSigned, b, true);
countAndPadding(COLOR, cComps-3);
}
public void glColor4s(short r, short g, short b, short a) {
checkSeal(false);
growBuffer(COLOR);
- if(cComps>0)
+ if(cComps>0)
Buffers.putNs(colorArray, cDataTypeSigned, r, true);
- if(cComps>1)
+ if(cComps>1)
Buffers.putNs(colorArray, cDataTypeSigned, g, true);
- if(cComps>2)
+ if(cComps>2)
Buffers.putNs(colorArray, cDataTypeSigned, b, true);
- if(cComps>3)
+ if(cComps>3)
Buffers.putNs(colorArray, cDataTypeSigned, a, true);
countAndPadding(COLOR, cComps-4);
}
public void glColor3f(float r, float g, float b) {
checkSeal(false);
growBuffer(COLOR);
- if(cComps>0)
+ if(cComps>0)
Buffers.putNf(colorArray, cDataTypeSigned, r);
- if(cComps>1)
+ if(cComps>1)
Buffers.putNf(colorArray, cDataTypeSigned, g);
- if(cComps>2)
+ if(cComps>2)
Buffers.putNf(colorArray, cDataTypeSigned, b);
countAndPadding(COLOR, cComps-3);
}
public void glColor4f(float r, float g, float b, float a) {
checkSeal(false);
growBuffer(COLOR);
- if(cComps>0)
+ if(cComps>0)
Buffers.putNf(colorArray, cDataTypeSigned, r);
- if(cComps>1)
+ if(cComps>1)
Buffers.putNf(colorArray, cDataTypeSigned, g);
- if(cComps>2)
+ if(cComps>2)
Buffers.putNf(colorArray, cDataTypeSigned, b);
- if(cComps>3)
+ if(cComps>3)
Buffers.putNf(colorArray, cDataTypeSigned, a);
countAndPadding(COLOR, cComps-4);
}
@@ -784,60 +784,60 @@ public class ImmModeSink {
public void glTexCoord2b(byte x, byte y) {
checkSeal(false);
growBuffer(TEXTCOORD);
- if(tComps>0)
+ if(tComps>0)
Buffers.putNb(textCoordArray, tDataTypeSigned, x, true);
- if(tComps>1)
+ if(tComps>1)
Buffers.putNb(textCoordArray, tDataTypeSigned, y, true);
countAndPadding(TEXTCOORD, tComps-2);
}
public void glTexCoord3b(byte x, byte y, byte z) {
checkSeal(false);
growBuffer(TEXTCOORD);
- if(tComps>0)
+ if(tComps>0)
Buffers.putNb(textCoordArray, tDataTypeSigned, x, true);
- if(tComps>1)
+ if(tComps>1)
Buffers.putNb(textCoordArray, tDataTypeSigned, y, true);
- if(tComps>2)
+ if(tComps>2)
Buffers.putNb(textCoordArray, tDataTypeSigned, z, true);
countAndPadding(TEXTCOORD, tComps-3);
}
public void glTexCoord2s(short x, short y) {
checkSeal(false);
growBuffer(TEXTCOORD);
- if(tComps>0)
+ if(tComps>0)
Buffers.putNs(textCoordArray, tDataTypeSigned, x, true);
- if(tComps>1)
+ if(tComps>1)
Buffers.putNs(textCoordArray, tDataTypeSigned, y, true);
countAndPadding(TEXTCOORD, tComps-2);
}
public void glTexCoord3s(short x, short y, short z) {
checkSeal(false);
growBuffer(TEXTCOORD);
- if(tComps>0)
+ if(tComps>0)
Buffers.putNs(textCoordArray, tDataTypeSigned, x, true);
- if(tComps>1)
+ if(tComps>1)
Buffers.putNs(textCoordArray, tDataTypeSigned, y, true);
- if(tComps>2)
+ if(tComps>2)
Buffers.putNs(textCoordArray, tDataTypeSigned, z, true);
countAndPadding(TEXTCOORD, tComps-3);
}
public void glTexCoord2f(float x, float y) {
checkSeal(false);
growBuffer(TEXTCOORD);
- if(tComps>0)
+ if(tComps>0)
Buffers.putNf(textCoordArray, tDataTypeSigned, x);
- if(tComps>1)
+ if(tComps>1)
Buffers.putNf(textCoordArray, tDataTypeSigned, y);
countAndPadding(TEXTCOORD, tComps-2);
}
public void glTexCoord3f(float x, float y, float z) {
checkSeal(false);
growBuffer(TEXTCOORD);
- if(tComps>0)
+ if(tComps>0)
Buffers.putNf(textCoordArray, tDataTypeSigned, x);
- if(tComps>1)
+ if(tComps>1)
Buffers.putNf(textCoordArray, tDataTypeSigned, y);
- if(tComps>2)
+ if(tComps>2)
Buffers.putNf(textCoordArray, tDataTypeSigned, z);
countAndPadding(TEXTCOORD, tComps-3);
}
@@ -864,20 +864,20 @@ public class ImmModeSink {
shaderProgram = program;
glslLocationSet = false; // enforce location reset!
}
-
+
/**
* @param gl
* @return true if all locations for all used arrays are found (min 1 array), otherwise false.
- * Also sets 'glslLocationSet' to the return value!
+ * Also sets 'glslLocationSet' to the return value!
*/
private boolean resetGLSLArrayLocation(GL2ES2 gl) {
int iA = 0;
int iL = 0;
-
+
if(null != vArrayData) {
iA++;
if( vArrayData.setLocation(gl, shaderProgram) >= 0 ) {
- iL++;
+ iL++;
}
}
if(null != cArrayData) {
@@ -901,7 +901,7 @@ public class ImmModeSink {
glslLocationSet = iA == iL;
return glslLocationSet;
}
-
+
public void destroy(GL gl) {
reset(gl);
@@ -931,7 +931,7 @@ public class ImmModeSink {
this.vElems=0;
this.cElems=0;
this.nElems=0;
- this.tElems=0;
+ this.tElems=0;
}
public void seal(GL glObj, boolean seal)
@@ -1016,20 +1016,20 @@ public class ImmModeSink {
}
} else {
gl.glBufferData(GL.GL_ARRAY_BUFFER, buffer.limit(), buffer, glBufferUsage);
- bufferWrittenOnce = true;
- }
+ bufferWrittenOnce = true;
+ }
}
-
+
private void enableBufferFixed(GL gl, boolean enable) {
GL2ES1 glf = gl.getGL2ES1();
-
+
final boolean useV = vComps>0 && vElems>0 ;
final boolean useC = cComps>0 && cElems>0 ;
final boolean useN = nComps>0 && nElems>0 ;
final boolean useT = tComps>0 && tElems>0 ;
-
+
if(DEBUG_DRAW) {
- System.err.println("ImmModeSink.enableFixed.0 "+enable+": use [ v "+useV+", c "+useC+", n "+useN+", t "+useT+"], "+getElemUseCountStr()+", "+buffer);
+ System.err.println("ImmModeSink.enableFixed.0 "+enable+": use [ v "+useV+", c "+useC+", n "+useN+", t "+useT+"], "+getElemUseCountStr()+", "+buffer);
}
if(enable) {
@@ -1038,7 +1038,7 @@ public class ImmModeSink {
throw new InternalError("Using VBO but no vboName");
}
glf.glBindBuffer(GL.GL_ARRAY_BUFFER, vboName);
-
+
if(!bufferWritten) {
writeBuffer(gl);
}
@@ -1051,7 +1051,7 @@ public class ImmModeSink {
glf.glEnableClientState(GLPointerFunc.GL_VERTEX_ARRAY);
glf.glVertexPointer(vArrayData);
} else {
- glf.glDisableClientState(GLPointerFunc.GL_VERTEX_ARRAY);
+ glf.glDisableClientState(GLPointerFunc.GL_VERTEX_ARRAY);
}
}
if(useC) {
@@ -1082,24 +1082,24 @@ public class ImmModeSink {
if(enable && useVBO) {
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
}
-
+
if(DEBUG_DRAW) {
- System.err.println("ImmModeSink.enableFixed.X ");
+ System.err.println("ImmModeSink.enableFixed.X ");
}
}
private void enableBufferGLSLShaderState(GL gl, boolean enable) {
GL2ES2 glsl = gl.getGL2ES2();
-
+
final boolean useV = vComps>0 && vElems>0 ;
final boolean useC = cComps>0 && cElems>0 ;
final boolean useN = nComps>0 && nElems>0 ;
final boolean useT = tComps>0 && tElems>0 ;
-
+
if(DEBUG_DRAW) {
- System.err.println("ImmModeSink.enableGLSL.A.0 "+enable+": use [ v "+useV+", c "+useC+", n "+useN+", t "+useT+"], "+getElemUseCountStr()+", "+buffer);
+ System.err.println("ImmModeSink.enableGLSL.A.0 "+enable+": use [ v "+useV+", c "+useC+", n "+useN+", t "+useT+"], "+getElemUseCountStr()+", "+buffer);
}
-
+
if(enable) {
if(useVBO) {
if(0 == vboName) {
@@ -1110,9 +1110,9 @@ public class ImmModeSink {
writeBuffer(gl);
}
}
- bufferWritten=true;
+ bufferWritten=true;
}
-
+
if(useV) {
if(enable) {
shaderState.enableVertexAttribArray(glsl, vArrayData);
@@ -1144,30 +1144,30 @@ public class ImmModeSink {
} else {
shaderState.disableVertexAttribArray(glsl, tArrayData);
}
- }
+ }
glslLocationSet = true; // ShaderState does set the location implicit
-
+
if(enable && useVBO) {
glsl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
}
-
+
if(DEBUG_DRAW) {
- System.err.println("ImmModeSink.enableGLSL.A.X ");
+ System.err.println("ImmModeSink.enableGLSL.A.X ");
}
}
private void enableBufferGLSLSimple(GL gl, boolean enable) {
GL2ES2 glsl = gl.getGL2ES2();
-
+
final boolean useV = vComps>0 && vElems>0 ;
final boolean useC = cComps>0 && cElems>0 ;
final boolean useN = nComps>0 && nElems>0 ;
final boolean useT = tComps>0 && tElems>0 ;
-
+
if(DEBUG_DRAW) {
- System.err.println("ImmModeSink.enableGLSL.B.0 "+enable+": use [ v "+useV+", c "+useC+", n "+useN+", t "+useT+"], "+getElemUseCountStr()+", "+buffer);
+ System.err.println("ImmModeSink.enableGLSL.B.0 "+enable+": use [ v "+useV+", c "+useC+", n "+useN+", t "+useT+"], "+getElemUseCountStr()+", "+buffer);
}
-
+
if(!glslLocationSet) {
if( !resetGLSLArrayLocation(glsl) ) {
if(DEBUG_DRAW) {
@@ -1180,7 +1180,7 @@ public class ImmModeSink {
return;
}
}
-
+
if(enable) {
if(useVBO) {
if(0 == vboName) {
@@ -1226,28 +1226,28 @@ public class ImmModeSink {
glsl.glDisableVertexAttribArray(tArrayData.getLocation());
}
}
-
+
if(enable && useVBO) {
glsl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
}
-
+
if(DEBUG_DRAW) {
- System.err.println("ImmModeSink.enableGLSL.B.X ");
+ System.err.println("ImmModeSink.enableGLSL.B.X ");
}
}
-
+
public String toString() {
- final String glslS = useGLSL ?
+ final String glslS = useGLSL ?
", useShaderState "+(null!=shaderState)+
", shaderProgram "+shaderProgram+
", glslLocationSet "+glslLocationSet : "";
-
- return "VBOSet[mode "+mode+
- ", modeOrig "+modeOrig+
+
+ return "VBOSet[mode "+mode+
+ ", modeOrig "+modeOrig+
", use/count "+getElemUseCountStr()+
- ", sealed "+sealed+
+ ", sealed "+sealed+
", sealedGL "+sealedGL+
- ", bufferEnabled "+bufferEnabled+
+ ", bufferEnabled "+bufferEnabled+
", bufferWritten "+bufferWritten+" (once "+bufferWrittenOnce+")"+
", useVBO "+useVBO+", vboName "+vboName+
", useGLSL "+useGLSL+
@@ -1264,7 +1264,7 @@ public class ImmModeSink {
protected String getElemUseCountStr() {
return "[v "+vElems+"/"+vCount+", c "+cElems+"/"+cCount+", n "+nElems+"/"+nCount+", t "+tElems+"/"+tCount+"]";
}
-
+
protected boolean fitElementInBuffer(int type) {
final int addElems = 1;
switch (type) {
@@ -1280,20 +1280,20 @@ public class ImmModeSink {
throw new InternalError("XXX");
}
}
-
+
protected boolean reallocateBuffer(int addElems) {
final int vAdd = addElems - ( vCount - vElems );
final int cAdd = addElems - ( cCount - cElems );
final int nAdd = addElems - ( nCount - nElems );
final int tAdd = addElems - ( tCount - tElems );
-
+
if( 0>=vAdd && 0>=cAdd && 0>=nAdd && 0>=tAdd) {
if(DEBUG_BUFFER) {
System.err.println("ImmModeSink.realloc: "+getElemUseCountStr()+" + "+addElems+" -> NOP");
}
return false;
}
-
+
if(DEBUG_BUFFER) {
System.err.println("ImmModeSink.realloc: "+getElemUseCountStr()+" + "+addElems);
}
@@ -1301,20 +1301,20 @@ public class ImmModeSink {
cCount += cAdd;
nCount += nAdd;
tCount += tAdd;
-
+
final int vBytes = vCount * vCompsBytes;
final int cBytes = cCount * cCompsBytes;
final int nBytes = nCount * nCompsBytes;
final int tBytes = tCount * tCompsBytes;
-
+
buffer = Buffers.newDirectByteBuffer( vBytes + cBytes + nBytes + tBytes );
vOffset = 0;
-
+
if(vBytes>0) {
vertexArray = GLBuffers.sliceGLBuffer(buffer, vOffset, vBytes, vDataType);
} else {
vertexArray = null;
- }
+ }
cOffset=vOffset+vBytes;
if(cBytes>0) {
@@ -1341,36 +1341,36 @@ public class ImmModeSink {
buffer.flip();
if(vComps>0) {
- vArrayData = GLArrayDataWrapper.createFixed(GLPointerFunc.GL_VERTEX_ARRAY, vComps,
+ vArrayData = GLArrayDataWrapper.createFixed(GLPointerFunc.GL_VERTEX_ARRAY, vComps,
vDataType, GLBuffers.isGLTypeFixedPoint(vDataType), 0,
vertexArray, 0, vOffset, GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER);
} else {
vArrayData = null;
}
if(cComps>0) {
- cArrayData = GLArrayDataWrapper.createFixed(GLPointerFunc.GL_COLOR_ARRAY, cComps,
+ cArrayData = GLArrayDataWrapper.createFixed(GLPointerFunc.GL_COLOR_ARRAY, cComps,
cDataType, GLBuffers.isGLTypeFixedPoint(cDataType), 0,
colorArray, 0, cOffset, GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER);
} else {
cArrayData = null;
}
if(nComps>0) {
- nArrayData = GLArrayDataWrapper.createFixed(GLPointerFunc.GL_NORMAL_ARRAY, nComps,
+ nArrayData = GLArrayDataWrapper.createFixed(GLPointerFunc.GL_NORMAL_ARRAY, nComps,
nDataType, GLBuffers.isGLTypeFixedPoint(nDataType), 0,
normalArray, 0, nOffset, GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER);
} else {
nArrayData = null;
}
if(tComps>0) {
- tArrayData = GLArrayDataWrapper.createFixed(GLPointerFunc.GL_TEXTURE_COORD_ARRAY, tComps,
+ tArrayData = GLArrayDataWrapper.createFixed(GLPointerFunc.GL_TEXTURE_COORD_ARRAY, tComps,
tDataType, GLBuffers.isGLTypeFixedPoint(tDataType), 0,
textCoordArray, 0, tOffset, GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER);
} else {
tArrayData = null;
}
-
+
bufferWrittenOnce = false; // new buffer data storage size!
-
+
if(DEBUG_BUFFER) {
System.err.println("ImmModeSink.realloc.X: "+this.toString());
Thread.dumpStack();
@@ -1384,7 +1384,7 @@ public class ImmModeSink {
if( !fitElementInBuffer(type) ) {
// save olde values ..
final Buffer _vertexArray=vertexArray, _colorArray=colorArray, _normalArray=normalArray, _textCoordArray=textCoordArray;
-
+
if ( reallocateBuffer(resizeElementCount) ) {
if(null!=_vertexArray) {
_vertexArray.flip();
@@ -1416,7 +1416,7 @@ public class ImmModeSink {
* vec4 v = vec4(0, 0, 0, 1);
* vec4 c = vec4(0, 0, 0, 1);
*
- *
+ *
* @param type
* @param fill
*/
@@ -1426,7 +1426,7 @@ public class ImmModeSink {
final Buffer dest;
final boolean dSigned;
final int e; // either 0 or 1
-
+
switch (type) {
case VERTEX:
dest = vertexArray;
@@ -1459,7 +1459,7 @@ public class ImmModeSink {
while( fill > e ) {
fill--;
- Buffers.putNf(dest, dSigned, 0f);
+ Buffers.putNf(dest, dSigned, 0f);
}
if( fill > 0 ) { // e == 1, add missing '1f end component'
Buffers.putNf(dest, dSigned, 1f);
@@ -1480,18 +1480,18 @@ public class ImmModeSink {
private static final int NORMAL = 2;
private static final int TEXTCOORD = 3;
- private int vCount, cCount, nCount, tCount; // number of elements fit in each buffer
+ private int vCount, cCount, nCount, tCount; // number of elements fit in each buffer
private int vOffset, cOffset, nOffset, tOffset; // offset of specific array in common buffer
private int vElems, cElems, nElems, tElems; // number of used elements in each buffer
- private final int vComps, cComps, nComps, tComps; // number of components for each elements [2, 3, 4]
- private final int vCompsBytes, cCompsBytes, nCompsBytes, tCompsBytes; // byte size of all components
+ private final int vComps, cComps, nComps, tComps; // number of components for each elements [2, 3, 4]
+ private final int vCompsBytes, cCompsBytes, nCompsBytes, tCompsBytes; // byte size of all components
private final int vDataType, cDataType, nDataType, tDataType;
private final boolean vDataTypeSigned, cDataTypeSigned, nDataTypeSigned, tDataTypeSigned;
private final int pageSize;
private Buffer vertexArray, colorArray, normalArray, textCoordArray;
private GLArrayDataWrapper vArrayData, cArrayData, nArrayData, tArrayData;
- private boolean sealed, sealedGL;
+ private boolean sealed, sealedGL;
private boolean bufferEnabled, bufferWritten, bufferWrittenOnce;
private boolean glslLocationSet;
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java b/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java
index 58151856f..b4a0156e9 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2011 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package com.jogamp.opengl.util;
@@ -55,22 +55,22 @@ import com.jogamp.opengl.math.geom.Frustum;
* regarding the projection (P), modelview (Mv) matrix operation
* which is specified in {@link GLMatrixFunc}.
*
- * Further more, PMVMatrix provides the {@link #glGetMviMatrixf() inverse modelview matrix (Mvi)} and
+ * Further more, PMVMatrix provides the {@link #glGetMviMatrixf() inverse modelview matrix (Mvi)} and
* {@link #glGetMvitMatrixf() inverse transposed modelview matrix (Mvit)}.
* {@link Frustum} is also provided by {@link #glGetFrustum()}.
* To keep these derived values synchronized after mutable Mv operations like {@link #glRotatef(float, float, float, float) glRotatef(..)}
- * in {@link #glMatrixMode(int) glMatrixMode}({@link GLMatrixFunc#GL_MODELVIEW GL_MODELVIEW}),
- * users have to call {@link #update()} before using Mvi and Mvit.
+ * in {@link #glMatrixMode(int) glMatrixMode}({@link GLMatrixFunc#GL_MODELVIEW GL_MODELVIEW}),
+ * users have to call {@link #update()} before using Mvi and Mvit.
*
*
- * All matrices are provided in column-major order,
- * as specified in the OpenGL fixed function pipeline, i.e. compatibility profile.
+ * All matrices are provided in column-major order,
+ * as specified in the OpenGL fixed function pipeline, i.e. compatibility profile.
*
*
- * PMVMatrix can supplement {@link GL2ES2} applications w/ the
+ * PMVMatrix can supplement {@link GL2ES2} applications w/ the
* lack of the described matrix functionality.
*
* All matrices use a common FloatBuffer storage
* and are a {@link Buffers#slice2Float(Buffer, float[], int, int) sliced} representation of it.
@@ -78,11 +78,11 @@ import com.jogamp.opengl.math.geom.Frustum;
* depending how the instance if {@link #PMVMatrix(boolean) being constructed}.
*
*
- * Note:
- *
+ * Note:
+ *
*
The matrix is a {@link Buffers#slice2Float(Buffer, float[], int, int) sliced part } of a host matrix and it's start position has been {@link FloatBuffer#mark() marked}.
*
Use {@link FloatBuffer#reset() reset()} to rewind it to it's start position after relative operations, like {@link FloatBuffer#get() get()}.
- *
If using absolute operations like {@link FloatBuffer#get(int) get(int)}, use it's {@link FloatBuffer#reset() reset} {@link FloatBuffer#position() position} as it's offset.
+ *
If using absolute operations like {@link FloatBuffer#get(int) get(int)}, use it's {@link FloatBuffer#reset() reset} {@link FloatBuffer#position() position} as it's offset.
*
*
*/
@@ -96,20 +96,20 @@ public class PMVMatrix implements GLMatrixFunc {
public static final int MODIFIED_TEXTURE = 1 << 2;
/** Bit value stating all is modified */
public static final int MODIFIED_ALL = MODIFIED_PROJECTION | MODIFIED_MODELVIEW | MODIFIED_TEXTURE ;
-
+
/** Bit value stating a dirty {@link #glGetMviMatrixf() inverse modelview matrix (Mvi)}. */
public static final int DIRTY_INVERSE_MODELVIEW = 1 << 0;
/** Bit value stating a dirty {@link #glGetMvitMatrixf() inverse transposed modelview matrix (Mvit)}. */
- public static final int DIRTY_INVERSE_TRANSPOSED_MODELVIEW = 1 << 1;
+ public static final int DIRTY_INVERSE_TRANSPOSED_MODELVIEW = 1 << 1;
/** Bit value stating a dirty {@link #glGetFrustum() frustum}. */
- public static final int DIRTY_FRUSTUM = 1 << 2;
+ public static final int DIRTY_FRUSTUM = 1 << 2;
/** Bit value stating all is dirty */
public static final int DIRTY_ALL = DIRTY_INVERSE_MODELVIEW | DIRTY_INVERSE_TRANSPOSED_MODELVIEW | DIRTY_FRUSTUM;
-
+
/**
- * @param matrixModeName One of {@link GLMatrixFunc#GL_MODELVIEW GL_MODELVIEW}, {@link GLMatrixFunc#GL_PROJECTION GL_PROJECTION} or {@link GL#GL_TEXTURE GL_TEXTURE}
+ * @param matrixModeName One of {@link GLMatrixFunc#GL_MODELVIEW GL_MODELVIEW}, {@link GLMatrixFunc#GL_PROJECTION GL_PROJECTION} or {@link GL#GL_TEXTURE GL_TEXTURE}
* @return true if the given matrix-mode name is valid, otherwise false.
- */
+ */
public static final boolean isMatrixModeName(final int matrixModeName) {
switch(matrixModeName) {
case GL_MODELVIEW_MATRIX:
@@ -121,9 +121,9 @@ public class PMVMatrix implements GLMatrixFunc {
}
/**
- * @param matrixModeName One of {@link GLMatrixFunc#GL_MODELVIEW GL_MODELVIEW}, {@link GLMatrixFunc#GL_PROJECTION GL_PROJECTION} or {@link GL#GL_TEXTURE GL_TEXTURE}
+ * @param matrixModeName One of {@link GLMatrixFunc#GL_MODELVIEW GL_MODELVIEW}, {@link GLMatrixFunc#GL_PROJECTION GL_PROJECTION} or {@link GL#GL_TEXTURE GL_TEXTURE}
* @return The corresponding matrix-get name, one of {@link GLMatrixFunc#GL_MODELVIEW_MATRIX GL_MODELVIEW_MATRIX}, {@link GLMatrixFunc#GL_PROJECTION_MATRIX GL_PROJECTION_MATRIX} or {@link GLMatrixFunc#GL_TEXTURE_MATRIX GL_TEXTURE_MATRIX}
- */
+ */
public static final int matrixModeName2MatrixGetName(final int matrixModeName) {
switch(matrixModeName) {
case GL_MODELVIEW:
@@ -138,9 +138,9 @@ public class PMVMatrix implements GLMatrixFunc {
}
/**
- * @param matrixGetName One of {@link GLMatrixFunc#GL_MODELVIEW_MATRIX GL_MODELVIEW_MATRIX}, {@link GLMatrixFunc#GL_PROJECTION_MATRIX GL_PROJECTION_MATRIX} or {@link GLMatrixFunc#GL_TEXTURE_MATRIX GL_TEXTURE_MATRIX}
+ * @param matrixGetName One of {@link GLMatrixFunc#GL_MODELVIEW_MATRIX GL_MODELVIEW_MATRIX}, {@link GLMatrixFunc#GL_PROJECTION_MATRIX GL_PROJECTION_MATRIX} or {@link GLMatrixFunc#GL_TEXTURE_MATRIX GL_TEXTURE_MATRIX}
* @return true if the given matrix-get name is valid, otherwise false.
- */
+ */
public static final boolean isMatrixGetName(final int matrixGetName) {
switch(matrixGetName) {
case GL_MATRIX_MODE:
@@ -155,7 +155,7 @@ public class PMVMatrix implements GLMatrixFunc {
/**
* @param matrixGetName One of {@link GLMatrixFunc#GL_MODELVIEW_MATRIX GL_MODELVIEW_MATRIX}, {@link GLMatrixFunc#GL_PROJECTION_MATRIX GL_PROJECTION_MATRIX} or {@link GLMatrixFunc#GL_TEXTURE_MATRIX GL_TEXTURE_MATRIX}
* @return The corresponding matrix-mode name, one of {@link GLMatrixFunc#GL_MODELVIEW GL_MODELVIEW}, {@link GLMatrixFunc#GL_PROJECTION GL_PROJECTION} or {@link GL#GL_TEXTURE GL_TEXTURE}
- */
+ */
public static final int matrixGetName2MatrixModeName(final int matrixGetName) {
switch(matrixGetName) {
case GL_MODELVIEW_MATRIX:
@@ -168,18 +168,18 @@ public class PMVMatrix implements GLMatrixFunc {
throw new GLException("unsupported matrixGetName: "+matrixGetName);
}
}
-
- /**
+
+ /**
* @param sb optional passed StringBuilder instance to be used
* @param f the format string of one floating point, i.e. "%10.5f", see {@link java.util.Formatter}
* @param a 4x4 matrix in column major order (OpenGL)
* @return matrix string representation
*/
public static StringBuilder matrixToString(StringBuilder sb, String f, FloatBuffer a) {
- return FloatUtil.matrixToString(sb, null, f, a, 0, 4, 4, false);
+ return FloatUtil.matrixToString(sb, null, f, a, 0, 4, 4, false);
}
-
- /**
+
+ /**
* @param sb optional passed StringBuilder instance to be used
* @param f the format string of one floating point, i.e. "%10.5f", see {@link java.util.Formatter}
* @param a 4x4 matrix in column major order (OpenGL)
@@ -187,33 +187,33 @@ public class PMVMatrix implements GLMatrixFunc {
* @return side by side representation
*/
public static StringBuilder matrixToString(StringBuilder sb, String f, FloatBuffer a, FloatBuffer b) {
- return FloatUtil.matrixToString(sb, null, f, a, 0, b, 0, 4, 4, false);
+ return FloatUtil.matrixToString(sb, null, f, a, 0, b, 0, 4, 4, false);
}
-
+
/**
* Creates an instance of PMVMatrix {@link #PMVMatrix(boolean) PMVMatrix(boolean useBackingArray)},
- * with useBackingArray = true.
+ * with useBackingArray = true.
*/
public PMVMatrix() {
this(true);
}
-
+
/**
* Creates an instance of PMVMatrix.
- *
+ *
* @param useBackingArray true for non direct NIO Buffers with guaranteed backing array,
* which allows faster access in Java computation.
*
false for direct NIO buffers w/o a guaranteed backing array.
* In most Java implementations, direct NIO buffers have no backing array
- * and hence the Java computation will be throttled down by direct IO get/put
- * operations.
+ * and hence the Java computation will be throttled down by direct IO get/put
+ * operations.
*
Depending on the application, ie. whether the Java computation or
- * JNI invocation and hence native data transfer part is heavier,
+ * JNI invocation and hence native data transfer part is heavier,
* this flag shall be set to true or false
.
*/
public PMVMatrix(boolean useBackingArray) {
this.usesBackingArray = useBackingArray;
-
+
// I Identity
// T Texture
// P Projection
@@ -228,24 +228,24 @@ public class PMVMatrix implements GLMatrixFunc {
matrixBuffer = Buffers.newDirectByteBuffer( ( 6*16 + ProjectFloat.getRequiredFloatBufferSize() ) * Buffers.SIZEOF_FLOAT );
matrixBuffer.mark();
}
-
+
matrixIdent = Buffers.slice2Float(matrixBuffer, matrixBufferArray, 0*16, 1*16); // I
matrixTex = Buffers.slice2Float(matrixBuffer, matrixBufferArray, 1*16, 1*16); // T
- matrixPMvMvit = Buffers.slice2Float(matrixBuffer, matrixBufferArray, 2*16, 4*16); // P + Mv + Mvi + Mvit
+ matrixPMvMvit = Buffers.slice2Float(matrixBuffer, matrixBufferArray, 2*16, 4*16); // P + Mv + Mvi + Mvit
matrixPMvMvi = Buffers.slice2Float(matrixBuffer, matrixBufferArray, 2*16, 3*16); // P + Mv + Mvi
matrixPMv = Buffers.slice2Float(matrixBuffer, matrixBufferArray, 2*16, 2*16); // P + Mv
matrixP = Buffers.slice2Float(matrixBuffer, matrixBufferArray, 2*16, 1*16); // P
matrixMv = Buffers.slice2Float(matrixBuffer, matrixBufferArray, 3*16, 1*16); // Mv
matrixMvi = Buffers.slice2Float(matrixBuffer, matrixBufferArray, 4*16, 1*16); // Mvi
matrixMvit = Buffers.slice2Float(matrixBuffer, matrixBufferArray, 5*16, 1*16); // Mvit
-
+
projectFloat = new ProjectFloat(matrixBuffer, matrixBufferArray, 6*16);
-
+
if(null != matrixBuffer) {
matrixBuffer.reset();
- }
+ }
FloatUtil.makeIdentityf(matrixIdent);
-
+
vec3f = new float[3];
matrixMult = new float[16];
matrixTrans = new float[16];
@@ -263,7 +263,7 @@ public class PMVMatrix implements GLMatrixFunc {
matrixTStack = new FloatStack( 0, 2*16); // growSize: GL-min size (2)
matrixPStack = new FloatStack( 0, 2*16); // growSize: GL-min size (2)
matrixMvStack= new FloatStack( 0, 16*16); // growSize: half GL-min size (32)
-
+
// default values and mode
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
@@ -275,22 +275,22 @@ public class PMVMatrix implements GLMatrixFunc {
dirtyBits = DIRTY_ALL;
requestMask = 0;
matrixMode = GL_MODELVIEW;
-
+
mulPMV = null;
frustum = null;
}
/** @see #PMVMatrix(boolean) */
- public final boolean usesBackingArray() { return usesBackingArray; }
-
+ public final boolean usesBackingArray() { return usesBackingArray; }
+
public final void destroy() {
if(null!=projectFloat) {
projectFloat.destroy(); projectFloat=null;
}
matrixBuffer=null;
- matrixBuffer=null; matrixPMvMvit=null; matrixPMvMvi=null; matrixPMv=null;
- matrixP=null; matrixTex=null; matrixMv=null; matrixMvi=null; matrixMvit=null;
+ matrixBuffer=null; matrixPMvMvit=null; matrixPMvMvi=null; matrixPMv=null;
+ matrixP=null; matrixTex=null; matrixMv=null; matrixMvi=null; matrixMvit=null;
vec3f = null;
matrixMult = null;
@@ -299,7 +299,7 @@ public class PMVMatrix implements GLMatrixFunc {
matrixScale = null;
matrixOrtho = null;
matrixFrustum = null;
-
+
if(null!=matrixPStack) {
matrixPStack=null;
}
@@ -314,13 +314,13 @@ public class PMVMatrix implements GLMatrixFunc {
}
}
-
+
/** Returns the current matrix-mode, one of {@link GLMatrixFunc#GL_MODELVIEW GL_MODELVIEW}, {@link GLMatrixFunc#GL_PROJECTION GL_PROJECTION} or {@link GL#GL_TEXTURE GL_TEXTURE}. */
public final int glGetMatrixMode() {
return matrixMode;
}
- /**
+ /**
* Returns the {@link GLMatrixFunc#GL_TEXTURE_MATRIX texture matrix} (T).
*
* See matrix storage details.
@@ -330,7 +330,7 @@ public class PMVMatrix implements GLMatrixFunc {
return matrixTex;
}
- /**
+ /**
* Returns the {@link GLMatrixFunc#GL_PROJECTION_MATRIX projection matrix} (P).
*
* See matrix storage details.
@@ -340,7 +340,7 @@ public class PMVMatrix implements GLMatrixFunc {
return matrixP;
}
- /**
+ /**
* Returns the {@link GLMatrixFunc#GL_MODELVIEW_MATRIX modelview matrix} (Mv).
*
* See matrix storage details.
@@ -350,7 +350,7 @@ public class PMVMatrix implements GLMatrixFunc {
return matrixMv;
}
- /**
+ /**
* Returns the inverse {@link GLMatrixFunc#GL_MODELVIEW_MATRIX modelview matrix} (Mvi).
*
* Method enables the Mvi matrix update, and performs it's update w/o clearing the modified bits.
@@ -367,7 +367,7 @@ public class PMVMatrix implements GLMatrixFunc {
return matrixMvi;
}
- /**
+ /**
* Returns the inverse transposed {@link GLMatrixFunc#GL_MODELVIEW_MATRIX modelview matrix} (Mvit).
*
* Method enables the Mvit matrix update, and performs it's update w/o clearing the modified bits.
@@ -383,9 +383,9 @@ public class PMVMatrix implements GLMatrixFunc {
updateImpl(false);
return matrixMvit;
}
-
- /**
- * Returns 2 matrices within one FloatBuffer: {@link #glGetPMatrixf() P} and {@link #glGetMvMatrixf() Mv}.
+
+ /**
+ * Returns 2 matrices within one FloatBuffer: {@link #glGetPMatrixf() P} and {@link #glGetMvMatrixf() Mv}.
*
@@ -393,9 +393,9 @@ public class PMVMatrix implements GLMatrixFunc {
public final FloatBuffer glGetPMvMatrixf() {
return matrixPMv;
}
-
- /**
- * Returns 3 matrices within one FloatBuffer: {@link #glGetPMatrixf() P}, {@link #glGetMvMatrixf() Mv} and {@link #glGetMviMatrixf() Mvi}.
+
+ /**
+ * Returns 3 matrices within one FloatBuffer: {@link #glGetPMatrixf() P}, {@link #glGetMvMatrixf() Mv} and {@link #glGetMviMatrixf() Mvi}.
*
* Method enables the Mvi matrix update, and performs it's update w/o clearing the modified bits.
*
@@ -410,9 +410,9 @@ public class PMVMatrix implements GLMatrixFunc {
updateImpl(false);
return matrixPMvMvi;
}
-
- /**
- * Returns 4 matrices within one FloatBuffer: {@link #glGetPMatrixf() P}, {@link #glGetMvMatrixf() Mv}, {@link #glGetMviMatrixf() Mvi} and {@link #glGetMvitMatrixf() Mvit}.
+
+ /**
+ * Returns 4 matrices within one FloatBuffer: {@link #glGetPMatrixf() P}, {@link #glGetMvMatrixf() Mv}, {@link #glGetMviMatrixf() Mvi} and {@link #glGetMvitMatrixf() Mvit}.
*
* Method enables the Mvi and Mvit matrix update, and performs it's update w/o clearing the modified bits.
*
@@ -427,14 +427,14 @@ public class PMVMatrix implements GLMatrixFunc {
updateImpl(false);
return matrixPMvMvit;
}
-
+
/** Returns the frustum, derived from projection * modelview */
public Frustum glGetFrustum() {
requestMask |= DIRTY_FRUSTUM;
updateImpl(false);
return frustum;
}
-
+
/*
* @return the matrix of the current matrix-mode
*/
@@ -443,7 +443,7 @@ public class PMVMatrix implements GLMatrixFunc {
}
/**
- * @param matrixName Either a matrix-get-name, i.e.
+ * @param matrixName Either a matrix-get-name, i.e.
* {@link GLMatrixFunc#GL_MODELVIEW_MATRIX GL_MODELVIEW_MATRIX}, {@link GLMatrixFunc#GL_PROJECTION_MATRIX GL_PROJECTION_MATRIX} or {@link GLMatrixFunc#GL_TEXTURE_MATRIX GL_TEXTURE_MATRIX},
* or a matrix-mode-name, i.e.
* {@link GLMatrixFunc#GL_MODELVIEW GL_MODELVIEW}, {@link GLMatrixFunc#GL_PROJECTION GL_PROJECTION} or {@link GL#GL_TEXTURE GL_TEXTURE}
@@ -462,10 +462,10 @@ public class PMVMatrix implements GLMatrixFunc {
return matrixTex;
default:
throw new GLException("unsupported matrixName: "+matrixName);
- }
+ }
}
- //
+ //
// GLMatrixFunc implementation
//
@@ -494,7 +494,7 @@ public class PMVMatrix implements GLMatrixFunc {
}
params.position(pos);
}
-
+
@Override
public final void glGetFloatv(int matrixGetName, float[] params, int params_offset) {
if(matrixGetName==GL_MATRIX_MODE) {
@@ -505,7 +505,7 @@ public class PMVMatrix implements GLMatrixFunc {
matrix.reset();
}
}
-
+
@Override
public final void glGetIntegerv(int pname, IntBuffer params) {
int pos = params.position();
@@ -516,7 +516,7 @@ public class PMVMatrix implements GLMatrixFunc {
}
params.position(pos);
}
-
+
@Override
public final void glGetIntegerv(int pname, int[] params, int params_offset) {
if(pname==GL_MATRIX_MODE) {
@@ -537,12 +537,12 @@ public class PMVMatrix implements GLMatrixFunc {
matrixP.put(values, offset, 16);
matrixP.reset();
dirtyBits |= DIRTY_FRUSTUM ;
- modifiedBits |= MODIFIED_PROJECTION;
+ modifiedBits |= MODIFIED_PROJECTION;
} else if(matrixMode==GL.GL_TEXTURE) {
matrixTex.put(values, offset, 16);
matrixTex.reset();
modifiedBits |= MODIFIED_TEXTURE;
- }
+ }
}
@Override
@@ -557,12 +557,12 @@ public class PMVMatrix implements GLMatrixFunc {
matrixP.put(m);
matrixP.reset();
dirtyBits |= DIRTY_FRUSTUM ;
- modifiedBits |= MODIFIED_PROJECTION;
+ modifiedBits |= MODIFIED_PROJECTION;
} else if(matrixMode==GL.GL_TEXTURE) {
matrixTex.put(m);
matrixTex.reset();
modifiedBits |= MODIFIED_TEXTURE;
- }
+ }
m.position(spos);
}
@@ -584,9 +584,9 @@ public class PMVMatrix implements GLMatrixFunc {
@Override
public final void glPushMatrix() {
- if(matrixMode==GL_MODELVIEW) {
+ if(matrixMode==GL_MODELVIEW) {
matrixMvStack.putOnTop(matrixMv, 16);
- matrixMv.reset();
+ matrixMv.reset();
} else if(matrixMode==GL_PROJECTION) {
matrixPStack.putOnTop(matrixP, 16);
matrixP.reset();
@@ -612,8 +612,8 @@ public class PMVMatrix implements GLMatrixFunc {
matrixTex.put(matrixIdent);
matrixTex.reset();
modifiedBits |= MODIFIED_TEXTURE;
- }
- matrixIdent.reset();
+ }
+ matrixIdent.reset();
}
@Override
@@ -629,7 +629,7 @@ public class PMVMatrix implements GLMatrixFunc {
} else if(matrixMode==GL.GL_TEXTURE) {
FloatUtil.multMatrixf(matrixTex, m);
modifiedBits |= MODIFIED_TEXTURE;
- }
+ }
}
@Override
@@ -645,12 +645,12 @@ public class PMVMatrix implements GLMatrixFunc {
} else if(matrixMode==GL.GL_TEXTURE) {
FloatUtil.multMatrixf(matrixTex, m, m_offset);
modifiedBits |= MODIFIED_TEXTURE;
- }
+ }
}
@Override
public final void glTranslatef(final float x, final float y, final float z) {
- // Translation matrix:
+ // Translation matrix:
// 1 0 0 x
// 0 1 0 y
// 0 0 1 z
@@ -665,7 +665,7 @@ public class PMVMatrix implements GLMatrixFunc {
public final void glRotatef(final float angdeg, float x, float y, float z) {
final float angrad = angdeg * (float) Math.PI / 180.0f;
final float c = (float)Math.cos(angrad);
- final float ic= 1.0f - c;
+ final float ic= 1.0f - c;
final float s = (float)Math.sin(angrad);
vec3f[0]=x; vec3f[1]=y; vec3f[2]=z;
@@ -700,7 +700,7 @@ public class PMVMatrix implements GLMatrixFunc {
@Override
public final void glScalef(final float x, final float y, final float z) {
- // Scale matrix:
+ // Scale matrix:
// x 0 0 0
// 0 y 0 0
// 0 0 z 0
@@ -714,7 +714,7 @@ public class PMVMatrix implements GLMatrixFunc {
@Override
public final void glOrthof(final float left, final float right, final float bottom, final float top, final float zNear, final float zFar) {
- // Ortho matrix:
+ // Ortho matrix:
// 2/dx 0 0 tx
// 0 2/dy 0 ty
// 0 0 2/dz tz
@@ -744,7 +744,7 @@ public class PMVMatrix implements GLMatrixFunc {
if(left==right || top==bottom) {
throw new GLException("GL_INVALID_VALUE: top,bottom and left,right must not be equal");
}
- // Frustum matrix:
+ // Frustum matrix:
// 2*zNear/dx 0 A 0
// 0 2*zNear/dy B 0
// 0 0 C D
@@ -774,7 +774,7 @@ public class PMVMatrix implements GLMatrixFunc {
//
// Extra functionality
//
-
+
/**
* {@link #glMultMatrixf(FloatBuffer) Multiply} the {@link #glGetMatrixMode() current matrix} with the perspective/frustum matrix.
*/
@@ -787,7 +787,7 @@ public class PMVMatrix implements GLMatrixFunc {
}
/**
- * {@link #glMultMatrixf(FloatBuffer) Multiply} and {@link #glTranslatef(float, float, float) translate} the {@link #glGetMatrixMode() current matrix}
+ * {@link #glMultMatrixf(FloatBuffer) Multiply} and {@link #glTranslatef(float, float, float) translate} the {@link #glGetMatrixMode() current matrix}
* with the eye, object and orientation.
*/
public final void gluLookAt(float eyex, float eyey, float eyez,
@@ -798,7 +798,7 @@ public class PMVMatrix implements GLMatrixFunc {
/**
* Map object coordinates to window coordinates.
- *
+ *
* @param objx
* @param objy
* @param objz
@@ -815,20 +815,20 @@ public class PMVMatrix implements GLMatrixFunc {
return projectFloat.gluProject(objx, objy, objz,
matrixMv.array(), matrixMv.position(),
matrixP.array(), matrixP.position(),
- viewport, viewport_offset,
+ viewport, viewport_offset,
win_pos, win_pos_offset);
} else {
return projectFloat.gluProject(objx, objy, objz,
matrixMv,
matrixP,
- viewport, viewport_offset,
+ viewport, viewport_offset,
win_pos, win_pos_offset);
}
}
/**
* Map window coordinates to object coordinates.
- *
+ *
* @param winx
* @param winy
* @param winz
@@ -845,23 +845,23 @@ public class PMVMatrix implements GLMatrixFunc {
return projectFloat.gluUnProject(winx, winy, winz,
matrixMv.array(), matrixMv.position(),
matrixP.array(), matrixP.position(),
- viewport, viewport_offset,
+ viewport, viewport_offset,
obj_pos, obj_pos_offset);
} else {
return projectFloat.gluUnProject(winx, winy, winz,
matrixMv,
matrixP,
- viewport, viewport_offset,
+ viewport, viewport_offset,
obj_pos, obj_pos_offset);
- }
+ }
}
-
+
public final void gluPickMatrix(float x, float y,
float deltaX, float deltaY,
int[] viewport, int viewport_offset) {
projectFloat.gluPickMatrix(this, x, y, deltaX, deltaY, viewport, viewport_offset);
}
-
+
public StringBuilder toString(StringBuilder sb, String f) {
if(null == sb) {
sb = new StringBuilder();
@@ -874,8 +874,8 @@ public class PMVMatrix implements GLMatrixFunc {
final boolean frustumReq = 0 != (DIRTY_FRUSTUM & requestMask);
final boolean modP = 0 != ( MODIFIED_PROJECTION & modifiedBits );
final boolean modMv = 0 != ( MODIFIED_MODELVIEW & modifiedBits );
- final boolean modT = 0 != ( MODIFIED_TEXTURE & modifiedBits );
-
+ final boolean modT = 0 != ( MODIFIED_TEXTURE & modifiedBits );
+
sb.append("PMVMatrix[backingArray ").append(this.usesBackingArray());
sb.append(", modified[P ").append(modP).append(", Mv ").append(modMv).append(", T ").append(modT);
sb.append("], dirty/req[Mvi ").append(mviDirty).append("/").append(mviReq).append(", Mvit ").append(mvitDirty).append("/").append(mvitReq).append(", Frustum ").append(frustumDirty).append("/").append(frustumReq);
@@ -887,28 +887,28 @@ public class PMVMatrix implements GLMatrixFunc {
matrixToString(sb, f, matrixTex);
if( 0 != ( requestMask & DIRTY_INVERSE_MODELVIEW ) ) {
sb.append(", Inverse Modelview").append(Platform.NEWLINE);
- matrixToString(sb, f, matrixMvi);
+ matrixToString(sb, f, matrixMvi);
}
if( 0 != ( requestMask & DIRTY_INVERSE_TRANSPOSED_MODELVIEW ) ) {
sb.append(", Inverse Transposed Modelview").append(Platform.NEWLINE);
- matrixToString(sb, f, matrixMvit);
+ matrixToString(sb, f, matrixMvit);
}
sb.append("]");
return sb;
}
-
+
public String toString() {
return toString(null, "%10.5f").toString();
}
- /**
+ /**
* Returns the modified bits due to mutable operations..
*
* A modified bit is set, if the corresponding matrix had been modified by a mutable operation
* since last {@link #update()} or {@link #getModifiedBits(boolean) getModifiedBits(true)} call.
*
* @param clear if true, clears the modified bits, otherwise leaves them untouched.
- *
+ *
* @see #MODIFIED_PROJECTION
* @see #MODIFIED_MODELVIEW
* @see #MODIFIED_TEXTURE
@@ -920,16 +920,16 @@ public class PMVMatrix implements GLMatrixFunc {
}
return r;
}
-
- /**
+
+ /**
* Returns the dirty bits due to mutable operations.
*
* A dirty bit is set , if the corresponding matrix had been modified by a mutable operation
* since last {@link #update()} call. The latter clears the dirty state only if the dirty matrix (Mvi or Mvit) or {@link Frustum}
- * has been requested by one of the {@link #glGetMviMatrixf() Mvi get}, {@link #glGetMvitMatrixf() Mvit get}
+ * has been requested by one of the {@link #glGetMviMatrixf() Mvi get}, {@link #glGetMvitMatrixf() Mvit get}
* or {@link #glGetFrustum() Frustum get} methods.
*
- *
+ *
* @deprecated Function is exposed for debugging purposes only.
* @see #DIRTY_INVERSE_MODELVIEW
* @see #DIRTY_INVERSE_TRANSPOSED_MODELVIEW
@@ -944,12 +944,12 @@ public class PMVMatrix implements GLMatrixFunc {
return dirtyBits;
}
- /**
+ /**
* Returns the request bit mask, which uses bit values equal to the dirty mask.
*
- * The request bit mask is set by one of the {@link #glGetMviMatrixf() Mvi get}, {@link #glGetMvitMatrixf() Mvit get}
+ * The request bit mask is set by one of the {@link #glGetMviMatrixf() Mvi get}, {@link #glGetMvitMatrixf() Mvit get}
* or {@link #glGetFrustum() Frustum get} methods.
- *
+ *
*
* @deprecated Function is exposed for debugging purposes only.
* @see #clearAllUpdateRequests()
@@ -965,16 +965,16 @@ public class PMVMatrix implements GLMatrixFunc {
public final int getRequestMask() {
return requestMask;
}
-
-
+
+
/**
* Clears all {@link #update()} requests of the Mvi and Mvit matrix and Frustum
- * after it has been enabled by one of the {@link #glGetMviMatrixf() Mvi get}, {@link #glGetMvitMatrixf() Mvit get}
+ * after it has been enabled by one of the {@link #glGetMviMatrixf() Mvi get}, {@link #glGetMvitMatrixf() Mvit get}
* or {@link #glGetFrustum() Frustum get} methods.
*
* Allows user to disable subsequent Mvi, Mvit and {@link Frustum} updates if no more required.
- *
- *
+ *
+ *
* @see #glGetMviMatrixf()
* @see #glGetMvitMatrixf()
* @see #glGetPMvMviMatrixf()
@@ -983,14 +983,14 @@ public class PMVMatrix implements GLMatrixFunc {
* @see #getRequestMask()
*/
public final void clearAllUpdateRequests() {
- requestMask &= ~DIRTY_ALL;
+ requestMask &= ~DIRTY_ALL;
}
-
+
/**
* Update the derived {@link #glGetMviMatrixf() inverse modelview (Mvi)},
- * {@link #glGetMvitMatrixf() inverse transposed modelview (Mvit)} matrices and {@link Frustum}
- * if they are dirty and they were requested
- * by one of the {@link #glGetMviMatrixf() Mvi get}, {@link #glGetMvitMatrixf() Mvit get}
+ * {@link #glGetMvitMatrixf() inverse transposed modelview (Mvit)} matrices and {@link Frustum}
+ * if they are dirty and they were requested
+ * by one of the {@link #glGetMviMatrixf() Mvi get}, {@link #glGetMvitMatrixf() Mvit get}
* or {@link #glGetFrustum() Frustum get} methods.
*
* The Mvi and Mvit matrices and {@link Frustum} are considered dirty, if their corresponding
@@ -999,7 +999,7 @@ public class PMVMatrix implements GLMatrixFunc {
*
* Method should be called manually in case mutable operations has been called
* and caller operates on already fetched references, i.e. not calling
- * {@link #glGetMviMatrixf() Mvi get}, {@link #glGetMvitMatrixf() Mvit get}
+ * {@link #glGetMviMatrixf() Mvi get}, {@link #glGetMvitMatrixf() Mvit get}
* or {@link #glGetFrustum() Frustum get} etc anymore.
*
*
@@ -1007,12 +1007,12 @@ public class PMVMatrix implements GLMatrixFunc {
* which are set by any mutable operation. The modified bits have no impact
* on this method, but the return value.
*
- *
- * @return true if any matrix has been modified since last update call or
+ *
+ * @return true if any matrix has been modified since last update call or
* if the derived matrices Mvi and Mvit or {@link Frustum} were updated, otherwise false.
* In other words, method returns true if any matrix used by the caller must be updated,
* e.g. uniforms in a shader program.
- *
+ *
* @see #getModifiedBits(boolean)
* @see #MODIFIED_PROJECTION
* @see #MODIFIED_MODELVIEW
@@ -1035,7 +1035,7 @@ public class PMVMatrix implements GLMatrixFunc {
if(clearModBits) {
modifiedBits = 0;
}
-
+
if( 0 != ( dirtyBits & ( DIRTY_FRUSTUM & requestMask ) ) ) {
if( null == frustum ) {
frustum = new Frustum();
@@ -1046,7 +1046,7 @@ public class PMVMatrix implements GLMatrixFunc {
dirtyBits &= ~DIRTY_FRUSTUM;
mod = true;
}
-
+
if( 0 == ( dirtyBits & requestMask ) ) {
return mod; // nothing more requested which may have been dirty
}
@@ -1061,9 +1061,9 @@ public class PMVMatrix implements GLMatrixFunc {
}
return setMviMvitNIODirectAccess() || mod;
}
-
+
//
- // private
+ // private
//
private int nioBackupArraySupported = 0; // -1 not supported, 0 - TBD, 1 - supported
private final String msgCantComputeInverse = "Invalid source Mv matrix, can't compute inverse";
@@ -1080,7 +1080,7 @@ public class PMVMatrix implements GLMatrixFunc {
res = true;
}
if( 0 != ( requestMask & ( dirtyBits & DIRTY_INVERSE_TRANSPOSED_MODELVIEW ) ) ) { // only if requested & dirty
- // transpose matrix
+ // transpose matrix
final float[] _matrixMvit = matrixMvit.array();
final int _matrixMvitOffset = matrixMvit.position();
for (int i = 0; i < 4; i++) {
@@ -1093,7 +1093,7 @@ public class PMVMatrix implements GLMatrixFunc {
}
return res;
}
-
+
private final boolean setMviMvitNIODirectAccess() {
boolean res = false;
if( 0 != ( dirtyBits & DIRTY_INVERSE_MODELVIEW ) ) { // only if dirt; always requested at this point, see update()
@@ -1104,7 +1104,7 @@ public class PMVMatrix implements GLMatrixFunc {
res = true;
}
if( 0 != ( requestMask & ( dirtyBits & DIRTY_INVERSE_TRANSPOSED_MODELVIEW ) ) ) { // only if requested & dirty
- // transpose matrix
+ // transpose matrix
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
matrixMvit.put(j+i*4, matrixMvi.get(i+j*4));
diff --git a/src/jogl/classes/com/jogamp/opengl/util/RandomTileRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/RandomTileRenderer.java
index a2b7ba343..b00866dd9 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/RandomTileRenderer.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/RandomTileRenderer.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -35,14 +35,14 @@ import javax.media.opengl.GLException;
import com.jogamp.opengl.util.GLPixelBuffer.GLPixelAttributes;
/**
- * Variation of {@link TileRenderer} w/o using fixed tiles but arbitrary rectangular regions.
+ * Variation of {@link TileRenderer} w/o using fixed tiles but arbitrary rectangular regions.
*
* See {@link TileRendererBase} for details.
*
*/
public class RandomTileRenderer extends TileRendererBase {
private boolean tileRectSet = false;
-
+
/**
* Creates a new TileRenderer object
*/
@@ -72,15 +72,15 @@ public class RandomTileRenderer extends TileRendererBase {
/**
* Set the tile rectangle for the subsequent rendering calls.
- *
- * @throws IllegalArgumentException is tile x/y are < 0 or tile size is <= 0x0
+ *
+ * @throws IllegalArgumentException is tile x/y are < 0 or tile size is <= 0x0
*/
public void setTileRect(int tX, int tY, int tWidth, int tHeight) throws IllegalStateException, IllegalArgumentException {
if( 0 > tX || 0 > tX ) {
- throw new IllegalArgumentException("Tile pos must be >= 0/0");
+ throw new IllegalArgumentException("Tile pos must be >= 0/0");
}
if( 0 >= tWidth || 0 >= tHeight ) {
- throw new IllegalArgumentException("Tile size must be > 0x0");
+ throw new IllegalArgumentException("Tile size must be > 0x0");
}
this.currentTileXPos = tX;
this.currentTileYPos = tY;
@@ -88,57 +88,57 @@ public class RandomTileRenderer extends TileRendererBase {
this.currentTileHeight = tHeight;
tileRectSet = true;
}
-
+
@Override
public final boolean isSetup() {
return 0 < imageSize.getWidth() && 0 < imageSize.getHeight() && tileRectSet;
}
-
+
/**
* {@inheritDoc}
- *
- *
+ *
+ *
* end of tiling is never reached w/ {@link RandomRileRenderer},
* i.e. method always returns false.
*
*/
@Override
public final boolean eot() { return false; }
-
+
/**
* {@inheritDoc}
- *
+ *
* Reset internal states of {@link RandomTileRenderer} are: none.
*/
@Override
public final void reset() { }
-
+
/**
* {@inheritDoc}
- *
- * @throws IllegalStateException if {@link #setImageSize(int, int) image-size} has not been set or
+ *
+ * @throws IllegalStateException if {@link #setImageSize(int, int) image-size} has not been set or
* {@link #setTileRect(int, int, int, int) tile-rect} has not been set.
*/
@Override
public final void beginTile(GL gl) throws IllegalStateException, GLException {
if( 0 >= imageSize.getWidth() || 0 >= imageSize.getHeight() ) {
- throw new IllegalStateException("Image size has not been set");
+ throw new IllegalStateException("Image size has not been set");
}
if( !tileRectSet ) {
throw new IllegalStateException("tileRect has not been set");
}
validateGL(gl);
-
+
gl.glViewport( 0, 0, currentTileWidth, currentTileHeight );
-
+
if( DEBUG ) {
System.err.println("TileRenderer.begin.X: "+this.toString());
}
-
+
// Do not forget to issue:
// reshape( 0, 0, tW, tH );
// which shall reflect tile renderer fileds: currentTileXPos, currentTileYPos and imageSize
-
+
beginCalled = true;
}
@@ -148,7 +148,7 @@ public class RandomTileRenderer extends TileRendererBase {
throw new IllegalStateException("beginTile(..) has not been called");
}
validateGL(gl);
-
+
// be sure OpenGL rendering is finished
gl.glFlush();
@@ -220,13 +220,13 @@ public class RandomTileRenderer extends TileRendererBase {
/* restore previous glPixelStore values */
psm.restore(gl);
-
+
beginCalled = false;
}
-
+
/**
* Rendering one tile, by simply calling {@link GLAutoDrawable#display()}.
- *
+ *
* @throws IllegalStateException if no {@link GLAutoDrawable} is {@link #attachAutoDrawable(GLAutoDrawable) attached}
* or imageSize is not set
*/
diff --git a/src/jogl/classes/com/jogamp/opengl/util/TGAWriter.java b/src/jogl/classes/com/jogamp/opengl/util/TGAWriter.java
index b949f0e39..47d56bcb1 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/TGAWriter.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/TGAWriter.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,7 +28,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
@@ -46,7 +46,7 @@ import java.nio.channels.*;
* class; can also be used in conjunction with the {@link com.jogamp.opengl.util.gl2.TileRenderer} class.
*/
public class TGAWriter {
-
+
private static final int TARGA_HEADER_SIZE = 18;
private FileChannel ch;
@@ -91,7 +91,7 @@ public class TGAWriter {
image.put(14, (byte) (height & 0xFF)); // height
image.put(15, (byte) (height >> 8)); // height
image.put(16, (byte) pixelSize); // pixel size
-
+
// go to image data position
image.position(TARGA_HEADER_SIZE);
// jogl needs a sliced buffer
diff --git a/src/jogl/classes/com/jogamp/opengl/util/TileRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/TileRenderer.java
index 999db77a9..7f86b14c6 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/TileRenderer.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/TileRenderer.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,18 +20,18 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
- *
+ *
* ---------------------
- *
+ *
* Based on Brian Paul's tile rendering library, found
* at http://www.mesa3d.org/brianp/TR.html.
- *
- * Copyright (C) 1997-2005 Brian Paul.
- * Licensed under BSD-compatible terms with permission of the author.
+ *
+ * Copyright (C) 1997-2005 Brian Paul.
+ * Licensed under BSD-compatible terms with permission of the author.
* See LICENSE.txt for license information.
*/
package com.jogamp.opengl.util;
@@ -60,7 +60,7 @@ import com.jogamp.opengl.util.GLPixelBuffer.GLPixelAttributes;
*
* See {@link TileRendererBase} for details.
*
- *
+ *
* @author ryanm, sgothel
*/
public class TileRenderer extends TileRendererBase {
@@ -150,7 +150,7 @@ public class TileRenderer extends TileRendererBase {
.append("rowOrder "+rowOrder+", offset/size "+offsetX+"/"+offsetY+" "+tileSize.getWidth()+"x"+tileSize.getHeight()+" brd "+tileBorder+", ");
return super.tileDetails(sb);
}
-
+
/**
* Creates a new TileRenderer object
*/
@@ -169,7 +169,7 @@ public class TileRenderer extends TileRendererBase {
super.setImageSize(width, height);
reset();
}
-
+
/**
* Clips the image-size this tile-renderer iterates through,
* which can be retrieved via {@link #getClippedImageSize()}.
@@ -179,7 +179,7 @@ public class TileRenderer extends TileRendererBase {
*
* Implementation {@link #reset()} internal states.
*
- *
+ *
* @param width The image-clipping.width
* @param height The image-clipping.height
* @see #getClippedImageSize()
@@ -208,7 +208,7 @@ public class TileRenderer extends TileRendererBase {
* {@link #TR_IMAGE_CLIPPING_HEIGHT}.
*
*/
- public final DimensionImmutable getClippedImageSize() {
+ public final DimensionImmutable getClippedImageSize() {
if( null != imageClippingDim ) {
return new Dimension(Math.min(imageClippingDim.getWidth(), imageSize.getWidth()),
Math.min(imageClippingDim.getHeight(), imageSize.getHeight()) );
@@ -224,7 +224,7 @@ public class TileRenderer extends TileRendererBase {
*
* Implementation {@link #reset()} internal states.
*
- *
+ *
* @param width
* The width of the tiles. Must not be larger than the GL
* context
@@ -238,10 +238,10 @@ public class TileRenderer extends TileRendererBase {
*/
public final void setTileSize(int width, int height, int border) {
if( 0 > border ) {
- throw new IllegalArgumentException("Tile border must be >= 0");
+ throw new IllegalArgumentException("Tile border must be >= 0");
}
if( 2 * border >= width || 2 * border >= height ) {
- throw new IllegalArgumentException("Tile size must be > 0x0 minus 2*border");
+ throw new IllegalArgumentException("Tile size must be > 0x0 minus 2*border");
}
tileBorder = border;
tileSize.set( width, height );
@@ -249,7 +249,7 @@ public class TileRenderer extends TileRendererBase {
reset();
}
- /**
+ /**
* Sets an xy offset for the resulting tiles
* {@link TileRendererBase#TR_CURRENT_TILE_X_POS x-pos} and {@link TileRendererBase#TR_CURRENT_TILE_Y_POS y-pos}.
* @see #TR_TILE_X_OFFSET
@@ -259,12 +259,12 @@ public class TileRenderer extends TileRendererBase {
offsetX = xoff;
offsetY = yoff;
}
-
+
/**
* {@inheritDoc}
- *
+ *
* Reset internal states of {@link TileRenderer} are:
- *
+ *
*
{@link #TR_ROWS}
*
{@link #TR_COLUMNS}
*
{@link #TR_CURRENT_COLUMN}
@@ -291,13 +291,13 @@ public class TileRenderer extends TileRendererBase {
assert columns >= 0;
assert rows >= 0;
-
+
beginCalled = false;
isInit = true;
}
/* pp */ final int getCurrentTile() { return currentTile; }
-
+
@Override
public final int getParam(int pname) {
switch (pname) {
@@ -346,7 +346,7 @@ public class TileRenderer extends TileRendererBase {
/**
* Sets the order of row traversal, default is {@link #TR_BOTTOM_TO_TOP}.
- *
+ *
* @param order The row traversal order, must be either {@link #TR_TOP_TO_BOTTOM} or {@link #TR_BOTTOM_TO_TOP}.
*/
public final void setRowOrder(int order) {
@@ -361,11 +361,11 @@ public class TileRenderer extends TileRendererBase {
public final boolean isSetup() {
return 0 < imageSize.getWidth() && 0 < imageSize.getHeight();
}
-
+
/**
* {@inheritDoc}
- *
- *
+ *
+ *
* end of tiling is reached w/ {@link TileRenderer}, if at least one of the following is true:
*
*
all tiles have been rendered, i.e. {@link #TR_CURRENT_TILE_NUM} is -1
@@ -378,13 +378,13 @@ public class TileRenderer extends TileRendererBase {
if ( !isInit ) { // ensure at least one reset-call
reset();
}
- return 0 > currentTile || 0 >= columns*rows;
+ return 0 > currentTile || 0 >= columns*rows;
}
-
+
/**
* {@inheritDoc}
- *
- * @throws IllegalStateException if {@link #setImageSize(int, int) image-size} has not been set or
+ *
+ * @throws IllegalStateException if {@link #setImageSize(int, int) image-size} has not been set or
* {@link #eot() end-of-tiling} has been reached.
*/
@Override
@@ -396,7 +396,7 @@ public class TileRenderer extends TileRendererBase {
throw new IllegalStateException("EOT reached: "+this);
}
validateGL(gl);
-
+
/* which tile (by row and column) we're about to render */
if (rowOrder == TR_BOTTOM_TO_TOP) {
currentRow = currentTile / columns;
@@ -434,11 +434,11 @@ public class TileRenderer extends TileRendererBase {
currentTileHeight = tH;
gl.glViewport( 0, 0, tW, tH );
-
+
if( DEBUG ) {
System.err.println("TileRenderer.begin: "+this.toString());
}
-
+
// Do not forget to issue:
// reshape( 0, 0, tW, tH );
// which shall reflect tile renderer tiles: currentTileXPos, currentTileYPos and imageSize
@@ -454,7 +454,7 @@ public class TileRenderer extends TileRendererBase {
// be sure OpenGL rendering is finished
gl.glFlush();
-
+
// save current glPixelStore values
psm.save(gl);
psm.setPackAlignment(gl, 1);
@@ -467,13 +467,13 @@ public class TileRenderer extends TileRendererBase {
} else {
gl2es3 = null;
readBuffer = 0; // undef. probably default: GL_FRONT (single buffering) GL_BACK (double buffering)
- }
+ }
if( DEBUG ) {
System.err.println("TileRenderer.end.0: readBuffer 0x"+Integer.toHexString(readBuffer)+", "+this.toString());
}
-
+
final int tmp[] = new int[1];
-
+
if( tileBuffer != null ) {
final GLPixelAttributes pixelAttribs = tileBuffer.pixelAttributes;
final int srcX = tileBorder;
@@ -527,7 +527,7 @@ public class TileRenderer extends TileRendererBase {
psm.restore(gl);
beginCalled = false;
-
+
/* increment tile counter, return 1 if more tiles left to render */
currentTile++;
if( currentTile >= rows * columns ) {
diff --git a/src/jogl/classes/com/jogamp/opengl/util/TileRendererBase.java b/src/jogl/classes/com/jogamp/opengl/util/TileRendererBase.java
index 0553d5673..ff7cc5516 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/TileRendererBase.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/TileRendererBase.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,18 +20,18 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
- *
+ *
* ---------------------
- *
+ *
* Based on Brian Paul's tile rendering library, found
* at http://www.mesa3d.org/brianp/TR.html.
- *
- * Copyright (C) 1997-2005 Brian Paul.
- * Licensed under BSD-compatible terms with permission of the author.
+ *
+ * Copyright (C) 1997-2005 Brian Paul.
+ * Licensed under BSD-compatible terms with permission of the author.
* See LICENSE.txt for license information.
*/
package com.jogamp.opengl.util;
@@ -66,17 +66,17 @@ import jogamp.opengl.Debug;
* The PMV matrix needs to be reshaped in user code
* after calling {@link #beginTile(GL)}, See {@link #beginTile(GL)}.
*
- *
+ *
* If {@link #attachAutoDrawable(GLAutoDrawable) attaching to} an {@link GLAutoDrawable},
* the {@link TileRendererListener#reshapeTile(TileRendererBase, int, int, int, int, int, int)} method
* is being called after {@link #beginTile(GL)} for each rendered tile.
- * It's implementation shall reshape the PMV matrix according to {@link #beginTile(GL)}.
+ * It's implementation shall reshape the PMV matrix according to {@link #beginTile(GL)}.
*
- * Note that {@link #setImageBuffer(GLPixelBuffer) image buffer} can only be used
+ * Note that {@link #setImageBuffer(GLPixelBuffer) image buffer} can only be used
* in conjunction w/ a {@link GL} instance ≥ {@link GL2ES3} passed to {@link #beginTile(GL)} and {@link #endTile(GL)}.
- * This is due to setting up the {@link GL2ES3#GL_PACK_ROW_LENGTH pack row length}
+ * This is due to setting up the {@link GL2ES3#GL_PACK_ROW_LENGTH pack row length}
* for an {@link #setImageSize(int, int) image width} != tile-width, which usually is the case.
* Hence a {@link GLException} is thrown in both methods,
* if using an {@link #setImageBuffer(GLPixelBuffer) image buffer}
@@ -86,7 +86,7 @@ import jogamp.opengl.Debug;
* Further more, reading back of MSAA buffers is only supported since {@link GL2ES3}
* since it requires to set the {@link GL2ES3#glReadBuffer(int) read-buffer}.
*
- *
+ *
* @author ryanm, sgothel
*/
public abstract class TileRendererBase {
@@ -114,16 +114,16 @@ public abstract class TileRendererBase {
* The height of the current tile. See {@link #getParam(int)}.
*/
public static final int TR_CURRENT_TILE_HEIGHT = 6;
-
+
/* pp */ static final boolean DEBUG = Debug.debug("TileRenderer");
-
- /**
+
+ /**
* Listener for tile renderer events, intended to extend {@link GLEventListener} implementations,
* enabling tile rendering via {@link TileRendererBase#attachAutoDrawable(GLAutoDrawable)}.
*/
public static interface TileRendererListener {
- /**
- * The owning {@link GLAutoDrawable} is {@link TileRendererBase#attachAutoDrawable(GLAutoDrawable) attached}
+ /**
+ * The owning {@link GLAutoDrawable} is {@link TileRendererBase#attachAutoDrawable(GLAutoDrawable) attached}
* to the given {@link TileRendererBase} instance.
*
* The {@link GLContext} of the {@link TileRendererBase}'s {@link TileRendererBase#getAttachedDrawable() attached} {@link GLAutoDrawable}
@@ -133,9 +133,9 @@ public abstract class TileRendererBase {
* @see TileRendererBase#getAttachedDrawable()
*/
public void addTileRendererNotify(TileRendererBase tr);
-
- /**
- * The owning {@link GLAutoDrawable} is {@link TileRendererBase#detachAutoDrawable() detached}
+
+ /**
+ * The owning {@link GLAutoDrawable} is {@link TileRendererBase#detachAutoDrawable() detached}
* from the given {@link TileRendererBase} instance.
*
* The {@link GLContext} of the {@link TileRendererBase}'s {@link TileRendererBase#getAttachedDrawable() attached} {@link GLAutoDrawable}
@@ -145,10 +145,10 @@ public abstract class TileRendererBase {
* @see TileRendererBase#getAttachedDrawable()
*/
public void removeTileRendererNotify(TileRendererBase tr);
-
- /**
+
+ /**
* Called by the {@link TileRendererBase} during tile-rendering via an
- * {@link TileRendererBase#getAttachedDrawable() attached} {@link GLAutoDrawable}'s
+ * {@link TileRendererBase#getAttachedDrawable() attached} {@link GLAutoDrawable}'s
* {@link GLAutoDrawable#display()} call for each tile before {@link #display(GLAutoDrawable)}.
*
* The PMV Matrix shall be reshaped
@@ -175,14 +175,14 @@ public abstract class TileRendererBase {
* @see TileRendererBase#getAttachedDrawable()
*/
public void reshapeTile(TileRendererBase tr,
- int tileX, int tileY, int tileWidth, int tileHeight,
+ int tileX, int tileY, int tileWidth, int tileHeight,
int imageWidth, int imageHeight);
/**
- * Called by the {@link TileRendererBase} during tile-rendering
+ * Called by the {@link TileRendererBase} during tile-rendering
* after {@link TileRendererBase#beginTile(GL)} and before {@link #reshapeTile(TileRendererBase, int, int, int, int, int, int) reshapeTile(..)}.
*
- * If {@link TileRendererBase} is of type {@link TileRenderer},
+ * If {@link TileRendererBase} is of type {@link TileRenderer},
* method is called for the first tile of all tiles.
* Otherwise, i.e. {@link RandomTileRenderer}, method is called for each particular tile.
*
@@ -193,12 +193,12 @@ public abstract class TileRendererBase {
* @param tr the issuing {@link TileRendererBase}
*/
public void startTileRendering(TileRendererBase tr);
-
+
/**
* Called by the {@link TileRenderer} during tile-rendering
* after {@link TileRendererBase#endTile(GL)} and {@link GLAutoDrawable#swapBuffers()}.
*
- * If {@link TileRendererBase} is of type {@link TileRenderer},
+ * If {@link TileRendererBase} is of type {@link TileRenderer},
* method is called for the last tile of all tiles.
* Otherwise, i.e. {@link RandomTileRenderer}, method is called for each particular tile.
*
@@ -210,7 +210,7 @@ public abstract class TileRendererBase {
*/
public void endTileRendering(TileRendererBase tr);
}
-
+
protected final Dimension imageSize = new Dimension(0, 0);
protected final GLPixelStorageModes psm = new GLPixelStorageModes();
protected GLPixelBuffer imageBuffer;
@@ -249,24 +249,24 @@ public abstract class TileRendererBase {
return getClass().getSimpleName()+
"["+toString(sb).toString()+"]";
}
-
+
protected TileRendererBase() {
}
/**
* Gets the parameters of this TileRenderer object
- *
+ *
* @param pname The parameter name that is to be retrieved
* @return the value of the parameter
* @throws IllegalArgumentException if pname is not handled
*/
public abstract int getParam(int pname) throws IllegalArgumentException;
-
+
/**
* Specify a buffer the tiles to be copied to. This is not
* necessary for the creation of the final image, but useful if you
* want to inspect each tile in turn.
- *
+ *
* @param buffer The buffer itself. Must be large enough to contain a random tile
*/
public final void setTileBuffer(GLPixelBuffer buffer) {
@@ -281,7 +281,7 @@ public abstract class TileRendererBase {
/**
* Sets the desired size of the final image
- *
+ *
* @param width The width of the final image
* @param height The height of the final image
*/
@@ -294,7 +294,7 @@ public abstract class TileRendererBase {
/**
* Sets the buffer in which to store the final image
- *
+ *
* @param buffer the buffer itself, must be large enough to hold the final image
*/
public final void setImageBuffer(GLPixelBuffer buffer) {
@@ -310,16 +310,16 @@ public abstract class TileRendererBase {
/* pp */ final void validateGL(GL gl) throws GLException {
if( imageBuffer != null && !gl.isGL2ES3()) {
throw new GLException("Using image-buffer w/ inssufficient GL context: "+gl.getContext().getGLVersion()+", "+gl.getGLProfile());
- }
+ }
}
-
- /**
+
+ /**
* Returns true if this instance is setup properly, i.e. {@link #setImageSize(int, int)} ..,
* and ready for {@link #beginTile(GL)}.
* Otherwise returns false.
*/
public abstract boolean isSetup();
-
+
/**
* Returns true if end of tiling has been reached, otherwise false.
*
@@ -331,7 +331,7 @@ public abstract class TileRendererBase {
*
*/
public abstract boolean eot();
-
+
/**
* Method resets implementation's internal state to start of tiling
* as required for {@link #beginTile(GL)} if {@link #eot() end of tiling} has been reached.
@@ -340,7 +340,7 @@ public abstract class TileRendererBase {
*
*/
public abstract void reset();
-
+
/**
* Begins rendering a tile.
*
@@ -367,7 +367,7 @@ public abstract class TileRendererBase {
*
*
* Use shall render the scene afterwards, concluded with a call to
- * this renderer {@link #endTile(GL)}.
+ * this renderer {@link #endTile(GL)}.
*
*
* User has to comply with the GL profile requirement.
@@ -376,10 +376,10 @@ public abstract class TileRendererBase {
* If {@link #eot() end of tiling} has been reached,
* user needs to {@link #reset()} tiling before calling this method.
*
- *
+ *
* @param gl The gl context
* @throws IllegalStateException if {@link #setImageSize(int, int) image-size} is undefined,
- * an {@link #isSetup() implementation related setup} has not be performed
+ * an {@link #isSetup() implementation related setup} has not be performed
* or {@ link #eot()} has been reached. See implementing classes.
* @throws GLException if {@link #setImageBuffer(GLPixelBuffer) image buffer} is used but gl instance is < {@link GL2ES3}
* @see #isSetup()
@@ -387,7 +387,7 @@ public abstract class TileRendererBase {
* @see #reset()
*/
public abstract void beginTile(GL gl) throws IllegalStateException, GLException;
-
+
/**
* Must be called after rendering the scene,
* see {@link #beginTile(GL)}.
@@ -399,13 +399,13 @@ public abstract class TileRendererBase {
*
- *
+ *
* @param gl the gl context
* @throws IllegalStateException if beginTile(gl) has not been called
* @throws GLException if {@link #setImageBuffer(GLPixelBuffer) image buffer} is used but gl instance is < {@link GL2ES3}
*/
public abstract void endTile( GL gl ) throws IllegalStateException, GLException;
-
+
/**
* Determines whether the chosen {@link GLCapabilitiesImmutable}
* requires a pre-{@link GLDrawable#swapBuffers() swap-buffers}
@@ -417,18 +417,18 @@ public abstract class TileRendererBase {
* Here {@link GLDrawable#swapBuffers() swap-buffers} shall happen after calling {@link #endTile(GL)}, the default.
*
*
- * However, multisampling offscreen {@link GLFBODrawable}s
+ * However, multisampling offscreen {@link GLFBODrawable}s
* utilize {@link GLDrawable#swapBuffers() swap-buffers} to downsample
* the multisamples into the readable sampling sink.
- * In this case, we require a {@link GLDrawable#swapBuffers() swap-buffers} before calling {@link #endTile(GL)}.
- *
- * @param chosenCaps the chosen {@link GLCapabilitiesImmutable}
+ * In this case, we require a {@link GLDrawable#swapBuffers() swap-buffers} before calling {@link #endTile(GL)}.
+ *
+ * @param chosenCaps the chosen {@link GLCapabilitiesImmutable}
* @return chosenCaps.isFBO() && chosenCaps.getSampleBuffers()
*/
public final boolean reqPreSwapBuffers(GLCapabilitiesImmutable chosenCaps) {
return chosenCaps.isFBO() && chosenCaps.getSampleBuffers();
}
-
+
/**
* Attaches the given {@link GLAutoDrawable} to this tile renderer.
*
@@ -440,17 +440,17 @@ public abstract class TileRendererBase {
*
* The {@link GLAutoDrawable}'s {@link GLAutoDrawable#getAutoSwapBufferMode() auto-swap mode} is cached
* and set to false, since {@link GLAutoDrawable#swapBuffers() swapBuffers()} maybe issued before {@link #endTile(GL)},
- * see {@link #reqPreSwapBuffers(GLCapabilitiesImmutable)}.
+ * see {@link #reqPreSwapBuffers(GLCapabilitiesImmutable)}.
*
*
- * This tile renderer's internal {@link GLEventListener} is then added to the attached {@link GLAutoDrawable}
+ * This tile renderer's internal {@link GLEventListener} is then added to the attached {@link GLAutoDrawable}
* to handle the tile rendering, replacing the original {@link GLEventListener}.
* It's {@link GLEventListener#display(GLAutoDrawable) display} implementations issues:
*
@@ -468,7 +468,7 @@ public abstract class TileRendererBase {
* since it's called after {@link #endTile(GL)}.
*
*
- * Call {@link #detachAutoDrawable()} to remove the attached {@link GLAutoDrawable} from this tile renderer
+ * Call {@link #detachAutoDrawable()} to remove the attached {@link GLAutoDrawable} from this tile renderer
* and to restore it's original {@link GLEventListener}.
*
* @param glad the {@link GLAutoDrawable} to attach.
@@ -481,7 +481,7 @@ public abstract class TileRendererBase {
throw new IllegalStateException("GLAutoDrawable already attached");
}
this.glad = glad;
-
+
final int aSz = glad.getGLEventListenerCount();
listeners = new GLEventListener[aSz];
listenersInit = new boolean[aSz];
@@ -510,11 +510,11 @@ public abstract class TileRendererBase {
}
}
- /**
- * Returns a previously {@link #attachAutoDrawable(GLAutoDrawable) attached} {@link GLAutoDrawable},
+ /**
+ * Returns a previously {@link #attachAutoDrawable(GLAutoDrawable) attached} {@link GLAutoDrawable},
* null if none is attached.
*
- * If called from {@link TileRendererListener#addTileRendererNotify(TileRendererBase)}
+ * If called from {@link TileRendererListener#addTileRendererNotify(TileRendererBase)}
* or {@link TileRendererListener#removeTileRendererNotify(TileRendererBase)}, method returns the
* just attached or soon to be detached {@link GLAutoDrawable}.
*
@@ -522,9 +522,9 @@ public abstract class TileRendererBase {
* @see #detachAutoDrawable()
*/
public final GLAutoDrawable getAttachedDrawable() {
- return glad;
+ return glad;
}
-
+
/**
* Detaches the given {@link GLAutoDrawable} from this tile renderer.
* @see #attachAutoDrawable(GLAutoDrawable)
@@ -547,16 +547,16 @@ public abstract class TileRendererBase {
System.err.println("TileRenderer: detached: "+glad);
System.err.println("TileRenderer: "+glad.getChosenGLCapabilities());
}
-
+
listeners = null;
listenersInit = null;
glad = null;
}
}
-
+
/**
* Set {@link GLEventListener} for pre- and post operations when used w/
- * {@link #attachAutoDrawable(GLAutoDrawable)}
+ * {@link #attachAutoDrawable(GLAutoDrawable)}
* for each {@link GLEventListener} callback.
* @param preTile the pre operations
* @param postTile the post operations
@@ -565,10 +565,10 @@ public abstract class TileRendererBase {
glEventListenerPre = preTile;
glEventListenerPost = postTile;
}
-
+
/**
* Rendering one tile, by simply calling {@link GLAutoDrawable#display()}.
- *
+ *
* @throws IllegalStateException if no {@link GLAutoDrawable} is {@link #attachAutoDrawable(GLAutoDrawable) attached}
* or imageSize is not set
*/
@@ -578,10 +578,10 @@ public abstract class TileRendererBase {
}
glad.display();
}
-
+
private final GLEventListener tiledGLEL = new GLEventListener() {
final TileRenderer tileRenderer = TileRendererBase.this instanceof TileRenderer ? (TileRenderer) TileRendererBase.this : null;
-
+
@Override
public void init(GLAutoDrawable drawable) {
if( null != glEventListenerPre ) {
@@ -642,13 +642,13 @@ public abstract class TileRendererBase {
if( null == tileRenderer || 0 == tileRenderer.getCurrentTile() ) {
tl.startTileRendering(TileRendererBase.this);
}
- tl.reshapeTile(TileRendererBase.this,
+ tl.reshapeTile(TileRendererBase.this,
currentTileXPos, currentTileYPos, currentTileWidth, currentTileHeight,
imageSize.getWidth(), imageSize.getHeight());
l.display(drawable);
}
}
-
+
if( gladRequiresPreSwap ) {
glad.swapBuffers();
endTile(gl);
@@ -662,7 +662,7 @@ public abstract class TileRendererBase {
if( l instanceof TileRendererListener ) {
((TileRendererListener)l).endTileRendering(TileRendererBase.this);
}
- }
+ }
}
if( null != glEventListenerPost ) {
glEventListenerPost.reshape(drawable, 0, 0, currentTileWidth, currentTileHeight);
diff --git a/src/jogl/classes/com/jogamp/opengl/util/TimeFrameI.java b/src/jogl/classes/com/jogamp/opengl/util/TimeFrameI.java
index e2bca010c..45f5d2694 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/TimeFrameI.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/TimeFrameI.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,51 +20,51 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
package com.jogamp.opengl.util;
-/**
+/**
* Integer time frame in milliseconds, maybe specialized for texture/video, audio, .. animated content.
*
* Type and value range has been chosen to suit embedded CPUs
* and characteristics of audio / video streaming and animations.
- * Milliseconds of type integer with a maximum value of {@link Integer#MAX_VALUE}
+ * Milliseconds of type integer with a maximum value of {@link Integer#MAX_VALUE}
* will allow tracking time up 2,147,483.647 seconds or
* 24 days 20 hours 31 minutes and 23 seconds.
*
*
* Milliseconds granularity is also more than enough to deal with A-V synchronization,
* where the threshold usually lies within 22ms.
- *
+ *
*
* Milliseconds granularity for displaying video frames might seem inaccurate
* for each single frame, i.e. 60Hz != 16ms, however, accumulated values diminish
- * this error and vertical sync is achieved by build-in V-Sync of the video drivers.
+ * this error and vertical sync is achieved by build-in V-Sync of the video drivers.
*
*/
public class TimeFrameI {
/** Constant marking an invalid PTS, i.e. Integer.MIN_VALUE == 0x80000000 == {@value}. Sync w/ native code. */
public static final int INVALID_PTS = 0x80000000;
-
+
/** Constant marking the end of the stream PTS, i.e. Integer.MIN_VALUE - 1 == 0x7FFFFFFF == {@value}. Sync w/ native code. */
- public static final int END_OF_STREAM_PTS = 0x7FFFFFFF;
+ public static final int END_OF_STREAM_PTS = 0x7FFFFFFF;
protected int pts;
protected int duration;
-
+
public TimeFrameI() {
pts = INVALID_PTS;
- duration = 0;
+ duration = 0;
}
public TimeFrameI(int pts, int duration) {
this.pts = pts;
- this.duration = duration;
+ this.duration = duration;
}
-
+
/** Get this frame's presentation timestamp (PTS) in milliseconds. */
public final int getPTS() { return pts; }
/** Set this frame's presentation timestamp (PTS) in milliseconds. */
@@ -73,7 +73,7 @@ public class TimeFrameI {
public final int getDuration() { return duration; }
/** Set this frame's duration in milliseconds. */
public final void setDuration(int duration) { this.duration = duration; }
-
+
public String toString() {
return "TimeFrame[pts " + pts + " ms, l " + duration + " ms]";
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/av/AudioSink.java b/src/jogl/classes/com/jogamp/opengl/util/av/AudioSink.java
index 8751fc816..dffdfae8e 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/av/AudioSink.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/av/AudioSink.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -35,10 +35,10 @@ import jogamp.opengl.Debug;
public interface AudioSink {
public static final boolean DEBUG = Debug.debug("AudioSink");
-
+
/** Default frame duration in millisecond, i.e. 1 frame per {@value} ms. */
public static final int DefaultFrameDuration = 32;
-
+
/** Initial audio queue size in milliseconds. {@value} ms, i.e. 16 frames per 32 ms. See {@link #init(AudioFormat, float, int, int, int)}.*/
public static final int DefaultInitialQueueSize = 16 * 32; // 512 ms
/** Audio queue grow size in milliseconds. {@value} ms, i.e. 16 frames per 32 ms. See {@link #init(AudioFormat, float, int, int, int)}.*/
@@ -47,7 +47,7 @@ public interface AudioSink {
public static final int DefaultQueueLimitWithVideo = 96 * 32; // 3072 ms
/** Audio queue limit w/o video in milliseconds. {@value} ms, i.e. 32 frames per 32 ms. See {@link #init(AudioFormat, float, int, int, int)}.*/
public static final int DefaultQueueLimitAudioOnly = 32 * 32; // 1024 ms
-
+
/**
* Specifies the linear audio PCM format.
*/
@@ -78,7 +78,7 @@ public interface AudioSink {
}
}
}
-
+
/** Sample rate in Hz (1/s). */
public final int sampleRate;
/** Sample size in bits. */
@@ -91,36 +91,36 @@ public interface AudioSink {
/** Planar or packed samples. If planar, each channel has their own data buffer. If packed, channel data is interleaved in one buffer. */
public final boolean planar;
public final boolean littleEndian;
-
-
+
+
//
// Time <-> Bytes
//
-
- /**
- * Returns the byte size of the given milliseconds
+
+ /**
+ * Returns the byte size of the given milliseconds
* according to {@link #sampleSize}, {@link #channelCount} and {@link #sampleRate}.
*
* Time -> Byte Count
- *
+ *
*/
public final int getDurationsByteSize(int millisecs) {
final int bytesPerSample = sampleSize >>> 3; // /8
return millisecs * ( channelCount * bytesPerSample * ( sampleRate / 1000 ) );
}
-
- /**
- * Returns the duration in milliseconds of the given byte count
- * according to {@link #sampleSize}, {@link #channelCount} and {@link #sampleRate}.
+
+ /**
+ * Returns the duration in milliseconds of the given byte count
+ * according to {@link #sampleSize}, {@link #channelCount} and {@link #sampleRate}.
*
* Byte Count -> Time
- *
+ *
*/
public final int getBytesDuration(int byteCount) {
final int bytesPerSample = sampleSize >>> 3; // /8
- return byteCount / ( channelCount * bytesPerSample * ( sampleRate / 1000 ) );
+ return byteCount / ( channelCount * bytesPerSample * ( sampleRate / 1000 ) );
}
-
+
/**
* Returns the duration in milliseconds of the given sample count per frame and channel
* according to the {@link #sampleRate}, i.e.
@@ -129,13 +129,13 @@ public interface AudioSink {
*
*
* Sample Count -> Time
- *
+ *
* @param sampleCount sample count per frame and channel
*/
public final float getSamplesDuration(int sampleCount) {
return ( 1000f * (float) sampleCount ) / (float)sampleRate;
}
-
+
/**
* Returns the rounded frame count of the given milliseconds and frame duration.
*
@@ -147,36 +147,36 @@ public interface AudioSink {
*
*
* Frame Time -> Frame Count
- *
+ *
* @param millisecs time in milliseconds
* @param frameDuration duration per frame in milliseconds.
*/
public final int getFrameCount(int millisecs, float frameDuration) {
return Math.max(1, (int) ( (float)millisecs / frameDuration + 0.5f ));
}
-
+
/**
* Returns the byte size of given sample count
- * according to the {@link #sampleSize}, i.e.:
+ * according to the {@link #sampleSize}, i.e.:
*
* sampleCount * ( sampleSize / 8 )
*
*
- * Note: To retrieve the byte size for all channels,
+ * Note: To retrieve the byte size for all channels,
* you need to pre-multiply sampleCount with {@link #channelCount}.
*
*
* Sample Count -> Byte Count
- *
+ *
* @param sampleCount sample count
*/
public final int getSamplesByteCount(int sampleCount) {
return sampleCount * ( sampleSize >>> 3 );
}
-
+
/**
* Returns the sample count of given byte count
- * according to the {@link #sampleSize}, i.e.:
+ * according to the {@link #sampleSize}, i.e.:
*
* ( byteCount * 8 ) / sampleSize
*
@@ -186,24 +186,24 @@ public interface AudioSink {
*
*
* Byte Count -> Sample Count
- *
+ *
* @param sampleCount sample count
*/
public final int getBytesSampleCount(int byteCount) {
return ( byteCount << 3 ) / sampleSize;
}
-
- public String toString() {
+
+ public String toString() {
return "AudioDataFormat[sampleRate "+sampleRate+", sampleSize "+sampleSize+", channelCount "+channelCount+
", signed "+signed+", fixedP "+fixedP+", "+(planar?"planar":"packed")+", "+(littleEndian?"little":"big")+"-endian]"; }
}
- /** Default {@link AudioFormat}, [type PCM, sampleRate 44100, sampleSize 16, channelCount 2, signed, fixedP, !planar, littleEndian]. */
- public static final AudioFormat DefaultFormat = new AudioFormat(44100, 16, 2, true /* signed */,
+ /** Default {@link AudioFormat}, [type PCM, sampleRate 44100, sampleSize 16, channelCount 2, signed, fixedP, !planar, littleEndian]. */
+ public static final AudioFormat DefaultFormat = new AudioFormat(44100, 16, 2, true /* signed */,
true /* fixed point */, false /* planar */, true /* littleEndian */);
-
+
public static abstract class AudioFrame extends TimeFrameI {
protected int byteSize;
-
+
public AudioFrame() {
this.byteSize = 0;
}
@@ -211,19 +211,19 @@ public interface AudioSink {
super(pts, duration);
this.byteSize=byteCount;
}
-
+
/** Get this frame's size in bytes. */
public final int getByteSize() { return byteSize; }
/** Set this frame's size in bytes. */
public final void setByteSize(int size) { this.byteSize=size; }
-
- public String toString() {
+
+ public String toString() {
return "AudioFrame[pts " + pts + " ms, l " + duration + " ms, "+byteSize + " bytes]";
}
}
public static class AudioDataFrame extends AudioFrame {
protected final ByteBuffer data;
-
+
public AudioDataFrame(int pts, int duration, ByteBuffer bytes, int byteCount) {
super(pts, duration, byteCount);
if( byteCount > bytes.remaining() ) {
@@ -231,62 +231,62 @@ public interface AudioSink {
}
this.data=bytes;
}
-
+
/** Get this frame's data. */
public final ByteBuffer getData() { return data; }
-
- public String toString() {
+
+ public String toString() {
return "AudioDataFrame[pts " + pts + " ms, l " + duration + " ms, "+byteSize + " bytes, " + data + "]";
}
}
-
- /**
+
+ /**
* Returns the initialized state of this instance.
*
* The initialized state is affected by this instance
* overall availability, i.e. after instantiation,
* as well as by {@link #destroy()}.
- *
+ *
*/
public boolean isInitialized();
/** Returns the playback speed. */
public float getPlaySpeed();
-
- /**
+
+ /**
* Sets the playback speed.
*
* To simplify test, play speed is normalized, i.e.
- *
- *
1.0f: if Math.abs(1.0f - rate) < 0.01f
+ *
+ *
1.0f: if Math.abs(1.0f - rate) < 0.01f
*
*
- * @return true if successful, otherwise false, i.e. due to unsupported value range of implementation.
+ * @return true if successful, otherwise false, i.e. due to unsupported value range of implementation.
*/
public boolean setPlaySpeed(float s);
-
+
/** Returns the volume. */
public float getVolume();
-
- /**
+
+ /**
* Sets the volume [0f..1f].
*
* To simplify test, volume is normalized, i.e.
- *
- *
0.0f: if Math.abs(v) < 0.01f
- *
1.0f: if Math.abs(1.0f - v) < 0.01f
+ *
+ *
0.0f: if Math.abs(v) < 0.01f
+ *
1.0f: if Math.abs(1.0f - v) < 0.01f
*
*
- * @return true if successful, otherwise false, i.e. due to unsupported value range of implementation.
+ * @return true if successful, otherwise false, i.e. due to unsupported value range of implementation.
*/
public boolean setVolume(float v);
-
- /**
+
+ /**
* Returns the preferred {@link AudioFormat} by this sink.
*
- * The preferred format is guaranteed to be supported
+ * The preferred format is guaranteed to be supported
* and shall reflect this sinks most native format,
- * i.e. best performance w/o data conversion.
+ * i.e. best performance w/o data conversion.
*
*
* Known {@link #AudioFormat} attributes considered by implementations:
@@ -295,20 +295,20 @@ public interface AudioSink {
*
*
* @see #initSink(AudioFormat)
- * @see #isSupported(AudioFormat)
+ * @see #isSupported(AudioFormat)
*/
public AudioFormat getPreferredFormat();
-
+
/** Return the maximum number of supported channels. */
public int getMaxSupportedChannels();
-
+
/**
* Returns true if the given format is supported by the sink, otherwise false.
* @see #initSink(AudioFormat)
- * @see #getPreferredFormat()
+ * @see #getPreferredFormat()
*/
public boolean isSupported(AudioFormat format);
-
+
/**
* Initializes the sink.
*
@@ -319,7 +319,7 @@ public interface AudioSink {
* beforehand and try to find a suitable supported one.
* {@link #getPreferredFormat()} and {@link #getMaxSupportedChannels()} may help.
*
- * @param requestedFormat the requested {@link AudioFormat}.
+ * @param requestedFormat the requested {@link AudioFormat}.
* @param frameDuration average or fixed frame duration in milliseconds
* helping a caching {@link AudioFrame} based implementation to determine the frame count in the queue.
* See {@link #DefaultFrameDuration}.
@@ -328,31 +328,31 @@ public interface AudioSink {
* @param queueLimit maximum time in milliseconds the queue can hold (and grow), see {@link #DefaultQueueLimitWithVideo} and {@link #DefaultQueueLimitAudioOnly}.
* @return true if successful, otherwise false
*/
- public boolean init(AudioFormat requestedFormat, float frameDuration,
+ public boolean init(AudioFormat requestedFormat, float frameDuration,
int initialQueueSize, int queueGrowAmount, int queueLimit);
-
+
/**
* Returns true, if {@link #play()} has been requested and the sink is still playing,
* otherwise false.
*/
public boolean isPlaying();
-
- /**
+
+ /**
* Play buffers queued via {@link #enqueueData(AudioFrame)} from current internal position.
* If no buffers are yet queued or the queue runs empty, playback is being continued when buffers are enqueued later on.
* @see #enqueueData(AudioFrame)
- * @see #pause()
+ * @see #pause()
*/
public void play();
-
- /**
+
+ /**
* Pause playing buffers while keeping enqueued data incl. it's internal position.
* @see #play()
* @see #flush()
* @see #enqueueData(AudioFrame)
*/
public void pause();
-
+
/**
* Flush all queued buffers, implies {@link #pause()}.
*
@@ -363,28 +363,28 @@ public interface AudioSink {
* @see #enqueueData(AudioFrame)
*/
public void flush();
-
+
/** Destroys this instance, i.e. closes all streams and devices allocated. */
public void destroy();
-
- /**
- * Returns the number of allocated buffers as requested by
+
+ /**
+ * Returns the number of allocated buffers as requested by
* {@link #init(AudioFormat, float, int, int, int)}.
*/
public int getFrameCount();
/** @return the current enqueued frames count since {@link #init(AudioFormat, float, int, int, int)}. */
public int getEnqueuedFrameCount();
-
- /**
+
+ /**
* Returns the current number of frames queued for playing.
*
* {@link #init(AudioFormat, float, int, int, int)} must be called first.
*
*/
public int getQueuedFrameCount();
-
- /**
+
+ /**
* Returns the current number of bytes queued for playing.
*
* {@link #init(AudioFormat, float, int, int, int)} must be called first.
@@ -392,28 +392,28 @@ public interface AudioSink {
*/
public int getQueuedByteCount();
- /**
+ /**
* Returns the current queued frame time in milliseconds for playing.
*
* {@link #init(AudioFormat, float, int, int, int)} must be called first.
*
*/
public int getQueuedTime();
-
- /**
+
+ /**
* Return the current audio presentation timestamp (PTS) in milliseconds.
*/
public int getPTS();
-
- /**
+
+ /**
* Returns the current number of frames in the sink available for writing.
*
* {@link #init(AudioFormat, float, int, int, int)} must be called first.
*
*/
public int getFreeFrameCount();
-
- /**
+
+ /**
* Enqueue the remaining bytes of the given {@link AudioDataFrame}'s direct ByteBuffer to this sink.
*
* The data must comply with the chosen {@link AudioFormat} as returned by {@link #initSink(AudioFormat)}.
@@ -426,8 +426,8 @@ public interface AudioSink {
* to reuse specialized {@link AudioFrame} instances.
*/
public AudioFrame enqueueData(AudioDataFrame audioDataFrame);
-
- /**
+
+ /**
* Enqueue byteCount bytes of the remaining bytes of the given NIO {@link ByteBuffer} to this sink.
*
* The data must comply with the chosen {@link AudioFormat} as returned by {@link #initSink(AudioFormat)}.
diff --git a/src/jogl/classes/com/jogamp/opengl/util/av/AudioSinkFactory.java b/src/jogl/classes/com/jogamp/opengl/util/av/AudioSinkFactory.java
index a6a14f7dd..2cfd40df7 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/av/AudioSinkFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/av/AudioSinkFactory.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -58,7 +58,7 @@ public class AudioSinkFactory {
if( audioSink.isInitialized() ) {
return audioSink;
}
- } catch (Throwable t) {
+ } catch (Throwable t) {
if(AudioSink.DEBUG) { System.err.println("Catched "+t.getClass().getName()+": "+t.getMessage()); t.printStackTrace(); }
}
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java b/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java
index 74036a3f7..db6f5fdee 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -49,9 +49,9 @@ import com.jogamp.opengl.util.TimeFrameI;
* using the appropriate stream id's.
*
*
- * Camera input can be selected using the {@link #CameraInputScheme} URI.
+ * Camera input can be selected using the {@link #CameraInputScheme} URI.
*
* Most of the stream processing is performed on the decoding thread, a.k.a. StreamWorker:
@@ -61,7 +61,7 @@ import com.jogamp.opengl.util.TimeFrameI;
*
* StreamWorker generates it's own {@link GLContext}, shared with the one passed to {@link #initGL(GL)}.
- * The shared {@link GLContext} allows the decoding thread to push the video frame data directly into
+ * The shared {@link GLContext} allows the decoding thread to push the video frame data directly into
* the designated {@link TextureFrame}, later returned via {@link #getNextTexture(GL)} and used by the user.
*
* StreamWorker Error Handling
@@ -71,12 +71,12 @@ import com.jogamp.opengl.util.TimeFrameI;
*
*
* An occurring {@link StreamException} triggers a {@link GLMediaEventListener#EVENT_CHANGE_ERR EVENT_CHANGE_ERR} event,
- * which can be listened to via {@link GLMediaEventListener#attributesChanged(GLMediaPlayer, int, long)}.
+ * which can be listened to via {@link GLMediaEventListener#attributesChanged(GLMediaPlayer, int, long)}.
*
*
- * An occurred {@link StreamException} can be read via {@link #getStreamException()}.
+ * An occurred {@link StreamException} can be read via {@link #getStreamException()}.
*
@@ -127,7 +127,7 @@ import com.jogamp.opengl.util.TimeFrameI;
* Timestamp type and value range has been chosen to suit embedded CPUs
* and characteristics of audio and video streaming. See {@link TimeFrameI}.
*
@@ -185,16 +185,16 @@ import com.jogamp.opengl.util.TimeFrameI;
public interface GLMediaPlayer extends TextureSequence {
public static final boolean DEBUG = Debug.debug("GLMediaPlayer");
public static final boolean DEBUG_NATIVE = Debug.debug("GLMediaPlayer.Native");
-
+
/** Minimum texture count, value {@value}. */
public static final int TEXTURE_COUNT_MIN = 4;
-
+
/** Constant {@value} for mute or not available. See Audio and video Stream IDs. */
public static final int STREAM_ID_NONE = -2;
/** Constant {@value} for auto or unspecified. See Audio and video Stream IDs. */
public static final int STREAM_ID_AUTO = -1;
-
- /**
+
+ /**
* {@link URI#getScheme() URI scheme} name {@value} for camera input. E.g. camera:/0
* for the 1st camera device.
*
* The ID is usually an integer value indexing the camera
- * ranging from [0..max-number].
+ * ranging from [0..max-number].
*
*
* The {@link URI#getRawQuery() URI query} is used to pass options to the camera
@@ -220,7 +220,7 @@ public interface GLMediaPlayer extends TextureSequence {
* w/ authority: [user-info@]host[:port]
* Note: 'path' starts w/ fwd slash
*
- *
+ *
*/
public static final String CameraInputScheme = "camera";
/** Camera property {@value}, size as string, e.g. 1280x720, hd720. May not be supported on all platforms. See {@link #CameraInputScheme}. */
@@ -231,10 +231,10 @@ public interface GLMediaPlayer extends TextureSequence {
public static final String CameraPropHeight = "height";
/** Camera property {@value}. See {@link #CameraInputScheme}. */
public static final String CameraPropRate = "rate";
-
+
/** Maximum video frame async of {@value} milliseconds. */
public static final int MAXIMUM_VIDEO_ASYNC = 22;
-
+
/**
* A StreamException encapsulates a caught exception in the decoder thread, a.k.a StreamWorker,
* see See StreamWorker Error Handling.
@@ -248,15 +248,15 @@ public interface GLMediaPlayer extends TextureSequence {
super(message, cause);
}
}
-
+
/**
* {@inheritDoc}
*
* See {@link TexSeqEventListener} for semantics and usage.
*
- */
+ */
public interface GLMediaEventListener extends TexSeqEventListener {
-
+
/** State changed to {@link State#Initialized}. See Lifecycle.*/
static final int EVENT_CHANGE_INIT = 1<<0;
/** State changed to {@link State#Uninitialized}. See Lifecycle.*/
@@ -269,7 +269,7 @@ public interface GLMediaPlayer extends TextureSequence {
static final int EVENT_CHANGE_EOS = 1<<4;
/** An error occurred, e.g. during off-thread initialization. See {@link StreamException} and Lifecycle. */
static final int EVENT_CHANGE_ERR = 1<<5;
-
+
/** Stream video id change. */
static final int EVENT_CHANGE_VID = 1<<16;
/** Stream audio id change. */
@@ -284,55 +284,55 @@ public interface GLMediaPlayer extends TextureSequence {
static final int EVENT_CHANGE_LENGTH = 1<<21;
/** Stream codec change. */
static final int EVENT_CHANGE_CODEC = 1<<22;
-
+
/**
- * @param mp the event source
+ * @param mp the event source
* @param event_mask the changes attributes
- * @param when system time in msec.
+ * @param when system time in msec.
*/
- public void attributesChanged(GLMediaPlayer mp, int event_mask, long when);
+ public void attributesChanged(GLMediaPlayer mp, int event_mask, long when);
}
-
+
/**
* See Lifecycle.
*/
public enum State {
/** Uninitialized player, no resources shall be hold. */
Uninitialized(0),
- /** Stream has been initialized, user may play or call {@link #initGL(GL)}. */
- Initialized(1),
+ /** Stream has been initialized, user may play or call {@link #initGL(GL)}. */
+ Initialized(1),
/** Stream is playing. */
Playing(2),
/** Stream is pausing. */
Paused(3);
-
+
public final int id;
State(int id){
this.id = id;
}
}
-
+
public int getTextureCount();
-
+
/** Returns the texture target used by implementation. */
public int getTextureTarget();
/** Sets the texture unit. Defaults to 0. */
public void setTextureUnit(int u);
-
+
/** Sets the texture min-mag filter, defaults to {@link GL#GL_NEAREST}. */
public void setTextureMinMagFilter(int[] minMagFilter);
/** Sets the texture min-mag filter, defaults to {@link GL#GL_CLAMP_TO_EDGE}. */
public void setTextureWrapST(int[] wrapST);
-
- /**
+
+ /**
* Issues asynchronous stream initialization.
*
* Muted video can be achieved by passing {@link #STREAM_ID_NONE} to vid,
- * in which case textureCount is ignored as well as the passed GL object of the subsequent {@link #initGL(GL)} call.
+ * in which case textureCount is ignored as well as the passed GL object of the subsequent {@link #initGL(GL)} call.
*
* @param streamLoc the stream location
* @param vid video stream id, see audio and video Stream IDs
@@ -352,41 +352,41 @@ public interface GLMediaPlayer extends TextureSequence {
* @param textureCount desired number of buffered textures to be decoded off-thread, will be validated by implementation.
* The minimum value is {@link #TEXTURE_COUNT_MIN}.
* Ignored if video is muted.
- * @throws IllegalStateException if not invoked in {@link State#Uninitialized}
+ * @throws IllegalStateException if not invoked in {@link State#Uninitialized}
* @throws IllegalArgumentException if arguments are invalid
*/
public void initStream(URI streamLoc, int vid, int aid, int textureCount) throws IllegalStateException, IllegalArgumentException;
-
+
/**
* Returns the {@link StreamException} caught in the decoder thread, or null.
* @see GLMediaEventListener#EVENT_CHANGE_ERR
* @see StreamException
*/
public StreamException getStreamException();
-
- /**
+
+ /**
* Initializes OpenGL related resources.
*
* Argument gl is ignored if video is muted, see {@link #initStream(URI, int, int, int)}.
- *
+ *
* @param gl current GL object. Maybe null, for audio only.
- * @throws IllegalStateException if not invoked in {@link State#Initialized}.
+ * @throws IllegalStateException if not invoked in {@link State#Initialized}.
* @throws StreamException forwarded from the off-thread stream initialization
* @throws GLException in case of difficulties to initialize the GL resources
*/
public void initGL(GL gl) throws IllegalStateException, StreamException, GLException;
-
- /**
+
+ /**
* If implementation uses a {@link AudioSink}, it's instance will be returned.
- *
- * The {@link AudioSink} instance is available after {@link #initStream(URI, int, int, int)},
+ *
+ * The {@link AudioSink} instance is available after {@link #initStream(URI, int, int, int)},
* if used by implementation.
- *
+ *
*/
public AudioSink getAudioSink();
-
+
/**
* Releases the GL and stream resources.
*
@@ -399,11 +399,11 @@ public interface GLMediaPlayer extends TextureSequence {
* Sets the playback speed.
*
* To simplify test, play speed is normalized, i.e.
- *
- *
1.0f: if Math.abs(1.0f - rate) < 0.01f
+ *
+ *
1.0f: if Math.abs(1.0f - rate) < 0.01f
*
*
- * @return true if successful, otherwise false, i.e. due to unsupported value range of implementation.
+ * @return true if successful, otherwise false, i.e. due to unsupported value range of implementation.
*/
public boolean setPlaySpeed(float rate);
@@ -414,18 +414,18 @@ public interface GLMediaPlayer extends TextureSequence {
* Sets the audio volume, [0f..1f].
*
* To simplify test, volume is normalized, i.e.
- *
- *
0.0f: if Math.abs(v) < 0.01f
- *
1.0f: if Math.abs(1.0f - v) < 0.01f
+ *
+ *
0.0f: if Math.abs(v) < 0.01f
+ *
1.0f: if Math.abs(1.0f - v) < 0.01f
*
*
- * @return true if successful, otherwise false, i.e. due to unsupported value range of implementation.
+ * @return true if successful, otherwise false, i.e. due to unsupported value range of implementation.
*/
public boolean setAudioVolume(float v);
-
+
/** Returns the audio volume. */
public float getAudioVolume();
-
+
/**
* Starts or resumes the StreamWorker decoding thread.
*
* If a new frame is desired after the next {@link #play()} call,
- * e.g. to make a snapshot of a camera input stream,
+ * e.g. to make a snapshot of a camera input stream,
* flush shall be set to true.
- *
+ *
* @param flush if true flushes the video and audio buffers, otherwise keep them intact.
*/
public State pause(boolean flush);
@@ -454,10 +454,10 @@ public interface GLMediaPlayer extends TextureSequence {
*
* Allowed in state {@link State#Playing} and {@link State#Paused}, otherwise ignored,
* see Lifecycle.
- *
- *
- * @param msec absolute desired time position in milliseconds
- * @return time current position in milliseconds, after seeking to the desired position
+ *
+ *
+ * @param msec absolute desired time position in milliseconds
+ * @return time current position in milliseconds, after seeking to the desired position
**/
public int seek(int msec);
@@ -466,39 +466,39 @@ public interface GLMediaPlayer extends TextureSequence {
* @return the current state, either {@link State#Uninitialized}, {@link State#Initialized}, {@link State#Playing} or {@link State#Paused}
*/
public State getState();
-
+
/**
* Return the video stream id, see audio and video Stream IDs.
*/
public int getVID();
-
+
/**
* Return the audio stream id, see audio and video Stream IDs.
*/
public int getAID();
-
+
/**
- * @return the current decoded frame count since {@link #play()} and {@link #seek(int)}
+ * @return the current decoded frame count since {@link #play()} and {@link #seek(int)}
* as increased by {@link #getNextTexture(GL)} or the decoding thread.
*/
public int getDecodedFrameCount();
-
+
/**
- * @return the current presented frame count since {@link #play()} and {@link #seek(int)}
+ * @return the current presented frame count since {@link #play()} and {@link #seek(int)}
* as increased by {@link #getNextTexture(GL)} for new frames.
*/
public int getPresentedFrameCount();
-
+
/**
- * @return current video presentation timestamp (PTS) in milliseconds of {@link #getLastTexture()}
+ * @return current video presentation timestamp (PTS) in milliseconds of {@link #getLastTexture()}
**/
public int getVideoPTS();
-
+
/**
- * @return current audio presentation timestamp (PTS) in milliseconds.
+ * @return current audio presentation timestamp (PTS) in milliseconds.
**/
public int getAudioPTS();
-
+
/**
* {@inheritDoc}
*
* In case the current state is not {@link State#Playing}, {@link #getLastTexture()} is returned.
*
@@ -519,25 +519,25 @@ public interface GLMediaPlayer extends TextureSequence {
* See audio and video synchronization.
*
* @throws IllegalStateException if not invoked in {@link State#Paused} or {@link State#Playing}
- *
+ *
* @see #addEventListener(GLMediaEventListener)
* @see GLMediaEventListener#newFrameAvailable(GLMediaPlayer, TextureFrame, long)
*/
@Override
public TextureSequence.TextureFrame getNextTexture(GL gl) throws IllegalStateException;
-
+
/** Return the stream location, as set by {@link #initStream(URI, int, int, int)}. */
public URI getURI();
/**
* Warning: Optional information, may not be supported by implementation.
- * @return the code of the video stream, if available
+ * @return the code of the video stream, if available
*/
public String getVideoCodec();
/**
* Warning: Optional information, may not be supported by implementation.
- * @return the code of the audio stream, if available
+ * @return the code of the audio stream, if available
*/
public String getAudioCodec();
@@ -557,25 +557,25 @@ public interface GLMediaPlayer extends TextureSequence {
* @return total duration of stream in msec.
*/
public int getDuration();
-
+
/**
* Warning: Optional information, may not be supported by implementation.
- * @return the overall bitrate of the stream.
+ * @return the overall bitrate of the stream.
*/
public long getStreamBitrate();
/**
* Warning: Optional information, may not be supported by implementation.
- * @return video bitrate
+ * @return video bitrate
*/
public int getVideoBitrate();
-
+
/**
* Warning: Optional information, may not be supported by implementation.
- * @return the audio bitrate
+ * @return the audio bitrate
*/
public int getAudioBitrate();
-
+
/**
* Warning: Optional information, may not be supported by implementation.
* @return the framerate of the video
@@ -583,10 +583,10 @@ public interface GLMediaPlayer extends TextureSequence {
public float getFramerate();
/**
- * Returns true if the video frame is oriented in
+ * Returns true if the video frame is oriented in
* OpenGL's coordinate system, origin at bottom left.
*
- * Otherwise returns false, i.e.
+ * Otherwise returns false, i.e.
* video frame is oriented origin at top left.
*
*
@@ -594,14 +594,14 @@ public interface GLMediaPlayer extends TextureSequence {
* but user shall not rely on.
*
*
- * false GL orientation leads to
+ * false GL orientation leads to
* {@link Texture#getMustFlipVertically()} == true,
* as reflected by all {@link TextureFrame}'s {@link Texture}s
- * retrieved via {@link #getLastTexture()} or {@link #getNextTexture(GL)}.
+ * retrieved via {@link #getLastTexture()} or {@link #getNextTexture(GL)}.
*
*/
public boolean isGLOriented();
-
+
/** Returns the width of the video. */
public int getWidth();
@@ -613,7 +613,7 @@ public interface GLMediaPlayer extends TextureSequence {
/** Returns a string represantation of this player's performance values. */
public String getPerfString();
-
+
/** Adds a {@link GLMediaEventListener} to this player. */
public void addEventListener(GLMediaEventListener l);
diff --git a/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayerFactory.java b/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayerFactory.java
index c7e1ab5e6..248e265f5 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayerFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayerFactory.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -36,7 +36,7 @@ public class GLMediaPlayerFactory {
private static final String FFMPEGMediaPlayerClazzName = "jogamp.opengl.util.av.impl.FFMPEGMediaPlayer";
private static final String OMXGLMediaPlayerClazzName = "jogamp.opengl.util.av.impl.OMXGLMediaPlayer";
private static final String isAvailableMethodName = "isAvailable";
-
+
public static GLMediaPlayer createDefault() {
final ClassLoader cl = GLMediaPlayerFactory.class.getClassLoader();
GLMediaPlayer sink = create(cl, OMXGLMediaPlayerClazzName);
@@ -54,7 +54,7 @@ public class GLMediaPlayerFactory {
public static GLMediaPlayer createNull() {
return new NullGLMediaPlayer();
}
-
+
public static GLMediaPlayer create(final ClassLoader cl, String implName) {
try {
if(((Boolean)ReflectionUtil.callStaticMethod(implName, isAvailableMethodName, null, null, cl)).booleanValue()) {
diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLPixelBuffer.java b/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLPixelBuffer.java
index 9d2ef6572..fb2bdbbcb 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLPixelBuffer.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLPixelBuffer.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -41,22 +41,22 @@ import javax.media.opengl.GL;
import com.jogamp.common.nio.Buffers;
import com.jogamp.opengl.util.GLPixelBuffer;
-/**
- * AWT {@link GLPixelBuffer} backed by an {@link BufferedImage} of type
+/**
+ * AWT {@link GLPixelBuffer} backed by an {@link BufferedImage} of type
* {@link BufferedImage#TYPE_INT_ARGB} or {@link BufferedImage#TYPE_INT_RGB}.
*
* Implementation uses an array backed {@link IntBuffer}.
*
*
- * {@link AWTGLPixelBuffer} can be produced via {@link AWTGLPixelBufferProvider}'s
- * {@link AWTGLPixelBufferProvider#allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocate(..)}.
+ * {@link AWTGLPixelBuffer} can be produced via {@link AWTGLPixelBufferProvider}'s
+ * {@link AWTGLPixelBufferProvider#allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocate(..)}.
*
*
* See {@link AWTGLPixelBuffer#requiresNewBuffer(GL, int, int, int)} for {@link #allowRowStride} details.
*
*
* If using allowRowStride == true, user may needs to get the {@link #getAlignedImage(int, int) aligned image}
- * since {@link #requiresNewBuffer(GL, int, int, int)} will allow different width in this case.
+ * since {@link #requiresNewBuffer(GL, int, int, int)} will allow different width in this case.
*
*/
public class AWTGLPixelBuffer extends GLPixelBuffer {
@@ -65,9 +65,9 @@ public class AWTGLPixelBuffer extends GLPixelBuffer {
/** The underlying {@link BufferedImage}. */
public final BufferedImage image;
-
+
/**
- *
+ *
* @param pixelAttributes the desired {@link GLPixelAttributes}
* @param width in pixels
* @param height in pixels
@@ -76,26 +76,26 @@ public class AWTGLPixelBuffer extends GLPixelBuffer {
* @param image the AWT image
* @param buffer the backing array
* @param allowRowStride If true, allow row-stride, otherwise not. See {@link #requiresNewBuffer(GL, int, int, int)}.
- * If true, user shall decide whether to use a {@link #getAlignedImage(int, int) width-aligned image}.
+ * If true, user shall decide whether to use a {@link #getAlignedImage(int, int) width-aligned image}.
*/
- public AWTGLPixelBuffer(GLPixelAttributes pixelAttributes, int width, int height, int depth, boolean pack, BufferedImage image,
+ public AWTGLPixelBuffer(GLPixelAttributes pixelAttributes, int width, int height, int depth, boolean pack, BufferedImage image,
Buffer buffer, boolean allowRowStride) {
super(pixelAttributes, width, height, depth, pack, buffer, allowRowStride);
this.image = image;
}
-
+
@Override
public void dispose() {
image.flush();
super.dispose();
}
-
+
/**
* Returns a width- and height-aligned image representation sharing data w/ {@link #image}.
* @param width
* @param height
* @return
- * @throws IllegalArgumentException if requested size exceeds image size
+ * @throws IllegalArgumentException if requested size exceeds image size
*/
public BufferedImage getAlignedImage(int width, int height) throws IllegalArgumentException {
if( width * height > image.getWidth() * image.getHeight() ) {
@@ -111,12 +111,12 @@ public class AWTGLPixelBuffer extends GLPixelBuffer {
final WritableRaster raster = image.getRaster();
final DataBuffer dataBuffer = raster.getDataBuffer();
final SinglePixelPackedSampleModel sppsm0 = (SinglePixelPackedSampleModel) raster.getSampleModel();
- final SinglePixelPackedSampleModel sppsm1 = new SinglePixelPackedSampleModel(dataBuffer.getDataType(),
+ final SinglePixelPackedSampleModel sppsm1 = new SinglePixelPackedSampleModel(dataBuffer.getDataType(),
width, height, width /* scanLineStride */, sppsm0.getBitMasks());
final WritableRaster raster1 = WritableRaster.createWritableRaster(sppsm1, dataBuffer, null);
return new BufferedImage (cm, raster1, cm.isAlphaPremultiplied(), null);
}
-
+
public StringBuilder toString(StringBuilder sb) {
sb = super.toString(sb);
sb.append(", allowRowStride ").append(allowRowStride).append(", image [").append(image.getWidth()).append("x").append(image.getHeight()).append(", ").append(image.toString()).append("]");
@@ -125,29 +125,29 @@ public class AWTGLPixelBuffer extends GLPixelBuffer {
public String toString() {
return "AWTGLPixelBuffer["+toString(null).toString()+"]";
}
-
+
/**
* Provider for {@link AWTGLPixelBuffer} instances.
*/
public static class AWTGLPixelBufferProvider implements GLPixelBufferProvider {
private final boolean allowRowStride;
-
+
/**
- * @param allowRowStride If true, allow row-stride, otherwise not.
+ * @param allowRowStride If true, allow row-stride, otherwise not.
* See {@link #getAllowRowStride()} and {@link AWTGLPixelBuffer#requiresNewBuffer(GL, int, int, int)}.
- * If true, user shall decide whether to use a {@link AWTGLPixelBuffer#getAlignedImage(int, int) width-aligned image}.
+ * If true, user shall decide whether to use a {@link AWTGLPixelBuffer#getAlignedImage(int, int) width-aligned image}.
*/
public AWTGLPixelBufferProvider(boolean allowRowStride) {
- this.allowRowStride = allowRowStride;
+ this.allowRowStride = allowRowStride;
}
@Override
public boolean getAllowRowStride() { return allowRowStride; }
-
+
@Override
public GLPixelAttributes getAttributes(GL gl, int componentCount) {
return 4 == componentCount ? awtPixelAttributesIntRGBA4 : awtPixelAttributesIntRGB3;
}
-
+
/**
* {@inheritDoc}
*
@@ -162,28 +162,28 @@ public class AWTGLPixelBuffer extends GLPixelBuffer {
return new AWTGLPixelBuffer(pixelAttributes, width, height, depth, pack, image, ibuffer, allowRowStride);
}
}
-
+
/**
* Provider for singleton {@link AWTGLPixelBuffer} instances.
*
* Provider instance holds the last {@link AWTGLPixelBuffer} instance
* {@link #allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocated}.
- * A new {@link #allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocation}
+ * A new {@link #allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocation}
* will return same instance, if a new buffer is not {@link AWTGLPixelBuffer#requiresNewBuffer(GL, int, int, int) required}.
- * The latter is true if size are compatible, hence allowRowStride should be enabled, if possible.
+ * The latter is true if size are compatible, hence allowRowStride should be enabled, if possible.
*
@@ -194,7 +194,7 @@ public class AWTGLPixelBuffer extends GLPixelBuffer {
public AWTGLPixelBuffer allocate(GL gl, GLPixelAttributes pixelAttributes, int width, int height, int depth, boolean pack, int minByteSize) {
if( 4 == pixelAttributes.componentCount ) {
if( null == singleRGBA4 || singleRGBA4.requiresNewBuffer(gl, width, height, minByteSize) ) {
- singleRGBA4 = allocateImpl(pixelAttributes, width, height, depth, pack, minByteSize);
+ singleRGBA4 = allocateImpl(pixelAttributes, width, height, depth, pack, minByteSize);
}
return singleRGBA4;
} else {
@@ -204,33 +204,33 @@ public class AWTGLPixelBuffer extends GLPixelBuffer {
return singleRGB3;
}
}
-
+
private AWTGLPixelBuffer allocateImpl(GLPixelAttributes pixelAttributes, int width, int height, int depth, boolean pack, int minByteSize) {
final BufferedImage image = new BufferedImage(width, height, 4 == pixelAttributes.componentCount ? BufferedImage.TYPE_INT_ARGB : BufferedImage.TYPE_INT_RGB);
final int[] readBackIntBuffer = ((DataBufferInt) image.getRaster().getDataBuffer()).getData();
final Buffer ibuffer = IntBuffer.wrap( readBackIntBuffer );
return new AWTGLPixelBuffer(pixelAttributes, width, height, depth, pack, image, ibuffer, getAllowRowStride());
}
-
- /** Return the last {@link #allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocated} {@link AWTGLPixelBuffer} w/ {@link GLPixelAttributes#componentCount}. */
+
+ /** Return the last {@link #allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocated} {@link AWTGLPixelBuffer} w/ {@link GLPixelAttributes#componentCount}. */
public AWTGLPixelBuffer getSingleBuffer(GLPixelAttributes pixelAttributes) {
return 4 == pixelAttributes.componentCount ? singleRGBA4 : singleRGB3;
}
-
- /**
+
+ /**
* Initializes the single {@link AWTGLPixelBuffer} w/ a given size, if not yet {@link #allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocated}.
* @return the newly initialized single {@link AWTGLPixelBuffer}, or null if already allocated.
*/
public AWTGLPixelBuffer initSingleton(int componentCount, int width, int height, int depth, boolean pack) {
if( 4 == componentCount ) {
if( null != singleRGBA4 ) {
- return null;
+ return null;
}
singleRGBA4 = allocateImpl(AWTGLPixelBuffer.awtPixelAttributesIntRGBA4, width, height, depth, pack, 0);
return singleRGBA4;
} else {
if( null != singleRGB3 ) {
- return null;
+ return null;
}
singleRGB3 = allocateImpl(AWTGLPixelBuffer.awtPixelAttributesIntRGB3, width, height, depth, pack, 0);
return singleRGB3;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLReadBufferUtil.java b/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLReadBufferUtil.java
index e85f04092..f5d31a132 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLReadBufferUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLReadBufferUtil.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -42,7 +42,7 @@ import com.jogamp.opengl.util.GLReadBufferUtil;
public class AWTGLReadBufferUtil extends GLReadBufferUtil {
/**
* {@inheritDoc}
- *
+ *
* @param alpha
*/
public AWTGLReadBufferUtil(GLProfile glp, boolean alpha) {
@@ -50,7 +50,7 @@ public class AWTGLReadBufferUtil extends GLReadBufferUtil {
}
public AWTGLPixelBuffer getAWTGLPixelBuffer() { return (AWTGLPixelBuffer)this.getPixelBuffer(); }
-
+
public BufferedImage readPixelsToBufferedImage(GL gl, boolean awtOrientation) {
return readPixelsToBufferedImage(gl, 0, 0, 0, 0, awtOrientation);
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/ImageUtil.java b/src/jogl/classes/com/jogamp/opengl/util/awt/ImageUtil.java
index a3139b16a..df3cc4a39 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/awt/ImageUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/awt/ImageUtil.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -54,7 +54,7 @@ public class ImageUtil {
WritableRaster raster = image.getRaster();
Object scanline1 = null;
Object scanline2 = null;
-
+
for (int i = 0; i < image.getHeight() / 2; i++) {
scanline1 = raster.getDataElements(0, i, image.getWidth(), 1, scanline1);
scanline2 = raster.getDataElements(0, image.getHeight() - i - 1, image.getWidth(), 1, scanline2);
@@ -97,21 +97,21 @@ public class ImageUtil {
if (thumbWidth > image.getWidth()) {
throw new IllegalArgumentException("Thumbnail width must be greater than image width");
}
-
+
if (thumbWidth == image.getWidth()) {
return image;
}
-
+
float ratio = (float) image.getWidth() / (float) image.getHeight();
int width = image.getWidth();
BufferedImage thumb = image;
-
+
do {
width /= 2;
if (width < thumbWidth) {
width = thumbWidth;
}
-
+
BufferedImage temp = createCompatibleImage(width, (int) (width / ratio));
Graphics2D g2 = temp.createGraphics();
g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
@@ -120,7 +120,7 @@ public class ImageUtil {
g2.dispose();
thumb = temp;
} while (width != thumbWidth);
-
+
return thumb;
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/Overlay.java b/src/jogl/classes/com/jogamp/opengl/util/awt/Overlay.java
index 73d694cd9..931f59869 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/awt/Overlay.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/awt/Overlay.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/Screenshot.java b/src/jogl/classes/com/jogamp/opengl/util/awt/Screenshot.java
index 2ffc27260..f686b672a 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/awt/Screenshot.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/awt/Screenshot.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2013 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
@@ -56,18 +56,18 @@ import com.jogamp.opengl.GLExtensions;
import com.jogamp.opengl.util.GLPixelStorageModes;
import com.jogamp.opengl.util.TGAWriter;
-/**
+/**
* Utilities for taking screenshots of OpenGL applications.
- * @deprecated Please consider using {@link com.jogamp.opengl.util.GLReadBufferUtil},
- * which is AWT independent and does not require a CPU based vertical image flip
+ * @deprecated Please consider using {@link com.jogamp.opengl.util.GLReadBufferUtil},
+ * which is AWT independent and does not require a CPU based vertical image flip
* in case drawable {@link GLDrawable#isGLOriented() is in OpenGL orientation}.
- * Further more you may use {@link AWTGLReadBufferUtil} to read out
+ * Further more you may use {@link AWTGLReadBufferUtil} to read out
* the framebuffer into a BufferedImage for further AWT processing.
*/
public class Screenshot {
private Screenshot() {}
- /**
+ /**
* Takes a fast screenshot of the current OpenGL drawable to a Targa
* file. Requires the OpenGL context for the desired drawable to be
* current. Takes the screenshot from the last assigned read buffer,
@@ -94,7 +94,7 @@ public class Screenshot {
writeToTargaFile(file, width, height, false);
}
- /**
+ /**
* Takes a fast screenshot of the current OpenGL drawable to a Targa
* file. Requires the OpenGL context for the desired drawable to be
* current. Takes the screenshot from the last assigned read buffer,
@@ -122,7 +122,7 @@ public class Screenshot {
writeToTargaFile(file, 0, 0, width, height, alpha);
}
- /**
+ /**
* Takes a fast screenshot of the current OpenGL drawable to a Targa
* file. Requires the OpenGL context for the desired drawable to be
* current. Takes the screenshot from the last assigned read buffer,
@@ -410,5 +410,5 @@ public class Screenshot {
if (!gl.isExtensionAvailable(GLExtensions.EXT_abgr)) {
throw new IllegalArgumentException("Saving alpha channel requires GL_EXT_abgr");
}
- }
+ }
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java
index c67141525..6e504c089 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java
@@ -129,7 +129,7 @@ import jogamp.opengl.Debug;
*/
public class TextRenderer {
private static final boolean DEBUG;
-
+
static {
Debug.initSingleton();
DEBUG = Debug.isPropertyDefined("jogl.debug.TextRenderer", true);
@@ -200,10 +200,10 @@ public class TextRenderer {
// Debugging purposes only
private boolean debugged;
Pipelined_QuadRenderer mPipelinedQuadRenderer;
-
+
//emzic: added boolean flag
private boolean useVertexArrays = true;
-
+
//emzic: added boolean flag
private boolean isExtensionAvailable_GL_VERSION_1_5;
private boolean checkFor_isExtensionAvailable_GL_VERSION_1_5;
@@ -707,7 +707,7 @@ public class TextRenderer {
/**
* emzic: here the call to glBindBuffer crashes on certain graphicscard/driver combinations
* this is why the ugly try-catch block has been added, which falls back to the old textrenderer
- *
+ *
* @param ortho
* @throws GLException
*/
@@ -891,7 +891,7 @@ public class TextRenderer {
data.markUsed();
Rectangle2D origRect = data.origRect();
-
+
// Align the leftmost point of the baseline to the (x, y, z) coordinate requested
renderer.draw3DRect(x - (scaleFactor * data.origOriginX()),
y - (scaleFactor * ((float) origRect.getHeight() - data.origOriginY())), z,
@@ -1715,7 +1715,7 @@ public class TextRenderer {
return glyph;
}
}
-
+
private static class CharacterCache {
private CharacterCache() {
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/TextureRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/awt/TextureRenderer.java
index 922fc69c1..26e1eb041 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/awt/TextureRenderer.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/awt/TextureRenderer.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,11 +29,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -407,7 +407,7 @@ public class TextureRenderer {
this.a = a;
gl.glColor4f(this.r, this.g, this.b, this.a);
- }
+ }
private float[] compArray;
/** Changes the current color of this TextureRenderer to the
@@ -437,7 +437,7 @@ public class TextureRenderer {
@param screenx the on-screen x coordinate at which to draw the rectangle
@param screeny the on-screen y coordinate (relative to lower left) at
which to draw the rectangle
-
+
@throws GLException If an OpenGL context is not current when this method is called
*/
public void drawOrthoRect(int screenx, int screeny) throws GLException {
@@ -459,7 +459,7 @@ public class TextureRenderer {
rectangle to draw
@param width the width of the rectangle to draw
@param height the height of the rectangle to draw
-
+
@throws GLException If an OpenGL context is not current when this method is called
*/
public void drawOrthoRect(int screenx, int screeny,
@@ -490,7 +490,7 @@ public class TextureRenderer {
@param height the height in texels of the rectangle to draw
@param scaleFactor the scale factor to apply (multiplicatively)
to the size of the drawn rectangle
-
+
@throws GLException If an OpenGL context is not current when this method is called
*/
public void draw3DRect(float x, float y, float z,
@@ -518,7 +518,7 @@ public class TextureRenderer {
OpenGL texture to the screen, if the application intends to draw
them as a flat overlay on to the screen. Must be used if {@link
#beginOrthoRendering} is used to set up the rendering stage for
- this overlay.
+ this overlay.
@throws GLException If an OpenGL context is not current when this method is called
*/
@@ -552,7 +552,7 @@ public class TextureRenderer {
private void beginRendering(boolean ortho, int width, int height, boolean disableDepthTestForOrtho) {
GL2 gl = GLContext.getCurrentGL().getGL2();
- int attribBits =
+ int attribBits =
GL2.GL_ENABLE_BIT | GL2.GL_TEXTURE_BIT | GL2.GL_COLOR_BUFFER_BIT |
(ortho ? (GL2.GL_DEPTH_BUFFER_BIT | GL2.GL_TRANSFORM_BIT) : 0);
gl.glPushAttrib(attribBits);
@@ -622,7 +622,7 @@ public class TextureRenderer {
// Infer the internal format if not an intensity texture
int internalFormat = (intensity ? GL2.GL_INTENSITY : 0);
- int imageType =
+ int imageType =
(intensity ? BufferedImage.TYPE_BYTE_GRAY :
(alpha ? BufferedImage.TYPE_INT_ARGB_PRE : BufferedImage.TYPE_INT_RGB));
image = new BufferedImage(width, height, imageType);
diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapCharRec.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapCharRec.java
index 34685e1b2..e8df6aaec 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapCharRec.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapCharRec.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -41,8 +41,8 @@ package com.jogamp.opengl.util.gl2;
/* Copyright (c) Mark J. Kilgard, 1994, 1998. */
-/* This program is freely distributable without licensing fees
- and is provided without guarantee or warrantee expressed or
+/* This program is freely distributable without licensing fees
+ and is provided without guarantee or warrantee expressed or
implied. This program is -not- in the public domain. */
class BitmapCharRec {
diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapFontRec.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapFontRec.java
index 18f7d3b28..d4ee12b32 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapFontRec.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapFontRec.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -41,8 +41,8 @@ package com.jogamp.opengl.util.gl2;
/* Copyright (c) Mark J. Kilgard, 1994, 1998. */
-/* This program is freely distributable without licensing fees
- and is provided without guarantee or warrantee expressed or
+/* This program is freely distributable without licensing fees
+ and is provided without guarantee or warrantee expressed or
implied. This program is -not- in the public domain. */
class BitmapFontRec {
diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/CoordRec.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/CoordRec.java
index 9ad95ec03..5e26e0d14 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/gl2/CoordRec.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/CoordRec.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -41,8 +41,8 @@ package com.jogamp.opengl.util.gl2;
/* Copyright (c) Mark J. Kilgard, 1994, 1998. */
-/* This program is freely distributable without licensing fees
- and is provided without guarantee or warrantee expressed or
+/* This program is freely distributable without licensing fees
+ and is provided without guarantee or warrantee expressed or
implied. This program is -not- in the public domain. */
class CoordRec {
diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUT.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUT.java
index 010ce6699..42529f3f1 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUT.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUT.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -163,7 +163,7 @@ public class GLUT {
public void glutSolidCylinder(double radius, double height, int slices, int stacks) {
GL2 gl = GLUgl2.getCurrentGL2();
-
+
// Prepare table of points for drawing end caps
double [] x = new double[slices];
double [] y = new double[slices];
@@ -174,7 +174,7 @@ public class GLUT {
x[i] = Math.cos(angle) * radius;
y[i] = Math.sin(angle) * radius;
}
-
+
// Draw bottom cap
gl.glBegin(GL2.GL_TRIANGLE_FAN);
gl.glNormal3d(0,0,-1);
@@ -184,7 +184,7 @@ public class GLUT {
}
gl.glVertex3d(x[0], y[0], 0);
gl.glEnd();
-
+
// Draw top cap
gl.glBegin(GL2.GL_TRIANGLE_FAN);
gl.glNormal3d(0,0,1);
@@ -194,7 +194,7 @@ public class GLUT {
}
gl.glVertex3d(x[0], y[0], height);
gl.glEnd();
-
+
// Draw walls
quadObjInit(glu);
glu.gluQuadricDrawStyle(quadObj, GLU.GLU_FILL);
@@ -262,7 +262,7 @@ public class GLUT {
/**
* Renders the teapot as a solid shape of the specified size. The teapot is
* created in a way that replicates the C GLUT implementation.
- *
+ *
* @param scale
* the factor by which to scale the teapot
*/
@@ -278,7 +278,7 @@ public class GLUT {
* instead of the y=-1 plane). Both surface normals and texture coordinates
* for the teapot are generated. The teapot is generated with OpenGL
* evaluators.
- *
+ *
* @param scale
* the factor by which to scale the teapot
* @param cStyle
@@ -292,14 +292,14 @@ public class GLUT {
/**
* Renders the teapot as a wireframe shape of the specified size. The teapot
* is created in a way that replicates the C GLUT implementation.
- *
+ *
* @param scale
* the factor by which to scale the teapot
*/
public void glutWireTeapot(double scale) {
glutWireTeapot(scale, true);
}
-
+
/**
* Renders the teapot as a wireframe shape of the specified size. The teapot
* can either be created in a way that is backward-compatible with the
@@ -308,7 +308,7 @@ public class GLUT {
* plane, instead of the y=-1 plane). Both surface normals and texture
* coordinates for the teapot are generated. The teapot is generated with
* OpenGL evaluators.
- *
+ *
* @param scale
* the factor by which to scale the teapot
* @param cStyle
@@ -356,7 +356,7 @@ public class GLUT {
int[] skiprows = new int[1];
int[] skippixels = new int[1];
int[] alignment = new int[1];
- beginBitmap(gl,
+ beginBitmap(gl,
swapbytes,
lsbfirst,
rowlength,
@@ -367,7 +367,7 @@ public class GLUT {
for (int i = 0; i < len; i++) {
bitmapCharacterImpl(gl, font, string.charAt(i));
}
- endBitmap(gl,
+ endBitmap(gl,
swapbytes,
lsbfirst,
rowlength,
@@ -502,7 +502,7 @@ public class GLUT {
gl.glEnd( );
}
}
-
+
/**
This function draws a solid-shaded dodecahedron
whose facets are rhombic and
@@ -522,7 +522,7 @@ public class GLUT {
}
gl.glEnd( );
}
-
+
//----------------------------------------------------------------------
// Internals only below this point
//
@@ -879,7 +879,7 @@ public class GLUT {
}
/* rhombic dodecahedron data: */
-
+
private static final double rdod_r[][] =
{
{ 0.0, 0.0, 1.0 },
@@ -897,7 +897,7 @@ public class GLUT {
{ 0.000000000000, -0.707106781187, -0.5 },
{ 0.0, 0.0, -1.0 }
};
-
+
private static final int rdod_v[][] =
{
{ 0, 1, 5, 2 },
@@ -913,7 +913,7 @@ public class GLUT {
{ 7, 11, 13, 12 },
{ 8, 12, 13, 9 }
};
-
+
private static final double rdod_n[][] =
{
{ 0.353553390594, 0.353553390594, 0.5 },
@@ -929,7 +929,7 @@ public class GLUT {
{ -0.353553390594, -0.353553390594, -0.5 },
{ 0.353553390594, -0.353553390594, -0.5 }
};
-
+
/* tetrahedron data: */
private static final float T = 1.73205080756887729f;
@@ -1124,7 +1124,7 @@ public class GLUT {
float[] r = new float[4*4*3];
float[] s = new float[4*4*3];
int i, j, k, l;
-
+
gl.glPushAttrib(GL2.GL_ENABLE_BIT | GL2.GL_EVAL_BIT | GL2.GL_POLYGON_BIT);
gl.glEnable(GL2.GL_AUTO_NORMAL);
gl.glEnable(GL2.GL_NORMALIZE);
@@ -1183,7 +1183,7 @@ public class GLUT {
gl.glPopMatrix();
gl.glPopAttrib();
}
-
+
private static void evaluateTeapotMesh(GL2 gl,
int grid,
int type,
diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmap8x13.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmap8x13.java
index 07ded652a..c24483777 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmap8x13.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmap8x13.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmap9x15.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmap9x15.java
index 5d357f3f7..62af3b631 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmap9x15.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmap9x15.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica10.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica10.java
index b9c7e6e50..5f06d697e 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica10.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica10.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica12.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica12.java
index bc86f6216..8326d6461 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica12.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica12.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica18.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica18.java
index 1b2e69ba4..cb11f6bec 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica18.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica18.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapTimesRoman10.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapTimesRoman10.java
index f753b56f7..17cbd0796 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapTimesRoman10.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapTimesRoman10.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapTimesRoman24.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapTimesRoman24.java
index 073e6e673..9cc2bdc3a 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapTimesRoman24.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapTimesRoman24.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeMonoRoman.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeMonoRoman.java
index b8296924e..3587ca992 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeMonoRoman.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeMonoRoman.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeRoman.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeRoman.java
index 94fa1c4fd..cf51ddd3c 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeRoman.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeRoman.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeCharRec.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeCharRec.java
index af3d538ae..515212f0e 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeCharRec.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeCharRec.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -41,8 +41,8 @@ package com.jogamp.opengl.util.gl2;
/* Copyright (c) Mark J. Kilgard, 1994, 1998. */
-/* This program is freely distributable without licensing fees
- and is provided without guarantee or warrantee expressed or
+/* This program is freely distributable without licensing fees
+ and is provided without guarantee or warrantee expressed or
implied. This program is -not- in the public domain. */
class StrokeCharRec {
diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeFontRec.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeFontRec.java
index d3195f24d..5335c8523 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeFontRec.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeFontRec.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -41,8 +41,8 @@ package com.jogamp.opengl.util.gl2;
/* Copyright (c) Mark J. Kilgard, 1994, 1998. */
-/* This program is freely distributable without licensing fees
- and is provided without guarantee or warrantee expressed or
+/* This program is freely distributable without licensing fees
+ and is provided without guarantee or warrantee expressed or
implied. This program is -not- in the public domain. */
class StrokeFontRec {
diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeRec.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeRec.java
index 8796e8b08..b0c91c696 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeRec.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeRec.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -41,14 +41,14 @@ package com.jogamp.opengl.util.gl2;
/* Copyright (c) Mark J. Kilgard, 1994, 1998. */
-/* This program is freely distributable without licensing fees
- and is provided without guarantee or warrantee expressed or
+/* This program is freely distributable without licensing fees
+ and is provided without guarantee or warrantee expressed or
implied. This program is -not- in the public domain. */
class StrokeRec {
public int num_coords;
public CoordRec[] coord;
-
+
public StrokeRec(int num_coords,
CoordRec[] coord) {
this.num_coords = num_coords;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java
index edc3d2677..68c1d0fec 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java
@@ -62,7 +62,7 @@ import com.jogamp.common.util.VersionNumber;
* A documented example of how to use this code is available
* {@link #create(GL2ES2, int, Class, String, String, String, boolean) here} and
* {@link #create(GL2ES2, int, int, Class, String, String[], String, String) here}.
- *
+ *
*/
public class ShaderCode {
public static final boolean DEBUG = Debug.debug("GLSLCode");
@@ -70,22 +70,22 @@ public class ShaderCode {
/** Unique resource suffix for {@link GL2ES2#GL_VERTEX_SHADER} in source code: vp */
public static final String SUFFIX_VERTEX_SOURCE = "vp" ;
-
+
/** Unique resource suffix for {@link GL2ES2#GL_VERTEX_SHADER} in binary: bvp */
public static final String SUFFIX_VERTEX_BINARY = "bvp" ;
-
+
/** Unique resource suffix for {@link GL3#GL_GEOMETRY_SHADER} in source code: gp */
public static final String SUFFIX_GEOMETRY_SOURCE = "gp" ;
-
+
/** Unique resource suffix for {@link GL3#GL_GEOMETRY_SHADER} in binary: bgp */
public static final String SUFFIX_GEOMETRY_BINARY = "bgp" ;
-
+
/** Unique resource suffix for {@link GL2ES2#GL_FRAGMENT_SHADER} in source code: fp */
public static final String SUFFIX_FRAGMENT_SOURCE = "fp" ;
-
+
/** Unique resource suffix for {@link GL2ES2#GL_FRAGMENT_SHADER} in binary: bfp */
public static final String SUFFIX_FRAGMENT_BINARY = "bfp" ;
-
+
/** Unique relative path for binary shader resources for {@link GLES2#GL_NVIDIA_PLATFORM_BINARY_NV NVIDIA}: nvidia */
public static final String SUB_PATH_NVIDIA = "nvidia" ;
@@ -94,7 +94,7 @@ public class ShaderCode {
* @param count number of shaders
* @param source CharSequence array containing the shader sources, organized as source[count][strings-per-shader].
* May be either an immutable String - or mutable StringBuilder array.
- *
+ *
* @throws IllegalArgumentException if count and source.length do not match
*/
public ShaderCode(int type, int count, CharSequence[][] source) {
@@ -125,7 +125,7 @@ public class ShaderCode {
/**
* @param type either {@link GL2ES2#GL_VERTEX_SHADER}, {@link GL2ES2#GL_FRAGMENT_SHADER} or {@link GL3#GL_GEOMETRY_SHADER}
* @param count number of shaders
- * @param binary binary buffer containing the shader binaries,
+ * @param binary binary buffer containing the shader binaries,
*/
public ShaderCode(int type, int count, int binFormat, Buffer binary) {
switch (type) {
@@ -147,19 +147,19 @@ public class ShaderCode {
/**
* Creates a complete {@link ShaderCode} object while reading all shader source of sourceFiles,
* which location is resolved using the context class, see {@link #readShaderSource(Class, String)}.
- *
+ *
* @param gl current GL object to determine whether a shader compiler is available. If null, no validation is performed.
* @param type either {@link GL2ES2#GL_VERTEX_SHADER}, {@link GL2ES2#GL_FRAGMENT_SHADER} or {@link GL3#GL_GEOMETRY_SHADER}
* @param count number of shaders
* @param context class used to help resolving the source location
* @param sourceFiles array of source locations, organized as sourceFiles[count]
* @param mutableStringBuilder if true method returns a mutable StringBuilder instance
- * which can be edited later on at the costs of a String conversion when passing to
+ * which can be edited later on at the costs of a String conversion when passing to
* {@link GL2ES2#glShaderSource(int, int, String[], IntBuffer)}.
* If false method returns an immutable String instance,
* which can be passed to {@link GL2ES2#glShaderSource(int, int, String[], IntBuffer)}
* at no additional costs.
- *
+ *
* @throws IllegalArgumentException if count and sourceFiles.length do not match
* @see #readShaderSource(Class, String)
*/
@@ -192,16 +192,16 @@ public class ShaderCode {
/**
* Creates a complete {@link ShaderCode} object while reading the shader binary of binaryFile,
* which location is resolved using the context class, see {@link #readShaderBinary(Class, String)}.
- *
+ *
* @param type either {@link GL2ES2#GL_VERTEX_SHADER}, {@link GL2ES2#GL_FRAGMENT_SHADER} or {@link GL3#GL_GEOMETRY_SHADER}
* @param count number of shaders
* @param context class used to help resolving the source location
* @param binFormat a valid native binary format as they can be queried by {@link ShaderUtil#getShaderBinaryFormats(GL)}.
* @param sourceFiles array of source locations, organized as sourceFiles[count]
- *
+ *
* @see #readShaderBinary(Class, String)
* @see ShaderUtil#getShaderBinaryFormats(GL)
- */
+ */
public static ShaderCode create(int type, int count, Class> context, int binFormat, String binaryFile) {
ByteBuffer shaderBinary = null;
if(null!=binaryFile && 0<=binFormat) {
@@ -231,12 +231,12 @@ public class ShaderCode {
*
- * @param binary true for a binary resource, false for a source resource
+ *
+ * @param binary true for a binary resource, false for a source resource
* @param type either {@link GL2ES2#GL_VERTEX_SHADER}, {@link GL2ES2#GL_FRAGMENT_SHADER} or {@link GL3#GL_GEOMETRY_SHADER}
- *
+ *
* @throws GLException if type is not supported
- *
+ *
* @see #create(GL2ES2, int, Class, String, String, String, boolean)
*/
public static String getFileSuffix(boolean binary, int type) {
@@ -252,16 +252,16 @@ public class ShaderCode {
}
}
- /**
+ /**
* Returns a unique relative path for binary shader resources as follows:
*
- *
+ *
* @throws GLException if binFormat is not supported
- *
+ *
* @see #create(GL2ES2, int, Class, String, String, String, boolean)
- */
+ */
public static String getBinarySubPath(int binFormat) {
switch (binFormat) {
case GLES2.GL_NVIDIA_PLATFORM_BINARY_NV:
@@ -272,42 +272,42 @@ public class ShaderCode {
}
/**
- * Convenient creation method for instantiating a complete {@link ShaderCode} object
- * either from source code using {@link #create(GL2ES2, int, int, Class, String[])},
+ * Convenient creation method for instantiating a complete {@link ShaderCode} object
+ * either from source code using {@link #create(GL2ES2, int, int, Class, String[])},
* or from a binary code using {@link #create(int, int, Class, int, String)},
* whatever is available first.
*
- * The source and binary location names are expected w/o suffixes which are
+ * The source and binary location names are expected w/o suffixes which are
* resolved and appended using {@link #getFileSuffix(boolean, int)}.
*
*
* Additionally, the binary resource is expected within a subfolder of binRoot
* which reflects the vendor specific binary format, see {@link #getBinarySubPath(int)}.
* All {@link ShaderUtil#getShaderBinaryFormats(GL)} are being iterated
- * using the binary subfolder, the first existing resource is being used.
+ * using the binary subfolder, the first existing resource is being used.
*
- *
+ *
* Example:
*
* Your std JVM layout (plain or within a JAR):
- *
+ *
* org/test/glsl/MyShaderTest.class
* org/test/glsl/shader/vertex.vp
* org/test/glsl/shader/fragment.fp
* org/test/glsl/shader/bin/nvidia/vertex.bvp
* org/test/glsl/shader/bin/nvidia/fragment.bfp
- *
+ *
* Your Android APK layout:
- *
+ *
* classes.dex
* assets/org/test/glsl/shader/vertex.vp
* assets/org/test/glsl/shader/fragment.fp
* assets/org/test/glsl/shader/bin/nvidia/vertex.bvp
* assets/org/test/glsl/shader/bin/nvidia/fragment.bfp
* ...
- *
+ *
* Your invocation in org/test/glsl/MyShaderTest.java:
- *
+ *
* ShaderCode vp0 = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, 1, this.getClass(),
* "shader", new String[] { "vertex" }, "shader/bin", "vertex");
* ShaderCode fp0 = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, 1, this.getClass(),
@@ -318,11 +318,11 @@ public class ShaderCode {
* st.attachShaderProgram(gl, sp0, true);
*
* A simplified entry point is {@link #create(GL2ES2, int, Class, String, String, String, boolean)}.
- *
+ *
*
* The location is finally being resolved using the context class, see {@link #readShaderBinary(Class, String)}.
*
- *
+ *
* @param gl current GL object to determine whether a shader compiler is available (if source is used),
* or to determine the shader binary format (if binary is used).
* @param type either {@link GL2ES2#GL_VERTEX_SHADER}, {@link GL2ES2#GL_FRAGMENT_SHADER} or {@link GL3#GL_GEOMETRY_SHADER}
@@ -333,22 +333,22 @@ public class ShaderCode {
* @param binRoot relative root path for binBasenames
* @param binBasename basename w/o path or suffix relative to binRoot for the shader's binary code
* @param mutableStringBuilder if true method returns a mutable StringBuilder instance
- * which can be edited later on at the costs of a String conversion when passing to
+ * which can be edited later on at the costs of a String conversion when passing to
* {@link GL2ES2#glShaderSource(int, int, String[], IntBuffer)}.
* If false method returns an immutable String instance,
* which can be passed to {@link GL2ES2#glShaderSource(int, int, String[], IntBuffer)}
* at no additional costs.
- *
+ *
* @throws IllegalArgumentException if count and srcBasenames.length do not match
- *
+ *
* @see #create(GL2ES2, int, int, Class, String[])
* @see #create(int, int, Class, int, String)
* @see #readShaderSource(Class, String)
* @see #getFileSuffix(boolean, int)
* @see ShaderUtil#getShaderBinaryFormats(GL)
* @see #getBinarySubPath(int)
- */
- public static ShaderCode create(GL2ES2 gl, int type, int count, Class> context,
+ */
+ public static ShaderCode create(GL2ES2 gl, int type, int count, Class> context,
String srcRoot, String[] srcBasenames, String binRoot, String binBasename,
boolean mutableStringBuilder) {
ShaderCode res = null;
@@ -391,28 +391,28 @@ public class ShaderCode {
/**
* Simplified variation of {@link #create(GL2ES2, int, int, Class, String, String[], String, String)}.
*
- *
+ *
* Example:
*
- *
+ *
* @param gl current GL object to determine whether a shader compiler is available (if source is used),
* or to determine the shader binary format (if binary is used).
* @param type either {@link GL2ES2#GL_VERTEX_SHADER}, {@link GL2ES2#GL_FRAGMENT_SHADER} or {@link GL3#GL_GEOMETRY_SHADER}
@@ -433,20 +433,20 @@ public class ShaderCode {
* @param basenames basename w/o path or suffix relative to srcRoot and binRoot
* for the shader's source and binary code.
* @param mutableStringBuilder if true method returns a mutable StringBuilder instance
- * which can be edited later on at the costs of a String conversion when passing to
+ * which can be edited later on at the costs of a String conversion when passing to
* {@link GL2ES2#glShaderSource(int, int, String[], IntBuffer)}.
* If false method returns an immutable String instance,
* which can be passed to {@link GL2ES2#glShaderSource(int, int, String[], IntBuffer)}
* at no additional costs.
* @throws IllegalArgumentException if count is not 1
- *
+ *
* @see #create(GL2ES2, int, int, Class, String, String[], String, String)
- */
- public static ShaderCode create(GL2ES2 gl, int type, Class> context,
+ */
+ public static ShaderCode create(GL2ES2 gl, int type, Class> context,
String srcRoot, String binRoot, String basename, boolean mutableStringBuilder) {
- return create(gl, type, 1, context, srcRoot, new String[] { basename }, binRoot, basename, mutableStringBuilder );
+ return create(gl, type, 1, context, srcRoot, new String[] { basename }, binRoot, basename, mutableStringBuilder );
}
-
+
/**
* returns the uniq shader id as an integer
*/
@@ -455,7 +455,7 @@ public class ShaderCode {
public int shaderType() { return shaderType; }
public String shaderTypeStr() { return shaderTypeStr(shaderType); }
- public static String shaderTypeStr(int type) {
+ public static String shaderTypeStr(int type) {
switch (type) {
case GL2ES2.GL_VERTEX_SHADER:
return "VERTEX_SHADER";
@@ -553,7 +553,7 @@ public class ShaderCode {
} else {
CharSequence[] src = shaderSource[i];
int lineno=0;
-
+
for(int j=0; jdata after the line containing tag.
*
* Note: The shader source to be edit must be created using a mutable StringBuilder.
*
- *
+ *
* @param shaderIdx the shader index to be used.
* @param tag search string
* @param fromIndex start search tag begininig with this index
* @param data the text to be inserted. Shall end with an EOL '\n' character.
* @return index after the inserted data
- *
+ *
* @throws IllegalStateException if the shader source's CharSequence is immutable, i.e. not of type StringBuilder
*/
public int insertShaderSource(int shaderIdx, String tag, int fromIndex, CharSequence data) {
@@ -595,7 +595,7 @@ public class ShaderCode {
final int sourceCount = (null!=shaderSource)?shaderSource.length:0;
if(shaderIdx>=sourceCount) {
throw new IndexOutOfBoundsException("shaderIdx not within source bounds [0.."+(sourceCount-1)+"]: "+shaderIdx);
- }
+ }
final CharSequence[] src = shaderSource[shaderIdx];
int curEndIndex = 0;
for(int j=0; joldName with newName in all shader sources.
*
* In case oldName and newName are equal, no action is performed.
- *
+ *
*
* Note: The shader source to be edit must be created using a mutable StringBuilder.
*
- *
+ *
* @param oldName the to be replace string
* @param newName the replacement string
* @return the number of replacements
- *
+ *
* @throws IllegalStateException if the shader source's CharSequence is immutable, i.e. not of type StringBuilder
*/
public int replaceInShaderSource(String oldName, String newName) {
@@ -675,18 +675,18 @@ public class ShaderCode {
}
return num;
}
-
+
/**
* Adds data at offset in shader source for shader shaderIdx.
*
* Note: The shader source to be edit must be created using a mutable StringBuilder.
*
- *
+ *
* @param shaderIdx the shader index to be used.
* @param position in shader source segments of shader shaderIdx
* @param data the text to be inserted. Shall end with an EOL '\n' character
* @return index after the inserted data
- *
+ *
* @throws IllegalStateException if the shader source's CharSequence is immutable, i.e. not of type StringBuilder
*/
public int insertShaderSource(int shaderIdx, int position, CharSequence data) {
@@ -700,7 +700,7 @@ public class ShaderCode {
final int sourceCount = (null!=shaderSource)?shaderSource.length:0;
if(shaderIdx>=sourceCount) {
throw new IndexOutOfBoundsException("shaderIdx not within source bounds [0.."+(sourceCount-1)+"]: "+shaderIdx);
- }
+ }
final CharSequence[] src = shaderSource[shaderIdx];
int curEndIndex = 0;
for(int j=0; j context, URLConnection conn, StringBuilder result) throws IOException {
readShaderSource(context, conn, result, 0);
}
-
+
/**
* Reads shader source located in path,
* either relative to the context class or absolute as-is.
@@ -774,21 +774,21 @@ public class ShaderCode {
* Final location lookup is performed via {@link ClassLoader#getResource(String)} and {@link ClassLoader#getSystemResource(String)},
* see {@link IOUtil#getResource(Class, String)}.
*
- *
+ *
* @param context class used to help resolve the source location
* @param path location of shader source
* @param mutableStringBuilder if true method returns a mutable StringBuilder instance
- * which can be edited later on at the costs of a String conversion when passing to
+ * which can be edited later on at the costs of a String conversion when passing to
* {@link GL2ES2#glShaderSource(int, int, String[], IntBuffer)}.
* If false method returns an immutable String instance,
* which can be passed to {@link GL2ES2#glShaderSource(int, int, String[], IntBuffer)}
* at no additional costs.
- * @throws IOException
- *
+ * @throws IOException
+ *
* @see IOUtil#getResource(Class, String)
- */
+ */
public static CharSequence readShaderSource(Class> context, String path, boolean mutableStringBuilder) throws IOException {
- URLConnection conn = IOUtil.getResource(context, path);
+ URLConnection conn = IOUtil.getResource(context, path);
if (conn == null) {
return null;
}
@@ -798,17 +798,17 @@ public class ShaderCode {
}
/**
- * Reads shader binary located in path,
+ * Reads shader binary located in path,
* either relative to the context class or absolute as-is.
*
* Final location lookup is perfomed via {@link ClassLoader#getResource(String)} and {@link ClassLoader#getSystemResource(String)},
* see {@link IOUtil#getResource(Class, String)}.
*
- *
+ *
* @param context class used to help resolve the source location
* @param path location of shader binary
- * @throws IOException
- *
+ * @throws IOException
+ *
* @see IOUtil#getResource(Class, String)
*/
public static ByteBuffer readShaderBinary(Class> context, String path) throws IOException {
@@ -824,41 +824,41 @@ public class ShaderCode {
}
}
- // Shall we use: #ifdef GL_FRAGMENT_PRECISION_HIGH .. #endif for using highp in fragment shader if avail ?
+ // Shall we use: #ifdef GL_FRAGMENT_PRECISION_HIGH .. #endif for using highp in fragment shader if avail ?
/** Default precision of {@link GL#isGLES2() ES2} for {@link GL2ES2#GL_VERTEX_SHADER vertex-shader}: {@value #es2_default_precision_vp} */
public static final String es2_default_precision_vp = "\nprecision highp float;\nprecision highp int;\n";
/** Default precision of {@link GL#isGLES2() ES2} for {@link GL2ES2#GL_FRAGMENT_SHADER fragment-shader}: {@value #es2_default_precision_fp} */
public static final String es2_default_precision_fp = "\nprecision mediump float;\nprecision mediump int;\n/*precision lowp sampler2D;*/\n";
-
+
/** Default precision of GLSL ≥ 1.30 as required until < 1.50 for {@link GL2ES2#GL_VERTEX_SHADER vertex-shader} or {@link GL3#GL_GEOMETRY_SHADER geometry-shader}: {@value #gl3_default_precision_vp_gp}. See GLSL Spec 1.30-1.50 Section 4.5.3. */
public static final String gl3_default_precision_vp_gp = "\nprecision highp float;\nprecision highp int;\n";
/** Default precision of GLSL ≥ 1.30 as required until < 1.50 for {@link GL2ES2#GL_FRAGMENT_SHADER fragment-shader}: {@value #gl3_default_precision_fp}. See GLSL Spec 1.30-1.50 Section 4.5.3. */
public static final String gl3_default_precision_fp = "\nprecision highp float;\nprecision mediump int;\n/*precision mediump sampler2D;*/\n";
-
+
/** Prefer enable over require, since it won't force a failure. */
public static final String extOESDerivativesEnable = "#extension GL_OES_standard_derivatives : enable\n";
-
+
/**
* Add GLSL version at the head of this shader source code.
*
* Note: The shader source to be edit must be created using a mutable StringBuilder.
*
- * @param gl a GL context, which must have been made current once
+ * @param gl a GL context, which must have been made current once
* @return the index after the inserted data, maybe 0 if nothing has be inserted.
*/
public final int addGLSLVersion(GL2ES2 gl) {
return insertShaderSource(0, 0, gl.getContext().getGLSLVersionString());
}
-
+
/**
* Adds default precision to source code at given position if required, i.e.
- * {@link #es2_default_precision_vp}, {@link #es2_default_precision_fp},
+ * {@link #es2_default_precision_vp}, {@link #es2_default_precision_fp},
* {@link #gl3_default_precision_vp_gp}, {@link #gl3_default_precision_fp} or none,
* depending on the {@link GLContext#getGLSLVersionNumber() GLSL version} being used.
*
* Note: The shader source to be edit must be created using a mutable StringBuilder.
*
- * @param gl a GL context, which must have been made current once
+ * @param gl a GL context, which must have been made current once
* @param pos position within this mutable shader source.
* @return the index after the inserted data, maybe 0 if nothing has be inserted.
*/
@@ -871,7 +871,7 @@ public class ShaderCode {
case GL2ES2.GL_FRAGMENT_SHADER:
defaultPrecision = es2_default_precision_vp; break;
default:
- defaultPrecision = null;
+ defaultPrecision = null;
break;
}
} else if( requiresGL3DefaultPrecision(gl) ) {
@@ -883,7 +883,7 @@ public class ShaderCode {
case GL2ES2.GL_FRAGMENT_SHADER:
defaultPrecision = gl3_default_precision_fp; break;
default:
- defaultPrecision = null;
+ defaultPrecision = null;
break;
}
} else {
@@ -894,7 +894,7 @@ public class ShaderCode {
}
return pos;
}
-
+
/** Returns true, if GLSL version requires default precision, i.e. ES2 or GLSL [1.30 .. 1.50[. */
public static final boolean requiresDefaultPrecision(GL2ES2 gl) {
if( gl.isGLES2() ) {
@@ -902,7 +902,7 @@ public class ShaderCode {
}
return requiresGL3DefaultPrecision(gl);
}
-
+
/** Returns true, if GL3 GLSL version requires default precision, i.e. GLSL [1.30 .. 1.50[. */
public static final boolean requiresGL3DefaultPrecision(GL2ES2 gl) {
if( gl.isGL3() ) {
@@ -912,16 +912,16 @@ public class ShaderCode {
return false;
}
}
-
+
/**
* Default customization of this shader source code.
*
* Note: The shader source to be edit must be created using a mutable StringBuilder.
*
- * @param gl a GL context, which must have been made current once
+ * @param gl a GL context, which must have been made current once
* @param preludeVersion if true {@link GLContext#getGLSLVersionString()} is preluded, otherwise not.
- * @param addDefaultPrecision if true default precision source code line(s) are added, i.e.
- * {@link #es2_default_precision_vp}, {@link #es2_default_precision_fp},
+ * @param addDefaultPrecision if true default precision source code line(s) are added, i.e.
+ * {@link #es2_default_precision_vp}, {@link #es2_default_precision_fp},
* {@link #gl3_default_precision_vp_gp}, {@link #gl3_default_precision_fp} or none,
* depending on the {@link GLContext#getGLSLVersionNumber() GLSL version} being used.
* @return the index after the inserted data, maybe 0 if nothing has be inserted.
@@ -940,13 +940,13 @@ public class ShaderCode {
}
return pos;
}
-
+
/**
* Default customization of this shader source code.
*
* Note: The shader source to be edit must be created using a mutable StringBuilder.
*
- * @param gl a GL context, which must have been made current once
+ * @param gl a GL context, which must have been made current once
* @param preludeVersion if true {@link GLContext#getGLSLVersionString()} is preluded, otherwise not.
* @param esDefaultPrecision optional default precision source code line(s) preluded if not null and if {@link GL#isGLES()}.
* You may use {@link #es2_default_precision_fp} for fragment shader and {@link #es2_default_precision_vp} for vertex shader.
@@ -967,8 +967,8 @@ public class ShaderCode {
pos = addDefaultShaderPrecision(gl, pos);
}
return pos;
- }
-
+ }
+
//----------------------------------------------------------------------
// Internals only below this point
//
diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java
index 1337a7e2b..d737d6f4e 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java
@@ -37,7 +37,7 @@ import java.util.Iterator;
import java.io.PrintStream;
public class ShaderProgram {
-
+
public ShaderProgram() {
id = getNextID();
}
@@ -111,7 +111,7 @@ public class ShaderProgram {
/**
* Adds a new shader to this program.
- *
+ *
*
This command does not compile and attach the shader,
* use {@link #add(GL2ES2, ShaderCode)} for this purpose.
*/
@@ -122,7 +122,7 @@ public class ShaderProgram {
public synchronized boolean contains(ShaderCode shaderCode) {
return allShaderCode.contains(shaderCode);
}
-
+
/**
* Warning slow O(n) operation ..
* @param id
@@ -145,9 +145,9 @@ public class ShaderProgram {
/**
* Creates the empty GL program object using {@link GL2ES2#glCreateProgram()},
* if not already created.
- *
+ *
* @param gl
- * @return true if shader program is valid, i.e. not zero
+ * @return true if shader program is valid, i.e. not zero
*/
public synchronized final boolean init(GL2ES2 gl) {
if( 0 == shaderProgram ) {
@@ -155,12 +155,12 @@ public class ShaderProgram {
}
return 0 != shaderProgram;
}
-
+
/**
* Adds a new shader to a this non running program.
*
*
Compiles and attaches the shader, if not done yet.
- *
+ *
* @return true if the shader was successfully added, false if compilation failed.
*/
public synchronized boolean add(GL2ES2 gl, ShaderCode shaderCode, PrintStream verboseOut) {
@@ -179,11 +179,11 @@ public class ShaderProgram {
/**
* Replace a shader in a program and re-links the program.
*
- * @param gl
+ * @param gl
* @param oldShader the to be replace Shader
* @param newShader the new ShaderCode
* @param verboseOut the optional verbose output stream
- *
+ *
* @return true if all steps are valid, shader compilation, attachment and linking; otherwise false.
*
* @see ShaderState#glEnableVertexAttribArray
@@ -199,25 +199,25 @@ public class ShaderProgram {
if(!init(gl) || !newShader.compile(gl, verboseOut)) {
return false;
}
-
+
boolean shaderWasInUse = inUse();
if(shaderWasInUse) {
useProgram(gl, false);
}
-
+
if(null != oldShader && allShaderCode.remove(oldShader)) {
if(attachedShaderCode.remove(oldShader)) {
ShaderUtil.detachShader(gl, shaderProgram, oldShader.shader());
}
}
-
+
add(newShader);
if(attachedShaderCode.add(newShader)) {
ShaderUtil.attachShader(gl, shaderProgram, newShader.shader());
}
-
+
gl.glLinkProgram(shaderProgram);
-
+
programLinked = ShaderUtil.isProgramLinkStatusValid(gl, shaderProgram, System.err);
if ( programLinked && shaderWasInUse ) {
useProgram(gl, true);
@@ -227,19 +227,19 @@ public class ShaderProgram {
/**
* Links the shader code to the program.
- *
+ *
*
Compiles and attaches the shader code to the program if not done by yet
- *
+ *
*
Within this process, all GL resources (shader and program objects) are created if necessary.
- *
+ *
* @param gl
* @param verboseOut
* @return true if program was successfully linked and is valid, otherwise false
- *
+ *
* @see #init(GL2ES2)
*/
public synchronized boolean link(GL2ES2 gl, PrintStream verboseOut) {
- if( !init(gl) ) {
+ if( !init(gl) ) {
programLinked = false; // mark unlinked due to user attempt to [re]link
return false;
}
@@ -287,7 +287,7 @@ public class ShaderProgram {
sb.append("]");
return sb;
}
-
+
public String toString() {
return toString(null).toString();
}
@@ -299,7 +299,7 @@ public class ShaderProgram {
public synchronized boolean validateProgram(GL2ES2 gl, PrintStream verboseOut) {
return ShaderUtil.isProgramExecStatusValid(gl, shaderProgram, verboseOut);
}
-
+
public synchronized void useProgram(GL2ES2 gl, boolean on) {
if(!programLinked) { throw new GLException("Program is not linked"); }
if(programInUse==on) { return; }
diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java
index 8e7781f07..f60cb6088 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java
@@ -48,21 +48,21 @@ import com.jogamp.opengl.util.GLArrayDataEditable;
* while updating the attribute and uniform locations when switching.
*
* This allows seamless switching of programs using almost same data
- * but performing different artifacts.
+ * but performing different artifacts.
*
*
* A {@link #useProgram(GL2ES2, boolean) used} ShaderState is attached to the current GL context
* and can be retrieved via {@link #getShaderState(GL)}.
*
*/
-public class ShaderState {
+public class ShaderState {
public static final boolean DEBUG;
-
+
static {
Debug.initSingleton();
DEBUG = Debug.isPropertyDefined("jogl.debug.GLSLState", true);
}
-
+
public ShaderState() {
}
@@ -80,7 +80,7 @@ public class ShaderState {
/**
* Attach user object for the given name to this ShaderState.
* Returns the previously set object or null.
- *
+ *
* @return the previous mapped object or null if none
*/
public final Object attachObject(String name, Object obj) {
@@ -89,13 +89,13 @@ public class ShaderState {
/**
* @param name name of the mapped object to detach
- *
+ *
* @return the previous mapped object or null if none
*/
public final Object detachObject(String name) {
return attachedObjectsByString.remove(name);
- }
-
+ }
+
/**
* Turns the shader program on or off.
*
@@ -104,7 +104,7 @@ public class ShaderState {
* @see com.jogamp.opengl.util.glsl.ShaderState#useProgram(GL2ES2, boolean)
*/
public synchronized void useProgram(GL2ES2 gl, boolean on) throws GLException {
- if(null==shaderProgram) { throw new GLException("No program is attached"); }
+ if(null==shaderProgram) { throw new GLException("No program is attached"); }
if(on) {
if(shaderProgram.linked()) {
shaderProgram.useProgram(gl, true);
@@ -112,7 +112,7 @@ public class ShaderState {
resetAllAttributes(gl);
resetAllUniforms(gl);
}
- } else {
+ } else {
if(resetAllShaderData) {
setAllAttributes(gl);
}
@@ -124,7 +124,7 @@ public class ShaderState {
resetAllUniforms(gl);
}
}
- resetAllShaderData = false;
+ resetAllShaderData = false;
} else {
shaderProgram.useProgram(gl, false);
}
@@ -141,17 +141,17 @@ public class ShaderState {
/**
* Attach or switch a shader program
*
- *
Attaching a shader program the first time,
+ *
Attaching a shader program the first time,
* as well as switching to another program on the fly,
* while managing all attribute and uniform data.
- *
+ *
*
[Re]sets all data and use program in case of a program switch.
- *
+ *
*
Use program, {@link #useProgram(GL2ES2, boolean)},
* if enable is true.
- *
+ *
* @return true if shader program was attached, otherwise false (already attached)
- *
+ *
* @throws GLException if program was not linked and linking fails
*/
public synchronized boolean attachShaderProgram(GL2ES2 gl, ShaderProgram prog, boolean enable) throws GLException {
@@ -161,7 +161,7 @@ public class ShaderState {
System.err.println("ShaderState: attachShaderProgram: "+curId+" -> "+newId+" (enable: "+enable+")\n\t"+shaderProgram+"\n\t"+prog);
if(DEBUG) {
Thread.dumpStack();
- }
+ }
}
if(null!=shaderProgram) {
if(shaderProgram.equals(prog)) {
@@ -190,7 +190,7 @@ public class ShaderState {
shaderProgram = prog;
if(null!=shaderProgram) {
- // [re]set all data and use program if switching program,
+ // [re]set all data and use program if switching program,
// or use program if program is linked
if(resetAllShaderData || enable) {
useProgram(gl, true); // may reset all data
@@ -216,7 +216,7 @@ public class ShaderState {
*/
public synchronized void destroy(GL2ES2 gl) {
release(gl, true, true, true);
- attachedObjectsByString.clear();
+ attachedObjectsByString.clear();
}
/**
@@ -242,7 +242,7 @@ public class ShaderState {
if(destroyBoundAttributes) {
for(Iterator iter = managedAttributes.iterator(); iter.hasNext(); ) {
iter.next().destroy(gl);
- }
+ }
}
releaseAllAttributes(gl);
releaseAllUniforms(gl);
@@ -258,7 +258,7 @@ public class ShaderState {
/**
* Gets the cached location of a shader attribute.
*
- * @return -1 if there is no such attribute available,
+ * @return -1 if there is no such attribute available,
* otherwise >= 0
*
* @see #bindAttribLocation(GL2ES2, int, String)
@@ -270,7 +270,7 @@ public class ShaderState {
Integer idx = activeAttribLocationMap.get(name);
return (null!=idx)?idx.intValue():-1;
}
-
+
/**
* Get the previous cached vertex attribute data.
*
@@ -289,27 +289,27 @@ public class ShaderState {
public GLArrayData getAttribute(String name) {
return activeAttribDataMap.get(name);
}
-
+
public boolean isActiveAttribute(GLArrayData attribute) {
return attribute == activeAttribDataMap.get(attribute.getName());
}
-
+
/**
* Binds or unbinds the {@link GLArrayData} lifecycle to this ShaderState.
- *
+ *
*
If an attribute location is cached (ie {@link #bindAttribLocation(GL2ES2, int, String)})
* it is promoted to the {@link GLArrayData} instance.
- *
- *
The attribute will be destroyed with {@link #destroy(GL2ES2)}
+ *
+ *
The attribute will be destroyed with {@link #destroy(GL2ES2)}
* and it's location will be reset when switching shader with {@link #attachShaderProgram(GL2ES2, ShaderProgram)}.
- *
+ *
*
The data will not be transfered to the GPU, use {@link #vertexAttribPointer(GL2ES2, GLArrayData)} additionally.
- *
+ *
*
The data will also be {@link GLArrayData#associate(Object, boolean) associated} with this ShaderState.
- *
+ *
* @param attribute the {@link GLArrayData} which lifecycle shall be managed
* @param own true if owning shall be performs, false if disowning.
- *
+ *
* @see #bindAttribLocation(GL2ES2, int, String)
* @see #getAttribute(String)
* @see GLArrayData#associate(Object, boolean)
@@ -326,11 +326,11 @@ public class ShaderState {
}
attribute.associate(this, own);
}
-
+
public boolean ownsAttribute(GLArrayData attribute) {
return managedAttributes.contains(attribute);
}
-
+
/**
* Binds a shader attribute to a location.
* Multiple names can be bound to one location.
@@ -339,14 +339,14 @@ public class ShaderState {
*
* @throws GLException if no program is attached
* @throws GLException if the program is already linked
- *
+ *
* @see javax.media.opengl.GL2ES2#glBindAttribLocation(int, int, String)
* @see #getAttribLocation(GL2ES2, String)
* @see #getCachedAttribLocation(String)
*/
public void bindAttribLocation(GL2ES2 gl, int location, String name) {
if(null==shaderProgram) throw new GLException("No program is attached");
- if(shaderProgram.linked()) throw new GLException("Program is already linked");
+ if(shaderProgram.linked()) throw new GLException("Program is already linked");
final Integer loc = new Integer(location);
activeAttribLocationMap.put(name, loc);
gl.glBindAttribLocation(shaderProgram.program(), location, name);
@@ -361,7 +361,7 @@ public class ShaderState {
*
* @throws GLException if no program is attached
* @throws GLException if the program is already linked
- *
+ *
* @see javax.media.opengl.GL2ES2#glBindAttribLocation(int, int, String)
* @see #getAttribLocation(GL2ES2, String)
* @see #getCachedAttribLocation(String)
@@ -382,7 +382,7 @@ public class ShaderState {
* or the GLSL queried via {@link GL2ES2#glGetAttribLocation(int, String)}.
* The location will be cached.
*
- * @return -1 if there is no such attribute available,
+ * @return -1 if there is no such attribute available,
* otherwise >= 0
* @throws GLException if no program is attached
* @throws GLException if the program is not linked and no location was cached.
@@ -407,22 +407,22 @@ public class ShaderState {
System.err.println("ShaderState: glGetAttribLocation failed, no location for: "+name+", loc: "+location);
if(DEBUG) {
Thread.dumpStack();
- }
+ }
}
}
return location;
}
-
+
/**
* Validates and returns the location of a shader attribute.
- * Uses either the cached value {@link #getCachedAttribLocation(String)} if valid,
+ * Uses either the cached value {@link #getCachedAttribLocation(String)} if valid,
* or the GLSL queried via {@link GL2ES2#glGetAttribLocation(int, String)}.
- * The location will be cached and set in the
+ * The location will be cached and set in the
* {@link GLArrayData} object.
*
- * @return -1 if there is no such attribute available,
+ * @return -1 if there is no such attribute available,
* otherwise >= 0
- *
+ *
* @throws GLException if no program is attached
* @throws GLException if the program is not linked and no location was cached.
*
@@ -451,13 +451,13 @@ public class ShaderState {
System.err.println("ShaderState: glGetAttribLocation failed, no location for: "+name+", loc: "+location);
if(DEBUG) {
Thread.dumpStack();
- }
+ }
}
- }
+ }
activeAttribDataMap.put(data.getName(), data);
return location;
}
-
+
//
// Enabled Vertex Arrays and its data
//
@@ -469,14 +469,14 @@ public class ShaderState {
final Boolean v = activedAttribEnabledMap.get(name);
return null != v && v.booleanValue();
}
-
+
/**
* @return true if the {@link GLArrayData} attribute is enable
*/
public final boolean isVertexAttribArrayEnabled(GLArrayData data) {
return isVertexAttribArrayEnabled(data.getName());
}
-
+
private boolean enableVertexAttribArray(GL2ES2 gl, String name, int location) {
activedAttribEnabledMap.put(name, Boolean.TRUE);
if(0>location) {
@@ -486,7 +486,7 @@ public class ShaderState {
System.err.println("ShaderState: glEnableVertexAttribArray failed, no index for: "+name);
if(DEBUG) {
Thread.dumpStack();
- }
+ }
}
return false;
}
@@ -497,12 +497,12 @@ public class ShaderState {
gl.glEnableVertexAttribArray(location);
return true;
}
-
+
/**
* Enables a vertex attribute array.
- *
+ *
* This method retrieves the the location via {@link #getAttribLocation(GL2ES2, GLArrayData)}
- * hence {@link #enableVertexAttribArray(GL2ES2, GLArrayData)} shall be preferred.
+ * hence {@link #enableVertexAttribArray(GL2ES2, GLArrayData)} shall be preferred.
*
* Even if the attribute is not found in the current shader,
* it is marked enabled in this state.
@@ -510,7 +510,7 @@ public class ShaderState {
* @return false, if the name is not found, otherwise true
*
* @throws GLException if the program is not linked and no location was cached.
- *
+ *
* @see #glEnableVertexAttribArray
* @see #glDisableVertexAttribArray
* @see #glVertexAttribPointer
@@ -519,7 +519,7 @@ public class ShaderState {
public boolean enableVertexAttribArray(GL2ES2 gl, String name) {
return enableVertexAttribArray(gl, name, -1);
}
-
+
/**
* Enables a vertex attribute array, usually invoked by {@link GLArrayDataEditable#enableBuffer(GL, boolean)}.
@@ -528,7 +528,7 @@ public class ShaderState {
* and is the preferred alternative to {@link #enableVertexAttribArray(GL2ES2, String)}.
* If data location is unset it will be retrieved via {@link #getAttribLocation(GL2ES2, GLArrayData)} set
* and cached in this state.
- *
+ *
* Even if the attribute is not found in the current shader,
* it is marked enabled in this state.
*
@@ -547,11 +547,11 @@ public class ShaderState {
getAttribLocation(gl, data);
} else {
// ensure data is the current bound one
- activeAttribDataMap.put(data.getName(), data);
+ activeAttribDataMap.put(data.getName(), data);
}
return enableVertexAttribArray(gl, data.getName(), data.getLocation());
}
-
+
private boolean disableVertexAttribArray(GL2ES2 gl, String name, int location) {
activedAttribEnabledMap.put(name, Boolean.FALSE);
if(0>location) {
@@ -572,13 +572,13 @@ public class ShaderState {
gl.glDisableVertexAttribArray(location);
return true;
}
-
+
/**
* Disables a vertex attribute array
*
* This method retrieves the the location via {@link #getAttribLocation(GL2ES2, GLArrayData)}
* hence {@link #disableVertexAttribArray(GL2ES2, GLArrayData)} shall be preferred.
- *
+ *
* Even if the attribute is not found in the current shader,
* it is removed from this state enabled list.
*
@@ -603,7 +603,7 @@ public class ShaderState {
* and is the preferred alternative to {@link #disableVertexAttribArray(GL2ES2, String)}.
* If data location is unset it will be retrieved via {@link #getAttribLocation(GL2ES2, GLArrayData)} set
* and cached in this state.
- *
+ *
* Even if the attribute is not found in the current shader,
* it is removed from this state enabled list.
*
@@ -623,20 +623,20 @@ public class ShaderState {
}
return disableVertexAttribArray(gl, data.getName(), data.getLocation());
}
-
+
/**
* Set the {@link GLArrayData} vertex attribute data, if it's location is valid, i.e. ≥ 0.
*
* This method uses the {@link GLArrayData}'s location if valid, i.e. ≥ 0.
- * If data's location is invalid, it will be retrieved via {@link #getAttribLocation(GL2ES2, GLArrayData)},
+ * If data's location is invalid, it will be retrieved via {@link #getAttribLocation(GL2ES2, GLArrayData)},
* set and cached in this state.
*
- *
+ *
* @return false, if the location could not be determined, otherwise true
*
* @throws GLException if no program is attached
* @throws GLException if the program is not linked and no location was cached.
- *
+ *
* @see #glEnableVertexAttribArray
* @see #glDisableVertexAttribArray
* @see #glVertexAttribPointer
@@ -646,7 +646,7 @@ public class ShaderState {
int location = data.getLocation();
if(0 > location) {
location = getAttribLocation(gl, data);
- }
+ }
if(0 <= location) {
// only pass the data, if the attribute exists in the current shader
if(DEBUG) {
@@ -683,16 +683,16 @@ public class ShaderState {
activeAttribDataMap.clear();
activedAttribEnabledMap.clear();
activeAttribLocationMap.clear();
- managedAttributes.clear();
+ managedAttributes.clear();
}
-
+
/**
* Disables all vertex attribute arrays.
*
* Their enabled stated will be removed from this state only
* if 'removeFromState' is true.
*
- * This method purpose is more for debugging.
+ * This method purpose is more for debugging.
*
* @see #glEnableVertexAttribArray
* @see #glDisableVertexAttribArray
@@ -717,7 +717,7 @@ public class ShaderState {
}
private final void relocateAttribute(GL2ES2 gl, GLArrayData attribute) {
- // get new location .. note: 'activeAttribLocationMap' is cleared before
+ // get new location .. note: 'activeAttribLocationMap' is cleared before
final String name = attribute.getName();
final int loc = attribute.setLocation(gl, shaderProgram.program());
if(0<=loc) {
@@ -729,34 +729,34 @@ public class ShaderState {
// enable attrib, VBO and pass location/data
gl.glEnableVertexAttribArray(loc);
}
-
+
if( attribute.isVBO() ) {
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, attribute.getVBOName());
gl.glVertexAttribPointer(attribute);
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
- } else {
+ } else {
gl.glVertexAttribPointer(attribute);
}
}
}
-
+
/**
* Reset all previously enabled mapped vertex attribute data.
- *
+ *
*
* Attribute data is bound to the GL state, i.e. VBO data itself will not be updated.
*
- *
+ *
*
* Attribute location and it's data assignment is bound to the program,
* hence both are updated.
*
- *
+ *
*
- * Note: Such update could only be prevented,
+ * Note: Such update could only be prevented,
* if tracking am attribute/program dirty flag.
*
- *
+ *
* @throws GLException is the program is not linked
*
* @see #attachShaderProgram(GL2ES2, ShaderProgram)
@@ -764,7 +764,7 @@ public class ShaderState {
private final void resetAllAttributes(GL2ES2 gl) {
if(!shaderProgram.linked()) throw new GLException("Program is not linked");
activeAttribLocationMap.clear();
-
+
for(int i=0; i= 0
*/
public final int getCachedUniformLocation(String name) {
@@ -822,38 +822,38 @@ public class ShaderState {
/**
* Bind the {@link GLUniform} lifecycle to this ShaderState.
- *
+ *
*
If a uniform location is cached it is promoted to the {@link GLUniformData} instance.
- *
- *
The attribute will be destroyed with {@link #destroy(GL2ES2)}
+ *
+ *
The attribute will be destroyed with {@link #destroy(GL2ES2)}
* and it's location will be reset when switching shader with {@link #attachShaderProgram(GL2ES2, ShaderProgram)}.
- *
+ *
*
The data will not be transfered to the GPU, use {@link #uniform(GL2ES2, GLUniformData)} additionally.
- *
+ *
* @param uniform the {@link GLUniformData} which lifecycle shall be managed
- *
+ *
* @see #getUniform(String)
*/
public void ownUniform(GLUniformData uniform) {
final int location = getCachedUniformLocation(uniform.getName());
if(0<=location) {
uniform.setLocation(location);
- }
+ }
activeUniformDataMap.put(uniform.getName(), uniform);
- managedUniforms.add(uniform);
+ managedUniforms.add(uniform);
}
-
+
public boolean ownsUniform(GLUniformData uniform) {
return managedUniforms.contains(uniform);
}
-
+
/**
* Gets the location of a shader uniform with given name.
* Uses either the cached value {@link #getCachedUniformLocation(String)} if valid,
* or the GLSL queried via {@link GL2ES2#glGetUniformLocation(int, String)}.
* The location will be cached.
*
- * The current shader program ({@link #attachShaderProgram(GL2ES2, ShaderProgram)})
+ * The current shader program ({@link #attachShaderProgram(GL2ES2, ShaderProgram)})
* must be in use ({@link #useProgram(GL2ES2, boolean) }) !
*
* @return -1 if there is no such attribute available,
@@ -884,15 +884,15 @@ public class ShaderState {
}
return location;
}
-
+
/**
* Validates and returns the location of a shader uniform.
* Uses either the cached value {@link #getCachedUniformLocation(String)} if valid,
* or the GLSL queried via {@link GL2ES2#glGetUniformLocation(int, String)}.
- * The location will be cached and set in the
+ * The location will be cached and set in the
* {@link GLUniformData} object.
*
- * The current shader program ({@link #attachShaderProgram(GL2ES2, ShaderProgram)})
+ * The current shader program ({@link #attachShaderProgram(GL2ES2, ShaderProgram)})
* must be in use ({@link #useProgram(GL2ES2, boolean) }) !
*
* @return -1 if there is no such attribute available,
@@ -922,16 +922,16 @@ public class ShaderState {
Thread.dumpStack();
}
}
- }
- activeUniformDataMap.put(name, data);
+ }
+ activeUniformDataMap.put(name, data);
return location;
}
-
+
/**
* Set the uniform data, if it's location is valid, i.e. ≥ 0.
*
* This method uses the {@link GLUniformData}'s location if valid, i.e. ≥ 0.
- * If data's location is invalid, it will be retrieved via {@link #getUniformLocation(GL2ES2, GLUniformData)},
+ * If data's location is invalid, it will be retrieved via {@link #getUniformLocation(GL2ES2, GLUniformData)},
* set and cached in this state.
*
*
@@ -959,7 +959,7 @@ public class ShaderState {
}
return false;
}
-
+
/**
* Get the uniform data, previously set.
*
@@ -978,7 +978,7 @@ public class ShaderState {
activeUniformLocationMap.clear();
managedUniforms.clear();
}
-
+
/**
* Reset all previously mapped uniform data
*
@@ -986,20 +986,20 @@ public class ShaderState {
* hence both are updated.
*
*
- * Note: Such update could only be prevented,
+ * Note: Such update could only be prevented,
* if tracking a uniform/program dirty flag.
*
- *
+ *
* @throws GLException is the program is not in use
- *
+ *
* @see #attachShaderProgram(GL2ES2, ShaderProgram)
*/
private final void resetAllUniforms(GL2ES2 gl) {
- if(!shaderProgram.inUse()) throw new GLException("Program is not in use");
+ if(!shaderProgram.inUse()) throw new GLException("Program is not in use");
activeUniformLocationMap.clear();
for(Iterator iter = managedUniforms.iterator(); iter.hasNext(); ) {
iter.next().setLocation(-1);
- }
+ }
for(Iterator iter = activeUniformDataMap.values().iterator(); iter.hasNext(); ) {
final GLUniformData data = iter.next();
final int loc = data.setLocation(gl, shaderProgram.program());
@@ -1018,9 +1018,9 @@ public class ShaderState {
if(null==sb) {
sb = new StringBuilder();
}
-
+
sb.append("ShaderState[ ");
-
+
sb.append(Platform.getNewline()).append(" ");
if(null != shaderProgram) {
shaderProgram.toString(sb);
@@ -1066,25 +1066,25 @@ public class ShaderState {
sb.append(Platform.getNewline()).append(" ]").append(Platform.getNewline()).append("]");
return sb;
}
-
+
@Override
public String toString() {
return toString(null, DEBUG).toString();
}
-
+
private boolean verbose = DEBUG;
private ShaderProgram shaderProgram=null;
-
+
private HashMap activedAttribEnabledMap = new HashMap();
private HashMap activeAttribLocationMap = new HashMap();
private HashMap activeAttribDataMap = new HashMap();
private ArrayList managedAttributes = new ArrayList();
-
+
private HashMap activeUniformLocationMap = new HashMap();
private HashMap activeUniformDataMap = new HashMap();
private ArrayList managedUniforms = new ArrayList();
-
- private HashMap attachedObjectsByString = new HashMap();
+
+ private HashMap attachedObjectsByString = new HashMap();
private boolean resetAllShaderData = false;
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java
index d18fd4bae..5cd384c58 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,7 +28,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package com.jogamp.opengl.util.glsl;
@@ -117,11 +117,11 @@ public class ShaderUtil {
}
return true;
}
-
+
/**
* Performs {@link GL2ES2#glValidateProgram(int)}
*
- * One shall only call this method while debugging and only if all required
+ * One shall only call this method while debugging and only if all required
* resources by the shader are set.
*
*
@@ -150,7 +150,7 @@ public class ShaderUtil {
}
/**
- * If supported, queries the natively supported shader binary formats using
+ * If supported, queries the natively supported shader binary formats using
* {@link GL2ES2#GL_NUM_SHADER_BINARY_FORMATS} and {@link GL2ES2#GL_SHADER_BINARY_FORMATS}
* via {@link GL2ES2#glGetIntegerv(int, int[], int)}.
*/
@@ -172,9 +172,9 @@ public class ShaderUtil {
info.shaderBinaryFormats.add(new Integer(formats[i]));
}
}
- } catch (GLException gle) {
- System.err.println("Catched Exception on thread "+Thread.currentThread().getName());
- gle.printStackTrace();
+ } catch (GLException gle) {
+ System.err.println("Catched Exception on thread "+Thread.currentThread().getName());
+ gle.printStackTrace();
}
}
}
@@ -202,13 +202,13 @@ public class ShaderUtil {
}
info.shaderCompilerAvailable = new Boolean(v);
queryOK = true;
- } catch (GLException gle) {
- System.err.println("Catched Exception on thread "+Thread.currentThread().getName());
- gle.printStackTrace();
+ } catch (GLException gle) {
+ System.err.println("Catched Exception on thread "+Thread.currentThread().getName());
+ gle.printStackTrace();
}
if(!queryOK) {
info.shaderCompilerAvailable = new Boolean(true);
- }
+ }
} else if( gl.isGL2ES2() ) {
info.shaderCompilerAvailable = new Boolean(true);
} else {
@@ -217,8 +217,8 @@ public class ShaderUtil {
}
return info.shaderCompilerAvailable.booleanValue();
}
-
- /** Returns true if GeometryShader is supported, i.e. whether GLContext is ≥ 3.2 or ARB_geometry_shader4 extension is available. */
+
+ /** Returns true if GeometryShader is supported, i.e. whether GLContext is ≥ 3.2 or ARB_geometry_shader4 extension is available. */
public static boolean isGeometryShaderSupported(GL _gl) {
final GLContext ctx = _gl.getContext();
return ctx.getGLVersionNumber().compareTo(GLContext.Version320) >= 0 ||
@@ -240,7 +240,7 @@ public class ShaderUtil {
IntBuffer lengths = Buffers.newDirectIntBuffer(count);
for(int i=0; i shaderBinaryFormats = null;
- }
+ }
private static ProfileInformation getProfileInformation(GL gl) {
final GLContext context = gl.getContext();
diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/FixedFuncUtil.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/FixedFuncUtil.java
index a653bd467..2f8884a3a 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/FixedFuncUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/FixedFuncUtil.java
@@ -24,13 +24,13 @@ import com.jogamp.opengl.util.PMVMatrix;
public class FixedFuncUtil {
/**
* @param gl
- * @param mode one of the {@link ShaderSelectionMode}s
+ * @param mode one of the {@link ShaderSelectionMode}s
* @param pmvMatrix optional pass through PMVMatrix for the {@link FixedFuncHook} and {@link FixedFuncPipeline}
* @return If gl is a GL2ES1 and force is false, return the type cast object,
* otherwise create a fixed function emulation pipeline using the given GL2ES2 impl
* and hook it to the GLContext via {@link GLContext#setGL(GL)}.
* @throws GLException if the GL object is neither GL2ES1 nor GL2ES2
- *
+ *
* @see ShaderSelectionMode#AUTO
* @see ShaderSelectionMode#COLOR
* @see ShaderSelectionMode#COLOR_LIGHT_PER_VERTEX
@@ -53,13 +53,13 @@ public class FixedFuncUtil {
/**
* @param gl
- * @param mode one of the {@link ShaderSelectionMode}s
+ * @param mode one of the {@link ShaderSelectionMode}s
* @param pmvMatrix optional pass through PMVMatrix for the {@link FixedFuncHook} and {@link FixedFuncPipeline}
* @return If gl is a GL2ES1, return the type cast object,
* otherwise create a fixed function emulation pipeline using the GL2ES2 impl.
* and hook it to the GLContext via {@link GLContext#setGL(GL)}.
* @throws GLException if the GL object is neither GL2ES1 nor GL2ES2
- *
+ *
* @see ShaderSelectionMode#AUTO
* @see ShaderSelectionMode#COLOR
* @see ShaderSelectionMode#COLOR_LIGHT_PER_VERTEX
@@ -71,11 +71,11 @@ public class FixedFuncUtil {
}
/**
- * Mapping fixed function (client) array indices to
+ * Mapping fixed function (client) array indices to
* GLSL array attribute names.
*
* Useful for uniq mapping of canonical array index names as listed.
- *
+ *
* @see #mgl_Vertex
* @see javax.media.opengl.fixedfunc.GLPointerFunc#GL_VERTEX_ARRAY
* @see #mgl_Normal
diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/ShaderSelectionMode.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/ShaderSelectionMode.java
index e6bdf702c..426fb0d85 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/ShaderSelectionMode.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/ShaderSelectionMode.java
@@ -1,8 +1,8 @@
package com.jogamp.opengl.util.glsl.fixedfunc;
-/**
+/**
* Shader selection mode
- *
+ *
* @see ShaderSelectionMode#AUTO
* @see ShaderSelectionMode#COLOR
* @see ShaderSelectionMode#COLOR_LIGHT_PER_VERTEX
@@ -11,17 +11,17 @@ package com.jogamp.opengl.util.glsl.fixedfunc;
*/
public enum ShaderSelectionMode {
/** Auto shader selection, based upon FFP states. */
- AUTO,
+ AUTO,
/** Fixed shader selection: Simple color. */
- COLOR,
+ COLOR,
/** Fixed shader selection: Multi-Textured color. 2 texture units. */
- COLOR_TEXTURE2,
+ COLOR_TEXTURE2,
/** Fixed shader selection: Multi-Textured color. 4 texture units. */
- COLOR_TEXTURE4,
+ COLOR_TEXTURE4,
/** Fixed shader selection: Multi-Textured color. 8 texture units. */
- COLOR_TEXTURE8,
+ COLOR_TEXTURE8,
/** Fixed shader selection: Color with vertex-lighting. */
- COLOR_LIGHT_PER_VERTEX,
+ COLOR_LIGHT_PER_VERTEX,
/** Fixed shader selection: Multi-Textured color with vertex-lighting. 8 texture units.*/
- COLOR_TEXTURE8_LIGHT_PER_VERTEX
+ COLOR_TEXTURE8_LIGHT_PER_VERTEX
}
\ No newline at end of file
diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShader.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShader.java
index a5b1c6687..9573ea5c3 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShader.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShader.java
@@ -55,8 +55,8 @@ public abstract class CompileShader {
URL resourceURL = IOUtil.getResource(null, resourceName).getURL();
String dirName = dirname(resourceURL.getPath());
- outName = dirName + File.separator + "bin" + File.separator +
- ShaderCode.getBinarySubPath(getBinaryFormat()) + File.separator +
+ outName = dirName + File.separator + "bin" + File.separator +
+ ShaderCode.getBinarySubPath(getBinaryFormat()) + File.separator +
outName;
processOneShader(resourceName, outName, type);
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/packrect/BackingStoreManager.java b/src/jogl/classes/com/jogamp/opengl/util/packrect/BackingStoreManager.java
index 7b6a1b479..c1b5025f8 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/packrect/BackingStoreManager.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/packrect/BackingStoreManager.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
diff --git a/src/jogl/classes/com/jogamp/opengl/util/packrect/Level.java b/src/jogl/classes/com/jogamp/opengl/util/packrect/Level.java
index 5ba3f7330..44b4fea9e 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/packrect/Level.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/packrect/Level.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -128,7 +128,7 @@ public class Level {
candidate.setSize(candidate.w() - rect.w(), height);
freeList.add(candidate);
}
-
+
coalesceFreeList();
return true;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/packrect/LevelSet.java b/src/jogl/classes/com/jogamp/opengl/util/packrect/LevelSet.java
index 6783aec3b..e14eef5ba 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/packrect/LevelSet.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/packrect/LevelSet.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -108,7 +108,7 @@ public class LevelSet {
if (level.remove(rect))
return true;
}
-
+
return false;
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/packrect/Rect.java b/src/jogl/classes/com/jogamp/opengl/util/packrect/Rect.java
index 6206c4a11..23f143b83 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/packrect/Rect.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/packrect/Rect.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -72,7 +72,7 @@ public class Rect {
// there is no room left due either to fragmentation or just being
// out of space)
private Rect nextLocation;
-
+
public Rect() {
this(null);
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/packrect/RectVisitor.java b/src/jogl/classes/com/jogamp/opengl/util/packrect/RectVisitor.java
index 49cfc82e6..5db216742 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/packrect/RectVisitor.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/packrect/RectVisitor.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
diff --git a/src/jogl/classes/com/jogamp/opengl/util/packrect/RectanglePacker.java b/src/jogl/classes/com/jogamp/opengl/util/packrect/RectanglePacker.java
index 1496a04a6..a9d609745 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/packrect/RectanglePacker.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/packrect/RectanglePacker.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -203,7 +203,7 @@ public class RectanglePacker {
}
nextLevelSet = new LevelSet(newWidth, newHeight);
-
+
// Make copies of all existing rectangles
List/**/ newRects = new ArrayList/**/();
for (Iterator i1 = levels.iterator(); i1.hasNext(); ) {
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java b/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java
index 4236e22fb..fd026d76e 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
@@ -53,8 +53,8 @@ import com.jogamp.opengl.util.texture.spi.*;
* for enabling/disabling OpenGL texture state, binding this texture,
* and computing texture coordinates for both the entire image as well
* as a sub-image.
- *
- *
* Due to many confusions w/ texture usage, following list described the order
* and semantics of texture unit selection, binding and enabling.
@@ -67,16 +67,16 @@ import com.jogamp.opengl.util.texture.spi.*;
*
Issue draw commands
*
*
- *
+ *
*
Non-power-of-two restrictions
* When creating an OpenGL texture object, the Texture class will
* attempt to use non-power-of-two textures (NPOT) if available, see {@link GL#isNPOTTextureAvailable()}.
- * Further more,
+ * Further more,
* GL_ARB_texture_rectangle
* (RECT) will be attempted on OSX w/ ATI drivers.
* If NPOT is not available or RECT not chosen, the Texture class will simply upload a non-pow2-sized
* image into a standard pow2-sized texture (without any special
- * scaling).
+ * scaling).
* Since the choice of extension (or whether one is used at
* all) depends on the user's machine configuration, developers are
* recommended to use {@link #getImageTexCoords} and {@link
@@ -106,7 +106,7 @@ import com.jogamp.opengl.util.texture.spi.*;
* #bind}, but when drawing many triangles all using the same texture,
* for best performance only one call to {@link #bind} should be made.
* User may also utilize multiple texture units,
- * see order of texture commands above.
+ * see order of texture commands above.
*
*
* The mathematically correct way to perform blending in OpenGL
* with the SrcOver "source over destination" mode, or any other
- * Porter-Duff rule, is to use premultiplied color components,
+ * Porter-Duff rule, is to use premultiplied color components,
* which means the R/G/ B color components must have been multiplied by
* the alpha value. If using premultiplied color components
* it is important to use the correct blending function; for
@@ -137,7 +137,7 @@ import com.jogamp.opengl.util.texture.spi.*;
float g = g * a;
float b = b * a;
gl.glColor4f(r, g, b, a);
-
+
*
* For reference, here is a list of the Porter-Duff compositing rules
* and the associated OpenGL blend functions (source and destination
@@ -187,8 +187,8 @@ public class Texture {
/** The texture coordinates corresponding to the entire image. */
private TextureCoords coords;
-
- public String toString() {
+
+ public String toString() {
return "Texture[target 0x"+Integer.toHexString(target)+", name "+texID+", "+
imgWidth+"/"+texWidth+" x "+imgHeight+"/"+texHeight+", y-flip "+mustFlipVertically+
", "+estimatedMemorySize+" bytes]";
@@ -237,7 +237,7 @@ public class Texture {
* gl.glEnable(texture.getTarget());
*
*
- * Call is ignored if the {@link GL} object's context
+ * Call is ignored if the {@link GL} object's context
* is using a core profile, see {@link GL#isGLcore()},
* or if {@link #getTarget()} is {@link GLES2#GL_TEXTURE_EXTERNAL_OES}.
*
@@ -255,7 +255,7 @@ public class Texture {
gl.glEnable(target);
}
}
-
+
/**
* Disables this texture's target (e.g., GL_TEXTURE_2D) in the
* given GL state. This method is a shorthand equivalent
@@ -264,7 +264,7 @@ public class Texture {
* gl.glDisable(texture.getTarget());
*
*
- * Call is ignored if the {@link GL} object's context
+ * Call is ignored if the {@link GL} object's context
* is using a core profile, see {@link GL#isGLcore()},
* or if {@link #getTarget()} is {@link GLES2#GL_TEXTURE_EXTERNAL_OES}.
*
@@ -282,7 +282,7 @@ public class Texture {
gl.glDisable(target);
}
}
-
+
/**
* Binds this texture to the given GL context. This method is a
* shorthand equivalent of the following OpenGL code:
@@ -292,16 +292,16 @@ public class Texture {
*
* See the performance tips above for hints
* on how to maximize performance when using many Texture objects.
- *
+ *
* @param gl the current GL context
* @throws GLException if no OpenGL context was current or if any
* OpenGL-related errors occurred
*/
public void bind(GL gl) throws GLException {
validateTexID(gl, true);
- gl.glBindTexture(target, texID);
+ gl.glBindTexture(target, texID);
}
-
+
/**
* Destroys the native resources used by this texture object.
*
@@ -335,7 +335,7 @@ public class Texture {
public int getWidth() {
return texWidth;
}
-
+
/**
* Returns the height of the allocated OpenGL texture in pixels.
* Note that the texture height will be greater than or equal to the
@@ -345,9 +345,9 @@ public class Texture {
*/
public int getHeight() {
return texHeight;
- }
-
- /**
+ }
+
+ /**
* Returns the width of the image contained within this texture.
* Note that for non-power-of-two textures in particular this may
* not be equal to the result of {@link #getWidth}. It is
@@ -389,7 +389,7 @@ public class Texture {
* entire image. If the TextureData indicated that the texture
* coordinates must be flipped vertically, the returned
* TextureCoords will take that into account.
- *
+ *
* @return the texture coordinates corresponding to the entire image
*/
public TextureCoords getImageTexCoords() {
@@ -406,7 +406,7 @@ public class Texture {
* flipped vertically, the returned TextureCoords will take that
* into account; this should not be handled by the end user in the
* specification of the y1 and y2 coordinates.
- *
+ *
* @return the texture coordinates corresponding to the specified sub-image
*/
public TextureCoords getSubImageTexCoords(int x1, int y1, int x2, int y2) {
@@ -431,9 +431,9 @@ public class Texture {
}
/**
- * Updates the entire content area incl. {@link TextureCoords}
+ * Updates the entire content area incl. {@link TextureCoords}
* of this texture using the data in the given image.
- *
+ *
* @throws GLException if any OpenGL-related errors occurred
*/
public void updateImage(GL gl, TextureData data) throws GLException {
@@ -465,12 +465,12 @@ public class Texture {
updateTexCoords();
}
}
-
+
/**
* Updates the content area incl. {@link TextureCoords} of the specified target of this texture
* using the data in the given image. In general this is intended
* for construction of cube maps.
- *
+ *
* @throws GLException if any OpenGL-related errors occurred
*/
public void updateImage(GL gl, TextureData data, int targetOverride) throws GLException {
@@ -791,7 +791,7 @@ public class Texture {
* texture's target. This gives control over parameters such as
* GL_TEXTURE_MAX_ANISOTROPY_EXT. Causes this texture to be bound to
* the current texture state.
- *
+ *
* @throws GLException if no OpenGL context was current or if any
* OpenGL-related errors occurred
*/
@@ -805,7 +805,7 @@ public class Texture {
* Sets the OpenGL multi-floating-point texture parameter for the
* texture's target. Causes this texture to be bound to the current
* texture state.
- *
+ *
* @throws GLException if any OpenGL-related errors occurred
*/
public void setTexParameterfv(GL gl, int parameterName,
@@ -818,7 +818,7 @@ public class Texture {
* Sets the OpenGL multi-floating-point texture parameter for the
* texture's target. Causes this texture to be bound to the current
* texture state.
- *
+ *
* @throws GLException if any OpenGL-related errors occurred
*/
public void setTexParameterfv(GL gl, int parameterName,
@@ -834,7 +834,7 @@ public class Texture {
* to GL_CLAMP_TO_EDGE if OpenGL 1.2 is supported on the current
* platform and GL_CLAMP if not. Causes this texture to be bound to
* the current texture state.
- *
+ *
* @throws GLException if any OpenGL-related errors occurred
*/
public void setTexParameteri(GL gl, int parameterName,
@@ -847,7 +847,7 @@ public class Texture {
* Sets the OpenGL multi-integer texture parameter for the texture's
* target. Causes this texture to be bound to the current texture
* state.
- *
+ *
* @throws GLException if any OpenGL-related errors occurred
*/
public void setTexParameteriv(GL gl, int parameterName,
@@ -860,7 +860,7 @@ public class Texture {
* Sets the OpenGL multi-integer texture parameter for the texture's
* target. Causes this texture to be bound to the current texture
* state.
- *
+ *
* @throws GLException if any OpenGL-related errors occurred
*/
public void setTexParameteriv(GL gl, int parameterName,
@@ -886,7 +886,7 @@ public class Texture {
}
/**
- * Returns the underlying OpenGL texture object for this texture,
+ * Returns the underlying OpenGL texture object for this texture,
* maybe 0 if not yet generated.
*
* Most applications will not need to access this, since it is
@@ -967,19 +967,19 @@ public class Texture {
}
} else {
if (mustFlipVertically) {
- coords = new TextureCoords(0, // l
+ coords = new TextureCoords(0, // l
(float) imgHeight / (float) texHeight, // b
(float) imgWidth / (float) texWidth, // r
0 // t
);
} else {
- coords = new TextureCoords(0, // l
+ coords = new TextureCoords(0, // l
0, // b
(float) imgWidth / (float) texWidth, // r
(float) imgHeight / (float) texHeight // t
);
}
- }
+ }
}
private void updateSubImageImpl(GL gl, TextureData data, int newTarget, int mipmapLevel,
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureCoords.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureCoords.java
index 3931b7290..63f100630 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureCoords.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureCoords.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2012 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
@@ -77,7 +77,7 @@ public class TextureCoords {
d[6+d_off] = right *ss; d[7+d_off] = top *ts;
return d;
}
-
+
/** Returns the leftmost (x) texture coordinate of this
rectangle. */
public float left() { return left; }
@@ -93,6 +93,6 @@ public class TextureCoords {
/** Returns the topmost (y) texture coordinate of this
rectangle. */
public float top() { return top; }
-
+
public String toString() { return "TexCoord[h: "+left+" - "+right+", v: "+bottom+" - "+top+"]"; }
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java
index afc5bf70c..28029efc5 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
@@ -57,8 +57,8 @@ import com.jogamp.opengl.util.GLPixelBuffer.GLPixelAttributes;
public class TextureData {
/** ColorSpace of pixel data. */
- public static enum ColorSpace { RGB, YCbCr, YCCK, CMYK };
-
+ public static enum ColorSpace { RGB, YCbCr, YCCK, CMYK };
+
protected int width;
protected int height;
private int border;
@@ -83,7 +83,7 @@ public class TextureData {
protected GLProfile glProfile;
protected ColorSpace pixelCS = ColorSpace.RGB;
- /**
+ /**
* Constructs a new TextureData object with the specified parameters
* and data contained in the given Buffer. The optional Flusher can
* be used to clean up native resources associated with this
@@ -123,7 +123,7 @@ public class TextureData {
* data were invalid, such as requesting mipmap generation for a
* compressed texture
*/
- public TextureData(GLProfile glp,
+ public TextureData(GLProfile glp,
int internalFormat,
int width,
int height,
@@ -135,11 +135,11 @@ public class TextureData {
boolean mustFlipVertically,
Buffer buffer,
Flusher flusher) throws IllegalArgumentException {
- this(glp, internalFormat, width, height, border, new GLPixelAttributes(pixelFormat, pixelType),
+ this(glp, internalFormat, width, height, border, new GLPixelAttributes(pixelFormat, pixelType),
mipmap, dataIsCompressed, mustFlipVertically, buffer, flusher);
}
- /**
+ /**
* Constructs a new TextureData object with the specified parameters
* and data contained in the given Buffer. The optional Flusher can
* be used to clean up native resources associated with this
@@ -178,7 +178,7 @@ public class TextureData {
* data were invalid, such as requesting mipmap generation for a
* compressed texture
*/
- public TextureData(GLProfile glp,
+ public TextureData(GLProfile glp,
int internalFormat,
int width,
int height,
@@ -207,8 +207,8 @@ public class TextureData {
alignment = 1; // FIXME: is this correct enough in all situations?
estimatedMemorySize = estimatedMemorySize(buffer);
}
-
- /**
+
+ /**
* Constructs a new TextureData object with the specified parameters
* and data for multiple mipmap levels contained in the given array
* of Buffers. The optional Flusher can be used to clean up native
@@ -258,11 +258,11 @@ public class TextureData {
boolean mustFlipVertically,
Buffer[] mipmapData,
Flusher flusher) throws IllegalArgumentException {
- this(glp, internalFormat, width, height, border, new GLPixelAttributes(pixelFormat, pixelType),
+ this(glp, internalFormat, width, height, border, new GLPixelAttributes(pixelFormat, pixelType),
dataIsCompressed, mustFlipVertically, mipmapData, flusher);
}
- /**
+ /**
* Constructs a new TextureData object with the specified parameters
* and data for multiple mipmap levels contained in the given array
* of Buffers. The optional Flusher can be used to clean up native
@@ -325,19 +325,19 @@ public class TextureData {
estimatedMemorySize += estimatedMemorySize(mipmapData[i]);
}
}
-
- /**
+
+ /**
* Returns the color space of the pixel data.
- * @see #setColorSpace(ColorSpace)
+ * @see #setColorSpace(ColorSpace)
*/
public ColorSpace getColorSpace() { return pixelCS; }
- /**
+ /**
* Set the color space of the pixel data, which defaults to {@link ColorSpace#RGB}.
- * @see #getColorSpace()
+ * @see #getColorSpace()
*/
public void setColorSpace(ColorSpace cs) { pixelCS = cs; }
-
+
/** Used only by subclasses */
protected TextureData(GLProfile glp) { this.glProfile = glp; this.pixelAttributes = GLPixelAttributes.UNDEF; }
@@ -346,8 +346,8 @@ public class TextureData {
/** Returns the height in pixels of the texture data. */
public int getHeight() { return height; }
/** Returns the border in pixels of the texture data. */
- public int getBorder() {
- return border;
+ public int getBorder() {
+ return border;
}
/** Returns the intended OpenGL {@link GLPixelAttributes} of the texture data, i.e. format and type. */
public GLPixelAttributes getPixelAttributes() {
@@ -362,21 +362,21 @@ public class TextureData {
return pixelAttributes.type;
}
/** Returns the intended OpenGL internal format of the texture data. */
- public int getInternalFormat() {
- return internalFormat;
+ public int getInternalFormat() {
+ return internalFormat;
}
/** Returns whether mipmaps should be generated for the texture data. */
- public boolean getMipmap() {
- return mipmap;
+ public boolean getMipmap() {
+ return mipmap;
}
/** Indicates whether the texture data is in compressed form. */
- public boolean isDataCompressed() {
- return dataIsCompressed;
+ public boolean isDataCompressed() {
+ return dataIsCompressed;
}
/** Indicates whether the texture coordinates must be flipped
vertically for proper display. */
- public boolean getMustFlipVertically() {
- return mustFlipVertically;
+ public boolean getMustFlipVertically() {
+ return mustFlipVertically;
}
/** Returns the texture data, or null if it is specified as a set of mipmaps. */
public Buffer getBuffer() {
@@ -384,18 +384,18 @@ public class TextureData {
}
/** Returns all mipmap levels for the texture data, or null if it is
specified as a single image. */
- public Buffer[] getMipmapData() {
- return mipmapData;
+ public Buffer[] getMipmapData() {
+ return mipmapData;
}
/** Returns the required byte alignment for the texture data. */
- public int getAlignment() {
- return alignment;
+ public int getAlignment() {
+ return alignment;
}
/** Returns the row length needed for correct GL_UNPACK_ROW_LENGTH
specification. This is currently only supported for
non-mipmapped, non-compressed textures. */
- public int getRowLength() {
- return rowLength;
+ public int getRowLength() {
+ return rowLength;
}
/** Sets the width in pixels of the texture data. */
@@ -405,25 +405,25 @@ public class TextureData {
/** Sets the border in pixels of the texture data. */
public void setBorder(int border) { this.border = border; }
/** Sets the intended OpenGL pixel format of the texture data. */
- public void setPixelAttributes(GLPixelAttributes pixelAttributes) { this.pixelAttributes = pixelAttributes; }
- /**
+ public void setPixelAttributes(GLPixelAttributes pixelAttributes) { this.pixelAttributes = pixelAttributes; }
+ /**
* Sets the intended OpenGL pixel format component of {@link GLPixelAttributes} of the texture data.
*
- * Use {@link #setPixelAttributes(GLPixelAttributes)}, if setting format and type.
- *
+ * Use {@link #setPixelAttributes(GLPixelAttributes)}, if setting format and type.
+ *
*/
public void setPixelFormat(int pixelFormat) {
if( pixelAttributes.format != pixelFormat ) {
pixelAttributes = new GLPixelAttributes(pixelFormat, pixelAttributes.type);
}
}
- /**
+ /**
* Sets the intended OpenGL pixel type component of {@link GLPixelAttributes} of the texture data.
*
- * Use {@link #setPixelAttributes(GLPixelAttributes)}, if setting format and type.
- *
+ * Use {@link #setPixelAttributes(GLPixelAttributes)}, if setting format and type.
+ *
*/
- public void setPixelType(int pixelType) {
+ public void setPixelType(int pixelType) {
if( pixelAttributes.type != pixelType) {
pixelAttributes = new GLPixelAttributes(pixelAttributes.format, pixelType);
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java
index 3748cd336..b6d89d6d2 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2011 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,11 +29,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -161,11 +161,11 @@ public class TextureIO {
/** Constant which can be used as a file suffix to indicate a PAM
file, NetPbm magic 7 - binary RGB and RGBA. Write support only. */
public static final String PAM = "pam";
-
+
/** Constant which can be used as a file suffix to indicate a PAM
file, NetPbm magic 6 - binary RGB. Write support only. */
public static final String PPM = "ppm";
-
+
private static final boolean DEBUG = Debug.debug("TextureIO");
// For manually disabling the use of the texture rectangle
@@ -421,7 +421,7 @@ public class TextureIO {
// methods that *do* require a current context
//
- /**
+ /**
* Creates an OpenGL texture object from the specified TextureData
* using the current OpenGL context.
*
@@ -434,7 +434,7 @@ public class TextureIO {
return newTexture(GLContext.getCurrentGL(), data);
}
- /**
+ /**
* Creates an OpenGL texture object from the specified TextureData
* using the given OpenGL context.
*
@@ -449,8 +449,8 @@ public class TextureIO {
}
return new Texture(gl, data);
}
-
- /**
+
+ /**
* Creates an OpenGL texture object from the specified file using
* the current OpenGL context.
*
@@ -474,7 +474,7 @@ public class TextureIO {
return texture;
}
- /**
+ /**
* Creates an OpenGL texture object from the specified stream using
* the current OpenGL context.
*
@@ -503,7 +503,7 @@ public class TextureIO {
return texture;
}
- /**
+ /**
* Creates an OpenGL texture object from the specified URL using the
* current OpenGL context.
*
@@ -535,13 +535,13 @@ public class TextureIO {
return texture;
}
- /**
+ /**
* Creates an OpenGL texture object associated with the given OpenGL
* texture target. The texture has
* no initial data. This is used, for example, to construct cube
* maps out of multiple TextureData objects.
*
- * @param target the OpenGL target type, eg GL.GL_TEXTURE_2D,
+ * @param target the OpenGL target type, eg GL.GL_TEXTURE_2D,
* GL.GL_TEXTURE_RECTANGLE_ARB
*/
public static Texture newTexture(int target) {
@@ -556,7 +556,7 @@ public class TextureIO {
* undefined results.
*
* @param textureID the OpenGL texture object to wrap
- * @param target the OpenGL texture target, eg GL.GL_TEXTURE_2D,
+ * @param target the OpenGL texture target, eg GL.GL_TEXTURE_2D,
* GL2.GL_TEXTURE_RECTANGLE
* @param texWidth the width of the texture in pixels
* @param texHeight the height of the texture in pixels
@@ -689,7 +689,7 @@ public class TextureIO {
gl.glPixelStorei(GL2.GL_PACK_SKIP_ROWS, packSkipRows);
gl.glPixelStorei(GL2.GL_PACK_SKIP_PIXELS, packSkipPixels);
gl.glPixelStorei(GL2.GL_PACK_SWAP_BYTES, packSwapBytes);
-
+
data = new TextureData(gl.getGLProfile(), internalFormat, width, height, border, fetchedFormat, GL.GL_UNSIGNED_BYTE,
false, false, false, res, null);
@@ -701,7 +701,7 @@ public class TextureIO {
write(data, file);
}
-
+
public static void write(TextureData data, File file) throws IOException, GLException {
for (Iterator iter = textureWriters.iterator(); iter.hasNext(); ) {
TextureWriter writer = iter.next();
@@ -712,12 +712,12 @@ public class TextureIO {
throw new IOException("No suitable texture writer found for "+file.getAbsolutePath());
}
-
+
//----------------------------------------------------------------------
// SPI support
//
- /**
+ /**
* Adds a TextureProvider to support reading of a new file format.
*
* The last provider added, will be the first provider to be tested.
@@ -730,7 +730,7 @@ public class TextureIO {
textureProviders.add(0, provider);
}
- /**
+ /**
* Adds a TextureWriter to support writing of a new file format.
*
* The last provider added, will be the first provider to be tested.
@@ -779,7 +779,7 @@ public class TextureIO {
private static List textureProviders = new ArrayList();
private static List textureWriters = new ArrayList();
- static {
+ static {
// ImageIO provider, the fall-back, must be the first one added
if(GLProfile.isAWTAvailable()) {
try {
@@ -1221,7 +1221,7 @@ public class TextureIO {
return null;
}
}
-
+
//----------------------------------------------------------------------
// DDS texture writer
//
@@ -1249,7 +1249,7 @@ public class TextureIO {
case GL.GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: d3dFormat = DDSImage.D3DFMT_DXT5; break;
default: throw new IOException("Unsupported pixel format 0x" + Integer.toHexString(pixelFormat) + " by DDS writer");
}
-
+
ByteBuffer[] mipmaps = null;
if (data.getMipmapData() != null) {
mipmaps = new ByteBuffer[data.getMipmapData().length];
@@ -1319,7 +1319,7 @@ public class TextureIO {
//----------------------------------------------------------------------
// TGA (Targa) texture writer
-
+
static class TGATextureWriter implements TextureWriter {
public boolean write(File file,
TextureData data) throws IOException {
@@ -1329,19 +1329,19 @@ public class TextureIO {
final int pixelFormat = pixelAttribs.format;
final int pixelType = pixelAttribs.type;
if ((pixelFormat == GL.GL_RGB ||
- pixelFormat == GL.GL_RGBA ||
+ pixelFormat == GL.GL_RGBA ||
pixelFormat == GL2.GL_BGR ||
pixelFormat == GL.GL_BGRA ) &&
(pixelType == GL.GL_BYTE ||
pixelType == GL.GL_UNSIGNED_BYTE)) {
-
+
ByteBuffer buf = (ByteBuffer) data.getBuffer();
if (null == buf) {
buf = (ByteBuffer) data.getMipmapData()[0];
}
buf.rewind();
-
- if( pixelFormat == GL.GL_RGB || pixelFormat == GL.GL_RGBA ) {
+
+ if( pixelFormat == GL.GL_RGB || pixelFormat == GL.GL_RGBA ) {
// Must reverse order of red and blue channels to get correct results
int skip = ((pixelFormat == GL.GL_RGB) ? 3 : 4);
for (int i = 0; i < buf.remaining(); i += skip) {
@@ -1364,12 +1364,12 @@ public class TextureIO {
}
return false;
- }
+ }
}
//----------------------------------------------------------------------
// PNG texture writer
-
+
static class PNGTextureWriter implements TextureWriter {
public boolean write(File file, TextureData data) throws IOException {
if (PNG.equals(IOUtil.getFileSuffix(file))) {
@@ -1402,13 +1402,13 @@ public class TextureIO {
break;
}
if ( ( 1 == bytesPerPixel || 3 == bytesPerPixel || 4 == bytesPerPixel) &&
- ( pixelType == GL.GL_BYTE || pixelType == GL.GL_UNSIGNED_BYTE)) {
+ ( pixelType == GL.GL_BYTE || pixelType == GL.GL_UNSIGNED_BYTE)) {
ByteBuffer buf = (ByteBuffer) data.getBuffer();
if (null == buf) {
buf = (ByteBuffer) data.getMipmapData()[0];
}
buf.rewind();
-
+
PNGImage image = PNGImage.createFromData(data.getWidth(), data.getHeight(), -1f, -1f,
bytesPerPixel, reversedChannels, !data.getMustFlipVertically(), buf);
image.write(file, true);
@@ -1418,9 +1418,9 @@ public class TextureIO {
" / type 0x"+Integer.toHexString(pixelFormat)+" (only GL_RGB/A, GL_BGR/A + bytes)");
}
return false;
- }
+ }
}
-
+
//----------------------------------------------------------------------
// Helper routines
//
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureSequence.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureSequence.java
index 5c6b63535..e4f72abf0 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureSequence.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureSequence.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -36,26 +36,26 @@ import com.jogamp.opengl.util.TimeFrameI;
/**
* Protocol for texture sequences, like animations, movies, etc.
*
- * Ensure to respect the texture coordinates provided by
+ * Ensure to respect the texture coordinates provided by
* {@link TextureFrame}.{@link TextureFrame#getTexture() getTexture()}.{@link Texture#getImageTexCoords() getImageTexCoords()}.
*
- * The user's shader shall be fitted for this implementation.
+ * The user's shader shall be fitted for this implementation.
* Assuming we use a base shader code w/o headers using ShaderCode.
* (Code copied from unit test / demo TexCubeES2)
*
- *
+ *
static final String[] es2_prelude = { "#version 100\n", "precision mediump float;\n" };
static final String gl2_prelude = "#version 110\n";
static final String shaderBasename = "texsequence_xxx"; // the base shader code w/o headers
- static final String myTextureLookupName = "myTexture2D"; // the desired texture lookup function
-
+ static final String myTextureLookupName = "myTexture2D"; // the desired texture lookup function
+
private void initShader(GL2ES2 gl, TextureSequence texSeq) {
// Create & Compile the shader objects
- ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, TexCubeES2.class,
+ ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, TexCubeES2.class,
"shader", "shader/bin", shaderBasename, true);
- ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, TexCubeES2.class,
+ ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, TexCubeES2.class,
"shader", "shader/bin", shaderBasename, true);
-
+
// Prelude shader code w/ GLSL profile specifics [ 1. pre-proc, 2. other ]
int rsFpPos;
if(gl.isGLES2()) {
@@ -72,25 +72,25 @@ import com.jogamp.opengl.util.TimeFrameI;
if(gl.isGLES2()) {
// insert ES2 default precision declaration
rsFpPos = rsFp.insertShaderSource(0, rsFpPos, es2_prelude[1]);
- }
+ }
// negotiate the texture lookup function name
final String texLookupFuncName = texSeq.getTextureLookupFunctionName(myTextureLookupName);
-
- // in case a fixed lookup function is being chosen, replace the name in our code
+
+ // in case a fixed lookup function is being chosen, replace the name in our code
rsFp.replaceInShaderSource(myTextureLookupName, texLookupFuncName);
-
+
// Cache the TextureSequence shader details in StringBuilder:
final StringBuilder sFpIns = new StringBuilder();
-
+
// .. declaration of the texture sampler using the implementation specific type
sFpIns.append("uniform ").append(texSeq.getTextureSampler2DType()).append(" mgl_ActiveTexture;\n");
-
+
// .. the actual texture lookup function, maybe null in case a built-in function is being used
sFpIns.append(texSeq.getTextureLookupFragmentShaderImpl());
-
+
// Now insert the TextureShader details in our shader after the given tag:
rsFp.insertShaderSource(0, "TEXTURE-SEQUENCE-CODE-BEGIN", 0, sFpIns);
-
+
// Create & Link the shader program
ShaderProgram sp = new ShaderProgram();
sp.add(rsVp);
@@ -102,16 +102,16 @@ import com.jogamp.opengl.util.TimeFrameI;
*
* The above procedure might look complicated, however, it allows most flexibility and
* workarounds to also deal with GLSL bugs.
- *
+ *
*/
public interface TextureSequence {
public static final String GL_OES_EGL_image_external_Required_Prelude = "#extension GL_OES_EGL_image_external : enable\n";
public static final String samplerExternalOES = "samplerExternalOES";
public static final String sampler2D = "sampler2D";
-
- /**
+
+ /**
* Texture holder interface, maybe specialized by implementation
- * to associated related data.
+ * to associated related data.
*/
public static class TextureFrame extends TimeFrameI {
public TextureFrame(Texture t, int pts, int duration) {
@@ -121,9 +121,9 @@ public interface TextureSequence {
public TextureFrame(Texture t) {
texture = t;
}
-
+
public final Texture getTexture() { return texture; }
-
+
public String toString() {
return "TextureFrame[pts " + pts + " ms, l " + duration + " ms, texID "+ (null != texture ? texture.getTextureObject() : 0) + "]";
}
@@ -139,30 +139,30 @@ public interface TextureSequence {
*
* Further more, the call may happen off-thread, possibly holding another, possibly shared, OpenGL context current.
*
- * Hence a user shall not issue any OpenGL, time consuming
+ * Hence a user shall not issue any OpenGL, time consuming
* or {@link TextureSequence} lifecycle operations directly.
* Instead, the user shall:
*
*
issue commands off-thread via spawning off another thread, or
*
injecting {@link GLRunnable} objects via {@link GLAutoDrawable#invoke(boolean, GLRunnable)}, or
*
simply changing a volatile state of their {@link GLEventListener} implementation.
- *
+ *
*
* */
public interface TexSeqEventListener {
- /**
+ /**
* Signaling listeners that a new {@link TextureFrame} is available.
*
- * User shall utilize {@link TextureSequence#getNextTexture(GL)} to dequeue it to maintain
- * a consistent queue.
+ * User shall utilize {@link TextureSequence#getNextTexture(GL)} to dequeue it to maintain
+ * a consistent queue.
*
- * @param ts the event source
+ * @param ts the event source
* @param newFrame the newly enqueued frame
- * @param when system time in msec.
+ * @param when system time in msec.
**/
public void newFrameAvailable(T ts, TextureFrame newFrame, long when);
}
-
+
/** Return the texture unit used to render the current frame. */
public int getTextureUnit();
@@ -174,17 +174,17 @@ public interface TextureSequence {
* Returns the last updated texture.
*
* In case the instance is just initialized, it shall return a TextureFrame
- * object with valid attributes. The texture content may be undefined
+ * object with valid attributes. The texture content may be undefined
* until the first call of {@link #getNextTexture(GL)}.
- *
+ *
* Not blocking.
- *
- * @throws IllegalStateException if instance is not initialized
+ *
+ * @throws IllegalStateException if instance is not initialized
*/
public TextureFrame getLastTexture() throws IllegalStateException ;
/**
- * Returns the next texture to be rendered.
+ * Returns the next texture to be rendered.
*
* Implementation shall return the next frame if available, may block if a next frame may arrive soon.
* Otherwise implementation shall return the last frame.
@@ -192,41 +192,41 @@ public interface TextureSequence {
*
* Shall return null in case no next or last frame is available.
*
- *
- * @throws IllegalStateException if instance is not initialized
+ *
+ * @throws IllegalStateException if instance is not initialized
*/
public TextureFrame getNextTexture(GL gl) throws IllegalStateException ;
-
+
/**
- * In case a shader extension is required, based on the implementation
+ * In case a shader extension is required, based on the implementation
* and the runtime GL profile, this method returns the preprocessor macros, e.g.:
*
- *
- * @throws IllegalStateException if instance is not initialized
+ *
+ *
+ * @throws IllegalStateException if instance is not initialized
*/
public String getRequiredExtensionsShaderStub() throws IllegalStateException ;
-
- /**
+
+ /**
* Returns either sampler2D or samplerExternalOES
- * depending on {@link #getLastTexture()}.{@link TextureFrame#getTexture() getTexture()}.{@link Texture#getTarget() getTarget()}.
- *
- * @throws IllegalStateException if instance is not initialized
+ * depending on {@link #getLastTexture()}.{@link TextureFrame#getTexture() getTexture()}.{@link Texture#getTarget() getTarget()}.
+ *
+ * @throws IllegalStateException if instance is not initialized
**/
public String getTextureSampler2DType() throws IllegalStateException ;
-
+
/**
* @param desiredFuncName desired lookup function name. If null or ignored by the implementation,
- * a build-in name is returned.
+ * a build-in name is returned.
* @return the final lookup function name
- *
+ *
* @see {@link #getTextureLookupFragmentShaderImpl()}
- *
+ *
* @throws IllegalStateException if instance is not initialized
*/
public String getTextureLookupFunctionName(String desiredFuncName) throws IllegalStateException ;
-
+
/**
* Returns the complete texture2D lookup function code of type
*
@@ -239,14 +239,14 @@ public interface TextureSequence {
* funcName can be negotiated and queried via {@link #getTextureLookupFunctionName(String)}.
*
* Note: This function may return an empty string in case a build-in lookup
- * function is being chosen. If the implementation desires so,
+ * function is being chosen. If the implementation desires so,
* {@link #getTextureLookupFunctionName(String)} will ignore the desired function name
* and returns the build-in lookup function name.
*
* @see #getTextureLookupFunctionName(String)
* @see #getTextureSampler2DType()
- *
- * @throws IllegalStateException if instance is not initialized
+ *
+ * @throws IllegalStateException if instance is not initialized
*/
- public String getTextureLookupFragmentShaderImpl() throws IllegalStateException ;
+ public String getTextureLookupFragmentShaderImpl() throws IllegalStateException ;
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureState.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureState.java
index 4a5d368e3..c8437d07c 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureState.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureState.java
@@ -43,55 +43,55 @@ import javax.media.opengl.GLException;
* - GL.GL_TEXTURE_MAG_FILTER
* - GL.GL_TEXTURE_MIN_FILTER
* - GL.GL_TEXTURE_WRAP_S
- * - GL.GL_TEXTURE_WRAP_T
+ * - GL.GL_TEXTURE_WRAP_T
*
*/
public class TextureState {
- /**
+ /**
* Returns the pname to query the textureTarget currently bound to the active texture-unit.
*
* Returns 0 is textureTarget is not supported.
- *
- */
+ *
+ */
public static final int getTextureTargetQueryName(int textureTarget) {
final int texBindQName;
switch(textureTarget) {
- case GL.GL_TEXTURE_2D: texBindQName = GL.GL_TEXTURE_BINDING_2D; break;
- case GL.GL_TEXTURE_CUBE_MAP: texBindQName = GL.GL_TEXTURE_BINDING_CUBE_MAP; break;
- case GL2ES2.GL_TEXTURE_3D: texBindQName = GL2ES2.GL_TEXTURE_BINDING_3D; break;
- case GL2GL3.GL_TEXTURE_1D: texBindQName = GL2GL3.GL_TEXTURE_BINDING_1D; break;
- case GL2GL3.GL_TEXTURE_1D_ARRAY: texBindQName = GL2GL3.GL_TEXTURE_BINDING_1D_ARRAY; break;
- case GL2GL3.GL_TEXTURE_2D_ARRAY: texBindQName = GL2GL3.GL_TEXTURE_BINDING_2D_ARRAY; break;
- case GL2GL3.GL_TEXTURE_RECTANGLE: texBindQName = GL2GL3.GL_TEXTURE_BINDING_RECTANGLE; break;
- case GL2GL3.GL_TEXTURE_BUFFER: texBindQName = GL2GL3.GL_TEXTURE_BINDING_BUFFER; break;
- case GL3.GL_TEXTURE_2D_MULTISAMPLE: texBindQName = GL3.GL_TEXTURE_BINDING_2D_MULTISAMPLE; break;
+ case GL.GL_TEXTURE_2D: texBindQName = GL.GL_TEXTURE_BINDING_2D; break;
+ case GL.GL_TEXTURE_CUBE_MAP: texBindQName = GL.GL_TEXTURE_BINDING_CUBE_MAP; break;
+ case GL2ES2.GL_TEXTURE_3D: texBindQName = GL2ES2.GL_TEXTURE_BINDING_3D; break;
+ case GL2GL3.GL_TEXTURE_1D: texBindQName = GL2GL3.GL_TEXTURE_BINDING_1D; break;
+ case GL2GL3.GL_TEXTURE_1D_ARRAY: texBindQName = GL2GL3.GL_TEXTURE_BINDING_1D_ARRAY; break;
+ case GL2GL3.GL_TEXTURE_2D_ARRAY: texBindQName = GL2GL3.GL_TEXTURE_BINDING_2D_ARRAY; break;
+ case GL2GL3.GL_TEXTURE_RECTANGLE: texBindQName = GL2GL3.GL_TEXTURE_BINDING_RECTANGLE; break;
+ case GL2GL3.GL_TEXTURE_BUFFER: texBindQName = GL2GL3.GL_TEXTURE_BINDING_BUFFER; break;
+ case GL3.GL_TEXTURE_2D_MULTISAMPLE: texBindQName = GL3.GL_TEXTURE_BINDING_2D_MULTISAMPLE; break;
case GL3.GL_TEXTURE_2D_MULTISAMPLE_ARRAY: texBindQName = GL3.GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY; break;
default: texBindQName = 0;
}
return texBindQName;
}
-
+
private final int target;
- /**
+ /**
*
*/
private final int[] state = new int[] { 0, 0, 0, 0, 0, 0 };
-
+
private static final String toHexString(int i) { return "0x"+Integer.toHexString(i); }
-
+
private static final int activeTexture(GL gl) {
final int[] vi = { 0 };
gl.glGetIntegerv(GL.GL_ACTIVE_TEXTURE, vi, 0);
return vi[0];
}
-
+
/**
* Creates a texture state for the retrieved active texture-unit and the given texture-target.
* See {@link TextureState}.
@@ -102,7 +102,7 @@ public class TextureState {
public TextureState(GL gl, int textureTarget) throws GLException {
this(gl, activeTexture(gl), textureTarget);
}
-
+
/**
* Creates a texture state for the given active texture-unit and the given texture-target.
* See {@link TextureState}.
@@ -124,7 +124,7 @@ public class TextureState {
gl.glGetTexParameteriv(target, GL.GL_TEXTURE_WRAP_S, state, 4);
gl.glGetTexParameteriv(target, GL.GL_TEXTURE_WRAP_T, state, 5);
}
-
+
/**
* Restores the texture-unit's texture-target state.
*
@@ -140,12 +140,12 @@ public class TextureState {
gl.glTexParameteri(target, GL.GL_TEXTURE_WRAP_S, state[4]);
gl.glTexParameteri(target, GL.GL_TEXTURE_WRAP_T, state[5]);
}
-
+
/** Returns the texture-unit of this state, key value. Unit is of range [ {@link GL#GL_TEXTURE0}.. ]. */
public final int getUnit() { return state[0]; }
/** Returns the texture-target of this state, key value. */
public final int getTarget() { return target; }
-
+
/** Returns the state's texture-object. */
public final int getObject() { return state[1]; }
/** Returns the state's mag-filter param. */
@@ -156,12 +156,12 @@ public class TextureState {
public final int getWrapS() { return state[4]; }
/** Returns the state's wrap-t param. */
public final int getWrapT() { return state[5]; }
-
-
+
+
public final String toString() {
return "TextureState[unit "+(state[0] - GL.GL_TEXTURE0)+", target "+toHexString(target)+
": obj "+toHexString(state[1])+
- ", filter[mag "+toHexString(state[2])+", min "+toHexString(state[3])+"], "+
+ ", filter[mag "+toHexString(state[2])+", min "+toHexString(state[3])+"], "+
": wrap[s "+toHexString(state[4])+", t "+toHexString(state[5])+"]]";
}
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureData.java b/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureData.java
index d7e825c1d..202c08e4e 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureData.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureData.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
@@ -80,7 +80,7 @@ public class AWTTextureData extends TextureData {
private static final java.awt.image.ColorModel rgbaColorModel =
new ComponentColorModel(java.awt.color.ColorSpace.getInstance(java.awt.color.ColorSpace.CS_sRGB),
- new int[] {8, 8, 8, 8}, true, true,
+ new int[] {8, 8, 8, 8}, true, true,
Transparency.TRANSLUCENT,
DataBuffer.TYPE_BYTE);
private static final java.awt.image.ColorModel rgbColorModel =
@@ -90,7 +90,7 @@ public class AWTTextureData extends TextureData {
DataBuffer.TYPE_BYTE);
- /**
+ /**
* Constructs a new TextureData object with the specified parameters
* and data contained in the given BufferedImage. The resulting
* TextureData "wraps" the contents of the BufferedImage, so if a
@@ -113,7 +113,7 @@ public class AWTTextureData extends TextureData {
* texture
* @param image the image containing the texture data
*/
- public AWTTextureData(GLProfile glp,
+ public AWTTextureData(GLProfile glp,
int internalFormat,
int pixelFormat,
boolean mipmap,
@@ -142,15 +142,15 @@ public class AWTTextureData extends TextureData {
(expectingGL12 && haveGL12))) {
revertPixelAttributes();
}
- }
+ }
}
-
+
@Override
public GLPixelAttributes getPixelAttributes() {
validatePixelAttributes();
return super.getPixelAttributes();
}
-
+
@Override
public int getPixelFormat() {
validatePixelAttributes();
@@ -246,7 +246,7 @@ public class AWTTextureData extends TextureData {
// we can pass the image data directly to OpenGL only if
// we have an integral number of pixels in each scanline
// and only if the GL_EXT_abgr extension is present
-
+
// NOTE: disabling this code path for now as it appears it's
// buggy at least on some NVidia drivers and doesn't perform
// the necessary byte swapping (FIXME: needs more
@@ -255,7 +255,7 @@ public class AWTTextureData extends TextureData {
pixelAttributes = new GLPixelAttributes(GL2.GL_ABGR_EXT, GL.GL_UNSIGNED_BYTE);
rowLength = scanlineStride / 4;
alignment = 4;
-
+
// Store a reference to the original image for later in
// case it turns out that we don't have GL_EXT_abgr at the
// time we're going to do the texture upload to OpenGL
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureIO.java b/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureIO.java
index fdd1365f7..c70f5d0f3 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureIO.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureIO.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -100,7 +100,7 @@ public class AWTTextureIO extends TextureIO {
return newTextureDataImpl(glp, image, internalFormat, pixelFormat, mipmap);
}
- /**
+ /**
* Creates an OpenGL texture object from the specified BufferedImage
* using the current OpenGL context.
*
@@ -119,7 +119,7 @@ public class AWTTextureIO extends TextureIO {
return texture;
}
- private static TextureData newTextureDataImpl(GLProfile glp,
+ private static TextureData newTextureDataImpl(GLProfile glp,
BufferedImage image,
int internalFormat,
int pixelFormat,
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java
index 3f91ae966..d75bb3767 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -166,7 +166,7 @@ public class DDSImage {
public static DDSImage read(String filename) throws IOException {
return read(new File(filename));
}
-
+
/** Reads a DirectDraw surface from the specified file, returning
the resulting DDSImage.
@@ -212,7 +212,7 @@ public class DDSImage {
}
}
- /**
+ /**
* Creates a new DDSImage from data supplied by the user. The
* resulting DDSImage can be written to disk using the write()
* method.
@@ -763,7 +763,7 @@ public class DDSImage {
default:
throw new IllegalArgumentException("d3dFormat must be one of the known formats");
}
-
+
// Now check the mipmaps against this size
int curSize = topmostMipmapSize;
int totalSize = 0;
@@ -785,7 +785,7 @@ public class DDSImage {
buf.put(mipmapData[i]);
}
this.buf = buf;
-
+
// Allocate and initialize a Header
header = new Header();
header.size = Header.size();
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/JPEGImage.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/JPEGImage.java
index 4d3d088ba..471938754 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/JPEGImage.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/JPEGImage.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -40,12 +40,12 @@ import com.jogamp.common.nio.Buffers;
import com.jogamp.opengl.util.texture.TextureData.ColorSpace;
public class JPEGImage {
- private static final boolean DEBUG = Debug.debug("JPEGImage");
-
-
+ private static final boolean DEBUG = Debug.debug("JPEGImage");
+
+
/**
* Reads a JPEG image from the specified InputStream, using the given color space for storage.
- *
+ *
* @param in
* @param cs Storage color space, either {@link ColorSpace#RGB} or {@link ColorSpace#YCbCr}. {@link ColorSpace#YCCK} and {@link ColorSpace#CMYK} will throw an exception!
* @return
@@ -54,12 +54,12 @@ public class JPEGImage {
public static JPEGImage read(InputStream in, ColorSpace cs) throws IOException {
return new JPEGImage(in, cs);
}
-
+
/** Reads a JPEG image from the specified InputStream, using the {@link ColorSpace#RGB}. */
public static JPEGImage read(InputStream in) throws IOException {
return new JPEGImage(in, ColorSpace.RGB);
}
-
+
private static class JPEGColorSink implements JPEGDecoder.ColorSink {
int width=0, height=0;
int sourceComponents=0;
@@ -67,7 +67,7 @@ public class JPEGImage {
int storageComponents;
final ColorSpace storageCS;
ByteBuffer data = null;
-
+
JPEGColorSink(ColorSpace storageCM) {
this.storageCS = storageCM;
switch(storageCS) {
@@ -79,7 +79,7 @@ public class JPEGImage {
throw new IllegalArgumentException("Unsupported storage color-space: "+storageCS);
}
}
-
+
@Override
public final ColorSpace allocate(int width, int height, ColorSpace sourceCM, int sourceComponents) throws RuntimeException {
this.width = width;
@@ -96,7 +96,7 @@ public class JPEGImage {
data.put(i++, r);
data.put(i++, g);
data.put(i++, b);
- // data.put(i++, (byte)0xff);
+ // data.put(i++, (byte)0xff);
}
@Override
@@ -111,12 +111,12 @@ public class JPEGImage {
data.put(i++, Cb);
data.put(i++, Cr);
}
-
+
public String toString() {
return "JPEGPixels["+width+"x"+height+", sourceComp "+sourceComponents+", sourceCS "+sourceCS+", storageCS "+storageCS+", storageComp "+storageComponents+"]";
}
};
-
+
private JPEGImage(InputStream in, ColorSpace cs) throws IOException {
pixelStorage = new JPEGColorSink(cs);
final JPEGDecoder decoder = new JPEGDecoder();
@@ -126,7 +126,7 @@ public class JPEGImage {
decoder.getPixel(pixelStorage, pixelWidth, pixelHeight);
data = pixelStorage.data;
final boolean hasAlpha = false;
-
+
bytesPerPixel = 3;
glFormat = GL.GL_RGB;
reversedChannels = false; // RGB[A]
@@ -142,7 +142,7 @@ public class JPEGImage {
private final int pixelWidth, pixelHeight, glFormat, bytesPerPixel;
private boolean reversedChannels;
private final ByteBuffer data;
-
+
/** Returns the color space of the pixel data */
public ColorSpace getColorSpace() { return pixelStorage.storageCS; }
@@ -157,10 +157,10 @@ public class JPEGImage {
/** Returns true if data has the channels reversed to BGR or BGRA, otherwise RGB or RGBA is expected. */
public boolean getHasReversedChannels() { return reversedChannels; }
-
+
/** Returns the OpenGL format for this texture; e.g. GL.GL_LUMINANCE, GL.GL_RGB or GL.GL_RGBA. */
public int getGLFormat() { return glFormat; }
-
+
/** Returns the OpenGL data type: GL.GL_UNSIGNED_BYTE. */
public int getGLType() { return GL.GL_UNSIGNED_BYTE; }
@@ -170,6 +170,6 @@ public class JPEGImage {
/** Returns the raw data for this texture in the correct
(bottom-to-top) order for calls to glTexImage2D. */
public ByteBuffer getData() { return data; }
-
+
public String toString() { return "JPEGImage["+pixelWidth+"x"+pixelHeight+", bytesPerPixel "+bytesPerPixel+", reversedChannels "+reversedChannels+", "+pixelStorage+", "+data+"]"; }
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataInputStream.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataInputStream.java
index b7262aa3e..4020ab3c0 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataInputStream.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataInputStream.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -148,7 +148,7 @@ public class LEDataInputStream extends FilterInputStream implements DataInput
}
public final int readUnsignedShort() throws IOException
- {
+ {
int ch1 = dataIn.read();
int ch2 = dataIn.read();
if ((ch1 | ch2) < 0)
@@ -195,7 +195,7 @@ public class LEDataInputStream extends FilterInputStream implements DataInput
/**
* dont call this it is not implemented.
- * @return empty new string
+ * @return empty new string
**/
public final String readLine() throws IOException
{
@@ -204,7 +204,7 @@ public class LEDataInputStream extends FilterInputStream implements DataInput
/**
* dont call this it is not implemented
- * @return empty new string
+ * @return empty new string
**/
public final String readUTF() throws IOException
{
@@ -213,7 +213,7 @@ public class LEDataInputStream extends FilterInputStream implements DataInput
/**
* dont call this it is not implemented
- * @return empty new string
+ * @return empty new string
**/
public final static String readUTF(DataInput in) throws IOException
{
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataOutputStream.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataOutputStream.java
index e1e1ca924..a7101a576 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataOutputStream.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataOutputStream.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/NetPbmTextureWriter.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/NetPbmTextureWriter.java
index cd42a1157..43b8eebe6 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/NetPbmTextureWriter.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/NetPbmTextureWriter.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -87,8 +87,8 @@ public class NetPbmTextureWriter implements TextureWriter {
public boolean write(File file, TextureData data) throws IOException {
boolean res;
final int magic_old = magic;
-
- // file suffix selection
+
+ // file suffix selection
if (0==magic) {
if (PPM.equals(IOUtil.getFileSuffix(file))) {
magic = 6;
@@ -97,7 +97,7 @@ public class NetPbmTextureWriter implements TextureWriter {
} else {
return false;
}
- }
+ }
try {
res = writeImpl(file, data);
} finally {
@@ -105,7 +105,7 @@ public class NetPbmTextureWriter implements TextureWriter {
}
return res;
}
-
+
private boolean writeImpl(File file, TextureData data) throws IOException {
int pixelFormat = data.getPixelFormat();
final int pixelType = data.getPixelType();
@@ -115,16 +115,16 @@ public class NetPbmTextureWriter implements TextureWriter {
pixelFormat == GL.GL_BGRA ) &&
(pixelType == GL.GL_BYTE ||
pixelType == GL.GL_UNSIGNED_BYTE)) {
-
+
ByteBuffer buf = (ByteBuffer) data.getBuffer();
if (null == buf ) {
buf = (ByteBuffer) data.getMipmapData()[0];
}
buf.rewind();
-
+
int comps = ( pixelFormat == GL.GL_RGBA || pixelFormat == GL.GL_BGRA ) ? 4 : 3 ;
-
- if( pixelFormat == GL2.GL_BGR || pixelFormat == GL.GL_BGRA ) {
+
+ if( pixelFormat == GL2.GL_BGR || pixelFormat == GL.GL_BGRA ) {
// Must reverse order of red and blue channels to get correct results
for (int i = 0; i < buf.remaining(); i += comps) {
byte red = buf.get(i + 0);
@@ -141,7 +141,7 @@ public class NetPbmTextureWriter implements TextureWriter {
}
FileOutputStream fos = IOUtil.getFileOutputStream(file, true);
-
+
StringBuilder header = new StringBuilder();
header.append("P");
header.append(magic);
@@ -171,7 +171,7 @@ public class NetPbmTextureWriter implements TextureWriter {
}
fos.write(header.toString().getBytes());
-
+
FileChannel fosc = fos.getChannel();
fosc.write(buf);
fosc.force(true);
@@ -180,7 +180,7 @@ public class NetPbmTextureWriter implements TextureWriter {
buf.rewind();
return true;
- }
+ }
throw new IOException("NetPbmTextureWriter writer doesn't support this pixel format / type (only GL_RGB/A + bytes)");
}
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/PNGImage.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/PNGImage.java
index 0f4559036..bfde1bfac 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/PNGImage.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/PNGImage.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -51,15 +51,15 @@ import com.jogamp.common.nio.Buffers;
import com.jogamp.common.util.IOUtil;
public class PNGImage {
- private static final boolean DEBUG = Debug.debug("PNGImage");
-
+ private static final boolean DEBUG = Debug.debug("PNGImage");
+
/**
* Creates a PNGImage from data supplied by the end user. Shares
* data with the passed ByteBuffer. Assumes the data is already in
* the correct byte order for writing to disk, i.e., LUMINANCE, RGB or RGBA.
* Orientation is bottom-to-top (OpenGL coord. default)
* or top-to-bottom depending on isGLOriented.
- *
+ *
* @param width
* @param height
* @param dpiX
@@ -74,17 +74,17 @@ public class PNGImage {
int bytesPerPixel, boolean reversedChannels, boolean isGLOriented, ByteBuffer data) {
return new PNGImage(width, height, dpiX, dpiY, bytesPerPixel, reversedChannels, isGLOriented, data);
}
-
- /**
+
+ /**
* Reads a PNG image from the specified InputStream.
*
* Implicitly flip image to GL orientation, see {@link #isGLOriented()}.
- *
+ *
*/
public static PNGImage read(InputStream in) throws IOException {
return new PNGImage(in);
}
-
+
/** Reverse read and store, implicitly flip image to GL orientation, see {@link #isGLOriented()}. */
private static final int getPixelRGBA8(ByteBuffer d, int dOff, int[] scanline, int lineOff, boolean hasAlpha) {
final int b = hasAlpha ? 4-1 : 3-1;
@@ -95,11 +95,11 @@ public class PNGImage {
d.put(dOff--, (byte)scanline[lineOff + 3]); // A
}
d.put(dOff--, (byte)scanline[lineOff + 2]); // B
- d.put(dOff--, (byte)scanline[lineOff + 1]); // G
+ d.put(dOff--, (byte)scanline[lineOff + 1]); // G
d.put(dOff--, (byte)scanline[lineOff ]); // R
return dOff;
}
-
+
/** Reverse write and store, implicitly flip image from current orientation, see {@link #isGLOriented()}. Handle reversed channels (BGR[A]). */
private int setPixelRGBA8(ImageLine line, int lineOff, ByteBuffer d, int dOff, boolean hasAlpha) {
final int b = hasAlpha ? 4-1 : 3-1;
@@ -138,9 +138,9 @@ public class PNGImage {
this.bytesPerPixel = bytesPerPixel;
this.reversedChannels = reversedChannels;
this.isGLOriented = isGLOriented;
- this.data = data;
+ this.data = data;
}
-
+
private PNGImage(InputStream in) {
final PngReader pngr = new PngReader(new BufferedInputStream(in), null);
final ImageInfo imgInfo = pngr.imgInfo;
@@ -148,12 +148,12 @@ public class PNGImage {
final PngChunkTRNS trns = pngr.getMetadata().getTRNS();
final boolean indexed = imgInfo.indexed;
final boolean hasAlpha = indexed ? ( trns != null ) : imgInfo.alpha ;
-
+
final int channels = indexed ? ( hasAlpha ? 4 : 3 ) : imgInfo.channels ;
if ( ! ( 1 == channels || 3 == channels || 4 == channels ) ) {
throw new RuntimeException("PNGImage can only handle Lum/RGB/RGBA [1/3/4 channels] images for now. Channels "+channels + " Paletted: " + indexed);
}
-
+
bytesPerPixel = indexed ? channels : imgInfo.bytesPixel ;
if ( ! ( 1 == bytesPerPixel || 3 == bytesPerPixel || 4 == bytesPerPixel ) ) {
throw new RuntimeException("PNGImage can only handle Lum/RGB/RGBA [1/3/4 bpp] images for now. BytesPerPixel "+bytesPerPixel);
@@ -189,14 +189,14 @@ public class PNGImage {
", bytesPerPixel "+bytesPerPixel+"/"+imgInfo.bytesPixel+
", pixels "+pixelWidth+"x"+pixelHeight+", dpi "+dpi[0]+"x"+dpi[1]+", glFormat 0x"+Integer.toHexString(glFormat));
}
-
+
data = Buffers.newDirectByteBuffer(bytesPerPixel * pixelWidth * pixelHeight);
reversedChannels = false; // RGB[A]
isGLOriented = true;
int dataOff = bytesPerPixel * pixelWidth * pixelHeight - 1; // start at end-of-buffer, reverse store
int[] rgbaScanline = indexed ? new int[imgInfo.cols * channels] : null;
-
+
for (int row = 0; row < pixelHeight; row++) {
final ImageLine l1 = pngr.readRow(row);
int lineOff = ( pixelWidth - 1 ) * bytesPerPixel ; // start w/ last pixel in line, reverse read (PNG top-left -> OpenGL bottom-left origin)
@@ -224,7 +224,7 @@ public class PNGImage {
private final boolean isGLOriented;
private final double[] dpi;
private final ByteBuffer data;
-
+
/** Returns the width of the image. */
public int getWidth() { return pixelWidth; }
@@ -233,23 +233,23 @@ public class PNGImage {
/** Returns true if data has the channels reversed to BGR or BGRA, otherwise RGB or RGBA is expected. */
public boolean getHasReversedChannels() { return reversedChannels; }
-
+
/**
- * Returns true if the drawable is rendered in
+ * Returns true if the drawable is rendered in
* OpenGL's coordinate system, origin at bottom left.
* Otherwise returns false, i.e. origin at top left.
*
* Default impl. is true, i.e. OpenGL coordinate system.
- *
+ *
*/
public boolean isGLOriented() { return isGLOriented; }
-
+
/** Returns the dpi of the image. */
public double[] getDpi() { return dpi; }
-
+
/** Returns the OpenGL format for this texture; e.g. GL.GL_LUMINANCE, GL.GL_RGB or GL.GL_RGBA. */
public int getGLFormat() { return glFormat; }
-
+
/** Returns the OpenGL data type: GL.GL_UNSIGNED_BYTE. */
public int getGLType() { return GL.GL_UNSIGNED_BYTE; }
@@ -260,12 +260,12 @@ public class PNGImage {
(bottom-to-top) order for calls to glTexImage2D. */
public ByteBuffer getData() { return data; }
- public void write(File out, boolean allowOverwrite) throws IOException {
- final ImageInfo imi = new ImageInfo(pixelWidth, pixelHeight, 8, (4 == bytesPerPixel) ? true : false); // 8 bits per channel, no alpha
+ public void write(File out, boolean allowOverwrite) throws IOException {
+ final ImageInfo imi = new ImageInfo(pixelWidth, pixelHeight, 8, (4 == bytesPerPixel) ? true : false); // 8 bits per channel, no alpha
// open image for writing to a output stream
final OutputStream outs = new BufferedOutputStream(IOUtil.getFileOutputStream(out, allowOverwrite));
try {
- final PngWriter png = new PngWriter(outs, imi);
+ final PngWriter png = new PngWriter(outs, imi);
// add some optional metadata (chunks)
png.getMetadata().setDpi(dpi[0], dpi[1]);
png.getMetadata().setTimeNow(0); // 0 seconds fron now = now
@@ -275,7 +275,7 @@ public class PNGImage {
final ImageLine l1 = new ImageLine(imi);
if( isGLOriented ) {
// start at last pixel at end-of-buffer, reverse read (OpenGL bottom-left -> PNG top-left origin)
- int dataOff = ( pixelWidth * bytesPerPixel * ( pixelHeight - 1 ) ) + // full lines - 1 line
+ int dataOff = ( pixelWidth * bytesPerPixel * ( pixelHeight - 1 ) ) + // full lines - 1 line
( ( pixelWidth - 1 ) * bytesPerPixel ); // one line - 1 pixel
for (int row = 0; row < pixelHeight; row++) {
int lineOff = ( pixelWidth - 1 ) * bytesPerPixel ; // start w/ last pixel in line, reverse store (OpenGL bottom-left -> PNG top-left origin)
@@ -306,13 +306,13 @@ public class PNGImage {
}
}
png.writeRow(l1, row);
- }
+ }
}
png.end();
} finally {
IOUtil.close(outs, false);
}
}
-
- public String toString() { return "PNGImage["+pixelWidth+"x"+pixelHeight+", dpi "+dpi[0]+" x "+dpi[1]+", bytesPerPixel "+bytesPerPixel+", reversedChannels "+reversedChannels+", "+data+"]"; }
+
+ public String toString() { return "PNGImage["+pixelWidth+"x"+pixelHeight+", dpi "+dpi[0]+" x "+dpi[1]+", bytesPerPixel "+bytesPerPixel+", reversedChannels "+reversedChannels+", "+data+"]"; }
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/SGIImage.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/SGIImage.java
index d35330f58..fd96fba80 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/SGIImage.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/SGIImage.java
@@ -1,21 +1,21 @@
/*
* Portions Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -72,15 +72,15 @@ public class SGIImage {
byte storage; // Storage format
// 0 for uncompressed
// 1 for RLE compression
- byte bpc; // Number of bytes per pixel channel
+ byte bpc; // Number of bytes per pixel channel
// Legally 1 or 2
short dimension; // Number of dimensions
// Legally 1, 2, or 3
// 1 means a single row, XSIZE long
// 2 means a single 2D image
// 3 means multiple 2D images
- short xsize; // X size in pixels
- short ysize; // Y size in pixels
+ short xsize; // X size in pixels
+ short ysize; // Y size in pixels
short zsize; // Number of channels
// 1 indicates greyscale
// 3 indicates RGB
@@ -233,7 +233,7 @@ public class SGIImage {
//----------------------------------------------------------------------
// Internals only below this point
//
-
+
private void decodeImage(DataInputStream in) throws IOException {
if (header.storage == 1) {
// Read RLE compression data; row starts and sizes
@@ -478,7 +478,7 @@ public class SGIImage {
for (int z = 0; z < zsize; z++) {
for (int y = ystart; y != yend; y += yincr) {
// RLE-compress each row.
-
+
int x = 0;
byte count = 0;
boolean repeat_mode = false;
@@ -486,7 +486,7 @@ public class SGIImage {
int start_ptr = ptr;
int num_ptr = ptr++;
byte repeat_val = 0;
-
+
while (x < xsize) {
// see if we should switch modes
should_switch = false;
@@ -503,7 +503,7 @@ public class SGIImage {
if (DEBUG)
System.err.println("left side was " + ((int) imgref(data, x, y, z, xsize, ysize, zsize)) +
", right side was " + (int)imgref(data, x+i, y, z, xsize, ysize, zsize));
-
+
if (imgref(data, x, y, z, xsize, ysize, zsize) !=
imgref(data, x+i, y, z, xsize, ysize, zsize))
should_switch = false;
@@ -531,7 +531,7 @@ public class SGIImage {
repeat_mode = true;
repeat_val = imgref(data, x, y, z, xsize, ysize, zsize);
}
-
+
if (x > 0) {
// reset the number pointer
num_ptr = ptr++;
@@ -539,7 +539,7 @@ public class SGIImage {
count = 0;
}
}
-
+
// if not in repeat mode, copy element to ptr
if (!repeat_mode) {
rlebuf[ptr++] = imgref(data, x, y, z, xsize, ysize, zsize);
@@ -581,8 +581,8 @@ public class SGIImage {
// Now we have the offset tables computed, as well as the RLE data.
// Output this information to the file.
total_size = ptr;
-
- if (DEBUG)
+
+ if (DEBUG)
System.err.println("total_size was " + total_size);
DataOutputStream stream = new DataOutputStream(new BufferedOutputStream(IOUtil.getFileOutputStream(file, true)));
@@ -604,7 +604,7 @@ public class SGIImage {
byte[] dest = new byte[16384];
int pos = 0;
int numRead = 0;
-
+
boolean done = false;
do {
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java
index 2ff3b9cf0..df9430a26 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -146,9 +146,9 @@ public class TGAImage {
tgaType = TYPE_OLD; // dont try and get footer.
// initial header fields
- idLength = in.readUnsignedByte();
+ idLength = in.readUnsignedByte();
colorMapType = in.readUnsignedByte();
- imageType = in.readUnsignedByte();
+ imageType = in.readUnsignedByte();
// color map header fields
firstEntryIndex = in.readUnsignedShort();
@@ -288,14 +288,14 @@ public class TGAImage {
throw new IOException("TGADecoder Compressed Grayscale images not supported");
}
}
-
+
/**
* This assumes that the body is for a 24 bit or 32 bit for a
* RGB or ARGB image respectively.
*/
private void decodeRGBImageU24_32(GLProfile glp, LEDataInputStream dIn) throws IOException {
setupImage24_32(glp);
-
+
int i; // row index
int y; // output row index
int rawWidth = header.width() * bpp;
@@ -317,14 +317,14 @@ public class TGAImage {
swapBGR(tmpData, rawWidth, header.height(), bpp);
data = ByteBuffer.wrap(tmpData);
}
-
+
/**
* This assumes that the body is for a 24 bit or 32 bit for a
* RGB or ARGB image respectively.
*/
private void decodeRGBImageRLE24_32(GLProfile glp, LEDataInputStream dIn) throws IOException {
setupImage24_32(glp);
-
+
byte[] pixel = new byte[bpp];
int rawWidth = header.width() * bpp;
byte[] tmpData = new byte[rawWidth * header.height()];
@@ -341,17 +341,17 @@ public class TGAImage {
dIn.read(tmpData, i, len * bpp);
i += bpp * len;
}
-
+
if(format == GL.GL_RGB || format == GL.GL_RGBA)
swapBGR(tmpData, rawWidth, header.height(), bpp);
data = ByteBuffer.wrap(tmpData);
}
-
+
private void setupImage24_32(GLProfile glp) {
bpp = header.pixelDepth / 8;
switch (header.pixelDepth) {
- case 24:
- format = glp.isGL2GL3() ? GL2GL3.GL_BGR : GL.GL_RGB;
+ case 24:
+ format = glp.isGL2GL3() ? GL2GL3.GL_BGR : GL.GL_RGB;
break;
case 32:
boolean useBGRA = glp.isGL2GL3();
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureProvider.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureProvider.java
index 88018edbe..0299531b1 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureProvider.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureProvider.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureWriter.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureWriter.java
index 55527cef5..35b8efa72 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureWriter.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureWriter.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureProvider.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureProvider.java
index 6e2f1b992..f23cb74bf 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureProvider.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureProvider.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureWriter.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureWriter.java
index 89d0d20a1..438ab6cc2 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureWriter.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureWriter.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -113,7 +113,7 @@ public class IIOTextureWriter implements TextureWriter {
return ImageIO.write(image, IOUtil.getFileSuffix(file), file);
}
-
+
throw new IOException("ImageIO writer doesn't support this pixel format / type (only GL_RGB/A + bytes)");
}
}
diff --git a/src/jogl/classes/javax/media/opengl/DebugGL2.java b/src/jogl/classes/javax/media/opengl/DebugGL2.java
index 05bcf3d5e..3c064a18f 100644
--- a/src/jogl/classes/javax/media/opengl/DebugGL2.java
+++ b/src/jogl/classes/javax/media/opengl/DebugGL2.java
@@ -10,7 +10,7 @@ package javax.media.opengl;
* Sample code which installs this pipeline, manual:
*
+ *
* For automatic instantiation see {@link GLPipelineFactory#create(String, Class, GL, Object[])}.
*
*/
diff --git a/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java b/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java
index b0f3da8e4..7e243471e 100644
--- a/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java
+++ b/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003-2009 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,11 +29,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -91,7 +91,7 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser {
Debug.initSingleton();
DEBUG = Debug.isPropertyDefined("jogl.debug.CapabilitiesChooser", true);
}
-
+
private final static int NO_SCORE = -9999999;
private final static int DOUBLE_BUFFER_MISMATCH_PENALTY = 1000;
private final static int OPAQUE_MISMATCH_PENALTY = 750;
@@ -106,7 +106,7 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser {
private final static int ACCUM_MISMATCH_PENALTY_SCALE = 1;
private final static int STENCIL_MISMATCH_PENALTY_SCALE = 3;
private final static int MULTISAMPLE_MISMATCH_PENALTY_SCALE = 3;
-
+
@Override
public int chooseCapabilities(final CapabilitiesImmutable desired,
final List extends CapabilitiesImmutable> available,
@@ -143,12 +143,12 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser {
// Create score array
int[] scores = new int[availnum];
-
+
for (int i = 0; i < scores.length; i++) {
scores[i] = NO_SCORE;
}
final int gldes_samples = gldes.getNumSamples();
-
+
// Compute score for each
for (int i = 0; i < availnum; i++) {
final GLCapabilitiesImmutable cur = (GLCapabilitiesImmutable) available.get(i);
@@ -165,24 +165,24 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser {
} */
if (gldes.isPBuffer() && !cur.isPBuffer()) {
continue; // requested pBuffer, but n/a
- }
+ }
if (gldes.isBitmap() && !cur.isBitmap()) {
continue; // requested pBuffer, but n/a
- }
+ }
}
if (gldes.getStereo() != cur.getStereo()) {
continue;
}
final int cur_samples = cur.getNumSamples() ;
int score = 0;
-
+
// Compute difference in color depth
// (Note that this decides the direction of all other penalties)
score += (COLOR_MISMATCH_PENALTY_SCALE *
((cur.getRedBits() + cur.getGreenBits() + cur.getBlueBits() + cur.getAlphaBits()) -
(gldes.getRedBits() + gldes.getGreenBits() + gldes.getBlueBits() + gldes.getAlphaBits())));
// Compute difference in depth buffer depth
- score += (DEPTH_MISMATCH_PENALTY_SCALE * sign(score) *
+ score += (DEPTH_MISMATCH_PENALTY_SCALE * sign(score) *
Math.abs(cur.getDepthBits() - gldes.getDepthBits()));
// Compute difference in accumulation buffer depth
score += (ACCUM_MISMATCH_PENALTY_SCALE * sign(score) *
@@ -261,7 +261,7 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser {
System.err.println(" ]");
}
- // Ready to select. Choose score closest to 0.
+ // Ready to select. Choose score closest to 0.
int scoreClosestToZero = NO_SCORE;
int chosenIndex = -1;
for (int i = 0; i < availnum; i++) {
diff --git a/src/jogl/classes/javax/media/opengl/FPSCounter.java b/src/jogl/classes/javax/media/opengl/FPSCounter.java
index 9c07b58e4..4997258e0 100644
--- a/src/jogl/classes/javax/media/opengl/FPSCounter.java
+++ b/src/jogl/classes/javax/media/opengl/FPSCounter.java
@@ -36,28 +36,28 @@ import java.io.PrintStream;
*/
public interface FPSCounter {
public static final int DEFAULT_FRAMES_PER_INTERVAL = 5*60;
-
+
/**
- * @param frames Update interval in frames. At every rendered frames interval the currentTime and fps values are updated.
+ * @param frames Update interval in frames. At every rendered frames interval the currentTime and fps values are updated.
* If the frames interval is <= 0, no update will be issued, ie the FPSCounter feature is turned off. You may choose {@link #DEFAULT_FRAMES_PER_INTERVAL}.
- * @param out optional print stream where the fps values gets printed if not null at every frames interval
+ * @param out optional print stream where the fps values gets printed if not null at every frames interval
*/
void setUpdateFPSFrames(int frames, PrintStream out);
-
+
/**
* Reset all performance counter (startTime, currentTime, frame number)
*/
void resetFPSCounter();
-
+
/**
* @return update interval in frames
- *
+ *
* @see #setUpdateFPSFrames(int, PrintStream)
*/
int getUpdateFPSFrames();
-
+
/**
- * Returns the time of the first display call in milliseconds after enabling this feature via {@link #setUpdateFPSFrames(int, PrintStream)}.
+ * Returns the time of the first display call in milliseconds after enabling this feature via {@link #setUpdateFPSFrames(int, PrintStream)}.
* This value is reset via {@link #resetFPSCounter()}.
*
* @see #setUpdateFPSFrames(int, PrintStream)
@@ -81,18 +81,18 @@ public interface FPSCounter {
* @see #resetFPSCounter()
*/
long getLastFPSPeriod();
-
+
/**
* @return Last update interval's frames per seconds, {@link #getUpdateFPSFrames()} / {@link #getLastFPSPeriod()}
- *
+ *
* @see #setUpdateFPSFrames(int, PrintStream)
* @see #resetFPSCounter()
*/
- float getLastFPS();
-
+ float getLastFPS();
+
/**
* @return Number of frame rendered since {@link #getFPSStartTime()} up to {@link #getLastFPSUpdateTime()}
- *
+ *
* @see #setUpdateFPSFrames(int, PrintStream)
* @see #resetFPSCounter()
*/
@@ -108,10 +108,10 @@ public interface FPSCounter {
/**
- * @return Total frames per seconds, {@link #getTotalFPSFrames()} / {@link #getTotalFPSDuration()}
- *
+ * @return Total frames per seconds, {@link #getTotalFPSFrames()} / {@link #getTotalFPSDuration()}
+ *
* @see #setUpdateFPSFrames(int, PrintStream)
* @see #resetFPSCounter()
*/
- float getTotalFPS();
+ float getTotalFPS();
}
diff --git a/src/jogl/classes/javax/media/opengl/GLAnimatorControl.java b/src/jogl/classes/javax/media/opengl/GLAnimatorControl.java
index a72403eae..827145654 100644
--- a/src/jogl/classes/javax/media/opengl/GLAnimatorControl.java
+++ b/src/jogl/classes/javax/media/opengl/GLAnimatorControl.java
@@ -29,7 +29,7 @@
package javax.media.opengl;
/**
- * An animator control interface,
+ * An animator control interface,
* which implementation may drive a {@link javax.media.opengl.GLAutoDrawable} animation.
*/
public interface GLAnimatorControl extends FPSCounter {
@@ -56,8 +56,8 @@ public interface GLAnimatorControl extends FPSCounter {
boolean isAnimating();
/**
- * Indicates whether this animator {@link #isStarted() is started}
- * and either {@link #pause() manually paused} or paused
+ * Indicates whether this animator {@link #isStarted() is started}
+ * and either {@link #pause() manually paused} or paused
* automatically due to no {@link #add(GLAutoDrawable) added} {@link GLAutoDrawable}s.
*
* @see #start()
@@ -157,15 +157,15 @@ public interface GLAnimatorControl extends FPSCounter {
/**
* Adds a drawable to this animator's list of rendering drawables.
*
- * This allows the animator thread to become {@link #isAnimating() animating},
+ * This allows the animator thread to become {@link #isAnimating() animating},
* in case the first drawable is added and the animator {@link #isStarted() is started}.
*
- *
+ *
* @param drawable the drawable to be added
* @throws IllegalArgumentException if drawable was already added to this animator
*/
void add(GLAutoDrawable drawable);
-
+
/**
* Removes a drawable from the animator's list of rendering drawables.
*
@@ -173,10 +173,10 @@ public interface GLAnimatorControl extends FPSCounter {
* and will not be recovered.
*
*
- * This allows the animator thread to become {@link #isAnimating() not animating},
+ * This allows the animator thread to become {@link #isAnimating() not animating},
* in case the last drawable has been removed.
*
- *
+ *
* @param drawable the drawable to be removed
* @throws IllegalArgumentException if drawable was not added to this animator
*/
diff --git a/src/jogl/classes/javax/media/opengl/GLArrayData.java b/src/jogl/classes/javax/media/opengl/GLArrayData.java
index 8e1383031..4025170cf 100644
--- a/src/jogl/classes/javax/media/opengl/GLArrayData.java
+++ b/src/jogl/classes/javax/media/opengl/GLArrayData.java
@@ -43,7 +43,7 @@ public interface GLArrayData {
* Implementation and type dependent object association.
*
* One currently known use case is to associate a {@link com.jogamp.opengl.util.glsl.ShaderState ShaderState}
- * to an GLSL aware vertex attribute object, allowing to use the ShaderState to handle it's
+ * to an GLSL aware vertex attribute object, allowing to use the ShaderState to handle it's
* data persistence, location and state change.
* This is implicitly done via {@link com.jogamp.opengl.util.glsl.ShaderState#ownAttribute(GLArrayData, boolean) shaderState.ownAttribute(GLArrayData, boolean)}.
*
@@ -51,7 +51,7 @@ public interface GLArrayData {
* @param enable pass true to enable the association and false to disable it.
*/
public void associate(Object obj, boolean enable);
-
+
/**
* Returns true if this data set is intended for a GLSL vertex shader attribute,
* otherwise false, ie intended for fixed function vertex pointer
@@ -110,7 +110,7 @@ public interface GLArrayData {
* <0 denotes an invalid location, i.e. not found or used in the given shader program.
*/
public int setLocation(GL2ES2 gl, int program);
-
+
/**
* Binds the location of the shader attribute to the given location for the unlinked shader program.
*
@@ -121,7 +121,7 @@ public interface GLArrayData {
* @return the given location
*/
public int setLocation(GL2ES2 gl, int program, int location);
-
+
/**
* Determines whether the data is server side (VBO) and enabled,
* or a client side array (false).
@@ -150,7 +150,7 @@ public interface GLArrayData {
*/
public int getVBOTarget();
-
+
/**
* The Buffer holding the data, may be null if a GPU buffer without client bound data
*/
@@ -179,7 +179,7 @@ public interface GLArrayData {
* In case the buffer's position is 0 (sealed, flipped), it's based on it's limit instead of it's position.
*/
public int getElementCount();
-
+
/**
* The currently used size in bytes.
* In case the buffer's position is 0 (sealed, flipped), it's based on it's limit instead of it's position.
@@ -187,18 +187,18 @@ public interface GLArrayData {
public int getSizeInBytes();
/**
- * True, if GL shall normalize fixed point data while converting
+ * True, if GL shall normalize fixed point data while converting
* them into float.
- *
+ *
* Default behavior (of the fixed function pipeline) is true
* for fixed point data type and false for floating point data types.
*
*/
public boolean getNormalized();
- /**
+ /**
* @return the byte offset between consecutive components
- */
+ */
public int getStride();
public String toString();
diff --git a/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java b/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java
index 989a61aaf..38824ce8f 100644
--- a/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java
+++ b/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java
@@ -50,8 +50,8 @@ import jogamp.opengl.Debug;
rendering context which is associated with the GLAutoDrawable for
the lifetime of the object.
- Since the {@link GLContext} {@link GLContext#makeCurrent makeCurrent}
- implementation is synchronized, i.e. blocks if the context
+ Since the {@link GLContext} {@link GLContext#makeCurrent makeCurrent}
+ implementation is synchronized, i.e. blocks if the context
is current on another thread, the internal
{@link GLContext} for the GLAutoDrawable can be used for the event
based rendering mechanism and by end users directly.
@@ -123,7 +123,7 @@ public interface GLAutoDrawable extends GLDrawable {
* otherwise return this instance.
*/
public GLDrawable getDelegatedDrawable();
-
+
/**
* Returns the context associated with this drawable. The returned
* context will be synchronized.
@@ -135,38 +135,38 @@ public interface GLAutoDrawable extends GLDrawable {
* Associate the new context, newtCtx, to this auto-drawable.
*
* The current context will be destroyed if destroyPrevCtx is true,
- * otherwise it will be dis-associated from this auto-drawable
+ * otherwise it will be dis-associated from this auto-drawable
* via {@link GLContext#setGLDrawable(GLDrawable, boolean) setGLDrawable(null, true);} first.
*
*
- * The new context will be associated with this auto-drawable
+ * The new context will be associated with this auto-drawable
* via {@link GLContext#setGLDrawable(GLDrawable, boolean) newCtx.setGLDrawable(drawable, true);}.
- *
+ *
*
* If the old or new context was current on this thread, it is being released before switching the association.
- * The new context will be made current afterwards, if it was current before.
+ * The new context will be made current afterwards, if it was current before.
* However the user shall take extra care that no other thread
* attempts to make this context current.
*
- *
+ *
* @param newCtx the new context, maybe null for dis-association.
- * @param destroyPrevCtx if true, destroy the previous context if exists
+ * @param destroyPrevCtx if true, destroy the previous context if exists
* @return the previous GLContext, maybe null
- *
+ *
* @see GLContext#setGLDrawable(GLDrawable, boolean)
* @see GLContext#setGLReadDrawable(GLDrawable)
* @see jogamp.opengl.GLDrawableHelper#switchContext(GLDrawable, GLContext, boolean, GLContext, int)
*/
public GLContext setContext(GLContext newCtx, boolean destroyPrevCtx);
-
+
/**
* Adds the given {@link GLEventListener listener} to the end of this drawable queue.
* The {@link GLEventListener listeners} are notified of events in the order of the queue.
*
- * The newly added listener's {@link GLEventListener#init(GLAutoDrawable) init(..)}
+ * The newly added listener's {@link GLEventListener#init(GLAutoDrawable) init(..)}
* method will be called once before any other of it's callback methods.
* See {@link #getGLEventListenerInitState(GLEventListener)} for details.
- *
+ *
* @param listener The GLEventListener object to be inserted
*/
public void addGLEventListener(GLEventListener listener);
@@ -175,10 +175,10 @@ public interface GLAutoDrawable extends GLDrawable {
* Adds the given {@link GLEventListener listener} at the given index of this drawable queue.
* The {@link GLEventListener listeners} are notified of events in the order of the queue.
*
- * The newly added listener's {@link GLEventListener#init(GLAutoDrawable) init(..)}
+ * The newly added listener's {@link GLEventListener#init(GLAutoDrawable) init(..)}
* method will be called once before any other of it's callback methods.
* See {@link #getGLEventListenerInitState(GLEventListener)} for details.
- *
+ *
* @param index Position where the listener will be inserted.
* Should be within (0 <= index && index <= size()).
* An index value of -1 is interpreted as the end of the list, size().
@@ -192,7 +192,7 @@ public interface GLAutoDrawable extends GLDrawable {
* @return The number of GLEventListener objects of this drawable queue.
*/
public int getGLEventListenerCount();
-
+
/**
* Returns the {@link GLEventListener} at the given index of this drawable queue.
* @param index Position of the listener to be returned.
@@ -202,18 +202,18 @@ public interface GLAutoDrawable extends GLDrawable {
* @throws IndexOutOfBoundsException If the index is not within (0 <= index && index < size()), or -1
*/
public GLEventListener getGLEventListener(int index) throws IndexOutOfBoundsException;
-
+
/**
* Retrieves whether the given {@link GLEventListener listener} is initialized or not.
*
- * After {@link #addGLEventListener(GLEventListener) adding} a {@link GLEventListener} it is
+ * After {@link #addGLEventListener(GLEventListener) adding} a {@link GLEventListener} it is
* marked uninitialized and added to a list of to be initialized {@link GLEventListener}.
- * If such uninitialized {@link GLEventListener}'s handler methods (reshape, display)
+ * If such uninitialized {@link GLEventListener}'s handler methods (reshape, display)
* are about to be invoked, it's {@link GLEventListener#init(GLAutoDrawable) init(..)} method is invoked first.
* Afterwards the {@link GLEventListener} is marked initialized
* and removed from the list of to be initialized {@link GLEventListener}.
*
- *
+ *
* This methods returns the {@link GLEventListener} initialized state,
* i.e. returns false if it is included in the list of to be initialized {@link GLEventListener},
* otherwise true.
@@ -221,17 +221,17 @@ public interface GLAutoDrawable extends GLDrawable {
* @param listener the GLEventListener object to query it's initialized state.
*/
public boolean getGLEventListenerInitState(GLEventListener listener);
-
+
/**
* Sets the given {@link GLEventListener listener's} initialized state.
- *
+ *
* This methods allows manually setting the {@link GLEventListener} initialized state,
* i.e. adding it to, or removing it from the list of to be initialized {@link GLEventListener}.
* See {@link #getGLEventListenerInitState(GLEventListener)} for details.
*
*
* Warning: This method does not validate whether the given {@link GLEventListener listener's}
- * is member of this drawable queue, i.e. {@link #addGLEventListener(GLEventListener) added}.
+ * is member of this drawable queue, i.e. {@link #addGLEventListener(GLEventListener) added}.
*
*
* This method is only exposed to allow users full control over the {@link GLEventListener}'s state
@@ -239,16 +239,16 @@ public interface GLAutoDrawable extends GLDrawable {
*
*
* One use case is moving a {@link GLContext} and their initialized {@link GLEventListener}
- * from one {@link GLAutoDrawable} to another,
+ * from one {@link GLAutoDrawable} to another,
* where a subsequent {@link GLEventListener#init(GLAutoDrawable) init(..)} call after adding it
- * to the new owner is neither required nor desired.
+ * to the new owner is neither required nor desired.
* See {@link com.jogamp.opengl.util.GLDrawableUtil#swapGLContextAndAllGLEventListener(GLAutoDrawable, GLAutoDrawable) swapGLContextAndAllGLEventListener(..)}.
*
* @param listener the GLEventListener object to perform a state change.
- * @param initialized if true, mark the listener initialized, otherwise uninitialized.
+ * @param initialized if true, mark the listener initialized, otherwise uninitialized.
*/
public void setGLEventListenerInitState(GLEventListener listener, boolean initialized);
-
+
/**
* Disposes the given {@link GLEventListener listener} via {@link GLEventListener#dispose(GLAutoDrawable) dispose(..)}
* if it has been initialized and added to this queue.
@@ -257,7 +257,7 @@ public interface GLAutoDrawable extends GLDrawable {
* otherwise marked uninitialized.
*
*
- * If an {@link GLAnimatorControl} is being attached and the current thread is different
+ * If an {@link GLAnimatorControl} is being attached and the current thread is different
* than {@link GLAnimatorControl#getThread() the animator's thread}, it is paused during the operation.
*
*
@@ -268,8 +268,8 @@ public interface GLAutoDrawable extends GLDrawable {
* Use {@link #removeGLEventListener(GLEventListener) removeGLEventListener(listener)} instead
* if you just want to remove the {@link GLEventListener listener} and don't care about the disposal of the it's (OpenGL) resources.
*
- *
- * Also note that this is done from within a particular drawable's
+ *
+ * Also note that this is done from within a particular drawable's
* {@link GLEventListener} handler (reshape, display, etc.), that it is not
* guaranteed that all other listeners will be evaluated properly
* during this update cycle.
@@ -277,30 +277,30 @@ public interface GLAutoDrawable extends GLDrawable {
* @param listener The GLEventListener object to be disposed and removed if remove is true
* @param remove pass true to have the listener removed from this drawable queue, otherwise pass false
* @return the disposed and/or removed GLEventListener, or null if no action was performed, i.e. listener was not added
- */
+ */
public GLEventListener disposeGLEventListener(GLEventListener listener, boolean remove);
-
- /**
+
+ /**
* Removes the given {@link GLEventListener listener} from this drawable queue.
*
- * This is an inexpensive operation, since the removed listener's
+ * This is an inexpensive operation, since the removed listener's
* {@link GLEventListener#dispose(GLAutoDrawable) dispose(..)} method will not be called.
*
*
- * Use {@link #disposeGLEventListener(GLEventListener, boolean) disposeGLEventListener(listener, true)}
+ * Use {@link #disposeGLEventListener(GLEventListener, boolean) disposeGLEventListener(listener, true)}
* instead to ensure disposal of the {@link GLEventListener listener}'s (OpenGL) resources.
- *
- *
- * Note that if this is done from within a particular drawable's
+ *
+ *
+ * Note that if this is done from within a particular drawable's
* {@link GLEventListener} handler (reshape, display, etc.), that it is not
* guaranteed that all other listeners will be evaluated properly
* during this update cycle.
*
* @param listener The GLEventListener object to be removed
* @return the removed GLEventListener, or null if listener was not added
- */
+ */
public GLEventListener removeGLEventListener(GLEventListener listener);
-
+
/**
* Registers the usage of an animator, an {@link javax.media.opengl.GLAnimatorControl} implementation.
* The animator will be queried whether it's animating, ie periodically issuing {@link #display()} calls or not.
@@ -334,17 +334,17 @@ public interface GLAutoDrawable extends GLDrawable {
/**
* Dedicates this instance's {@link GLContext} to the given thread.
* The thread will exclusively claim the {@link GLContext} via {@link #display()} and not release it
- * until {@link #destroy()} or setExclusiveContextThread(null) has been called.
+ * until {@link #destroy()} or setExclusiveContextThread(null) has been called.
*
* Default non-exclusive behavior is requested via setExclusiveContextThread(null),
- * which will cause the next call of {@link #display()} on the exclusive thread to
- * release the {@link GLContext}. Only after it's async release, {@link #getExclusiveContextThread()}
+ * which will cause the next call of {@link #display()} on the exclusive thread to
+ * release the {@link GLContext}. Only after it's async release, {@link #getExclusiveContextThread()}
* will return null.
*
*
* To release a previous made exclusive thread, a user issues setExclusiveContextThread(null)
- * and may poll {@link #getExclusiveContextThread()} until it returns null,
- * while the exclusive thread is still running.
+ * and may poll {@link #getExclusiveContextThread()} until it returns null,
+ * while the exclusive thread is still running.
*
*
* Note: Setting a new exclusive thread without properly releasing a previous one
@@ -359,17 +359,17 @@ public interface GLAutoDrawable extends GLDrawable {
* and spare redundant context switches, see {@link com.jogamp.opengl.util.AnimatorBase#setExclusiveContext(boolean)}.
*
* @param t the exclusive thread to claim the context, or null for default operation.
- * @return previous exclusive context thread
+ * @return previous exclusive context thread
* @throws GLException If an exclusive thread is still active but a new one is attempted to be set
* @see com.jogamp.opengl.util.AnimatorBase#setExclusiveContext(boolean)
*/
public Thread setExclusiveContextThread(Thread t) throws GLException;
-
+
/**
- * @see #setExclusiveContextThread(Thread)
+ * @see #setExclusiveContextThread(Thread)
*/
public Thread getExclusiveContextThread();
-
+
/**
* Enqueues a one-shot {@link GLRunnable},
* which will be executed within the next {@link #display()} call
@@ -391,7 +391,7 @@ public interface GLAutoDrawable extends GLDrawable {
* has been executed by the {@link GLAnimatorControl animator}, otherwise the method returns immediately.
*
*
- * If wait is trueand
+ * If wait is trueand
* {@link #isRealized()} returns falseor {@link #getContext()} returns null,
* the call is ignored and returns false.
* This helps avoiding deadlocking the caller.
@@ -404,16 +404,16 @@ public interface GLAutoDrawable extends GLDrawable {
* @param wait if true block until execution of glRunnable is finished, otherwise return immediately w/o waiting
* @param glRunnable the {@link GLRunnable} to execute within {@link #display()}
* @return true if the {@link GLRunnable} has been processed or queued, otherwise false.
- *
+ *
* @see #setAnimator(GLAnimatorControl)
* @see #display()
* @see GLRunnable
* @see #invoke(boolean, List)
*/
public boolean invoke(boolean wait, GLRunnable glRunnable);
-
+
/**
- * Extends {@link #invoke(boolean, GLRunnable)} functionality
+ * Extends {@link #invoke(boolean, GLRunnable)} functionality
* allowing to inject a list of {@link GLRunnable}s.
* @param wait if true block until execution of the last glRunnable is finished, otherwise return immediately w/o waiting
* @param glRunnables the {@link GLRunnable}s to execute within {@link #display()}
@@ -494,16 +494,16 @@ public interface GLAutoDrawable extends GLDrawable {
*
* This GLAutoDrawable implementation holds it's own GLContext reference,
* thus created a GLContext using this methods won't replace it implicitly.
- * To replace or set this GLAutoDrawable's GLContext you need to call {@link #setContext(GLContext, boolean)}.
+ * To replace or set this GLAutoDrawable's GLContext you need to call {@link #setContext(GLContext, boolean)}.
*
*
- * The GLAutoDrawable implementation shall also set the
- * context creation flags as customized w/ {@link #setContextCreationFlags(int)}.
+ * The GLAutoDrawable implementation shall also set the
+ * context creation flags as customized w/ {@link #setContextCreationFlags(int)}.
*
*/
@Override
public GLContext createContext(GLContext shareWith);
-
+
/** Returns the {@link GL} pipeline object this GLAutoDrawable uses.
If this method is called outside of the {@link
GLEventListener}'s callback methods (init, display, etc.) it may
@@ -522,13 +522,13 @@ public interface GLAutoDrawable extends GLDrawable {
demos for examples.
@return the set GL pipeline or null if not successful */
public GL setGL(GL gl);
-
+
/**
* Method may return the upstream UI toolkit object
* holding this {@link GLAutoDrawable} instance, if exist.
*
* Currently known Java UI toolkits and it's known return types are:
- *
+ *
*
- * However, the result may be other object types than the listed above
+ * However, the result may be other object types than the listed above
* due to new supported toolkits.
*
*
The base interface from which all GL profiles derive, providing
* checked conversion down to concrete profiles, access to the
- * OpenGL context associated with the GL and extension/function
+ * OpenGL context associated with the GL and extension/function
* availability queries as described below.
*
*
While the APIs for vendor extensions are unconditionally
@@ -79,7 +79,7 @@ package javax.media.opengl;
*
*/
public interface GLBase {
-
+
/**
* Indicates whether this GL object conforms to any of the OpenGL profiles.
*/
@@ -131,7 +131,7 @@ public interface GLBase {
*
* Remark: ES2 compatible desktop profiles are not included.
* To query whether core ES2 functionality is provided, use {@link #isGLES2Compatible()}.
- *
* Remark: ES3 compatible desktop profiles are not included.
* To query whether core ES3 functionality is provided, use {@link #isGLES3Compatible()}.
- *
+ *
* @see #isGLES3Compatible()
* @see GLContext#isGLES3()
*/
public boolean isGLES3();
-
+
/**
* Indicates whether this GL object conforms to one of the OpenGL ES profiles,
* see {@link #isGLES1()} and {@link #isGLES2()}.
@@ -180,7 +180,7 @@ public interface GLBase {
public boolean isGL3ES3();
/**
- * Returns true if this GL object conforms to a GL4ES3 compatible profile, i.e. if {@link #isGLES3Compatible()} returns true.
+ * Returns true if this GL object conforms to a GL4ES3 compatible profile, i.e. if {@link #isGLES3Compatible()} returns true.
*
Includes [ GL ≥ 4.3, GL ≥ 3.1 w/ GL_ARB_ES3_compatibility and GLES3 ]
* @see GLContext#isGL4ES3()
*/
@@ -192,29 +192,29 @@ public interface GLBase {
*/
public boolean isGL2GL3();
- /**
+ /**
* Indicates whether this GL object uses a GL4 core profile.
Includes [ GL4 ].
* @see GLContext#isGL4core()
*/
public boolean isGL4core();
-
- /**
+
+ /**
* Indicates whether this GL object uses a GL3 core profile.
Includes [ GL4, GL3 ].
* @see GLContext#isGL3core()
*/
public boolean isGL3core();
-
- /**
+
+ /**
* Indicates whether this GL object uses a GL core profile.
Includes [ GL4, GL3, GLES3, GL2ES2 ].
* @see GLContext#isGLcore()
*/
public boolean isGLcore();
-
+
/**
* Indicates whether this GL object is compatible with the core OpenGL ES2 functionality.
- * @return true if this context is an ES2 context or implements
+ * @return true if this context is an ES2 context or implements
* the extension GL_ARB_ES2_compatibility, otherwise false
- * @see GLContext#isGLES2Compatible()
+ * @see GLContext#isGLES2Compatible()
*/
public boolean isGLES2Compatible();
@@ -227,26 +227,26 @@ public interface GLBase {
*
* Includes [ GL ≥ 4.3, GL ≥ 3.1 w/ GL_ARB_ES3_compatibility and GLES3 ]
*
- * @see GLContext#isGLES3Compatible()
+ * @see GLContext#isGLES3Compatible()
*/
public boolean isGLES3Compatible();
- /**
- * Indicates whether this GL object supports GLSL.
- * @see GLContext#hasGLSL()
+ /**
+ * Indicates whether this GL object supports GLSL.
+ * @see GLContext#hasGLSL()
*/
public boolean hasGLSL();
/**
* Returns the downstream GL instance in case this is a wrapping pipeline, otherwise null.
*
- * See {@link #getRootGL()} for retrieving the implementing root instance.
+ * See {@link #getRootGL()} for retrieving the implementing root instance.
*
* @throws GLException if the downstream instance is not null and not a GL implementation
* @see #getRootGL()
*/
public GL getDownstreamGL() throws GLException;
-
+
/**
* Returns the implementing root instance, considering a wrapped pipelined hierarchy, see {@link #getDownstreamGL()}.
*
@@ -256,7 +256,7 @@ public interface GLBase {
* @throws GLException if the root instance is not a GL implementation
*/
public GL getRootGL() throws GLException;
-
+
/**
* Casts this object to the GL interface.
* @throws GLException if this object is not a GL implementation
@@ -360,14 +360,14 @@ public interface GLBase {
/**
* Returns true if the specified OpenGL core- or extension-function can be
* used successfully through this GL instance given the current host (OpenGL
- * client) and display (OpenGL server) configuration.
- * By "successfully" we mean that the function is both callable
- * on the machine running the program and available on the current
- * display.
+ * client) and display (OpenGL server) configuration.
+ * By "successfully" we mean that the function is both callable
+ * on the machine running the program and available on the current
+ * display.
*
* In order to call a function successfully, the function must be both
- * callable on the machine running the program and available on
- * the display device that is rendering the output (note: on non-networked,
+ * callable on the machine running the program and available on
+ * the display device that is rendering the output (note: on non-networked,
* single-display machines these two conditions are identical; on networked and/or
* multi-display machines this becomes more complicated). These conditions are
* met if the function is either part of the core OpenGL version supported by
@@ -376,7 +376,7 @@ public interface GLBase {
*
* A GL function is callable if it is successfully linked at runtime,
* hence the GLContext must be made current at least once.
- *
+ *
* @param glFunctionName the name of the OpenGL function (e.g., use
* "glBindRenderbufferEXT" or "glBindRenderbuffer" to check if {@link
* GL#glBindRenderbuffer(int,int)} is available).
@@ -386,14 +386,14 @@ public interface GLBase {
/**
* Returns true if the specified OpenGL extension can be
* used successfully through this GL instance given the current host (OpenGL
- * client) and display (OpenGL server) configuration.
+ * client) and display (OpenGL server) configuration.
*
* @param glExtensionName the name of the OpenGL extension (e.g.,
* "GL_ARB_vertex_program").
*/
public boolean isExtensionAvailable(String glExtensionName);
- /**
+ /**
* Returns true if basic FBO support is available, otherwise false.
*
* Basic FBO is supported if the context is either GL-ES >= 2.0, GL >= core 3.0 or implements the extensions
@@ -407,12 +407,12 @@ public interface GLBase {
*/
public boolean hasBasicFBOSupport();
- /**
+ /**
* Returns true if full FBO support is available, otherwise false.
*
* Full FBO is supported if the context is either GL >= core 3.0 or implements the extensions
* ARB_framebuffer_object, or all of
- * EXT_framebuffer_object, EXT_framebuffer_multisample,
+ * EXT_framebuffer_object, EXT_framebuffer_multisample,
* EXT_framebuffer_blit, GL_EXT_packed_depth_stencil.
*
*
@@ -424,7 +424,7 @@ public interface GLBase {
/**
* Returns the maximum number of FBO RENDERBUFFER samples
- * if {@link #hasFullFBOSupport() full FBO is supported}, otherwise false.
+ * if {@link #hasFullFBOSupport() full FBO is supported}, otherwise false.
* @see GLContext#getMaxRenderbufferSamples()
*/
public int getMaxRenderbufferSamples();
@@ -440,7 +440,7 @@ public interface GLBase {
public boolean isNPOTTextureAvailable();
public boolean isTextureFormatBGRA8888Available();
-
+
/** Provides a platform-independent way to specify the minimum swap
interval for buffer swaps. An argument of 0 disables
sync-to-vertical-refresh completely, while an argument of 1
@@ -449,7 +449,7 @@ public interface GLBase {
is usually either 0 or 1. This function is not guaranteed to
have an effect, and in particular only affects heavyweight
onscreen components.
-
+
@see #getSwapInterval
@throws GLException if this context is not the current
*/
@@ -458,8 +458,8 @@ public interface GLBase {
/** Provides a platform-independent way to get the swap
interval set by {@link #setSwapInterval}.
- If the interval is not set by {@link #setSwapInterval} yet,
- -1 is returned, indicating that the platforms default
+ If the interval is not set by {@link #setSwapInterval} yet,
+ -1 is returned, indicating that the platforms default
is being used.
@see #setSwapInterval
@@ -498,10 +498,10 @@ public interface GLBase {
*/
public Object getExtension(String extensionName);
- /** Aliased entrypoint of void {@native glClearDepth}(GLclampd depth); and void {@native glClearDepthf}(GLclampf depth); . */
+ /** Aliased entrypoint of void {@native glClearDepth}(GLclampd depth); and void {@native glClearDepthf}(GLclampf depth); . */
public void glClearDepth( double depth );
- /** Aliased entrypoint of void {@native glDepthRange}(GLclampd depth); and void {@native glDepthRangef}(GLclampf depth); . */
+ /** Aliased entrypoint of void {@native glDepthRange}(GLclampd depth); and void {@native glDepthRangef}(GLclampf depth); . */
public void glDepthRange(double zNear, double zFar);
/**
@@ -526,44 +526,44 @@ public interface GLBase {
*/
public boolean glIsVBOElementArrayBound();
- /**
- * Return the framebuffer name bound to this context,
+ /**
+ * Return the framebuffer name bound to this context,
* see {@link GL#glBindFramebuffer(int, int)}.
*/
public int getBoundFramebuffer(int target);
- /**
+ /**
* Return the default draw framebuffer name.
- *
+ *
* May differ from it's default zero
* in case an framebuffer object ({@link com.jogamp.opengl.FBObject}) based drawable
* is being used.
- *
+ *
*/
public int getDefaultDrawFramebuffer();
- /**
+ /**
* Return the default read framebuffer name.
- *
+ *
* May differ from it's default zero
* in case an framebuffer object ({@link com.jogamp.opengl.FBObject}) based drawable
* is being used.
- *
+ *
*/
public int getDefaultReadFramebuffer();
-
- /**
- * Returns the default color buffer within the current bound
+
+ /**
+ * Returns the default color buffer within the current bound
* {@link #getDefaultReadFramebuffer()}, i.e. GL_READ_FRAMEBUFFER,
- * which will be used as the source for pixel reading commands,
+ * which will be used as the source for pixel reading commands,
* like {@link GL#glReadPixels(int, int, int, int, int, int, java.nio.Buffer)} etc.
*
* For offscreen framebuffer objects this is {@link GL#GL_COLOR_ATTACHMENT0},
- * otherwise this is {@link GL#GL_FRONT} for single buffer configurations
+ * otherwise this is {@link GL#GL_FRONT} for single buffer configurations
* and {@link GL#GL_BACK} for double buffer configurations.
- *
+ *
*/
public int getDefaultReadBuffer();
-
+
}
diff --git a/src/jogl/classes/javax/media/opengl/GLCapabilities.java b/src/jogl/classes/javax/media/opengl/GLCapabilities.java
index 872069fb8..b825d6388 100644
--- a/src/jogl/classes/javax/media/opengl/GLCapabilities.java
+++ b/src/jogl/classes/javax/media/opengl/GLCapabilities.java
@@ -99,7 +99,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil
}
/**
- * Copies all {@link GLCapabilities} and {@link Capabilities} values
+ * Copies all {@link GLCapabilities} and {@link Capabilities} values
* from source into this instance.
* @return this instance
*/
@@ -122,11 +122,11 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil
sampleExtension = source.getSampleExtension();
return this;
}
-
+
@Override
public int hashCode() {
// 31 * x == (x << 5) - x
- int hash = super.hashCode();
+ int hash = super.hashCode();
hash = ((hash << 5) - hash) + this.glProfile.hashCode() ;
hash = ((hash << 5) - hash) + ( this.hardwareAccelerated ? 1 : 0 );
hash = ((hash << 5) - hash) + ( this.stereo ? 1 : 0 );
@@ -238,7 +238,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil
public void setGLProfile(GLProfile profile) {
glProfile=profile;
}
-
+
@Override
public final boolean isPBuffer() {
return isPBuffer;
@@ -255,7 +255,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil
*
* Requesting offscreen pbuffer mode disables the offscreen auto selection.
*
- */
+ */
public void setPBuffer(boolean enable) {
if(enable) {
setOnscreen(false);
@@ -267,7 +267,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil
public final boolean isFBO() {
return isFBO;
}
-
+
/**
* Requesting offscreen FBO mode.
*
@@ -422,7 +422,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil
return sampleBuffers;
}
- /**
+ /**
* If sample buffers are enabled, indicates the number of buffers
* to be allocated. Defaults to 2.
* @see #getNumSamples()
@@ -491,7 +491,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil
if(isOnscreen()) {
sink.append("."); // no additional off-screen modes besides on-screen
} else {
- sink.append("auto-cfg"); // auto-config off-screen mode
+ sink.append("auto-cfg"); // auto-config off-screen mode
}
}
sink.append("]");
diff --git a/src/jogl/classes/javax/media/opengl/GLCapabilitiesChooser.java b/src/jogl/classes/javax/media/opengl/GLCapabilitiesChooser.java
index 5d575c2ee..2e0bec1f9 100644
--- a/src/jogl/classes/javax/media/opengl/GLCapabilitiesChooser.java
+++ b/src/jogl/classes/javax/media/opengl/GLCapabilitiesChooser.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003-2009 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,11 +29,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -53,7 +53,7 @@ import javax.media.opengl.GLCapabilitiesImmutable;
the appropriate method of {@link GLDrawableFactory}; the chooser
will be called during the OpenGL context creation process. Note
that this is only a marker interface; its signature is the same as
- {@link CapabilitiesChooser} and the {@link List} of
+ {@link CapabilitiesChooser} and the {@link List} of
objects extending {@link CapabilitiesImmutable}
passed to {@link #chooseCapabilities chooseCapabilities}
is actually a {@link List} of type {@link GLCapabilitiesImmutable}. */
diff --git a/src/jogl/classes/javax/media/opengl/GLCapabilitiesImmutable.java b/src/jogl/classes/javax/media/opengl/GLCapabilitiesImmutable.java
index 6af35021f..dc28539a0 100644
--- a/src/jogl/classes/javax/media/opengl/GLCapabilitiesImmutable.java
+++ b/src/jogl/classes/javax/media/opengl/GLCapabilitiesImmutable.java
@@ -37,13 +37,13 @@ import javax.media.nativewindow.CapabilitiesImmutable;
* @see javax.media.nativewindow.CapabilitiesImmutable
*/
public interface GLCapabilitiesImmutable extends CapabilitiesImmutable {
- /**
- * One of the platform's default sample extension
+ /**
+ * One of the platform's default sample extension
* EGL.EGL_SAMPLES, GLX.GLX_SAMPLES, WGLExt.WGL_SAMPLES_ARB
* if available, or any other known fallback one, ie EGLExt.EGL_COVERAGE_SAMPLES_NV
*/
public static final String DEFAULT_SAMPLE_EXTENSION = "default" ;
-
+
/**
* Returns the GL profile you desire or used by the drawable.
*/
@@ -110,10 +110,10 @@ public interface GLCapabilitiesImmutable extends CapabilitiesImmutable {
*
*/
String getSampleExtension();
-
+
/**
* Returns whether sample buffers for full-scene antialiasing
- * (FSAA) should be allocated for this drawable.
+ * (FSAA) should be allocated for this drawable.
*
* Default is false.
*
diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java
index f4dbde6b2..bd6867359 100644
--- a/src/jogl/classes/javax/media/opengl/GLContext.java
+++ b/src/jogl/classes/javax/media/opengl/GLContext.java
@@ -72,14 +72,14 @@ import com.jogamp.opengl.GLRendererQuirks;
abstraction provides a stable object which clients can use to
refer to a given context. */
public abstract class GLContext {
-
+
public static final boolean DEBUG = Debug.debug("GLContext");
public static final boolean TRACE_SWITCH = Debug.isPropertyDefined("jogl.debug.GLContext.TraceSwitch", true);
- public static final boolean DEBUG_TRACE_SWITCH = DEBUG || TRACE_SWITCH;
+ public static final boolean DEBUG_TRACE_SWITCH = DEBUG || TRACE_SWITCH;
- /**
- * If true (default), bootstrapping the available GL profiles
- * will use the highest compatible GL context for each profile,
+ /**
+ * If true (default), bootstrapping the available GL profiles
+ * will use the highest compatible GL context for each profile,
* hence skipping querying lower profiles if a compatible higher one is found:
*
*
4.2-core -> 4.2-core, 3.3-core
@@ -95,17 +95,17 @@ public abstract class GLContext {
*
* Using aliasing speeds up initialization about:
*
- *
Linux x86_64 - Nvidia: 28%, 700ms down to 500ms
- *
Linux x86_64 - AMD : 40%, 1500ms down to 900ms
+ *
Linux x86_64 - Nvidia: 28%, 700ms down to 500ms
+ *
Linux x86_64 - AMD : 40%, 1500ms down to 900ms
*
* Can be turned off with property jogl.debug.GLContext.NoProfileAliasing.
*
*/
public static final boolean PROFILE_ALIASING = !Debug.isPropertyDefined("jogl.debug.GLContext.NoProfileAliasing", true);
-
+
protected static final boolean FORCE_NO_FBO_SUPPORT = Debug.isPropertyDefined("jogl.fbo.force.none", true);
protected static final boolean FORCE_MIN_FBO_SUPPORT = Debug.isPropertyDefined("jogl.fbo.force.min", true);
-
+
/** Reflects property jogl.debug.DebugGL. If true, the debug pipeline is enabled at context creation. */
public static final boolean DEBUG_GL = Debug.isPropertyDefined("jogl.debug.DebugGL", true);
/** Reflects property jogl.debug.TraceGL. If true, the trace pipeline is enabled at context creation. */
@@ -130,31 +130,31 @@ public abstract class GLContext {
public static final VersionNumber Version140 = new VersionNumber(1, 40, 0);
/* Version 1.50, i.e. GLSL 1.50 for GL 3.2. */
public static final VersionNumber Version150 = new VersionNumber(1, 50, 0);
-
+
/** Version 3.0. As an OpenGL version, it qualifies for desktop {@link #isGL2()} only, or ES 3.0. */
public static final VersionNumber Version300 = new VersionNumber(3, 0, 0);
-
+
/** Version 3.1. As an OpenGL version, it qualifies for {@link #isGL3core()}, {@link #isGL3bc()} and {@link #isGL3()} */
public static final VersionNumber Version310 = new VersionNumber(3, 1, 0);
-
+
/** Version 3.2. As an OpenGL version, it qualifies for geometry shader */
public static final VersionNumber Version320 = new VersionNumber(3, 2, 0);
-
+
/** Version 4.3. As an OpenGL version, it qualifies for GL_ARB_ES3_compatibility */
public static final VersionNumber Version430 = new VersionNumber(4, 3, 0);
-
+
protected static final VersionNumber Version800 = new VersionNumber(8, 0, 0);
//
// Cached keys, bits [0..15]
//
-
+
/** Context option bits, full bit mask covering bits [0..15], i.e. 0x0000FFFF, {@value}. */
protected static final int CTX_IMPL_FULL_MASK = 0x0000FFFF;
-
+
/** Context option bits, cached bit mask covering 9 bits [0..8], i.e. 0x000001FF, {@value}. Leaving 7 bits for non cached options, i.e. 9:7. */
protected static final int CTX_IMPL_CACHE_MASK = 0x000001FF;
-
+
/** ARB_create_context related: created via ARB_create_context. Cache key value. See {@link #getAvailableContextProperties(AbstractGraphicsDevice, GLProfile)}. */
protected static final int CTX_IS_ARB_CREATED = 1 << 0;
/** ARB_create_context related: desktop compatibility profile. Cache key value. See {@link #isGLCompatibilityProfile()}, {@link #getAvailableContextProperties(AbstractGraphicsDevice, GLProfile)}. */
@@ -173,14 +173,14 @@ public abstract class GLContext {
//
// Non cached keys, bits [9..15]
//
-
+
/** GL_ARB_ES2_compatibility implementation related: Context is compatible w/ ES2. Not a cache key. See {@link #isGLES2Compatible()}, {@link #getAvailableContextProperties(AbstractGraphicsDevice, GLProfile)}. */
protected static final int CTX_IMPL_ES2_COMPAT = 1 << 9;
/** GL_ARB_ES3_compatibility implementation related: Context is compatible w/ ES3. Not a cache key. See {@link #isGLES3Compatible()}, {@link #getAvailableContextProperties(AbstractGraphicsDevice, GLProfile)}. */
protected static final int CTX_IMPL_ES3_COMPAT = 1 << 10;
-
- /**
+
+ /**
* Context supports basic FBO, details see {@link #hasBasicFBOSupport()}.
* Not a cache key.
* @see #hasBasicFBOSupport()
@@ -188,15 +188,15 @@ public abstract class GLContext {
*/
protected static final int CTX_IMPL_FBO = 1 << 11;
- /**
- * Context supports OES_single_precision, fp32, fixed function point (FFP) compatibility entry points,
+ /**
+ * Context supports OES_single_precision, fp32, fixed function point (FFP) compatibility entry points,
* see {@link #hasFP32CompatAPI()}.
* Not a cache key.
* @see #hasFP32CompatAPI()
* @see #getAvailableContextProperties(AbstractGraphicsDevice, GLProfile)
*/
protected static final int CTX_IMPL_FP32_COMPAT_API = 1 << 12;
-
+
private static final ThreadLocal currentContext = new ThreadLocal();
private final HashMap attachedObjects = new HashMap();
@@ -219,9 +219,9 @@ public abstract class GLContext {
private int currentSwapInterval;
protected GLRendererQuirks glRendererQuirks;
- /** Did the drawable association changed ? see {@link GLRendererQuirks#NoSetSwapIntervalPostRetarget} */
- protected boolean drawableRetargeted;
-
+ /** Did the drawable association changed ? see {@link GLRendererQuirks#NoSetSwapIntervalPostRetarget} */
+ protected boolean drawableRetargeted;
+
/**
* @param isInit true if called for class initialization, otherwise false (re-init or destruction).
*/
@@ -242,12 +242,12 @@ public abstract class GLContext {
drawableRetargeted = false;
}
- /**
+ /**
* Returns the instance of {@link GLRendererQuirks}, allowing one to determine workarounds.
* @return instance of {@link GLRendererQuirks} if context was made current once, otherwise null.
*/
public final GLRendererQuirks getRendererQuirks() { return glRendererQuirks; }
-
+
/**
* Returns true if the quirk exist in {@link #getRendererQuirks()}, otherwise false.
*
@@ -260,10 +260,10 @@ public abstract class GLContext {
* @param quirk the quirk to be tested, e.g. {@link GLRendererQuirks#NoDoubleBufferedPBuffer}.
* @throws IllegalArgumentException if the quirk is out of range
*/
- public final boolean hasRendererQuirk(int quirk) throws IllegalArgumentException {
- return null != glRendererQuirks ? glRendererQuirks.exist(quirk) : false ;
+ public final boolean hasRendererQuirk(int quirk) throws IllegalArgumentException {
+ return null != glRendererQuirks ? glRendererQuirks.exist(quirk) : false ;
}
-
+
/**
* Sets the read/write drawable for framebuffer operations.
*
@@ -276,13 +276,13 @@ public abstract class GLContext {
* attempts to make this context current. Otherwise a race condition may happen.
*
* @param readWrite The read/write drawable for framebuffer operations, maybe null to remove association.
- * @param setWriteOnly Only change the write-drawable, if setWriteOnly is true and
- * if the {@link #getGLReadDrawable() read-drawable} differs
- * from the {@link #getGLDrawable() write-drawable}.
+ * @param setWriteOnly Only change the write-drawable, if setWriteOnly is true and
+ * if the {@link #getGLReadDrawable() read-drawable} differs
+ * from the {@link #getGLDrawable() write-drawable}.
* Otherwise set both drawables, read and write.
* @return The previous read/write drawable
*
- * @throws GLException in case null is being passed or
+ * @throws GLException in case null is being passed or
* this context is made current on another thread.
*
* @see #isGLReadDrawableAvailable()
@@ -292,13 +292,13 @@ public abstract class GLContext {
* @see #getGLDrawable()
*/
public abstract GLDrawable setGLDrawable(GLDrawable readWrite, boolean setWriteOnly);
-
+
/**
* Returns the write-drawable this context uses for framebuffer operations.
*
* If the read-drawable has not been changed manually via {@link #setGLReadDrawable(GLDrawable)},
* it equals to the write-drawable (default).
- *
+ *
* @see #setGLDrawable(GLDrawable, boolean)
* @see #setGLReadDrawable(GLDrawable)
*/
@@ -336,10 +336,10 @@ public abstract class GLContext {
*
* If the read-drawable has not been changed manually via {@link #setGLReadDrawable(GLDrawable)},
* it equals to the write-drawable (default).
- *
* A return value of {@link #CONTEXT_CURRENT_NEW}
- * indicates that that context has been made current for the 1st time,
+ * indicates that that context has been made current for the 1st time,
* or that the state of the underlying context or drawable has
- * changed since the last time this context was current.
+ * changed since the last time this context was current.
* In this case, the application may wish to initialize the render state.
*
*
@@ -378,7 +378,7 @@ public abstract class GLContext {
*
*
* @return
- *
{@link #CONTEXT_CURRENT_NEW} if the context was successfully made current the 1st time,
+ *
{@link #CONTEXT_CURRENT_NEW} if the context was successfully made current the 1st time,
*
{@link #CONTEXT_CURRENT} if the context was successfully made current,
*
{@link #CONTEXT_NOT_CURRENT} if the context could not be made current.
*
@@ -514,7 +514,7 @@ public abstract class GLContext {
public abstract void destroy();
/**
- * Returns the implementing root GL instance of this GLContext's GL object,
+ * Returns the implementing root GL instance of this GLContext's GL object,
* considering a wrapped pipelined hierarchy, see {@link GLBase#getDownstreamGL()}.
* @throws GLException if the root instance is not a GL implementation
* @see GLBase#getRootGL()
@@ -523,7 +523,7 @@ public abstract class GLContext {
* @see #setGL(GL)
*/
public abstract GL getRootGL();
-
+
/**
* Returns the GL pipeline object for this GLContext.
*
@@ -716,16 +716,16 @@ public abstract class GLContext {
}
/**
- * Returns this context OpenGL version.
- * @see #getGLSLVersionNumber()
+ * Returns this context OpenGL version.
+ * @see #getGLSLVersionNumber()
**/
public final VersionNumber getGLVersionNumber() { return ctxVersion; }
- /**
+ /**
* Returns the vendor's version, i.e. version number at the end of GL_VERSION not being the GL version.
*
- * In case no such version exists within GL_VERSION,
+ * In case no such version exists within GL_VERSION,
* the {@link VersionNumberString#zeroVersion zero version} instance is returned.
- *
+ *
*
* The vendor's version is usually the vendor's OpenGL driver version.
*
@@ -743,31 +743,31 @@ public abstract class GLContext {
* via {@link GL2ES2#GL_SHADING_LANGUAGE_VERSION} if ≥ ES2.0 or GL2.0,
* otherwise a static match is being utilized.
*
- * The context must have been current once,
- * otherwise the {@link VersionNumberString#zeroVersion zero version} instance is returned.
+ * The context must have been current once,
+ * otherwise the {@link VersionNumberString#zeroVersion zero version} instance is returned.
*
* Matching could also refer to the maximum GLSL version usable by this context
* since normal GL implementations are capable of using a lower GLSL version as well.
- * The latter is not true on OSX w/ a GL3 context.
+ * The latter is not true on OSX w/ a GL3 context.
*
- *
- * @return GLSL version number if context has been made current at least once,
+ *
+ * @return GLSL version number if context has been made current at least once,
* otherwise the {@link VersionNumberString#zeroVersion zero version} instance is returned.
- *
+ *
* @see #getGLVersionNumber()
*/
public final VersionNumber getGLSLVersionNumber() {
return ctxGLSLVersion;
}
-
+
/**
* Returns the GLSL version string as to be used in a shader program, including a terminating newline '\n',
* i.e. for desktop
@@ -794,10 +794,10 @@ public abstract class GLContext {
return "";
}
final int minor = ctxGLSLVersion.getMinor();
- final String esSuffix = isGLES() && ctxGLSLVersion.compareTo(Version300) >= 0 ? " es" : "";
+ final String esSuffix = isGLES() && ctxGLSLVersion.compareTo(Version300) >= 0 ? " es" : "";
return "#version " + ctxGLSLVersion.getMajor() + ( minor < 10 ? "0"+minor : minor ) + esSuffix + "\n" ;
}
-
+
protected static final VersionNumber getStaticGLSLVersionNumber(int glMajorVersion, int glMinorVersion, int ctxOptions) {
if( 0 != ( CTX_PROFILE_ES & ctxOptions ) ) {
if( 3 > glMajorVersion ) {
@@ -814,13 +814,13 @@ public abstract class GLContext {
switch ( glMinorVersion ) {
case 0: return Version130; // GL 3.0 -> GLSL 1.30
case 1: return Version140; // GL 3.1 -> GLSL 1.40
- default: return Version150; // GL 3.2 -> GLSL 1.50
+ default: return Version150; // GL 3.2 -> GLSL 1.50
}
}
// The new default: GL >= 3.3, ES >= 3.0
return new VersionNumber(glMajorVersion, glMinorVersion * 10, 0); // GL M.N -> GLSL M.N
}
-
+
/**
* @return true if this context is an ES2 context or implements
* the extension GL_ARB_ES3_compatibility or GL_ARB_ES2_compatibility, otherwise false
@@ -840,18 +840,18 @@ public abstract class GLContext {
return 0 != ( ctxOptions & CTX_IMPL_ES3_COMPAT ) ;
}
- /**
+ /**
* @return true if impl. is a hardware rasterizer, otherwise false.
* @see #isHardwareRasterizer(AbstractGraphicsDevice, GLProfile)
- * @see GLProfile#isHardwareRasterizer()
+ * @see GLProfile#isHardwareRasterizer()
*/
public final boolean isHardwareRasterizer() {
return 0 == ( ctxOptions & CTX_IMPL_ACCEL_SOFT ) ;
}
-
+
/**
* @return true if context supports GLSL, i.e. is either {@link #isGLES2()}, {@link #isGL3()} or {@link #isGL2()} and major-version > 1.
- * @see GLProfile#hasGLSL()
+ * @see GLProfile#hasGLSL()
*/
public final boolean hasGLSL() {
return isGLES2() ||
@@ -859,7 +859,7 @@ public abstract class GLContext {
isGL2() && ctxVersion.getMajor()>1 ;
}
- /**
+ /**
* Returns true if basic FBO support is available, otherwise false.
*
* Basic FBO is supported if the context is either GL-ES >= 2.0, GL >= core 3.0 or implements the extensions
@@ -875,30 +875,30 @@ public abstract class GLContext {
return 0 != ( ctxOptions & CTX_IMPL_FBO ) ;
}
- /**
- * Returns true if OES_single_precision, fp32, fixed function point (FFP) compatibility entry points available,
+ /**
+ * Returns true if OES_single_precision, fp32, fixed function point (FFP) compatibility entry points available,
* otherwise false.
* @see #CTX_IMPL_FP32_COMPAT_API
*/
public final boolean hasFP32CompatAPI() {
return 0 != ( ctxOptions & CTX_IMPL_FP32_COMPAT_API ) ;
}
-
- /**
+
+ /**
* Returns true if full FBO support is available, otherwise false.
*
* Full FBO is supported if the context is either GL >= core 3.0 or implements the extensions
* ARB_framebuffer_object, or all of
- * EXT_framebuffer_object, EXT_framebuffer_multisample,
+ * EXT_framebuffer_object, EXT_framebuffer_multisample,
* EXT_framebuffer_blit, GL_EXT_packed_depth_stencil.
*
*
* Full FBO support includes multiple color attachments and multisampling.
*
*/
- public final boolean hasFullFBOSupport() {
+ public final boolean hasFullFBOSupport() {
return hasBasicFBOSupport() && !hasRendererQuirk(GLRendererQuirks.NoFullFBOSupport) &&
- ( isGL3() || // GL >= 3.0
+ ( isGL3() || // GL >= 3.0
isExtensionAvailable(GLExtensions.ARB_framebuffer_object) || // ARB_framebuffer_object
( isExtensionAvailable(GLExtensions.EXT_framebuffer_object) && // All EXT_framebuffer_object*
isExtensionAvailable(GLExtensions.EXT_framebuffer_multisample) &&
@@ -907,10 +907,10 @@ public abstract class GLContext {
)
) ;
}
-
+
/**
* Returns the maximum number of FBO RENDERBUFFER samples
- * if {@link #hasFullFBOSupport() full FBO is supported}, otherwise false.
+ * if {@link #hasFullFBOSupport() full FBO is supported}, otherwise false.
*/
public final int getMaxRenderbufferSamples() {
if( hasFullFBOSupport() ) {
@@ -928,7 +928,7 @@ public abstract class GLContext {
}
return 0;
}
-
+
/** Note: The GL impl. may return a const value, ie {@link GLES2#isNPOTTextureAvailable()} always returns true. */
public boolean isNPOTTextureAvailable() {
return isGL3() || isGLES2Compatible() || isExtensionAvailable(GLExtensions.ARB_texture_non_power_of_two);
@@ -940,9 +940,9 @@ public abstract class GLContext {
isExtensionAvailable(GLExtensions.IMG_texture_format_BGRA8888) ;
}
- /**
+ /**
* Indicates whether this GLContext is capable of GL4bc.
Includes [ GL4bc ].
- * @see GLProfile#isGL4bc()
+ * @see GLProfile#isGL4bc()
*/
public final boolean isGL4bc() {
return 0 != (ctxOptions & CTX_IS_ARB_CREATED) &&
@@ -950,9 +950,9 @@ public abstract class GLContext {
ctxVersion.getMajor() >= 4;
}
- /**
+ /**
* Indicates whether this GLContext is capable of GL4.
Includes [ GL4bc, GL4 ].
- * @see GLProfile#isGL4()
+ * @see GLProfile#isGL4()
*/
public final boolean isGL4() {
return 0 != (ctxOptions & CTX_IS_ARB_CREATED) &&
@@ -960,7 +960,7 @@ public abstract class GLContext {
ctxVersion.getMajor() >= 4;
}
- /**
+ /**
* Indicates whether this GLContext uses a GL4 core profile.
Includes [ GL4 ].
*/
public final boolean isGL4core() {
@@ -968,10 +968,10 @@ public abstract class GLContext {
0 != ( ctxOptions & CTX_PROFILE_CORE ) &&
ctxVersion.getMajor() >= 4;
}
-
- /**
+
+ /**
* Indicates whether this GLContext is capable of GL3bc.
Includes [ GL4bc, GL3bc ].
- * @see GLProfile#isGL3bc()
+ * @see GLProfile#isGL3bc()
*/
public final boolean isGL3bc() {
return 0 != (ctxOptions & CTX_IS_ARB_CREATED) &&
@@ -979,17 +979,17 @@ public abstract class GLContext {
ctxVersion.compareTo(Version310) >= 0 ;
}
- /**
+ /**
* Indicates whether this GLContext is capable of GL3.
*/
public final boolean isGL3core() {
@@ -997,8 +997,8 @@ public abstract class GLContext {
0 != ( ctxOptions & CTX_PROFILE_CORE ) &&
ctxVersion.compareTo(Version310) >= 0;
}
-
- /**
+
+ /**
* Indicates whether this GLContext uses a GL core profile.
Includes [ GL4, GL3, GLES3, GLES2 ].
*/
public final boolean isGLcore() {
@@ -1008,26 +1008,26 @@ public abstract class GLContext {
ctxVersion.compareTo(Version310) >= 0
) ;
}
-
+
/**
* Indicates whether this GLContext allows CPU data sourcing (indices, vertices ..) as opposed to using a GPU buffer source (VBO),
- * e.g. {@link GL2#glDrawElements(int, int, int, java.nio.Buffer)}.
+ * e.g. {@link GL2#glDrawElements(int, int, int, java.nio.Buffer)}.
*
See Bug 852 - https://jogamp.org/bugzilla/show_bug.cgi?id=852
*/
public final boolean isCPUDataSourcingAvail() {
return isGL2ES1() || isGLES2();
}
-
- /**
- * Indicates whether this GLContext's native profile does not implement a default vertex array object (VAO),
+
+ /**
+ * Indicates whether this GLContext's native profile does not implement a default vertex array object (VAO),
* starting w/ OpenGL 3.1 core and GLES3.
*
Includes [ GL4, GL3, GLES3 ].
*
Due to GL 3.1 core spec: E.1. DEPRECATED AND REMOVED FEATURES (p 296),
GL 3.2 core spec: E.2. DEPRECATED AND REMOVED FEATURES (p 331)
there is no more default VAO buffer 0 bound, hence generating and binding one
- to avoid INVALID_OPERATION at VertexAttribPointer.
+ to avoid INVALID_OPERATION at VertexAttribPointer.
More clear is GL 4.3 core spec: 10.4 (p 307).
*
*
@@ -1047,87 +1047,87 @@ public abstract class GLContext {
ctxVersion.compareTo(Version310) >= 0
) ;
}
-
+
/**
* If this GLContext does not implement a default VAO, see {@link #hasNoDefaultVAO()},
* an own default VAO will be created and bound at context creation.
*
* If this GLContext does implement a default VAO, i.e. {@link #hasNoDefaultVAO()}
* returns false, this method returns 0.
- *
+ *
*
* Otherwise this method returns the VAO object name
- * representing this GLContext's own default VAO.
- *
+ * representing this GLContext's own default VAO.
+ *
* @see #hasNoDefaultVAO()
*/
public abstract int getDefaultVAO();
- /**
+ /**
* Indicates whether this GLContext is capable of GL2.
Includes [ GL4bc, GL3bc, GL2 ].
- * @see GLProfile#isGL2()
+ * @see GLProfile#isGL2()
*/
public final boolean isGL2() {
return 0 != ( ctxOptions & CTX_PROFILE_COMPAT ) && ctxVersion.getMajor()>=1 ;
}
- /**
+ /**
* Indicates whether this GLContext is capable of GL2GL3.
Includes [ GL4bc, GL4, GL3bc, GL3, GL2, GL2GL3 ].
- * @see GLProfile#isGL2GL3()
- */
+ * @see GLProfile#isGL2GL3()
+ */
public final boolean isGL2GL3() {
return isGL2() || isGL3();
}
- /**
+ /**
* Indicates whether this GLContext is capable of GLES1.
Includes [ GLES1 ].
- * @see GLProfile#isGLES1()
+ * @see GLProfile#isGLES1()
*/
public final boolean isGLES1() {
return 0 != ( ctxOptions & CTX_PROFILE_ES ) && ctxVersion.getMajor() == 1 ;
}
/**
- * Indicates whether this GLContext is capable of GLES2.
Includes [ GLES2 ].
- * @see GLProfile#isGLES2()
+ * Indicates whether this GLContext is capable of GLES2.
Includes [ GLES2 ].
+ * @see GLProfile#isGLES2()
*/
public final boolean isGLES2() {
return 0 != ( ctxOptions & CTX_PROFILE_ES ) && ctxVersion.getMajor() == 2 ;
}
- /**
+ /**
* Indicates whether this GLContext is capable of GLES3.
Includes [ GLES3 ].
- * @see GLProfile#isGLES3()
+ * @see GLProfile#isGLES3()
*/
public final boolean isGLES3() {
return 0 != ( ctxOptions & CTX_PROFILE_ES ) && ctxVersion.getMajor() >= 3 ;
}
- /**
+ /**
* Indicates whether this GLContext is capable of GLES.
Includes [ GLES3, GLES1, GLES2 ].
- * @see GLProfile#isGLES()
+ * @see GLProfile#isGLES()
*/
public final boolean isGLES() {
return 0 != ( CTX_PROFILE_ES & ctxOptions ) ;
}
- /**
+ /**
* Indicates whether this GLContext is capable of GL2ES1.
Includes [ GL4bc, GL3bc, GL2, GLES1, GL2ES1 ].
- * @see GLProfile#isGL2ES1()
+ * @see GLProfile#isGL2ES1()
*/
public final boolean isGL2ES1() {
return isGLES1() || isGL2();
}
- /**
+ /**
* Indicates whether this GLContext is capable of GL2ES2.
* @see GLProfile#isGL2ES3()
* @see #isGL3ES3()
@@ -1137,16 +1137,16 @@ public abstract class GLContext {
return isGL3ES3() || isGL2GL3();
}
- /**
+ /**
* Indicates whether this GLContext is capable of GL3ES3.
Includes [ GL4bc, GL4, GL3bc, GL3, GLES3 ].
- * @see GLProfile#isGL3ES3()
+ * @see GLProfile#isGL3ES3()
*/
public final boolean isGL3ES3() {
return isGL4ES3() || isGL3();
}
- /**
- * Returns true if this profile is capable of GL4ES3, i.e. if {@link #isGLES3Compatible()} returns true.
+ /**
+ * Returns true if this profile is capable of GL4ES3, i.e. if {@link #isGLES3Compatible()} returns true.
*
Includes [ GL ≥ 4.3, GL ≥ 3.1 w/ GL_ARB_ES3_compatibility and GLES3 ]
* @see GLProfile#isGL4ES3()
*/
@@ -1185,7 +1185,7 @@ public abstract class GLContext {
*
*
* For a valid context the default value is 1
- * in case of an EGL based profile (ES1 or ES2) and -1
+ * in case of an EGL based profile (ES1 or ES2) and -1
* (undefined) for desktop.
*
*/
@@ -1222,51 +1222,51 @@ public abstract class GLContext {
}
protected boolean bindSwapBarrierImpl(int group, int barrier) { /** nop per default .. **/ return false; }
- /**
- * Return the framebuffer name bound to this context,
+ /**
+ * Return the framebuffer name bound to this context,
* see {@link GL#glBindFramebuffer(int, int)}.
*/
public abstract int getBoundFramebuffer(int target);
-
- /**
+
+ /**
* Return the default draw framebuffer name.
- *
+ *
* May differ from it's default zero
* in case an framebuffer object ({@link com.jogamp.opengl.FBObject}) based drawable
* is being used.
- *
+ *
*/
public abstract int getDefaultDrawFramebuffer();
-
- /**
+
+ /**
* Return the default read framebuffer name.
- *
+ *
* May differ from it's default zero
* in case an framebuffer object ({@link com.jogamp.opengl.FBObject}) based drawable
* is being used.
- *
+ *
*/
public abstract int getDefaultReadFramebuffer();
-
- /**
- * Returns the default color buffer within the current bound
- * {@link #getDefaultReadFramebuffer()}, i.e. GL_READ_FRAMEBUFFER​,
- * which will be used as the source for pixel reading commands,
+
+ /**
+ * Returns the default color buffer within the current bound
+ * {@link #getDefaultReadFramebuffer()}, i.e. GL_READ_FRAMEBUFFER​,
+ * which will be used as the source for pixel reading commands,
* like {@link GL#glReadPixels(int, int, int, int, int, int, java.nio.Buffer)} etc.
*
* For offscreen framebuffer objects this is {@link GL#GL_COLOR_ATTACHMENT0},
- * otherwise this is {@link GL#GL_FRONT} for single buffer configurations
+ * otherwise this is {@link GL#GL_FRONT} for single buffer configurations
* and {@link GL#GL_BACK} for double buffer configurations.
- *
+ *
*/
public abstract int getDefaultReadBuffer();
-
+
/** Get the default pixel data type, as required by e.g. {@link GL#glReadPixels(int, int, int, int, int, int, java.nio.Buffer)}. */
public abstract int getDefaultPixelDataType();
-
+
/** Get the default pixel data format, as required by e.g. {@link GL#glReadPixels(int, int, int, int, int, int, java.nio.Buffer)}. */
public abstract int getDefaultPixelDataFormat();
-
+
/**
* @return The extension implementing the GLDebugOutput feature,
* either {@link GLExtensions#ARB_debug_output} or {@link GLExtensions#AMD_debug_output}.
@@ -1486,13 +1486,13 @@ public abstract class GLContext {
}
if (DEBUG) {
System.err.println(getThreadName() + ": createContextARB: SET mappedVersionsAvailableSet "+devKey);
- System.err.println(GLContext.dumpAvailableGLVersions(null).toString());
+ System.err.println(GLContext.dumpAvailableGLVersions(null).toString());
}
}
}
- /**
- * Returns a unique String object using {@link String#intern()} for the given arguments,
+ /**
+ * Returns a unique String object using {@link String#intern()} for the given arguments,
* which object reference itself can be used as a key.
*/
protected static String getDeviceVersionAvailableKey(AbstractGraphicsDevice device, int major, int profile) {
@@ -1575,7 +1575,7 @@ public abstract class GLContext {
}
return val;
}
-
+
/**
* @param reqMajor Key Value either 1, 2, 3 or 4
* @param reqProfile Key Value either {@link #CTX_PROFILE_COMPAT}, {@link #CTX_PROFILE_CORE} or {@link #CTX_PROFILE_ES}
@@ -1647,7 +1647,7 @@ public abstract class GLContext {
reqMajorCTP[1]=CTX_PROFILE_CORE;
}
}
-
+
/**
* @param device the device the context profile is being requested for
* @param GLProfile the GLProfile the context profile is being requested for
@@ -1656,7 +1656,7 @@ public abstract class GLContext {
protected static final int getAvailableContextProperties(final AbstractGraphicsDevice device, final GLProfile glp) {
final int[] reqMajorCTP = new int[] { 0, 0 };
getRequestMajorAndCompat(glp, reqMajorCTP);
-
+
int _major[] = { 0 };
int _minor[] = { 0 };
int _ctp[] = { 0 };
@@ -1702,7 +1702,7 @@ public abstract class GLContext {
* Returns true if it is possible to create an framebuffer object (FBO).
*
* FBO feature is implemented in OpenGL, hence it is {@link GLProfile} dependent.
- *
+ *
*
* FBO support is queried as described in {@link #hasBasicFBOSupport()}.
*
@@ -1714,16 +1714,16 @@ public abstract class GLContext {
public static final boolean isFBOAvailable(AbstractGraphicsDevice device, GLProfile glp) {
return 0 != ( CTX_IMPL_FBO & getAvailableContextProperties(device, glp) );
}
-
+
/**
- * @return 1 if using a hardware rasterizer, 0 if using a software rasterizer and -1 if not determined yet.
+ * @return 1 if using a hardware rasterizer, 0 if using a software rasterizer and -1 if not determined yet.
* @see GLContext#isHardwareRasterizer()
- * @see GLProfile#isHardwareRasterizer()
+ * @see GLProfile#isHardwareRasterizer()
*/
public static final int isHardwareRasterizer(AbstractGraphicsDevice device, GLProfile glp) {
final int r;
final int ctp = getAvailableContextProperties(device, glp);
- if(0 == ctp) {
+ if(0 == ctp) {
r = -1;
} else if( 0 == ( CTX_IMPL_ACCEL_SOFT & ctp ) ) {
r = 1;
@@ -1732,7 +1732,7 @@ public abstract class GLContext {
}
return r;
}
-
+
/**
* @param device the device to request whether the profile is available for
* @param reqMajor Key Value either 1, 2, 3 or 4
@@ -1774,7 +1774,7 @@ public abstract class GLContext {
int minor[] = { 0 };
int ctp[] = { 0 };
boolean ok;
-
+
ok = GLContext.getAvailableGLVersion(device, 3, GLContext.CTX_PROFILE_ES, major, minor, ctp);
if( !ok ) {
ok = GLContext.getAvailableGLVersion(device, 3, GLContext.CTX_PROFILE_CORE, major, minor, ctp);
@@ -1784,7 +1784,7 @@ public abstract class GLContext {
}
return 0 != ( ctp[0] & CTX_IMPL_ES3_COMPAT );
}
-
+
public static boolean isGL4bcAvailable(AbstractGraphicsDevice device, boolean isHardware[]) {
return isGLVersionAvailable(device, 4, CTX_PROFILE_COMPAT, isHardware);
}
@@ -1859,6 +1859,6 @@ public abstract class GLContext {
}
protected static String getThreadName() { return Thread.currentThread().getName(); }
-
+
}
diff --git a/src/jogl/classes/javax/media/opengl/GLDebugListener.java b/src/jogl/classes/javax/media/opengl/GLDebugListener.java
index 8887d022a..ec7f7cec1 100644
--- a/src/jogl/classes/javax/media/opengl/GLDebugListener.java
+++ b/src/jogl/classes/javax/media/opengl/GLDebugListener.java
@@ -29,16 +29,16 @@ package javax.media.opengl;
/**
* Listener for {@link GLDebugMessage}s.
- *
+ *
*
One can enable GLDebugOutput via {@link GLContext#enableGLDebugMessage(boolean)}
* and add listeners via {@link GLContext#addGLDebugListener(GLDebugListener)}.
*/
public interface GLDebugListener {
- /**
+ /**
* Handle {@link GLDebugMessage} message sent from native GL implementation.
- *
+ *
*
Since this method is invoked directly by the GL implementation, it shall
* return as fast as possible.
*/
- void messageSent(GLDebugMessage event);
+ void messageSent(GLDebugMessage event);
}
diff --git a/src/jogl/classes/javax/media/opengl/GLDebugMessage.java b/src/jogl/classes/javax/media/opengl/GLDebugMessage.java
index 4b8d62898..1032cf929 100644
--- a/src/jogl/classes/javax/media/opengl/GLDebugMessage.java
+++ b/src/jogl/classes/javax/media/opengl/GLDebugMessage.java
@@ -30,18 +30,18 @@ package javax.media.opengl;
import com.jogamp.common.os.Platform;
/**
- * OpenGL debug message generated by the driver
+ * OpenGL debug message generated by the driver
* and delivered via {@link GLDebugListener}.
*/
public class GLDebugMessage {
final GLContext source;
- final long when;
+ final long when;
final int dbgSource;
final int dbgType;
final int dbgId;
final int dbgSeverity;
final String dbgMsg;
-
+
/**
* @param source The source of the event
* @param when The time of the event
@@ -60,9 +60,9 @@ public class GLDebugMessage {
this.dbgSeverity = dbgSeverity;
this.dbgMsg = dbgMsg;
}
-
+
/**
- *
+ *
* @param source
* @param when
* @param dbgId
@@ -73,88 +73,88 @@ public class GLDebugMessage {
*/
public static GLDebugMessage translateAMDEvent(GLContext source, long when, int dbgId, int amdDbgCategory, int dbgSeverity, String dbgMsg) {
int dbgSource, dbgType;
-
+
// AMD category == ARB source/type
switch(amdDbgCategory) {
- case GL2GL3.GL_DEBUG_CATEGORY_API_ERROR_AMD:
+ case GL2GL3.GL_DEBUG_CATEGORY_API_ERROR_AMD:
dbgSource = GL2GL3.GL_DEBUG_SOURCE_API;
- dbgType = GL2GL3.GL_DEBUG_TYPE_ERROR;
+ dbgType = GL2GL3.GL_DEBUG_TYPE_ERROR;
break;
//
// def source / other type
//
-
- case GL2GL3.GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD:
+
+ case GL2GL3.GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD:
dbgSource = GL2GL3.GL_DEBUG_SOURCE_WINDOW_SYSTEM;
- dbgType = GL2GL3.GL_DEBUG_TYPE_OTHER;
+ dbgType = GL2GL3.GL_DEBUG_TYPE_OTHER;
break;
-
+
case GL2GL3.GL_DEBUG_CATEGORY_SHADER_COMPILER_AMD:
dbgSource = GL2GL3.GL_DEBUG_SOURCE_SHADER_COMPILER;
- dbgType = GL2GL3.GL_DEBUG_TYPE_OTHER;
+ dbgType = GL2GL3.GL_DEBUG_TYPE_OTHER;
break;
-
+
case GL2GL3.GL_DEBUG_CATEGORY_APPLICATION_AMD:
dbgSource = GL2GL3.GL_DEBUG_SOURCE_APPLICATION;
dbgType = GL2GL3.GL_DEBUG_TYPE_OTHER;
break;
-
-
+
+
//
// other source / def type
//
-
+
case GL2GL3.GL_DEBUG_CATEGORY_DEPRECATION_AMD:
dbgSource = GL2GL3.GL_DEBUG_SOURCE_OTHER;
- dbgType = GL2GL3.GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR;
+ dbgType = GL2GL3.GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR;
break;
-
+
case GL2GL3.GL_DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD:
dbgSource = GL2GL3.GL_DEBUG_SOURCE_OTHER;
- dbgType = GL2GL3.GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR;
+ dbgType = GL2GL3.GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR;
break;
-
+
case GL2GL3.GL_DEBUG_CATEGORY_PERFORMANCE_AMD:
dbgSource = GL2GL3.GL_DEBUG_SOURCE_OTHER;
- dbgType = GL2GL3.GL_DEBUG_TYPE_PERFORMANCE;
+ dbgType = GL2GL3.GL_DEBUG_TYPE_PERFORMANCE;
break;
-
- case GL2GL3.GL_DEBUG_CATEGORY_OTHER_AMD:
+
+ case GL2GL3.GL_DEBUG_CATEGORY_OTHER_AMD:
default:
dbgSource = GL2GL3.GL_DEBUG_SOURCE_OTHER;
dbgType = GL2GL3.GL_DEBUG_TYPE_OTHER;
}
-
- return new GLDebugMessage(source, when, dbgSource, dbgType, dbgId, dbgSeverity, dbgMsg);
+
+ return new GLDebugMessage(source, when, dbgSource, dbgType, dbgId, dbgSeverity, dbgMsg);
}
public static int translateARB2AMDCategory(int dbgSource, int dbgType) {
switch (dbgSource) {
case GL2GL3.GL_DEBUG_SOURCE_WINDOW_SYSTEM:
- return GL2GL3.GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD;
-
+ return GL2GL3.GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD;
+
case GL2GL3.GL_DEBUG_SOURCE_SHADER_COMPILER:
return GL2GL3.GL_DEBUG_CATEGORY_SHADER_COMPILER_AMD;
-
+
case GL2GL3.GL_DEBUG_SOURCE_APPLICATION:
return GL2GL3.GL_DEBUG_CATEGORY_APPLICATION_AMD;
}
-
+
switch(dbgType) {
case GL2GL3.GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR:
return GL2GL3.GL_DEBUG_CATEGORY_DEPRECATION_AMD;
-
+
case GL2GL3.GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR:
return GL2GL3.GL_DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD;
-
- case GL2GL3.GL_DEBUG_TYPE_PERFORMANCE:
+
+ case GL2GL3.GL_DEBUG_TYPE_PERFORMANCE:
return GL2GL3.GL_DEBUG_CATEGORY_PERFORMANCE_AMD;
}
-
- return GL2GL3.GL_DEBUG_CATEGORY_OTHER_AMD;
+
+ return GL2GL3.GL_DEBUG_CATEGORY_OTHER_AMD;
}
-
+
public GLContext getSource() {
return source;
}
@@ -162,7 +162,7 @@ public class GLDebugMessage {
public long getWhen() {
return when;
}
-
+
public int getDbgSource() {
return dbgSource;
}
@@ -182,14 +182,14 @@ public class GLDebugMessage {
public String getDbgMsg() {
return dbgMsg;
}
-
+
public StringBuilder toString(StringBuilder sb) {
- final String crtab = Platform.getNewline()+"\t";
+ final String crtab = Platform.getNewline()+"\t";
if(null==sb) {
sb = new StringBuilder();
- }
+ }
sb.append("GLDebugEvent[ id ");
- toHexString(sb, dbgId)
+ toHexString(sb, dbgId)
.append(crtab).append("type ").append(getDbgTypeString(dbgType))
.append(crtab).append("severity ").append(getDbgSeverityString(dbgSeverity))
.append(crtab).append("source ").append(getDbgSourceString(dbgSource))
@@ -199,46 +199,46 @@ public class GLDebugMessage {
sb.append(crtab).append("source ").append(source.getGLVersion()).append(" - hash 0x").append(Integer.toHexString(source.hashCode()));
}
sb.append("]");
- return sb;
+ return sb;
}
public String toString() {
return toString(null).toString();
}
-
+
public static String getDbgSourceString(int dbgSource) {
switch(dbgSource) {
case GL2GL3.GL_DEBUG_SOURCE_API: return "GL API";
- case GL2GL3.GL_DEBUG_SOURCE_SHADER_COMPILER: return "GLSL or extension compiler";
- case GL2GL3.GL_DEBUG_SOURCE_WINDOW_SYSTEM: return "Native Windowing binding";
+ case GL2GL3.GL_DEBUG_SOURCE_SHADER_COMPILER: return "GLSL or extension compiler";
+ case GL2GL3.GL_DEBUG_SOURCE_WINDOW_SYSTEM: return "Native Windowing binding";
case GL2GL3.GL_DEBUG_SOURCE_THIRD_PARTY: return "Third party";
case GL2GL3.GL_DEBUG_SOURCE_APPLICATION: return "Application";
case GL2GL3.GL_DEBUG_SOURCE_OTHER: return "generic";
default: return "Unknown (" + toHexString(dbgSource) + ")";
}
}
-
+
public static String getDbgTypeString(int dbgType) {
switch(dbgType) {
case GL2GL3.GL_DEBUG_TYPE_ERROR: return "Error";
- case GL2GL3.GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR: return "Warning: marked for deprecation";
+ case GL2GL3.GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR: return "Warning: marked for deprecation";
case GL2GL3.GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR: return "Warning: undefined behavior";
- case GL2GL3.GL_DEBUG_TYPE_PERFORMANCE: return "Warning: implementation dependent performance";
- case GL2GL3.GL_DEBUG_TYPE_PORTABILITY: return "Warning: vendor-specific extension use";
- case GL2GL3.GL_DEBUG_TYPE_OTHER: return "Warning: generic";
+ case GL2GL3.GL_DEBUG_TYPE_PERFORMANCE: return "Warning: implementation dependent performance";
+ case GL2GL3.GL_DEBUG_TYPE_PORTABILITY: return "Warning: vendor-specific extension use";
+ case GL2GL3.GL_DEBUG_TYPE_OTHER: return "Warning: generic";
default: return "Unknown (" + toHexString(dbgType) + ")";
}
}
-
+
public static String getDbgSeverityString(int dbgSeverity) {
switch(dbgSeverity) {
- case GL2GL3.GL_DEBUG_SEVERITY_HIGH: return "High: dangerous undefined behavior";
- case GL2GL3.GL_DEBUG_SEVERITY_MEDIUM: return "Medium: Severe performance/deprecation/other warnings";
- case GL2GL3.GL_DEBUG_SEVERITY_LOW: return "Low: Performance warnings (redundancy/undefined)";
+ case GL2GL3.GL_DEBUG_SEVERITY_HIGH: return "High: dangerous undefined behavior";
+ case GL2GL3.GL_DEBUG_SEVERITY_MEDIUM: return "Medium: Severe performance/deprecation/other warnings";
+ case GL2GL3.GL_DEBUG_SEVERITY_LOW: return "Low: Performance warnings (redundancy/undefined)";
default: return "Unknown (" + toHexString(dbgSeverity) + ")";
}
}
-
+
public static StringBuilder toHexString(StringBuilder sb, int i) {
if(null==sb) {
sb = new StringBuilder();
@@ -247,6 +247,6 @@ public class GLDebugMessage {
}
public static String toHexString(int i) {
return "0x"+Integer.toHexString(i);
- }
-
+ }
+
}
diff --git a/src/jogl/classes/javax/media/opengl/GLDrawable.java b/src/jogl/classes/javax/media/opengl/GLDrawable.java
index 46fa923ad..5a032db29 100644
--- a/src/jogl/classes/javax/media/opengl/GLDrawable.java
+++ b/src/jogl/classes/javax/media/opengl/GLDrawable.java
@@ -73,13 +73,13 @@ public interface GLDrawable {
*
*
* End users do not need to call this method; it is not necessary to
- * call setRealized on a {@link GLAutoDrawable}
+ * call setRealized on a {@link GLAutoDrawable}
* as these perform the appropriate calls on their underlying GLDrawables internally.
*
*
* Developers implementing new OpenGL components for various window
* toolkits need to call this method against GLDrawables obtained
- * from the GLDrawableFactory via the
+ * from the GLDrawableFactory via the
* {@link GLDrawableFactory#createGLDrawable(NativeSurface)} method.
* It must typically be
* called with an argument of true when the component
@@ -89,7 +89,7 @@ public interface GLDrawable {
* the addNotify method and with an argument of
* false in the removeNotify method.
*
- *
+ *
* GLDrawable implementations should handle multiple
* cycles of setRealized(true) /
* setRealized(false) calls. Most, if not all, Java
@@ -104,7 +104,7 @@ public interface GLDrawable {
* associated resources as the component becomes realized and
* unrealized, respectively.
*
- *
+ *
* With an argument of true,
* the minimum implementation shall call
* {@link NativeSurface#lockSurface() NativeSurface's lockSurface()} and if successful:
@@ -117,7 +117,7 @@ public interface GLDrawable {
* ensures resolving the window/surface handles, and the drawable's {@link GLCapabilities}
* might have changed.
*
- *
+ *
* Calling this method has no other effects. For example, if
* removeNotify is called on a Canvas implementation
* for which a GLDrawable has been created, it is also necessary to
@@ -130,7 +130,7 @@ public interface GLDrawable {
*/
public void setRealized(boolean realized);
- /**
+ /**
* Returns true if this drawable is realized, otherwise true.
*
* A drawable can be realized and unrealized via {@link #setRealized(boolean)}.
@@ -146,19 +146,19 @@ public interface GLDrawable {
public int getHeight();
/**
- * Returns true if the drawable is rendered in
+ * Returns true if the drawable is rendered in
* OpenGL's coordinate system, origin at bottom left.
* Otherwise returns false, i.e. origin at top left.
*
* Default impl. is true, i.e. OpenGL coordinate system.
- *
+ *
*
* Currently only MS-Windows bitmap offscreen drawable uses a non OpenGL orientation and hence returns false.
* This removes the need of a vertical flip when used in AWT or Windows applications.
*
*/
public boolean isGLOriented();
-
+
/** Swaps the front and back buffers of this drawable. For {@link
GLAutoDrawable} implementations, when automatic buffer swapping
is enabled (as is the default), this method is called
@@ -191,11 +191,11 @@ public interface GLDrawable {
public NativeSurface getNativeSurface();
/**
- * Returns the GL drawable handle,
+ * Returns the GL drawable handle,
* guaranteed to be valid after {@link #setRealized(boolean) realization}
* and while it's {@link NativeSurface surface} is being {@link NativeSurface#lockSurface() locked}.
*
- * It is usually identical to the underlying windowing toolkit {@link NativeSurface surface}'s
+ * It is usually identical to the underlying windowing toolkit {@link NativeSurface surface}'s
* {@link javax.media.nativewindow.NativeSurface#getSurfaceHandle() handle}
* or an intermediate layer to suite GL, e.g. an EGL surface.
*
diff --git a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
index 7c3c42e45..e486e2bfd 100644
--- a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
+++ b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,11 +29,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -83,7 +83,7 @@ import jogamp.opengl.Debug;
during the first repaint of the {@link javax.media.opengl.awt.GLCanvas} or {@link
javax.media.opengl.awt.GLJPanel} if the capabilities can not be met.
{@link javax.media.opengl.GLPbuffer} are always
- created immediately and their creation will fail with a
+ created immediately and their creation will fail with a
{@link javax.media.opengl.GLException} if errors occur.
The concrete GLDrawableFactory subclass instantiated by {@link
@@ -94,21 +94,21 @@ import jogamp.opengl.Debug;
public abstract class GLDrawableFactory {
protected static final boolean DEBUG = Debug.debug("GLDrawable");
-
- /**
- * We have to disable support for ANGLE, the D3D ES2 emulation on Windows provided w/ Firefox and Chrome.
+
+ /**
+ * We have to disable support for ANGLE, the D3D ES2 emulation on Windows provided w/ Firefox and Chrome.
* When run in the mentioned browsers, the eglInitialize(..) implementation crashes.
*
* This can be overridden by explicitly enabling ANGLE on Windows by setting the property
* jogl.enable.ANGLE.
- *
+ *
*/
protected static final boolean enableANGLE = Debug.isPropertyDefined("jogl.enable.ANGLE", true);
- /**
+ /**
* In case no OpenGL ES implementation is required
* and if the running platform may have a buggy implementation,
- * setting the property jogl.disable.opengles disables querying a possible existing OpenGL ES implementation.
+ * setting the property jogl.disable.opengles disables querying a possible existing OpenGL ES implementation.
*/
protected static final boolean disableOpenGLES = Debug.isPropertyDefined("jogl.disable.opengles", true);
@@ -117,11 +117,11 @@ public abstract class GLDrawableFactory {
private static GLDrawableFactory nativeOSFactory;
private static ArrayList glDrawableFactories = new ArrayList();
-
+
/**
* Instantiate singleton factories if available, EGLES1, EGLES2 and the OS native ones.
*/
- public static final void initSingleton() {
+ public static final void initSingleton() {
if (!isInit) { // volatile: ok
synchronized (GLDrawableFactory.class) {
if (!isInit) {
@@ -130,7 +130,7 @@ public abstract class GLDrawableFactory {
}
}
}
- }
+ }
private static final void initSingletonImpl() {
NativeWindowFactory.initSingleton();
NativeWindowFactory.addCustomShutdownHook(false /* head */, new Runnable() {
@@ -138,7 +138,7 @@ public abstract class GLDrawableFactory {
shutdown0();
}
});
-
+
final String nwt = NativeWindowFactory.getNativeWindowType(true);
GLDrawableFactory tmp = null;
String factoryClassName = Debug.getProperty("jogl.gldrawablefactory.class.name", true);
@@ -163,7 +163,7 @@ public abstract class GLDrawableFactory {
}
try {
tmp = (GLDrawableFactory) ReflectionUtil.createInstance(factoryClassName, cl);
- } catch (Exception jre) {
+ } catch (Exception jre) {
if (DEBUG || GLProfile.DEBUG) {
System.err.println("Info: GLDrawableFactory.static - Native Platform: "+nwt+" - not available: "+factoryClassName);
jre.printStackTrace();
@@ -202,7 +202,7 @@ public abstract class GLDrawableFactory {
}
}
}
-
+
private static void shutdown0() {
// Following code will _always_ remain in shutdown hook
// due to special semantics of native utils, i.e. X11Utils.
@@ -228,22 +228,22 @@ public abstract class GLDrawableFactory {
}
}
glDrawableFactories.clear();
-
- // both were members of glDrawableFactories and are shutdown already
+
+ // both were members of glDrawableFactories and are shutdown already
nativeOSFactory = null;
eglFactory = null;
}
GLContext.shutdown();
}
-
+
protected GLDrawableFactory() {
synchronized(glDrawableFactories) {
glDrawableFactories.add(this);
}
}
-
+
protected static String getThreadName() { return Thread.currentThread().getName(); }
-
+
/** Returns true if this factory is complete, i.e. ready to be used. Otherwise return false. */
protected abstract boolean isComplete();
@@ -253,14 +253,14 @@ public abstract class GLDrawableFactory {
protected abstract void destroy();
public abstract void resetDisplayGamma();
-
+
/**
* Retrieve the default device {@link AbstractGraphicsDevice#getConnection() connection},
* {@link AbstractGraphicsDevice#getUnitID() unit ID} and {@link AbstractGraphicsDevice#getUniqueID() unique ID name}. for this factory
* The implementation must return a non null default device, which must not be opened, ie. it's native handle is null.
*
* This method shall return the default device if available
- * even if the GLDrawableFactory is not functional and hence not compatible.
+ * even if the GLDrawableFactory is not functional and hence not compatible.
* The latter situation may happen because no native OpenGL implementation is available for the specific implementation.
*
* @return the default shared device for this factory, eg. :0.0 on X11 desktop.
@@ -272,7 +272,7 @@ public abstract class GLDrawableFactory {
* @param device which {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be null for the platform's default device.
* @return true if the device is compatible with this factory, ie. if it can be used for GLDrawable creation. Otherwise false.
* This implies validation whether the implementation is functional.
- *
+ *
* @see #getDefaultDevice()
*/
public abstract boolean getIsDeviceCompatible(AbstractGraphicsDevice device);
@@ -287,8 +287,8 @@ public abstract class GLDrawableFactory {
System.err.println("Info: "+getClass().getSimpleName()+".validateDevice: using default device : "+device);
}
}
-
- // Always validate the device,
+
+ // Always validate the device,
// since even the default device may not be used by this factory.
if( !getIsDeviceCompatible(device) ) {
if (GLProfile.DEBUG) {
@@ -300,29 +300,29 @@ public abstract class GLDrawableFactory {
}
/**
- * Validate and start the shared resource runner thread if necessary and
+ * Validate and start the shared resource runner thread if necessary and
* if the implementation uses it.
- *
+ *
* @return the shared resource runner thread, if implementation uses it.
*/
protected abstract Thread getSharedResourceThread();
-
+
/**
* Create the shared resource used internally as a reference for capabilities etc.
*
- * Returns true if a shared resource could be created
+ * Returns true if a shared resource could be created
* for the device {@link AbstractGraphicsDevice#getConnection()}.
* This does not imply a shared resource is mapped (ie. made persistent), but is available in general .
*
*
* @param device which {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be null for the platform's default device.
- * @return true if a shared resource could been created, otherwise false.
+ * @return true if a shared resource could been created, otherwise false.
*/
protected final boolean createSharedResource(AbstractGraphicsDevice device) {
return createSharedResourceImpl(device);
- }
+ }
protected abstract boolean createSharedResourceImpl(AbstractGraphicsDevice device);
-
+
/**
* Returns true if the quirk exist in the shared resource's context {@link GLRendererQuirks}.
*
@@ -332,7 +332,7 @@ public abstract class GLDrawableFactory {
return null != glrq ? glrq.exist(quirk) : false;
*
*
- *
+ *
* @param device which {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be null for the platform's default device.
* @param quirk the quirk to be tested, e.g. {@link GLRendererQuirks#NoDoubleBufferedPBuffer}.
* @throws IllegalArgumentException if the quirk is out of range
@@ -343,7 +343,7 @@ public abstract class GLDrawableFactory {
final GLRendererQuirks glrq = getRendererQuirks(device);
return null != glrq ? glrq.exist(quirk) : false;
}
-
+
/**
* Returns the shared resource's context {@link GLRendererQuirks}.
*
@@ -358,12 +358,12 @@ public abstract class GLDrawableFactory {
* @see GLRendererQuirks
*/
public abstract GLRendererQuirks getRendererQuirks(AbstractGraphicsDevice device);
-
+
/**
* Returns the sole GLDrawableFactory instance for the desktop (X11, WGL, ..) if exist or null
*/
public static GLDrawableFactory getDesktopFactory() {
- GLProfile.initSingleton();
+ GLProfile.initSingleton();
return nativeOSFactory;
}
@@ -371,14 +371,14 @@ public abstract class GLDrawableFactory {
* Returns the sole GLDrawableFactory instance for EGL if exist or null
*/
public static GLDrawableFactory getEGLFactory() {
- GLProfile.initSingleton();
+ GLProfile.initSingleton();
return eglFactory;
}
- /**
- * Returns the sole GLDrawableFactory instance.
- *
- * @param glProfile GLProfile to determine the factory type, ie EGLDrawableFactory,
+ /**
+ * Returns the sole GLDrawableFactory instance.
+ *
+ * @param glProfile GLProfile to determine the factory type, ie EGLDrawableFactory,
* or one of the native GLDrawableFactory's, ie X11/GLX, Windows/WGL or MacOSX/CGL.
*/
public static GLDrawableFactory getFactory(GLProfile glProfile) throws GLException {
@@ -387,7 +387,7 @@ public abstract class GLDrawableFactory {
protected static GLDrawableFactory getFactoryImpl(String glProfileImplName) throws GLException {
if ( GLProfile.usesNativeGLES(glProfileImplName) ) {
- if(null!=eglFactory) {
+ if(null!=eglFactory) {
return eglFactory;
}
} else if(null!=nativeOSFactory) {
@@ -446,10 +446,10 @@ public abstract class GLDrawableFactory {
* and {@link #canCreateGLPbuffer(AbstractGraphicsDevice, GLProfile) canCreateGLPbuffer(device)} is true.
*
*
- * If not onscreen and neither FBO nor Pbuffer is available,
+ * If not onscreen and neither FBO nor Pbuffer is available,
* a simple pixmap/bitmap drawable/surface is created, which is unlikely to be hardware accelerated.
*
- *
+ *
* @throws IllegalArgumentException if the passed target is null
* @throws GLException if any window system-specific errors caused
* the creation of the GLDrawable to fail.
@@ -463,12 +463,12 @@ public abstract class GLDrawableFactory {
*/
public abstract GLDrawable createGLDrawable(NativeSurface target)
throws IllegalArgumentException, GLException;
-
+
/**
- * Creates a {@link GLDrawable#isRealized() realized} {@link GLOffscreenAutoDrawable}
+ * Creates a {@link GLDrawable#isRealized() realized} {@link GLOffscreenAutoDrawable}
* incl it's offscreen {@link javax.media.nativewindow.NativeSurface} with the given capabilites and dimensions.
*
- * The {@link GLOffscreenAutoDrawable}'s {@link GLDrawable} is {@link GLDrawable#isRealized() realized}
+ * The {@link GLOffscreenAutoDrawable}'s {@link GLDrawable} is {@link GLDrawable#isRealized() realized}
* and it's {@link GLContext} assigned but not yet made current.
*
*
@@ -485,7 +485,7 @@ public abstract class GLDrawableFactory {
* and {@link #canCreateGLPbuffer(AbstractGraphicsDevice, GLProfile) canCreateGLPbuffer(device)} is true.
*
*
- * If neither FBO nor Pbuffer is available,
+ * If neither FBO nor Pbuffer is available,
* a simple pixmap/bitmap auto drawable is created, which is unlikely to be hardware accelerated.
*
*
@@ -498,7 +498,7 @@ public abstract class GLDrawableFactory {
*
* @throws GLException if any window system-specific errors caused
* the creation of the Offscreen to fail.
- *
+ *
* @see #createOffscreenDrawable(AbstractGraphicsDevice, GLCapabilitiesImmutable, GLCapabilitiesChooser, int, int)
*/
public abstract GLOffscreenAutoDrawable createOffscreenAutoDrawable(AbstractGraphicsDevice device,
@@ -507,7 +507,7 @@ public abstract class GLDrawableFactory {
int width, int height,
GLContext shareWith) throws GLException;
/**
- * Creates an {@link GLDrawable#isRealized() unrealized} offscreen {@link GLDrawable}
+ * Creates an {@link GLDrawable#isRealized() unrealized} offscreen {@link GLDrawable}
* incl it's offscreen {@link javax.media.nativewindow.NativeSurface} with the given capabilites and dimensions.
*
* In case the passed {@link GLCapabilitiesImmutable} contains default values, i.e.
@@ -523,7 +523,7 @@ public abstract class GLDrawableFactory {
* and {@link #canCreateGLPbuffer(AbstractGraphicsDevice, GLProfile) canCreateGLPbuffer(device)} is true.
*
*
- * If neither FBO nor Pbuffer is available,
+ * If neither FBO nor Pbuffer is available,
* a simple pixmap/bitmap drawable is created, which is unlikely to be hardware accelerated.
*
*
@@ -537,7 +537,7 @@ public abstract class GLDrawableFactory {
*
* @throws GLException if any window system-specific errors caused
* the creation of the Offscreen to fail.
- *
+ *
* @see #createOffscreenAutoDrawable(AbstractGraphicsDevice, GLCapabilitiesImmutable, GLCapabilitiesChooser, int, int, GLContext)
*/
public abstract GLDrawable createOffscreenDrawable(AbstractGraphicsDevice device,
@@ -546,7 +546,7 @@ public abstract class GLDrawableFactory {
int width, int height) throws GLException;
/**
- * Creates an {@link GLDrawable#isRealized() unrealized} dummy {@link GLDrawable}.
+ * Creates an {@link GLDrawable#isRealized() unrealized} dummy {@link GLDrawable}.
* A dummy drawable is not visible on screen and will not be used to render directly to, it maybe on- or offscreen.
*
* It is used to allow the creation of a {@link GLContext} to query information.
@@ -558,26 +558,26 @@ public abstract class GLDrawableFactory {
* @return the created dummy {@link GLDrawable}
*/
public abstract GLDrawable createDummyDrawable(AbstractGraphicsDevice deviceReq, boolean createNewDevice, GLProfile glp);
-
+
/**
- * Creates a proxy {@link NativeSurface} w/ defined surface handle,
- * i.e. a {@link jogamp.nativewindow.WrappedSurface} or {@link jogamp.nativewindow.windows.GDISurface} instance.
+ * Creates a proxy {@link NativeSurface} w/ defined surface handle,
+ * i.e. a {@link jogamp.nativewindow.WrappedSurface} or {@link jogamp.nativewindow.windows.GDISurface} instance.
*
- * It's {@link AbstractGraphicsConfiguration} is properly set according to the given
+ * It's {@link AbstractGraphicsConfiguration} is properly set according to the given
* windowHandle's native visualID if set or the given {@link GLCapabilitiesImmutable}.
*
*
* Lifecycle (creation and destruction) of the given surface handle shall be handled by the caller
- * via {@link ProxySurface#createNotify()} and {@link ProxySurface#destroyNotify()}.
+ * via {@link ProxySurface#createNotify()} and {@link ProxySurface#destroyNotify()}.
*
*
* Such surface can be used to instantiate a GLDrawable. With the help of {@link GLAutoDrawableDelegate}
- * you will be able to implement a new native windowing system binding almost on-the-fly,
- * see {@link com.jogamp.opengl.swt.GLCanvas}.
+ * you will be able to implement a new native windowing system binding almost on-the-fly,
+ * see {@link com.jogamp.opengl.swt.GLCanvas}.
*
- *
+ *
* @param device which {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be null for the platform's default device.
- * Caller has to ensure it is compatible w/ the given windowHandle
+ * Caller has to ensure it is compatible w/ the given windowHandle
* @param screenIdx matching screen index of given windowHandle
* @param windowHandle the native window handle
* @param caps the requested GLCapabilties
@@ -586,15 +586,15 @@ public abstract class GLDrawableFactory {
* @return the created {@link ProxySurface} instance w/ defined surface handle.
*/
public abstract ProxySurface createProxySurface(AbstractGraphicsDevice device,
- int screenIdx,
- long windowHandle,
+ int screenIdx,
+ long windowHandle,
GLCapabilitiesImmutable caps, GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstream);
-
+
/**
* Returns true if it is possible to create an framebuffer object (FBO).
*
* FBO feature is implemented in OpenGL, hence it is {@link GLProfile} dependent.
- *
+ *
*
* FBO support is queried as described in {@link GLContext#hasBasicFBOSupport()}.
*
@@ -607,9 +607,9 @@ public abstract class GLDrawableFactory {
/**
* Returns true if it is possible to create an pbuffer surface.
- *
- * Some older graphics cards do not have this capability,
- * as well as some new GL implementation, i.e. OpenGL 3 core on OSX.
+ *
+ * Some older graphics cards do not have this capability,
+ * as well as some new GL implementation, i.e. OpenGL 3 core on OSX.
*
*
* @param device which {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be null for the platform's default device.
@@ -637,7 +637,7 @@ public abstract class GLDrawableFactory {
*
* @throws GLException if any window system-specific errors caused
* the creation of the GLPbuffer to fail.
- *
+ *
* @deprecated {@link GLPbuffer} is deprecated, use {@link #createOffscreenAutoDrawable(AbstractGraphicsDevice, GLCapabilitiesImmutable, GLCapabilitiesChooser, int, int, GLContext)}
*/
public abstract GLPbuffer createGLPbuffer(AbstractGraphicsDevice device,
@@ -648,7 +648,7 @@ public abstract class GLDrawableFactory {
GLContext shareWith)
throws GLException;
-
+
//----------------------------------------------------------------------
// Methods for interacting with third-party OpenGL libraries
diff --git a/src/jogl/classes/javax/media/opengl/GLEventListener.java b/src/jogl/classes/javax/media/opengl/GLEventListener.java
index 15fae4a39..c8c3440b5 100644
--- a/src/jogl/classes/javax/media/opengl/GLEventListener.java
+++ b/src/jogl/classes/javax/media/opengl/GLEventListener.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -49,7 +49,7 @@ import java.util.EventListener;
public interface GLEventListener extends EventListener {
/** Called by the drawable immediately after the OpenGL context is
initialized. Can be used to perform one-time OpenGL
- initialization per GLContext, such as setup of lights and display lists.
+ initialization per GLContext, such as setup of lights and display lists.
Note that this method may be called more than once if the underlying
OpenGL context for the GLAutoDrawable is destroyed and
@@ -57,7 +57,7 @@ public interface GLEventListener extends EventListener {
hierarchy and later added again.
*/
public void init(GLAutoDrawable drawable);
-
+
/** Notifies the listener to perform the release of all OpenGL
resources per GLContext, such as memory buffers and GLSL programs.
@@ -68,11 +68,11 @@ public interface GLEventListener extends EventListener {
Note that this event does not imply the end of life of the application.
It could be produced with a followup call to {@link #init(GLAutoDrawable)}
- in case the GLContext has been recreated,
+ in case the GLContext has been recreated,
e.g. due to a pixel configuration change in a multihead environment.
*/
public void dispose(GLAutoDrawable drawable);
-
+
/** Called by the drawable to initiate OpenGL rendering by the
client. After all GLEventListeners have been notified of a
display event, the drawable will swap its buffers if {@link
diff --git a/src/jogl/classes/javax/media/opengl/GLException.java b/src/jogl/classes/javax/media/opengl/GLException.java
index 644042e15..460f17be9 100644
--- a/src/jogl/classes/javax/media/opengl/GLException.java
+++ b/src/jogl/classes/javax/media/opengl/GLException.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
diff --git a/src/jogl/classes/javax/media/opengl/GLFBODrawable.java b/src/jogl/classes/javax/media/opengl/GLFBODrawable.java
index df38745d5..052b08a4b 100644
--- a/src/jogl/classes/javax/media/opengl/GLFBODrawable.java
+++ b/src/jogl/classes/javax/media/opengl/GLFBODrawable.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -33,17 +33,17 @@ import javax.media.nativewindow.NativeWindowException;
import com.jogamp.opengl.FBObject;
import com.jogamp.opengl.FBObject.TextureAttachment;
-/**
+/**
* Platform-independent {@link GLDrawable} specialization,
* exposing {@link FBObject} functionality.
*
*
- * A {@link GLFBODrawable} is uninitialized until a {@link GLContext} is bound
+ * A {@link GLFBODrawable} is uninitialized until a {@link GLContext} is bound
* and made current the first time, hence only then it's capabilities fully reflect expectations,
* i.e. color, depth, stencil and MSAA bits will be valid only after the first {@link GLContext#makeCurrent() makeCurrent()} call.
* On-/offscreen bits are valid after {@link #setRealized(boolean) setRealized(true)}.
*
- *
+ *
*
* MSAA is used if {@link GLCapabilitiesImmutable#getNumSamples() requested}.
*
@@ -51,7 +51,7 @@ import com.jogamp.opengl.FBObject.TextureAttachment;
* Double buffering is used if {@link GLCapabilitiesImmutable#getDoubleBuffered() requested}.
*
*
- * In MSAA mode, it always uses the implicit 2nd {@link FBObject framebuffer} {@link FBObject#getSamplingSinkFBO() sink}.
+ * In MSAA mode, it always uses the implicit 2nd {@link FBObject framebuffer} {@link FBObject#getSamplingSinkFBO() sink}.
* Hence double buffering is always the case w/ MSAA.
*
*
@@ -61,7 +61,7 @@ import com.jogamp.opengl.FBObject.TextureAttachment;
* This method also allows usage of both textures seperately.
*
*
- * It would be possible to implement double buffering simply using
+ * It would be possible to implement double buffering simply using
* {@link TextureAttachment}s with one {@link FBObject framebuffer}.
* This would require mode selection and hence complicate the API. Besides, it would
* not support differentiation of read and write framebuffer and hence not be spec compliant.
@@ -71,50 +71,50 @@ import com.jogamp.opengl.FBObject.TextureAttachment;
* is performed either in the {@link jogamp.opengl.GLContextImpl#contextMadeCurrent(boolean) context current hook}
* or when {@link jogamp.opengl.GLDrawableImpl#swapBuffersImpl(boolean) swapping buffers}, whatever comes first.
*
- */
+ */
public interface GLFBODrawable extends GLDrawable {
// public enum DoubleBufferMode { NONE, TEXTURE, FBO }; // TODO: Add or remove TEXTURE (only) DoubleBufferMode support
-
+
/**
* @return true if initialized, i.e. a {@link GLContext} is bound and made current once, otherwise false.
*/
public boolean isInitialized();
-
+
/**
* Notify this instance about upstream size change
* to reconfigure the {@link FBObject}.
- * @param gl GL context object bound to this drawable, will be made current during operation.
- * A prev. current context will be make current after operation.
+ * @param gl GL context object bound to this drawable, will be made current during operation.
+ * A prev. current context will be make current after operation.
* @throws GLException if resize operation failed
*/
void resetSize(GL gl) throws GLException;
-
+
/**
* @return the used texture unit
*/
int getTextureUnit();
-
+
/**
- *
+ *
* @param unit the texture unit to be used
*/
void setTextureUnit(int unit);
-
+
/**
* Set the number of sample buffers if using MSAA
- *
- * @param gl GL context object bound to this drawable, will be made current during operation.
- * A prev. current context will be make current after operation.
+ *
+ * @param gl GL context object bound to this drawable, will be made current during operation.
+ * A prev. current context will be make current after operation.
* @param newSamples new sample size
* @throws GLException if resetting the FBO failed
*/
void setNumSamples(GL gl, int newSamples) throws GLException;
-
+
/**
* @return the number of sample buffers if using MSAA, otherwise 0
*/
int getNumSamples();
-
+
/**
* Sets the number of buffers (FBO) being used if using {@link GLCapabilities#getDoubleBuffered() double buffering}.
*
* Must be called before {@link #isInitialized() initialization}, otherwise an exception is thrown.
*
- * @return the new number of buffers (FBO) used, maybe different than the requested bufferCount (see above)
+ * @return the new number of buffers (FBO) used, maybe different than the requested bufferCount (see above)
* @throws GLException if already initialized, see {@link #isInitialized()}.
*/
int setNumBuffers(int bufferCount) throws GLException;
-
- /**
+
+ /**
* @return the number of buffers (FBO) being used. 1 if not using {@link GLCapabilities#getDoubleBuffered() double buffering},
- * otherwise ≥ 2, depending on {@link #setNumBuffers(int)}.
+ * otherwise ≥ 2, depending on {@link #setNumBuffers(int)}.
*/
int getNumBuffers();
-
+
/**
- * @return the used {@link DoubleBufferMode}
+ * @return the used {@link DoubleBufferMode}
*/
// DoubleBufferMode getDoubleBufferMode(); // TODO: Add or remove TEXTURE (only) DoubleBufferMode support
-
+
/**
* Sets the {@link DoubleBufferMode}. Must be called before {@link #isInitialized() initialization},
* otherwise an exception is thrown.
@@ -153,11 +153,11 @@ public interface GLFBODrawable extends GLDrawable {
* @throws GLException if already initialized, see {@link #isInitialized()}.
*/
// void setDoubleBufferMode(DoubleBufferMode mode) throws GLException; // TODO: Add or remove TEXTURE (only) DoubleBufferMode support
-
+
/**
* If MSAA is being used and {@link GL#GL_FRONT} is requested,
- * the internal {@link FBObject} {@link FBObject#getSamplingSinkFBO() sample sink} is being returned.
- *
+ * the internal {@link FBObject} {@link FBObject#getSamplingSinkFBO() sample sink} is being returned.
+ *
* @param bufferName {@link GL#GL_FRONT} and {@link GL#GL_BACK} are valid buffer names
* @return the named {@link FBObject}
* @throws IllegalArgumentException if an illegal buffer name is being used
@@ -167,7 +167,7 @@ public interface GLFBODrawable extends GLDrawable {
/**
* Returns the named texture buffer.
*
- * If MSAA is being used, only the {@link GL#GL_FRONT} buffer is accessible
+ * If MSAA is being used, only the {@link GL#GL_FRONT} buffer is accessible
* and an exception is being thrown if {@link GL#GL_BACK} is being requested.
*
* This drawable is being locked during operation.
*
- * @param context the {@link GLContext} bound to this drawable, will be made current during operation
- * A prev. current context will be make current after operation.
+ * @param context the {@link GLContext} bound to this drawable, will be made current during operation
+ * A prev. current context will be make current after operation.
* @param newWidth
* @param newHeight
* @throws NativeWindowException in case the surface could no be locked
* @throws GLException in case an error during the resize operation occurred
*/
- void setSize(GLContext context, int newWidth, int newHeight) throws NativeWindowException, GLException;
+ void setSize(GLContext context, int newWidth, int newHeight) throws NativeWindowException, GLException;
}
}
diff --git a/src/jogl/classes/javax/media/opengl/GLOffscreenAutoDrawable.java b/src/jogl/classes/javax/media/opengl/GLOffscreenAutoDrawable.java
index 6fe76a3f4..be90d935f 100644
--- a/src/jogl/classes/javax/media/opengl/GLOffscreenAutoDrawable.java
+++ b/src/jogl/classes/javax/media/opengl/GLOffscreenAutoDrawable.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -32,7 +32,7 @@ import javax.media.nativewindow.NativeWindowException;
import com.jogamp.opengl.FBObject;
-/**
+/**
* Platform-independent {@link GLAutoDrawable} specialization,
* exposing offscreen functionality.
*
*/
public interface GLOffscreenAutoDrawable extends GLAutoDrawable {
-
+
/**
* Resize this auto drawable.
* @param newWidth
@@ -56,8 +56,8 @@ public interface GLOffscreenAutoDrawable extends GLAutoDrawable {
* @see #getUpstreamWidget()
*/
void setUpstreamWidget(Object newUpstreamWidget);
-
- /** {@link FBObject} based {@link GLOffscreenAutoDrawable} specialization */
- public interface FBO extends GLOffscreenAutoDrawable, GLFBODrawable {
- }
+
+ /** {@link FBObject} based {@link GLOffscreenAutoDrawable} specialization */
+ public interface FBO extends GLOffscreenAutoDrawable, GLFBODrawable {
+ }
}
diff --git a/src/jogl/classes/javax/media/opengl/GLPbuffer.java b/src/jogl/classes/javax/media/opengl/GLPbuffer.java
index 12f57fcd8..f36a4bf29 100644
--- a/src/jogl/classes/javax/media/opengl/GLPbuffer.java
+++ b/src/jogl/classes/javax/media/opengl/GLPbuffer.java
@@ -46,8 +46,8 @@ package javax.media.opengl;
as a texture map and enabling rendering to floating-point frame
buffers. These methods are not guaranteed to be supported on all
platforms and may be deprecated in a future release.
-
- @deprecated Use {@link GLOffscreenAutoDrawable} w/ {@link GLCapabilities#setFBO(boolean)}
+
+ @deprecated Use {@link GLOffscreenAutoDrawable} w/ {@link GLCapabilities#setFBO(boolean)}
via {@link GLDrawableFactory#createOffscreenAutoDrawable(javax.media.nativewindow.AbstractGraphicsDevice, GLCapabilitiesImmutable, GLCapabilitiesChooser, int, int, GLContext) GLDrawableFactory.createOffscreenAutoDrawable(..)}.
*/
public interface GLPbuffer extends GLAutoDrawable {
diff --git a/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java b/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java
index c6bf26235..d947bada2 100644
--- a/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java
+++ b/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,7 +28,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
@@ -49,7 +49,7 @@ import jogamp.opengl.*;
public class GLPipelineFactory {
public static final boolean DEBUG = Debug.debug("GLPipelineFactory");
- /**
+ /**
* Creates a pipelined GL instance using the given downstream downstream
* and optional arguments additionalArgs for the constructor.
*
@@ -66,7 +66,7 @@ public class GLPipelineFactory {
* gl = drawable.setGL( GLPipelineFactory.create("javax.media.opengl.Trace", null, gl, new Object[] { System.err } ) );
*
*
- *
+ *
*
* The upstream GL instance is determined as follows:
*
@@ -76,7 +76,7 @@ public class GLPipelineFactory {
*
For all downstream class and superclass interfaces, do:
*
*
If reqInterface is not null and the interface is unequal, continue loop.
- *
If downstream is not instance of interface, continue loop.
+ *
If downstream is not instance of interface, continue loop.
*
If upstream class is available use it, end loop.
*
*
@@ -116,7 +116,7 @@ public class GLPipelineFactory {
if(DEBUG) {
System.out.println("GLPipelineFactory: "+downstream.getClass().getName() + " is _not_ instance of "+ clazzes[i].getName());
}
- continue; // not a compatible one
+ continue; // not a compatible one
} else {
if(DEBUG) {
System.out.println("GLPipelineFactory: "+downstream.getClass().getName() + " _is_ instance of "+ clazzes[i].getName());
@@ -153,7 +153,7 @@ public class GLPipelineFactory {
// throws exception if cstr not found!
Constructor> cstr = ReflectionUtil.getConstructor(upstreamClazz, cstrArgTypes);
Object instance = null;
- try {
+ try {
Object[] cstrArgs = new Object[ 1 + ( ( null==additionalArgs ) ? 0 : additionalArgs.length ) ] ;
{
int i = 0;
diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java
index 4a2edc56b..15300e397 100644
--- a/src/jogl/classes/javax/media/opengl/GLProfile.java
+++ b/src/jogl/classes/javax/media/opengl/GLProfile.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
@@ -66,48 +66,48 @@ import java.util.List;
/**
* Specifies the the OpenGL profile.
- *
+ *
* This class static singleton initialization queries the availability of all OpenGL Profiles
* and instantiates singleton GLProfile objects for each available profile.
*
- * The platform default profile may be used, using {@link GLProfile#GetProfileDefault()},
+ * The platform default profile may be used, using {@link GLProfile#GetProfileDefault()},
* or more specialized versions using the other static GetProfile methods.
*/
public class GLProfile {
-
+
public static final boolean DEBUG = Debug.debug("GLProfile");
-
+
static {
// Also initializes TempJarCache if shall be used.
Platform.initSingleton();
}
-
+
/**
* Static initialization of JOGL.
*
*
* This method shall not need to be called for other reasons than having a defined initialization sequence.
*
- *
+ *
*
* In case this method is not invoked, GLProfile is initialized implicit by
* the first call to {@link #getDefault()}, {@link #get(java.lang.String)}.
*
- *
+ *
*
- * To initialize JOGL at startup ASAP, this method may be invoked in the main class's
+ * To initialize JOGL at startup ASAP, this method may be invoked in the main class's
* static initializer block, in the static main() method or in the Applet init() method.
*
- *
+ *
*
* Since JOGL's initialization is complex and involves multi threading, it is not recommended
- * to be have it invoked on the AWT EDT thread. In case all JOGL usage is performed
+ * to be have it invoked on the AWT EDT thread. In case all JOGL usage is performed
* on the AWT EDT, invoke this method outside the AWT EDT - see above.
*
- *
+ *
*/
public static void initSingleton() {
- final boolean justInitialized;
+ final boolean justInitialized;
initLock.lock();
try {
if(!initialized) { // volatile: ok
@@ -117,13 +117,13 @@ public class GLProfile {
System.err.println("GLProfile.initSingleton() - thread "+Thread.currentThread().getName());
Thread.dumpStack();
}
-
+
// run the whole static initialization privileged to speed up,
// since this skips checking further access
AccessController.doPrivileged(new PrivilegedAction
* @see Platform#AWT_AVAILABLE
* @see Platform#getOSType()
@@ -479,9 +479,9 @@ public class SWTAccessor {
OSXUtil.RunOnMainThread(wait, runnable);
} else {
runnable.run();
- }
+ }
}
-
+
/**
* Runs the specified action on the SWT UI thread.
*
@@ -492,56 +492,56 @@ public class SWTAccessor {
public static void invoke(org.eclipse.swt.widgets.Display display, boolean wait, Runnable runnable) {
if( display.isDisposed() || Thread.currentThread() == display.getThread() ) {
invoke(wait, runnable);
- } else if( wait ) {
+ } else if( wait ) {
display.syncExec(runnable);
} else {
display.asyncExec(runnable);
}
}
-
+
//
// Specific X11 GTK ChildWindow - Using plain X11 native parenting (works well)
//
-
+
public static long createCompatibleX11ChildWindow(AbstractGraphicsScreen screen, Control swtControl, int visualID, int width, int height) {
final long handle = getHandle(swtControl);
final long parentWindow = gdk_widget_get_window( handle );
gdk_window_set_back_pixmap (parentWindow, 0, false);
-
+
final long x11ParentHandle = gdk_window_get_xwindow(parentWindow);
final long x11WindowHandle = X11Lib.CreateWindow(x11ParentHandle, screen.getDevice().getHandle(), screen.getIndex(), visualID, width, height, true, true);
-
+
return x11WindowHandle;
}
-
+
public static void resizeX11Window(AbstractGraphicsDevice device, Rectangle clientArea, long x11Window) {
- X11Lib.SetWindowPosSize(device.getHandle(), x11Window, clientArea.x, clientArea.y, clientArea.width, clientArea.height);
+ X11Lib.SetWindowPosSize(device.getHandle(), x11Window, clientArea.x, clientArea.y, clientArea.width, clientArea.height);
}
public static void destroyX11Window(AbstractGraphicsDevice device, long x11Window) {
X11Lib.DestroyWindow(device.getHandle(), x11Window);
}
-
+
//
// Specific X11 SWT/GTK ChildWindow - Using SWT/GTK native parenting (buggy - sporadic resize flickering, sporadic drop of rendering)
//
// FIXME: Need to use reflection for 32bit access as well !
//
-
+
// public static final int GDK_WA_TYPE_HINT = 1 << 9;
// public static final int GDK_WA_VISUAL = 1 << 6;
-
+
public static long createCompatibleGDKChildWindow(Control swtControl, int visualID, int width, int height) {
return 0;
/**
final long handle = SWTAccessor.getHandle(swtControl);
final long parentWindow = gdk_widget_get_window( handle );
-
+
final long screen = OS.gdk_screen_get_default ();
final long gdkvisual = OS.gdk_x11_screen_lookup_visual (screen, visualID);
-
+
final GdkWindowAttr attrs = new GdkWindowAttr();
attrs.width = width > 0 ? width : 1;
- attrs.height = height > 0 ? height : 1;
+ attrs.height = height > 0 ? height : 1;
attrs.event_mask = OS.GDK_KEY_PRESS_MASK | OS.GDK_KEY_RELEASE_MASK |
OS.GDK_FOCUS_CHANGE_MASK | OS.GDK_POINTER_MOTION_MASK |
OS.GDK_BUTTON_PRESS_MASK | OS.GDK_BUTTON_RELEASE_MASK |
@@ -550,16 +550,16 @@ public class SWTAccessor {
OS.GDK_POINTER_MOTION_HINT_MASK;
attrs.window_type = OS.GDK_WINDOW_CHILD;
attrs.visual = gdkvisual;
-
+
final long childWindow = OS.gdk_window_new (parentWindow, attrs, OS.GDK_WA_VISUAL|GDK_WA_TYPE_HINT);
OS.gdk_window_set_user_data (childWindow, handle);
OS.gdk_window_set_back_pixmap (parentWindow, 0, false);
-
+
OS.gdk_window_show (childWindow);
OS.gdk_flush();
return childWindow; */
}
-
+
public static void showGDKWindow(long gdkWindow) {
/* OS.gdk_window_show (gdkWindow);
OS.gdk_flush(); */
@@ -576,8 +576,8 @@ public class SWTAccessor {
OS.gdk_window_resize (gdkWindow, clientArea.width, clientArea.height);
OS.gdk_flush(); */
}
-
+
public static void destroyGDKWindow(long gdkWindow) {
// OS.gdk_window_destroy (gdkWindow);
- }
+ }
}
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/windows/WindowsGraphicsDevice.java b/src/nativewindow/classes/com/jogamp/nativewindow/windows/WindowsGraphicsDevice.java
index 5cabdf150..7468d254b 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/windows/WindowsGraphicsDevice.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/windows/WindowsGraphicsDevice.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -34,7 +34,7 @@ package com.jogamp.nativewindow.windows;
import javax.media.nativewindow.*;
-/**
+/**
* Encapsulates a graphics device on Windows platforms.
*/
public class WindowsGraphicsDevice extends DefaultGraphicsDevice implements Cloneable {
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsConfiguration.java b/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsConfiguration.java
index 0d2914c7d..120c86584 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsConfiguration.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsConfiguration.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -48,7 +48,7 @@ import jogamp.nativewindow.x11.XVisualInfo;
public class X11GraphicsConfiguration extends MutableGraphicsConfiguration implements Cloneable {
private XVisualInfo info;
- public X11GraphicsConfiguration(X11GraphicsScreen screen,
+ public X11GraphicsConfiguration(X11GraphicsScreen screen,
CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested,
XVisualInfo info) {
super(screen, capsChosen, capsRequested);
@@ -71,12 +71,12 @@ public class X11GraphicsConfiguration extends MutableGraphicsConfiguration imple
final public int getXVisualID() {
return (null!=info)?(int)info.getVisualid():0;
}
-
+
@Override
public String toString() {
return getClass().getSimpleName()+"["+getScreen()+", visualID 0x" + Long.toHexString(getXVisualID()) +
",\n\tchosen " + capabilitiesChosen+
- ",\n\trequested " + capabilitiesRequested+
+ ",\n\trequested " + capabilitiesRequested+
"]";
}
}
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsDevice.java b/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsDevice.java
index e630e012e..40d212df3 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsDevice.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsDevice.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -87,12 +87,12 @@ public class X11GraphicsDevice extends DefaultGraphicsDevice implements Cloneabl
handleOwner = owner;
isXineramaEnabled = X11Util.XineramaIsEnabled(this);
}
-
+
private static int getDefaultScreenImpl(long dpy) {
return X11Lib.DefaultScreen(dpy);
}
-
+
/**
* Returns the default screen number as referenced by the display connection, i.e. 'somewhere:0.1' -> 1
*
@@ -110,7 +110,7 @@ public class X11GraphicsDevice extends DefaultGraphicsDevice implements Cloneabl
}
return ds;
}
-
+
public int getDefaultVisualID() {
final long display = getHandle();
if(0==display) {
@@ -118,11 +118,11 @@ public class X11GraphicsDevice extends DefaultGraphicsDevice implements Cloneabl
}
return X11Lib.DefaultVisualID(display, getDefaultScreenImpl(display));
}
-
+
public final boolean isXineramaEnabled() {
return isXineramaEnabled;
}
-
+
@Override
public Object clone() {
return super.clone();
@@ -142,7 +142,7 @@ public class X11GraphicsDevice extends DefaultGraphicsDevice implements Cloneabl
}
return false;
}
-
+
@Override
public boolean close() {
if(handleOwner && 0 != handle) {
@@ -153,11 +153,11 @@ public class X11GraphicsDevice extends DefaultGraphicsDevice implements Cloneabl
}
return super.close();
}
-
+
@Override
public boolean isHandleOwner() {
return handleOwner;
- }
+ }
@Override
public void clearHandleOwner() {
handleOwner = false;
@@ -168,8 +168,8 @@ public class X11GraphicsDevice extends DefaultGraphicsDevice implements Cloneabl
}
@Override
protected Object setHandleOwnership(Object newOwnership) {
- final Boolean oldOwnership = Boolean.valueOf(handleOwner);
+ final Boolean oldOwnership = Boolean.valueOf(handleOwner);
handleOwner = ((Boolean) newOwnership).booleanValue();
return oldOwnership;
- }
+ }
}
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsScreen.java b/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsScreen.java
index 2ec66290a..8aac7095a 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsScreen.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsScreen.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -62,7 +62,7 @@ public class X11GraphicsScreen extends DefaultGraphicsScreen implements Cloneabl
// It still could be an AWT hold handle ..
return X11Lib.DefaultVisualID(getDevice().getHandle(), getIndex());
}
-
+
public Object clone() {
return super.clone();
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsConfiguration.java b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsConfiguration.java
index 4e45113d4..48f72e574 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsConfiguration.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsConfiguration.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,11 +29,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -44,7 +44,7 @@ package javax.media.nativewindow;
pixel format in a toolkit-independent manner. */
public interface AbstractGraphicsConfiguration extends VisualIDHolder, Cloneable {
public Object clone();
-
+
/**
* Return the screen this graphics configuration is valid for
*/
diff --git a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java
index ed305d49e..31b64269f 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,11 +29,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -47,7 +47,7 @@ import jogamp.nativewindow.Debug;
*/
public interface AbstractGraphicsDevice extends Cloneable {
public static final boolean DEBUG = Debug.debug("GraphicsDevice");
-
+
/** Dummy connection value for a default connection where no native support for multiple devices is available */
public static String DEFAULT_CONNECTION = "decon";
@@ -58,7 +58,7 @@ public interface AbstractGraphicsDevice extends Cloneable {
public static int DEFAULT_UNIT = 0;
public Object clone();
-
+
/**
* Returns the type of the underlying subsystem, ie
* NativeWindowFactory.TYPE_KD, NativeWindowFactory.TYPE_X11, ..
@@ -96,7 +96,7 @@ public interface AbstractGraphicsDevice extends Cloneable {
* The unique ID may be used as a key for semantic device mapping.
*
*
- * The returned string object reference is unique using {@link String#intern()}
+ * The returned string object reference is unique using {@link String#intern()}
* and hence can be used as a key itself.
*
*/
@@ -114,29 +114,29 @@ public interface AbstractGraphicsDevice extends Cloneable {
*/
public void lock();
- /**
+ /**
* Optionally unlocking the device, utilizing eg {@link javax.media.nativewindow.ToolkitLock#unlock()}.
* The lock implementation must be recursive.
- *
+ *
* @throws RuntimeException in case the lock is not acquired by this thread.
*/
public void unlock();
/**
- * @throws RuntimeException if current thread does not hold the lock
+ * @throws RuntimeException if current thread does not hold the lock
*/
public void validateLocked() throws RuntimeException;
-
- /**
+
+ /**
* Optionally [re]opening the device if handle is null.
*
* The default implementation is a NOP.
*
*
- * Example implementations like {@link com.jogamp.nativewindow.x11.X11GraphicsDevice}
- * or {@link com.jogamp.nativewindow.egl.EGLGraphicsDevice}
+ * Example implementations like {@link com.jogamp.nativewindow.x11.X11GraphicsDevice}
+ * or {@link com.jogamp.nativewindow.egl.EGLGraphicsDevice}
* issue the native open operation in case handle is null.
- *
+ *
*
* @return true if the handle was null and opening was successful, otherwise false.
*/
@@ -148,19 +148,19 @@ public interface AbstractGraphicsDevice extends Cloneable {
* The default implementation {@link ToolkitLock#dispose() dispose} it's {@link ToolkitLock} and sets the handle to null.
*
*
- * Example implementations like {@link com.jogamp.nativewindow.x11.X11GraphicsDevice}
- * or {@link com.jogamp.nativewindow.egl.EGLGraphicsDevice}
+ * Example implementations like {@link com.jogamp.nativewindow.x11.X11GraphicsDevice}
+ * or {@link com.jogamp.nativewindow.egl.EGLGraphicsDevice}
* issue the native close operation or skip it depending on the {@link #isHandleOwner() handles's ownership}.
- *
+ *
*
* @return true if the handle was not null and closing was successful, otherwise false.
*/
public boolean close();
-
+
/**
* @return true if instance owns the handle to issue {@link #close()}, otherwise false.
*/
public boolean isHandleOwner();
-
+
public void clearHandleOwner();
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsScreen.java b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsScreen.java
index acb98073b..da8f12f3e 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsScreen.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsScreen.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -45,7 +45,7 @@ package javax.media.nativewindow;
public interface AbstractGraphicsScreen extends Cloneable {
public Object clone();
-
+
/**
* Return the device this graphics configuration is valid for
*/
diff --git a/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java b/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java
index f2a8e2394..9eed887b5 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java
@@ -61,7 +61,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
// Switch for on- or offscreen
private boolean onscreen = true;
-
+
// offscreen bitmap mode
private boolean isBitmap = false;
@@ -74,7 +74,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
public Object cloneMutable() {
return clone();
}
-
+
@Override
public Object clone() {
try {
@@ -85,7 +85,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
}
/**
- * Copies all {@link Capabilities} values
+ * Copies all {@link Capabilities} values
* from source into this instance.
* @return this instance
*/
@@ -103,7 +103,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
transparentValueAlpha = other.getTransparentAlphaValue();
return this;
}
-
+
@Override
public int hashCode() {
// 31 * x == (x << 5) - x
@@ -150,15 +150,15 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
**/
@Override
public int compareTo(final CapabilitiesImmutable caps) {
- /**
+ /**
if ( ! ( o instanceof CapabilitiesImmutable ) ) {
Class> c = (null != o) ? o.getClass() : null ;
throw new ClassCastException("Not a CapabilitiesImmutable object, but " + c);
}
final CapabilitiesImmutable caps = (CapabilitiesImmutable) o; */
-
+
final int rgba = redBits * greenBits * blueBits * ( alphaBits + 1 );
-
+
final int xrgba = caps.getRedBits() * caps.getGreenBits() * caps.getBlueBits() * ( caps.getAlphaBits() + 1 );
if(rgba > xrgba) {
@@ -222,17 +222,17 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
return alphaBits;
}
- /**
+ /**
* Sets the number of bits requested for the color buffer's alpha
* component. On some systems only the color depth, which is the
* sum of the red, green, and blue bits, is considered.
*
- * Note: If alpha bits are zero, they are set to one
+ * Note: If alpha bits are zero, they are set to one
* by {@link #setBackgroundOpaque(boolean)} and it's OpenGL specialization GLCapabilities::setSampleBuffers(boolean).
* Ensure to call this method after the above to ensure a zero value.
* The above automated settings takes into account, that the user calls this method to request alpha bits,
* not to reflect a current state. Nevertheless if this is the case - call it at last.
- *
+ *
*/
public void setAlphaBits(int alphaBits) {
this.alphaBits = alphaBits;
@@ -271,7 +271,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
* Defaults to true.
*
*
- * If requesting an offscreen surface without further selection of it's mode,
+ * If requesting an offscreen surface without further selection of it's mode,
* e.g. FBO, Pbuffer or {@link #setBitmap(boolean) bitmap},
* the implementation will choose the best available offscreen mode.
*
@@ -304,12 +304,12 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
}
isBitmap = enable;
}
-
+
@Override
public boolean isBitmap() {
- return isBitmap;
+ return isBitmap;
}
-
+
@Override
public final int getTransparentRedValue() { return transparentValueRed; }
@@ -354,7 +354,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
public StringBuilder toString(StringBuilder sink) {
return toString(sink, true);
}
-
+
/** Returns a textual representation of this Capabilities
object. */
@Override
@@ -365,7 +365,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
msg.append("]");
return msg.toString();
}
-
+
/** Return a textual representation of this object's on/off screen state. Use the given StringBuilder [optional]. */
protected StringBuilder onoffScreenToString(StringBuilder sink) {
if(null == sink) {
@@ -381,19 +381,19 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
} else if(onscreen) {
sink.append("."); // no additional off-screen modes besides on-screen
} else {
- sink.append("auto-cfg"); // auto-config off-screen mode
+ sink.append("auto-cfg"); // auto-config off-screen mode
}
- sink.append("]");
-
+ sink.append("]");
+
return sink;
}
-
+
/** Element separator */
protected static final String ESEP = "/";
/** Component separator */
protected static final String CSEP = ", ";
-
- protected StringBuilder toString(StringBuilder sink, boolean withOnOffScreen) {
+
+ protected StringBuilder toString(StringBuilder sink, boolean withOnOffScreen) {
if(null == sink) {
sink = new StringBuilder();
}
@@ -409,6 +409,6 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
}
return sink;
}
-
+
protected final String toHexString(int val) { return Integer.toHexString(val); }
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesChooser.java b/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesChooser.java
index e1fdf4938..1f4db7997 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesChooser.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesChooser.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -58,7 +58,7 @@ public interface CapabilitiesChooser {
not necessarily required, that the chooser select that entry.
Note: this method is called automatically by the
- {@link GraphicsConfigurationFactory#chooseGraphicsConfiguration} method
+ {@link GraphicsConfigurationFactory#chooseGraphicsConfiguration} method
when an instance of this class is passed in to it.
It should generally not be
invoked by users directly, unless it is desired to delegate the
diff --git a/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesImmutable.java b/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesImmutable.java
index 85659f286..c496a1535 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesImmutable.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesImmutable.java
@@ -70,12 +70,12 @@ public interface CapabilitiesImmutable extends VisualIDHolder, WriteCloneable, C
* Returns whether an opaque or translucent surface is requested, supported or chosen.
*
* Default is true, i.e. opaque.
- *
+ *
*/
boolean isBackgroundOpaque();
/**
- * Returns whether an on- or offscreen surface is requested, available or chosen.
+ * Returns whether an on- or offscreen surface is requested, available or chosen.
*
* Default is true, i.e. onscreen.
*
@@ -83,7 +83,7 @@ public interface CapabilitiesImmutable extends VisualIDHolder, WriteCloneable, C
* Mind that an capabilities intance w/ available semantics
* may show onscreen, but also the offscreen modes FBO, Pbuffer or {@link #setBitmap(boolean) bitmap}.
* This is valid, since one native configuration maybe used for either functionality.
- *
+ *
*/
boolean isOnscreen();
@@ -97,7 +97,7 @@ public interface CapabilitiesImmutable extends VisualIDHolder, WriteCloneable, C
*
*/
boolean isBitmap();
-
+
/**
* Gets the transparent red value for the frame buffer configuration. This
* value is undefined if; equals true.
diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java b/src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java
index 4f07bca9b..6095db052 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,11 +29,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -66,16 +66,16 @@ import jogamp.nativewindow.Debug;
*/
public class DefaultCapabilitiesChooser implements CapabilitiesChooser {
- private static final boolean DEBUG;
+ private static final boolean DEBUG;
static {
Debug.initSingleton();
DEBUG = Debug.isPropertyDefined("nativewindow.debug.CapabilitiesChooser", true);
}
-
+
private final static int NO_SCORE = -9999999;
private final static int COLOR_MISMATCH_PENALTY_SCALE = 36;
-
+
public int chooseCapabilities(final CapabilitiesImmutable desired,
final List extends CapabilitiesImmutable> available,
final int windowSystemRecommendedChoice) {
@@ -112,7 +112,7 @@ public class DefaultCapabilitiesChooser implements CapabilitiesChooser {
if (desired.isOnscreen() && !cur.isOnscreen()) {
continue; // requested onscreen, but n/a
}
-
+
int score = 0;
// Compute difference in color depth
score += (COLOR_MISMATCH_PENALTY_SCALE *
@@ -132,7 +132,7 @@ public class DefaultCapabilitiesChooser implements CapabilitiesChooser {
System.err.println(" ]");
}
- // Ready to select. Choose score closest to 0.
+ // Ready to select. Choose score closest to 0.
int scoreClosestToZero = NO_SCORE;
int chosenIndex = -1;
for (int i = 0; i < availnum; i++) {
diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java
index 6b23172e1..3e32f30df 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -36,12 +36,12 @@ import jogamp.nativewindow.Debug;
public class DefaultGraphicsConfiguration implements Cloneable, AbstractGraphicsConfiguration {
protected static final boolean DEBUG = Debug.debug("GraphicsConfiguration");
-
+
private AbstractGraphicsScreen screen;
protected CapabilitiesImmutable capabilitiesChosen;
protected CapabilitiesImmutable capabilitiesRequested;
- public DefaultGraphicsConfiguration(AbstractGraphicsScreen screen,
+ public DefaultGraphicsConfiguration(AbstractGraphicsScreen screen,
CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested) {
if(null == screen) {
throw new IllegalArgumentException("Null screen");
@@ -89,7 +89,7 @@ public class DefaultGraphicsConfiguration implements Cloneable, AbstractGraphics
final public int getVisualID(VIDType type) throws NativeWindowException {
return capabilitiesChosen.getVisualID(type);
}
-
+
/**
* Set the capabilities to a new value.
*
@@ -119,7 +119,7 @@ public class DefaultGraphicsConfiguration implements Cloneable, AbstractGraphics
public String toString() {
return getClass().getSimpleName()+"[" + screen +
",\n\tchosen " + capabilitiesChosen+
- ",\n\trequested " + capabilitiesRequested+
+ ",\n\trequested " + capabilitiesRequested+
"]";
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java
index 0bf5c2937..d74954a0d 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -140,8 +140,8 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice
public final void validateLocked() throws RuntimeException {
toolkitLock.validateLocked();
}
-
- /**
+
+ /**
* {@inheritDoc}
*
* Locking is perfomed via delegation to {@link ToolkitLock#lock()}, {@link ToolkitLock#unlock()}.
@@ -154,7 +154,7 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice
public final void unlock() {
toolkitLock.unlock();
}
-
+
@Override
public boolean open() {
return false;
@@ -174,11 +174,11 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice
public boolean isHandleOwner() {
return false;
}
-
+
@Override
- public void clearHandleOwner() {
+ public void clearHandleOwner() {
}
-
+
@Override
public String toString() {
return getClass().getSimpleName()+"[type "+getType()+", connection "+getConnection()+", unitID "+getUnitID()+", handle 0x"+Long.toHexString(getHandle())+", owner "+isHandleOwner()+", "+toolkitLock+"]";
@@ -193,14 +193,14 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice
handle = newHandle;
return oldHandle;
}
-
+
protected Object getHandleOwnership() {
return null;
}
protected Object setHandleOwnership(Object newOwnership) {
return null;
}
-
+
public static final void swapDeviceHandleAndOwnership(final DefaultGraphicsDevice aDevice1, final DefaultGraphicsDevice aDevice2) {
aDevice1.lock();
try {
@@ -219,7 +219,7 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice
aDevice1.unlock();
}
}
-
+
/**
* Set the internal ToolkitLock, which is used within the
* {@link #lock()} and {@link #unlock()} implementation.
@@ -228,7 +228,7 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice
* The current ToolkitLock is being locked/unlocked while swapping the reference,
* ensuring no concurrent access can occur during the swap.
*
- *
+ *
* @param locker the ToolkitLock, if null, {@link jogamp.nativewindow.NullToolkitLock} is being used
* @return the previous ToolkitLock instance
*/
@@ -253,8 +253,8 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice
return toolkitLock;
}
- /**
- * Returns a unique String object using {@link String#intern()} for the given arguments,
+ /**
+ * Returns a unique String object using {@link String#intern()} for the given arguments,
* which object reference itself can be used as a key.
*/
protected static String getUniqueID(String type, String connection, int unitID) {
diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsScreen.java b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsScreen.java
index 9fa58c7a3..ffcad235c 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsScreen.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsScreen.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -57,7 +57,7 @@ public class DefaultGraphicsScreen implements Cloneable, AbstractGraphicsScreen
public AbstractGraphicsDevice getDevice() {
return device;
}
-
+
public int getIndex() {
return idx;
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java b/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java
index 9694f2491..e1aa91959 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008-2009 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -48,7 +48,7 @@ import java.util.Set;
/**
* Provides the mechanism by which the graphics configuration for a
- * window can be chosen before the window is created. The graphics
+ * window can be chosen before the window is created. The graphics
* configuration decides parameters related to hardware accelerated rendering such
* as the OpenGL pixel format.
* On some window systems (EGL/OpenKODE and X11 in particular) it is necessary to
@@ -69,21 +69,21 @@ public abstract class GraphicsConfigurationFactory {
public final Class> deviceType;
public final Class> capsType;
private final int hash32;
-
+
public DeviceCapsType(Class> deviceType, Class> capsType) {
this.deviceType = deviceType;
this.capsType = capsType;
-
+
// 31 * x == (x << 5) - x
int hash32 = 31 + deviceType.hashCode();
hash32 = ((hash32 << 5) - hash32) + capsType.hashCode();
this.hash32 = hash32;
}
-
+
public final int hashCode() {
return hash32;
}
-
+
public final boolean equals(Object obj) {
if(this == obj) { return true; }
if (obj instanceof DeviceCapsType) {
@@ -92,18 +92,18 @@ public abstract class GraphicsConfigurationFactory {
}
return false;
}
-
+
@Override
public final String toString() {
return "DeviceCapsType["+deviceType.getName()+", "+capsType.getName()+"]";
}
-
+
}
-
+
private static final Map registeredFactories;
- private static final DeviceCapsType defaultDeviceCapsType;
+ private static final DeviceCapsType defaultDeviceCapsType;
static boolean initialized = false;
-
+
static {
DEBUG = Debug.debug("GraphicsConfiguration");
if(DEBUG) {
@@ -113,7 +113,7 @@ public abstract class GraphicsConfigurationFactory {
registeredFactories = Collections.synchronizedMap(new HashMap());
defaultDeviceCapsType = new DeviceCapsType(AbstractGraphicsDevice.class, CapabilitiesImmutable.class);
}
-
+
public static synchronized void initSingleton() {
if(!initialized) {
initialized = true;
@@ -121,31 +121,31 @@ public abstract class GraphicsConfigurationFactory {
if(DEBUG) {
System.err.println(Thread.currentThread().getName()+" - GraphicsConfigurationFactory.initSingleton()");
}
-
+
// Register the default no-op factory for arbitrary
// AbstractGraphicsDevice implementations, including
// AWTGraphicsDevice instances -- the OpenGL binding will take
// care of handling AWTGraphicsDevices on X11 platforms (as
// well as X11GraphicsDevices in non-AWT situations)
registerFactory(defaultDeviceCapsType.deviceType, defaultDeviceCapsType.capsType, new DefaultGraphicsConfigurationFactoryImpl());
-
+
if (NativeWindowFactory.TYPE_X11 == NativeWindowFactory.getNativeWindowType(true)) {
try {
- ReflectionUtil.callStaticMethod("jogamp.nativewindow.x11.X11GraphicsConfigurationFactory",
- "registerFactory", null, null, GraphicsConfigurationFactory.class.getClassLoader());
+ ReflectionUtil.callStaticMethod("jogamp.nativewindow.x11.X11GraphicsConfigurationFactory",
+ "registerFactory", null, null, GraphicsConfigurationFactory.class.getClassLoader());
} catch (Exception e) {
throw new RuntimeException(e);
}
if(NativeWindowFactory.isAWTAvailable()) {
try {
- ReflectionUtil.callStaticMethod("jogamp.nativewindow.x11.awt.X11AWTGraphicsConfigurationFactory",
- "registerFactory", null, null, GraphicsConfigurationFactory.class.getClassLoader());
+ ReflectionUtil.callStaticMethod("jogamp.nativewindow.x11.awt.X11AWTGraphicsConfigurationFactory",
+ "registerFactory", null, null, GraphicsConfigurationFactory.class.getClassLoader());
} catch (Exception e) { /* n/a */ }
}
}
}
}
-
+
public static synchronized void shutdown() {
if(initialized) {
initialized = false;
@@ -155,7 +155,7 @@ public abstract class GraphicsConfigurationFactory {
registeredFactories.clear();
}
}
-
+
protected static String getThreadName() {
return Thread.currentThread().getName();
}
@@ -176,10 +176,10 @@ public abstract class GraphicsConfigurationFactory {
/**
* Returns the graphics configuration factory for use with the
* given device and capability.
- *
+ *
* @see #getFactory(Class, Class)
*/
- public static GraphicsConfigurationFactory getFactory(AbstractGraphicsDevice device, CapabilitiesImmutable caps) {
+ public static GraphicsConfigurationFactory getFactory(AbstractGraphicsDevice device, CapabilitiesImmutable caps) {
if (device == null) {
throw new IllegalArgumentException("null device");
}
@@ -195,7 +195,7 @@ public abstract class GraphicsConfigurationFactory {
*
* Note: Registered device types maybe classes or interfaces, where capabilities types are interfaces only.
*
- *
+ *
*
* Pseudo code for finding a suitable factory is:
*
@@ -211,7 +211,7 @@ public abstract class GraphicsConfigurationFactory {
* @param deviceType the minimum capabilities class type accepted, must implement or extend {@link AbstractGraphicsDevice}
* @param capabilitiesType the minimum capabilities class type accepted, must implement or extend {@link CapabilitiesImmutable}
*
- * @throws IllegalArgumentException if the deviceType does not implement {@link AbstractGraphicsDevice} or
+ * @throws IllegalArgumentException if the deviceType does not implement {@link AbstractGraphicsDevice} or
* capabilitiesType does not implement {@link CapabilitiesImmutable}
*/
public static GraphicsConfigurationFactory getFactory(Class> deviceType, Class> capabilitiesType)
@@ -228,12 +228,12 @@ public abstract class GraphicsConfigurationFactory {
System.err.println("GraphicsConfigurationFactory.getFactory: "+deviceType.getName()+", "+capabilitiesType.getName());
dumpFactories();
}
-
- final List> deviceTypes = getAllAssignableClassesFrom(defaultDeviceCapsType.deviceType, deviceType, false);
+
+ final List> deviceTypes = getAllAssignableClassesFrom(defaultDeviceCapsType.deviceType, deviceType, false);
if(DEBUG) {
System.err.println("GraphicsConfigurationFactory.getFactory() deviceTypes: " + deviceTypes);
}
- final List> capabilitiesTypes = getAllAssignableClassesFrom(defaultDeviceCapsType.capsType, capabilitiesType, true);
+ final List> capabilitiesTypes = getAllAssignableClassesFrom(defaultDeviceCapsType.capsType, capabilitiesType, true);
if(DEBUG) {
System.err.println("GraphicsConfigurationFactory.getFactory() capabilitiesTypes: " + capabilitiesTypes);
}
@@ -259,7 +259,7 @@ public abstract class GraphicsConfigurationFactory {
return factory;
}
private static ArrayList> getAllAssignableClassesFrom(Class> superClassOrInterface, Class> fromClass, boolean interfacesOnly) {
- // Using a todo list avoiding a recursive loop!
+ // Using a todo list avoiding a recursive loop!
final ArrayList> inspectClasses = new ArrayList>();
final ArrayList> resolvedInterfaces = new ArrayList>();
inspectClasses.add(fromClass);
@@ -277,7 +277,7 @@ public abstract class GraphicsConfigurationFactory {
}
}
types.addAll(Arrays.asList(fromClass.getInterfaces()));
-
+
for(int i=0; i iface = types.get(i);
if( superClassOrInterface.isAssignableFrom(iface) && !resolvedInterfaces.contains(iface) ) {
@@ -302,20 +302,20 @@ public abstract class GraphicsConfigurationFactory {
}
}
- /**
+ /**
* Registers a GraphicsConfigurationFactory handling
* the given graphics device and capability class.
*
* This does not need to be called by end users, only implementors of new
* GraphicsConfigurationFactory subclasses.
*
- *
+ *
*
* Note: Registered device types maybe classes or interfaces, where capabilities types are interfaces only.
- *
- *
+ *
+ *
*
See {@link #getFactory(Class, Class)} for a description of the find algorithm.
- *
+ *
* @param deviceType the minimum capabilities class type accepted, must implement or extend interface {@link AbstractGraphicsDevice}
* @param capabilitiesType the minimum capabilities class type accepted, must extend interface {@link CapabilitiesImmutable}
* @return the previous registered factory, or null if none
@@ -329,7 +329,7 @@ public abstract class GraphicsConfigurationFactory {
}
if (!(defaultDeviceCapsType.capsType.isAssignableFrom(capabilitiesType))) {
throw new IllegalArgumentException("Given capabilities class must implement CapabilitiesImmutable");
- }
+ }
final DeviceCapsType dct = new DeviceCapsType(abstractGraphicsDeviceImplementor, capabilitiesType);
final GraphicsConfigurationFactory prevFactory;
if(null == factory) {
@@ -352,7 +352,7 @@ public abstract class GraphicsConfigurationFactory {
*
Selects a graphics configuration on the specified graphics
* device compatible with the supplied {@link Capabilities}. Some
* platforms (e.g.: X11, EGL, KD) require the graphics configuration
- * to be specified when the native window is created.
+ * to be specified when the native window is created.
* These architectures have seperated their device, screen, window and drawable
* context and hence are capable of quering the capabilities for each screen.
* A fully established window is not required.
@@ -360,7 +360,7 @@ public abstract class GraphicsConfigurationFactory {
*
Other platforms (e.g. Windows, MacOSX) don't offer the mentioned seperation
* and hence need a fully established window and it's drawable.
* Here the validation of the capabilities is performed later.
- * In this case, the AbstractGraphicsConfiguration implementation
+ * In this case, the AbstractGraphicsConfiguration implementation
* must allow an overwrite of the Capabilites, for example
* {@link DefaultGraphicsConfiguration#setChosenCapabilities DefaultGraphicsConfiguration.setChosenCapabilities(..)}.
*
@@ -385,7 +385,7 @@ public abstract class GraphicsConfigurationFactory {
* @param capsRequested the original requested capabilities
* @param chooser the choosing implementation
* @param screen the referring Screen
- * @param nativeVisualID if not {@link VisualIDHolder#VID_UNDEFINED} it reflects a pre-chosen visualID of the native platform's windowing system.
+ * @param nativeVisualID if not {@link VisualIDHolder#VID_UNDEFINED} it reflects a pre-chosen visualID of the native platform's windowing system.
* @return the complete GraphicsConfiguration
*
* @throws IllegalArgumentException if the data type of the passed
diff --git a/src/nativewindow/classes/javax/media/nativewindow/MutableSurface.java b/src/nativewindow/classes/javax/media/nativewindow/MutableSurface.java
index ff53c8109..a0db11ad9 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/MutableSurface.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/MutableSurface.java
@@ -31,12 +31,12 @@ package javax.media.nativewindow;
/**
* Provides a {@link NativeSurface} with a mutable surfaceHandle
* via {@link #setSurfaceHandle(long)}.
- *
+ *
* @see NativeSurface
*/
public interface MutableSurface extends NativeSurface {
- /**
+ /**
* Sets the surface handle which is created outside of this implementation.
*/
public void setSurfaceHandle(long surfaceHandle);
diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java b/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java
index a89caec76..a755b1812 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package javax.media.nativewindow;
/** Provides low-level information required for
@@ -54,10 +54,10 @@ public interface NativeSurface extends SurfaceUpdatedListener {
*
* The surface handle shall be valid after a successfull call,
* ie return a value other than {@link #LOCK_SURFACE_UNLOCKED} and {@link #LOCK_SURFACE_NOT_READY},
- * which is
- *
- * boolean ok = LOCK_SURFACE_NOT_READY < lockSurface();
- *
+ * which is
+ *
+ * boolean ok = LOCK_SURFACE_NOT_READY < lockSurface();
+ *
*
*
* The caller may need to take care of the result {@link #LOCK_SURFACE_CHANGED},
@@ -71,7 +71,7 @@ public interface NativeSurface extends SurfaceUpdatedListener {
* This call allows recursion from the same thread.
*
*
- * The implementation may want to aquire the
+ * The implementation may want to aquire the
* application level {@link com.jogamp.common.util.locks.RecursiveLock}
* first before proceeding with a native surface lock.
*
*/
public boolean isSurfaceLockedByOtherThread();
-
+
/**
* Return the locking owner's Thread, or null if not locked.
*/
@@ -123,15 +123,15 @@ public interface NativeSurface extends SurfaceUpdatedListener {
/**
* Provide a mechanism to utilize custom (pre-) swap surface
- * code. This method is called before the render toolkit (e.g. JOGL)
+ * code. This method is called before the render toolkit (e.g. JOGL)
* swaps the buffer/surface if double buffering is enabled.
- *
+ *
* The implementation may itself apply the swapping,
* in which case true shall be returned.
*
*
* @return true if this method completed swapping the surface,
- * otherwise false, in which case eg the GLDrawable
+ * otherwise false, in which case eg the GLDrawable
* implementation has to swap the code.
*/
public boolean surfaceSwap();
@@ -153,13 +153,13 @@ public interface NativeSurface extends SurfaceUpdatedListener {
/** Remove the specified {@link SurfaceUpdatedListener} from the list. */
public void removeSurfaceUpdatedListener(SurfaceUpdatedListener l);
-
+
/**
* Returns the handle to the surface for this NativeSurface.
- *
+ *
* The surface handle should be set/update by {@link #lockSurface()},
* where {@link #unlockSurface()} is not allowed to modify it.
- * After {@link #unlockSurface()} it is no more guaranteed
+ * After {@link #unlockSurface()} it is no more guaranteed
* that the surface handle is still valid.
*
* The surface handle shall reflect the platform one
@@ -195,16 +195,16 @@ public interface NativeSurface extends SurfaceUpdatedListener {
public AbstractGraphicsConfiguration getGraphicsConfiguration();
/**
- * Convenience: Get display handle from
+ * Convenience: Get display handle from
* AbstractGraphicsConfiguration . AbstractGraphicsScreen . AbstractGraphicsDevice
*/
public long getDisplayHandle();
/**
- * Convenience: Get display handle from
+ * Convenience: Get display handle from
* AbstractGraphicsConfiguration . AbstractGraphicsScreen
*/
public int getScreenIndex();
-
+
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowException.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowException.java
index 593c1e7d6..0943c8c09 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowException.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowException.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java
index 07d1008b4..bad72f355 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008-2009 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -90,13 +90,13 @@ public abstract class NativeWindowFactory {
private static final String nativeWindowingTypePure; // canonical String via String.intern()
private static final String nativeWindowingTypeCustom; // canonical String via String.intern()
-
+
private static NativeWindowFactory defaultFactory;
private static Map, NativeWindowFactory> registeredFactories;
-
+
private static Class> nativeWindowClass;
private static boolean isAWTAvailable;
-
+
private static final String JAWTUtilClassName = "jogamp.nativewindow.jawt.JAWTUtil" ;
/** {@link jogamp.nativewindow.x11.X11Util} implements {@link ToolkitProperties}. */
private static final String X11UtilClassName = "jogamp.nativewindow.x11.X11Util";
@@ -104,16 +104,16 @@ public abstract class NativeWindowFactory {
private static final String OSXUtilClassName = "jogamp.nativewindow.macosx.OSXUtil";
/** {@link jogamp.nativewindow.windows.GDIUtil} implements {@link ToolkitProperties}. */
private static final String GDIClassName = "jogamp.nativewindow.windows.GDIUtil";
-
+
private static ToolkitLock jawtUtilJAWTToolkitLock;
-
+
private static boolean requiresToolkitLock;
private static boolean desktopHasThreadingIssues;
// Shutdown hook mechanism for the factory
private static volatile boolean isJVMShuttingDown = false;
private static final List customShutdownHooks = new ArrayList();
-
+
/** Creates a new NativeWindowFactory instance. End users do not
need to call this method. */
protected NativeWindowFactory() {
@@ -139,10 +139,10 @@ public abstract class NativeWindowFactory {
case MACOS:
return TYPE_MACOSX;
case WINDOWS:
- return TYPE_WINDOWS;
+ return TYPE_WINDOWS;
case OPENKODE:
return TYPE_EGL;
-
+
case LINUX:
case FREEBSD:
case SUNOS:
@@ -158,7 +158,7 @@ public abstract class NativeWindowFactory {
static {
final boolean[] _DEBUG = new boolean[] { false };
final String[] _tmp = new String[] { null };
-
+
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
Platform.initSingleton(); // last resort ..
@@ -168,16 +168,16 @@ public abstract class NativeWindowFactory {
new Thread(new Runnable() {
public void run() {
NativeWindowFactory.shutdown(true);
- } }, "NativeWindowFactory_ShutdownHook" ) ) ;
+ } }, "NativeWindowFactory_ShutdownHook" ) ) ;
return null;
} } ) ;
-
+
DEBUG = _DEBUG[0];
if(DEBUG) {
System.err.println(Thread.currentThread().getName()+" - Info: NativeWindowFactory.");
// Thread.dumpStack();
}
-
+
// Gather the windowing TK first
nativeWindowingTypePure = _getNativeWindowingType();
if(null==_tmp[0] || _tmp[0].length()==0) {
@@ -202,23 +202,23 @@ public abstract class NativeWindowFactory {
}
if( null != clazzName ) {
ReflectionUtil.callStaticMethod(clazzName, "initSingleton", null, null, cl );
-
+
final Boolean res1 = (Boolean) ReflectionUtil.callStaticMethod(clazzName, "requiresToolkitLock", null, null, cl);
requiresToolkitLock = res1.booleanValue();
final Boolean res2 = (Boolean) ReflectionUtil.callStaticMethod(clazzName, "hasThreadingIssues", null, null, cl);
desktopHasThreadingIssues = res2.booleanValue();
- } else {
+ } else {
requiresToolkitLock = false;
desktopHasThreadingIssues = false;
}
}
- /** Returns true if the JVM is shutting down, otherwise false. */
+ /** Returns true if the JVM is shutting down, otherwise false. */
public static final boolean isJVMShuttingDown() { return isJVMShuttingDown; }
-
- /**
+
+ /**
* Add a custom shutdown hook to be performed at JVM shutdown before shutting down NativeWindowFactory instance.
- *
+ *
* @param head if true add runnable at the start, otherwise at the end
* @param runnable runnable to be added.
*/
@@ -234,7 +234,7 @@ public abstract class NativeWindowFactory {
}
}
- /**
+ /**
* Cleanup resources at JVM shutdown
*/
public static synchronized void shutdown(boolean _isJVMShuttingDown) {
@@ -246,14 +246,14 @@ public abstract class NativeWindowFactory {
final int cshCount = customShutdownHooks.size();
for(int i=0; i < cshCount; i++) {
try {
- if( DEBUG ) {
+ if( DEBUG ) {
System.err.println("NativeWindowFactory.shutdown - customShutdownHook #"+(i+1)+"/"+cshCount);
}
customShutdownHooks.get(i).run();
} catch(Throwable t) {
System.err.println("NativeWindowFactory.shutdown: Catched "+t.getClass().getName()+" during customShutdownHook #"+(i+1)+"/"+cshCount);
- if( DEBUG ) {
- t.printStackTrace();
+ if( DEBUG ) {
+ t.printStackTrace();
}
}
}
@@ -262,7 +262,7 @@ public abstract class NativeWindowFactory {
if(DEBUG) {
System.err.println("NativeWindowFactory.shutdown(): Post customShutdownHook");
}
-
+
if(initialized) {
initialized = false;
if(null != registeredFactories) {
@@ -271,14 +271,14 @@ public abstract class NativeWindowFactory {
}
GraphicsConfigurationFactory.shutdown();
}
-
+
shutdownNativeImpl(NativeWindowFactory.class.getClassLoader()); // always re-shutdown
// SharedResourceToolkitLock.shutdown(DEBUG); // not used yet
if(DEBUG) {
System.err.println(Thread.currentThread().getName()+" - NativeWindowFactory.shutdown() END JVM Shutdown "+isJVMShuttingDown);
}
}
-
+
private static void shutdownNativeImpl(final ClassLoader cl) {
final String clazzName;
if( TYPE_X11 == nativeWindowingTypePure ) {
@@ -292,11 +292,11 @@ public abstract class NativeWindowFactory {
}
if( null != clazzName ) {
ReflectionUtil.callStaticMethod(clazzName, "shutdown", null, null, cl );
- }
+ }
}
-
+
/** Returns true if {@link #initSingleton()} has been called w/o subsequent {@link #shutdown(boolean)}. */
- public static synchronized boolean isInitialized() { return initialized; }
+ public static synchronized boolean isInitialized() { return initialized; }
/**
* Static one time initialization of this factory.
@@ -316,7 +316,7 @@ public abstract class NativeWindowFactory {
if( Platform.AWT_AVAILABLE &&
ReflectionUtil.isClassAvailable("com.jogamp.nativewindow.awt.AWTGraphicsDevice", cl) ) {
-
+
Method[] jawtUtilMethods = AccessController.doPrivileged(new PrivilegedAction() {
public Method[] run() {
try {
@@ -327,7 +327,7 @@ public abstract class NativeWindowFactory {
jawtUtilInitMethod.setAccessible(true);
Method jawtUtilGetJAWTToolkitLockMethod = _jawtUtilClass.getDeclaredMethod("getJAWTToolkitLock", new Class[]{});
jawtUtilGetJAWTToolkitLockMethod.setAccessible(true);
- return new Method[] { jawtUtilInitMethod, jawtUtilIsHeadlessMethod, jawtUtilGetJAWTToolkitLockMethod };
+ return new Method[] { jawtUtilInitMethod, jawtUtilIsHeadlessMethod, jawtUtilGetJAWTToolkitLockMethod };
} catch (Exception e) {
if(DEBUG) {
e.printStackTrace();
@@ -340,7 +340,7 @@ public abstract class NativeWindowFactory {
final Method jawtUtilInitMethod = jawtUtilMethods[0];
final Method jawtUtilIsHeadlessMethod = jawtUtilMethods[1];
final Method jawtUtilGetJAWTToolkitLockMethod = jawtUtilMethods[2];
-
+
ReflectionUtil.callMethod(null, jawtUtilInitMethod);
Object resO = ReflectionUtil.callMethod(null, jawtUtilIsHeadlessMethod);
@@ -351,21 +351,21 @@ public abstract class NativeWindowFactory {
} else {
throw new RuntimeException("JAWTUtil.isHeadlessMode() didn't return a Boolean");
}
- resO = ReflectionUtil.callMethod(null, jawtUtilGetJAWTToolkitLockMethod);
+ resO = ReflectionUtil.callMethod(null, jawtUtilGetJAWTToolkitLockMethod);
if(resO instanceof ToolkitLock) {
jawtUtilJAWTToolkitLock = (ToolkitLock) resO;
} else {
throw new RuntimeException("JAWTUtil.getJAWTToolkitLock() didn't return a ToolkitLock");
- }
+ }
}
}
-
+
// X11 initialization after possible AWT initialization
// This is performed post AWT initialization, allowing AWT to complete the same,
- // which may have been triggered before NativeWindow initialization.
- // This way behavior is more uniforms across configurations (Applet/RCP, applications, ..).
+ // which may have been triggered before NativeWindow initialization.
+ // This way behavior is more uniforms across configurations (Applet/RCP, applications, ..).
initSingletonNativeImpl(cl);
-
+
registeredFactories = Collections.synchronizedMap(new HashMap, NativeWindowFactory>());
// register our default factory -> NativeWindow
@@ -373,17 +373,17 @@ public abstract class NativeWindowFactory {
nativeWindowClass = javax.media.nativewindow.NativeWindow.class;
registerFactory(nativeWindowClass, factory);
defaultFactory = factory;
-
+
if ( isAWTAvailable ) {
// register either our default factory or (if exist) the X11/AWT one -> AWT Component
registerFactory(ReflectionUtil.getClass(ReflectionUtil.AWTNames.ComponentClass, false, cl), factory);
}
-
+
if(DEBUG) {
System.err.println("NativeWindowFactory requiresToolkitLock "+requiresToolkitLock+", desktopHasThreadingIssues "+desktopHasThreadingIssues);
System.err.println("NativeWindowFactory isAWTAvailable "+isAWTAvailable+", defaultFactory "+factory);
}
-
+
GraphicsConfigurationFactory.initSingleton();
}
}
@@ -392,20 +392,20 @@ public abstract class NativeWindowFactory {
public static boolean requiresToolkitLock() {
return requiresToolkitLock;
}
-
+
/** @return true if not headless, AWT Component and NativeWindow's AWT part available */
public static boolean isAWTAvailable() { return isAWTAvailable; }
/**
* @param useCustom if false return the native value, if true return a custom value if set, otherwise fallback to the native value.
- * @return the native window type, e.g. {@link #TYPE_X11}, which is canonical via {@link String#intern()}.
+ * @return the native window type, e.g. {@link #TYPE_X11}, which is canonical via {@link String#intern()}.
* Hence {@link String#equals(Object)} and == produce the same result.
*/
public static String getNativeWindowType(boolean useCustom) {
return useCustom?nativeWindowingTypeCustom:nativeWindowingTypePure;
}
- /** Don't know if we shall add this factory here ..
+ /** Don't know if we shall add this factory here ..
public static AbstractGraphicsDevice createGraphicsDevice(String type, String connection, int unitID, long handle, ToolkitLock locker) {
if(TYPE_EGL == type) {
return new
@@ -427,13 +427,13 @@ public abstract class NativeWindowFactory {
return defaultFactory;
}
- /**
+ /**
* Returns the AWT {@link ToolkitLock} (JAWT based) if {@link #isAWTAvailable}, otherwise null.
*
* The JAWT based {@link ToolkitLock} also locks the global lock,
* which matters if the latter is required.
- *
- */
+ *
+ */
public static ToolkitLock getAWTToolkitLock() {
return jawtUtilJAWTToolkitLock;
}
@@ -441,7 +441,7 @@ public abstract class NativeWindowFactory {
public static ToolkitLock getNullToolkitLock() {
return NativeWindowFactoryImpl.getNullToolkitLock();
}
-
+
/**
* Provides the system default {@link ToolkitLock} for the default system windowing type.
* @see #getNativeWindowType(boolean)
@@ -486,7 +486,7 @@ public abstract class NativeWindowFactory {
}
return NativeWindowFactoryImpl.getNullToolkitLock();
}
-
+
/**
* @param device
* @param screen -1 is default screen of the given device, e.g. maybe 0 or determined by native API. >= 0 is specific screen
@@ -510,7 +510,7 @@ public abstract class NativeWindowFactory {
}
return new DefaultGraphicsScreen(device, screen);
}
-
+
/** Returns the appropriate NativeWindowFactory to handle window
objects of the given type. The windowClass might be {@link
NativeWindow NativeWindow}, in which case the client has
@@ -543,7 +543,7 @@ public abstract class NativeWindowFactory {
}
/** Converts the given window object and it's
- {@link AbstractGraphicsConfiguration AbstractGraphicsConfiguration} into a
+ {@link AbstractGraphicsConfiguration AbstractGraphicsConfiguration} into a
{@link NativeWindow NativeWindow} which can be operated upon by a custom
toolkit, e.g. {@link javax.media.opengl.GLDrawableFactory javax.media.opengl.GLDrawableFactory}.
The object may be a component for a particular window toolkit, such as an AWT
@@ -554,7 +554,7 @@ public abstract class NativeWindowFactory {
NativeWindowFactory is responsible for handling objects from a
particular window toolkit. The built-in NativeWindowFactory
handles NativeWindow instances as well as AWT Components.
-
+
@throws IllegalArgumentException if the given window object
could not be handled by any of the registered
NativeWindowFactory instances
@@ -573,22 +573,22 @@ public abstract class NativeWindowFactory {
NativeWindow. Implementors of concrete NativeWindowFactory
subclasses should override this method. */
protected abstract NativeWindow getNativeWindowImpl(Object winObj, AbstractGraphicsConfiguration config) throws IllegalArgumentException;
-
+
/**
* Returns the {@link OffscreenLayerSurface} instance of this {@link NativeSurface}.
*
- * In case this surface is a {@link NativeWindow}, we traverse from the given surface
+ * In case this surface is a {@link NativeWindow}, we traverse from the given surface
* up to root until an implementation of {@link OffscreenLayerSurface} is found.
* In case ifEnabled is true, the surface must also implement {@link OffscreenLayerOption}
- * where {@link OffscreenLayerOption#isOffscreenLayerSurfaceEnabled()} is true.
+ * where {@link OffscreenLayerOption#isOffscreenLayerSurfaceEnabled()} is true.
*
- *
+ *
* @param surface The surface to query.
- * @param ifEnabled If true, only return the enabled {@link OffscreenLayerSurface}, see {@link OffscreenLayerOption#isOffscreenLayerSurfaceEnabled()}.
+ * @param ifEnabled If true, only return the enabled {@link OffscreenLayerSurface}, see {@link OffscreenLayerOption#isOffscreenLayerSurfaceEnabled()}.
* @return
*/
public static OffscreenLayerSurface getOffscreenLayerSurface(NativeSurface surface, boolean ifEnabled) {
- if(surface instanceof OffscreenLayerSurface &&
+ if(surface instanceof OffscreenLayerSurface &&
( !ifEnabled || surface instanceof OffscreenLayerOption ) ) {
final OffscreenLayerSurface ols = (OffscreenLayerSurface) surface;
return ( !ifEnabled || ((OffscreenLayerOption)ols).isOffscreenLayerSurfaceEnabled() ) ? ols : null;
@@ -601,12 +601,12 @@ public abstract class NativeWindowFactory {
final OffscreenLayerSurface ols = (OffscreenLayerSurface) nw;
return ( !ifEnabled || ((OffscreenLayerOption)ols).isOffscreenLayerSurfaceEnabled() ) ? ols : null;
}
- nw = nw.getParent();
+ nw = nw.getParent();
}
}
- return null;
+ return null;
}
-
+
/**
* Returns true if the given visualID is valid for further processing, i.e. OpenGL usage,
* otherwise return false.
@@ -619,8 +619,8 @@ public abstract class NativeWindowFactory {
*
*/
public static boolean isNativeVisualIDValidForProcessing(int visualID) {
- return NativeWindowFactory.TYPE_X11 != NativeWindowFactory.getNativeWindowType(false) ||
+ return NativeWindowFactory.TYPE_X11 != NativeWindowFactory.getNativeWindowType(false) ||
VisualIDHolder.VID_UNDEFINED != visualID ;
}
-
+
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerOption.java b/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerOption.java
index 12d30b3cd..11496899a 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerOption.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerOption.java
@@ -32,30 +32,30 @@ package javax.media.nativewindow;
* within the implementation.
*/
public interface OffscreenLayerOption {
- /**
+ /**
* Request an offscreen layer, if supported.
*
* Shall be called before the first {@link NativeWindow#lockSurface()},
* and hence before realization.
*
- *
+ *
* @see #getShallUseOffscreenLayer()
- * @see #isOffscreenLayerSurfaceEnabled()
+ * @see #isOffscreenLayerSurfaceEnabled()
*/
public void setShallUseOffscreenLayer(boolean v);
/** Returns the property set by {@link #setShallUseOffscreenLayer(boolean)}. */
public boolean getShallUseOffscreenLayer();
- /**
+ /**
* Returns true if this instance uses an offscreen layer, otherwise false.
*
* This instance is an offscreen layer, if {@link #setShallUseOffscreenLayer(boolean) setShallUseOffscreenLayer(true)}
* has been called before it's realization and first lock and the underlying implementation supports it.
*
* The return value is undefined before issuing the first {@link NativeWindow#lockSurface()}.
- *
- * @see #setShallUseOffscreenLayer(boolean)
+ *
+ * @see #setShallUseOffscreenLayer(boolean)
*/
public boolean isOffscreenLayerSurfaceEnabled();
}
\ No newline at end of file
diff --git a/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerSurface.java b/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerSurface.java
index 1826008ad..8681422ef 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerSurface.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerSurface.java
@@ -33,36 +33,36 @@ import com.jogamp.common.util.locks.RecursiveLock;
* Interface specifying the offscreen layer surface protocol.
*/
public interface OffscreenLayerSurface {
- /**
+ /**
* Attach the offscreen layer to this offscreen layer surface.
*
* Implementation may realize all required resources at this point.
*
- *
+ *
* @see #isOffscreenLayerSurfaceEnabled()
* @throws NativeWindowException if {@link #isOffscreenLayerSurfaceEnabled()} == false
*/
public void attachSurfaceLayer(final long layerHandle) throws NativeWindowException;
-
- /**
+
+ /**
* Detaches a previously attached offscreen layer from this offscreen layer surface.
* @see #attachSurfaceLayer(long)
* @see #isOffscreenLayerSurfaceEnabled()
- * @throws NativeWindowException if {@link #isOffscreenLayerSurfaceEnabled()} == false
+ * @throws NativeWindowException if {@link #isOffscreenLayerSurfaceEnabled()} == false
* or no surface layer is attached.
*/
public void detachSurfaceLayer() throws NativeWindowException;
-
+
/** Returns the attached surface layer or null if none is attached. */
public long getAttachedSurfaceLayer();
-
+
/** Returns true if a surface layer is attached, otherwise false. */
public boolean isSurfaceLayerAttached();
-
+
/** Sets the capabilities of this instance, allowing upstream API's to refine it, i.e. OpenGL related settings. */
public void setChosenCapabilities(CapabilitiesImmutable caps);
-
- /** Returns the recursive lock object of this surface, which synchronizes multithreaded access. */
+
+ /** Returns the recursive lock object of this surface, which synchronizes multithreaded access. */
public RecursiveLock getLock();
-
+
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java b/src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java
index 15a8738c5..eb0a6cf04 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java
@@ -33,44 +33,44 @@ import jogamp.nativewindow.Debug;
/**
* Provides a mutable {@link NativeSurface}, i.e. {@link MutableSurface}, while allowing an
* {@link UpstreamSurfaceHook} to influence the lifecycle and information.
- *
+ *
* @see UpstreamSurfaceHook
* @see MutableSurface
* @see NativeSurface
*/
-public interface ProxySurface extends MutableSurface {
+public interface ProxySurface extends MutableSurface {
public static final boolean DEBUG = Debug.debug("ProxySurface");
-
- /**
+
+ /**
* Implementation specific bit-value stating this {@link ProxySurface} owns the upstream's surface handle
* @see #addUpstreamOptionBits(int)
* @see #clearUpstreamOptionBits(int)
* @see #getUpstreamOptionBits()
- */
+ */
public static final int OPT_PROXY_OWNS_UPSTREAM_SURFACE = 1 << 6;
-
- /**
+
+ /**
* Implementation specific bit-value stating this {@link ProxySurface} owns the upstream's {@link AbstractGraphicsDevice}.
* @see #addUpstreamOptionBits(int)
* @see #clearUpstreamOptionBits(int)
* @see #getUpstreamOptionBits()
- */
+ */
public static final int OPT_PROXY_OWNS_UPSTREAM_DEVICE = 1 << 7;
-
- /**
+
+ /**
* Implementation specific bitvalue stating the upstream's {@link NativeSurface} is an invisible window, i.e. maybe incomplete.
* @see #addUpstreamOptionBits(int)
* @see #clearUpstreamOptionBits(int)
* @see #getUpstreamOptionBits()
- */
+ */
public static final int OPT_UPSTREAM_WINDOW_INVISIBLE = 1 << 8;
/** Allow redefining the AbstractGraphicsConfiguration */
- public void setGraphicsConfiguration(AbstractGraphicsConfiguration cfg);
+ public void setGraphicsConfiguration(AbstractGraphicsConfiguration cfg);
/**
* Return the upstream {@link NativeSurface} if used, otherwise null.
- *
+ *
* An upstream {@link NativeSurface} may backup this {@link ProxySurface} instance's representation,
* e.g. via a {@link #setUpstreamSurfaceHook(UpstreamSurfaceHook) set} {@link UpstreamSurfaceHook}.
*
@@ -80,47 +80,47 @@ public interface ProxySurface extends MutableSurface {
*
*/
public NativeSurface getUpstreamSurface();
-
+
/** Returns the {@link UpstreamSurfaceHook} if {@link #setUpstreamSurfaceHook(UpstreamSurfaceHook) set}, otherwise null. */
public UpstreamSurfaceHook getUpstreamSurfaceHook();
-
+
/**
* Sets the {@link UpstreamSurfaceHook} and returns the previous value.
*/
public void setUpstreamSurfaceHook(UpstreamSurfaceHook hook);
-
- /**
- * Enables or disables the {@link UpstreamSurfaceHook} lifecycle functions
+
+ /**
+ * Enables or disables the {@link UpstreamSurfaceHook} lifecycle functions
* {@link UpstreamSurfaceHook#create(ProxySurface)} and {@link UpstreamSurfaceHook#destroy(ProxySurface)}.
*
* Use this for small code blocks where the native resources shall not change,
* i.e. resizing a derived (OpenGL) drawable.
- *
+ *
*/
public void enableUpstreamSurfaceHookLifecycle(boolean enable);
-
- /**
+
+ /**
* {@link UpstreamSurfaceHook#create(ProxySurface)} is being issued and the proxy surface/window handles shall be set.
- */
+ */
public void createNotify();
-
- /**
+
+ /**
* {@link UpstreamSurfaceHook#destroy(ProxySurface)} is being issued and all proxy surface/window handles shall be cleared.
- */
+ */
public void destroyNotify();
-
+
public StringBuilder getUpstreamOptionBits(StringBuilder sink);
public int getUpstreamOptionBits();
-
+
/** Returns true if the give bit-mask v is set in this instance upstream-option-bits, otherwise false.*/
public boolean containsUpstreamOptionBits(int v);
-
+
/** Add the given bit-mask to this instance upstream-option-bits using bit-or w/ v.*/
public void addUpstreamOptionBits(int v);
-
+
/** Clear the given bit-mask from this instance upstream-option-bits using bit-and w/ ~v*/
public void clearUpstreamOptionBits(int v);
-
+
public StringBuilder toString(StringBuilder sink);
public String toString();
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/SurfaceUpdatedListener.java b/src/nativewindow/classes/javax/media/nativewindow/SurfaceUpdatedListener.java
index 0912b5afe..de65a3031 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/SurfaceUpdatedListener.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/SurfaceUpdatedListener.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package javax.media.nativewindow;
diff --git a/src/nativewindow/classes/javax/media/nativewindow/ToolkitLock.java b/src/nativewindow/classes/javax/media/nativewindow/ToolkitLock.java
index eccfcfa4f..017b996d7 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/ToolkitLock.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/ToolkitLock.java
@@ -53,26 +53,26 @@ public interface ToolkitLock {
* @throws RuntimeException in case of a timeout
*/
public void lock();
-
+
/**
* Release the lock.
*
* @throws RuntimeException in case the lock is not acquired by this thread.
*/
public void unlock();
-
+
/**
- * @throws RuntimeException if current thread does not hold the lock
+ * @throws RuntimeException if current thread does not hold the lock
*/
public void validateLocked() throws RuntimeException;
-
- /**
+
+ /**
* Dispose this instance.
- *
+ *
* Shall be called when instance is no more required.
*
* This allows implementations sharing a lock via resources
- * to decrease the reference counter.
+ * to decrease the reference counter.
*/
public void dispose();
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/UpstreamSurfaceHook.java b/src/nativewindow/classes/javax/media/nativewindow/UpstreamSurfaceHook.java
index 6fe2e5364..f08a6c938 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/UpstreamSurfaceHook.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/UpstreamSurfaceHook.java
@@ -28,24 +28,24 @@
package javax.media.nativewindow;
-/**
- * Interface allowing upstream caller to pass lifecycle actions and size info
- * to a {@link ProxySurface} instance.
- */
+/**
+ * Interface allowing upstream caller to pass lifecycle actions and size info
+ * to a {@link ProxySurface} instance.
+ */
public interface UpstreamSurfaceHook {
/** called within {@link ProxySurface#createNotify()} within lock, before using surface. */
public void create(ProxySurface s);
/** called within {@link ProxySurface#destroyNotify()} within lock, before clearing fields. */
public void destroy(ProxySurface s);
- /** Returns the width of the upstream surface, used if {@link ProxySurface#UPSTREAM_PROVIDES_SIZE} is set. */
+ /** Returns the width of the upstream surface, used if {@link ProxySurface#UPSTREAM_PROVIDES_SIZE} is set. */
public int getWidth(ProxySurface s);
- /** Returns the height of the upstream surface, used if {@link ProxySurface#UPSTREAM_PROVIDES_SIZE} is set. */
+ /** Returns the height of the upstream surface, used if {@link ProxySurface#UPSTREAM_PROVIDES_SIZE} is set. */
public int getHeight(ProxySurface s);
-
+
/**
- * {@link UpstreamSurfaceHook} w/ mutable size, allowing it's {@link ProxySurface} user to resize.
- */
+ * {@link UpstreamSurfaceHook} w/ mutable size, allowing it's {@link ProxySurface} user to resize.
+ */
public interface MutableSize extends UpstreamSurfaceHook {
public void setSize(int width, int height);
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/VisualIDHolder.java b/src/nativewindow/classes/javax/media/nativewindow/VisualIDHolder.java
index 4f3d3ff00..4ee71ee79 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/VisualIDHolder.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/VisualIDHolder.java
@@ -38,7 +38,7 @@ import java.util.Comparator;
*
*/
public interface VisualIDHolder {
-
+
public enum VIDType {
// Generic Values
INTRINSIC(0), NATIVE(1),
@@ -47,19 +47,19 @@ public interface VisualIDHolder {
// X11 Values
X11_XVISUAL(20), X11_FBCONFIG(21),
// Windows Values
- WIN32_PFD(30);
-
+ WIN32_PFD(30);
+
public final int id;
VIDType(int id){
this.id = id;
}
- }
-
+ }
+
/**
* Returns the native visual ID of the given type
* if supported, or {@link #VID_UNDEFINED} if not supported.
- *
+ *
* Depending on the native windowing system, type is handled as follows:
*
*
X11 throws NativeWindowException on EGL_CONFIG, WIN32_PFD
@@ -76,7 +76,7 @@ public interface VisualIDHolder {
*
X11_XVISUAL: X11 XVisual ID
*
X11_FBCONFIG: X11 FBConfig ID or VID_UNDEFINED
*
- *
Windows/GL throws NativeWindowException on EGL_CONFIG, X11_XVISUAL, X11_FBCONFIG
+ *
Windows/GL throws NativeWindowException on EGL_CONFIG, X11_XVISUAL, X11_FBCONFIG
*
*
INTRINSIC: Win32 PIXELFORMATDESCRIPTOR ID
*
NATIVE: Win32 PIXELFORMATDESCRIPTOR ID
@@ -91,35 +91,35 @@ public interface VisualIDHolder {
*
*
* Note: INTRINSIC and NATIVE are always handled,
- * but may result in {@link #VID_UNDEFINED}. The latter is true if
- * the native value are actually undefined or the corresponding object is not
+ * but may result in {@link #VID_UNDEFINED}. The latter is true if
+ * the native value are actually undefined or the corresponding object is not
* mapped to a native visual object.
- *
+ *
* @throws NativeWindowException if type is neither
* INTRINSIC nor NATIVE
- * and does not match the native implementation.
+ * and does not match the native implementation.
*/
int getVisualID(VIDType type) throws NativeWindowException ;
-
- /**
+
+ /**
* {@link #getVisualID(VIDType)} result indicating an undefined value,
* which could be cause by an unsupported query.
*
* We assume the const value 0 doesn't reflect a valid native visual ID
* and is interpreted as no value on all platforms.
* This is currently true for Android, X11 and Windows.
- *
+ *
*/
static final int VID_UNDEFINED = 0;
-
+
/** Comparing {@link VIDType#NATIVE} */
public static class VIDComparator implements Comparator {
private VIDType type;
-
+
public VIDComparator(VIDType type) {
this.type = type;
}
-
+
public int compare(VisualIDHolder vid1, VisualIDHolder vid2) {
final int id1 = vid1.getVisualID(type);
final int id2 = vid2.getVisualID(type);
@@ -131,5 +131,5 @@ public interface VisualIDHolder {
}
return 0;
}
- }
+ }
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/WindowClosingProtocol.java b/src/nativewindow/classes/javax/media/nativewindow/WindowClosingProtocol.java
index 02f68f442..8570b78da 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/WindowClosingProtocol.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/WindowClosingProtocol.java
@@ -37,7 +37,7 @@ package javax.media.nativewindow;
* this protocol default behavior {@link WindowClosingMode#DISPOSE_ON_CLOSE DISPOSE_ON_CLOSE} shall be used.
*/
public interface WindowClosingProtocol {
-
+
/**
* Window closing mode if triggered by toolkit close operation.
*/
@@ -47,7 +47,7 @@ public interface WindowClosingProtocol {
* This is the default behavior within an AWT environment.
*/
DO_NOTHING_ON_CLOSE,
-
+
/**
* Dispose resources on native window close operation.
* This is the default behavior in case no underlying toolkit defines otherwise.
diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/Dimension.java b/src/nativewindow/classes/javax/media/nativewindow/util/Dimension.java
index 17b4930c5..b8b48a46c 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/util/Dimension.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/util/Dimension.java
@@ -4,14 +4,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -21,12 +21,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package javax.media.nativewindow.util;
public class Dimension implements Cloneable, DimensionImmutable {
@@ -48,7 +48,7 @@ public class Dimension implements Cloneable, DimensionImmutable {
public Object cloneMutable() {
return clone();
}
-
+
public Object clone() {
try {
return super.clone();
@@ -92,7 +92,7 @@ public class Dimension implements Cloneable, DimensionImmutable {
public int compareTo(final DimensionImmutable d) {
final int tsq = width*height;
final int xsq = d.getWidth()*d.getHeight();
-
+
if(tsq > xsq) {
return 1;
} else if(tsq < xsq) {
@@ -100,13 +100,13 @@ public class Dimension implements Cloneable, DimensionImmutable {
}
return 0;
}
-
+
@Override
public boolean equals(Object obj) {
if(this == obj) { return true; }
if (obj instanceof Dimension) {
Dimension p = (Dimension)obj;
- return height == p.height &&
+ return height == p.height &&
width == p.width ;
}
return false;
diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/DimensionImmutable.java b/src/nativewindow/classes/javax/media/nativewindow/util/DimensionImmutable.java
index 22bd3f48b..9caa433a6 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/util/DimensionImmutable.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/util/DimensionImmutable.java
@@ -46,12 +46,12 @@ public interface DimensionImmutable extends WriteCloneable, Comparable
* Compares square of size.
- *
+ *
* {@inheritDoc}
*/
@Override
public int compareTo(final DimensionImmutable d);
-
+
/**
* Checks whether two dimensions objects are equal. Two instances
* of DimensionReadOnly are equal if two components
diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java b/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java
index 942c12c2b..dbd997c60 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,18 +20,18 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package javax.media.nativewindow.util;
public class Insets implements Cloneable, InsetsImmutable {
static final InsetsImmutable zeroInsets = new Insets();
public static final InsetsImmutable getZero() { return zeroInsets; }
-
+
int l, r, t, b;
public Insets() {
@@ -44,11 +44,11 @@ public class Insets implements Cloneable, InsetsImmutable {
this.t=top;
this.b=bottom;
}
-
+
public Object cloneMutable() {
return clone();
}
-
+
protected Object clone() {
try {
return super.clone();
@@ -77,7 +77,7 @@ public class Insets implements Cloneable, InsetsImmutable {
public final void setRightWidth(int right) { r = right; }
public final void setTopHeight(int top) { t = top; }
public final void setBottomHeight(int bottom) { b = bottom; }
-
+
@Override
public boolean equals(Object obj) {
if(this == obj) { return true; }
diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/InsetsImmutable.java b/src/nativewindow/classes/javax/media/nativewindow/util/InsetsImmutable.java
index 075641ede..0f99a7861 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/util/InsetsImmutable.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/util/InsetsImmutable.java
@@ -41,13 +41,13 @@ public interface InsetsImmutable extends WriteCloneable {
/** @return total width, ie. left_width + right_width */
int getTotalWidth();
-
+
/** @return top inset height */
int getTopHeight();
/** @return bottom inset height */
int getBottomHeight();
-
+
/** @return total height, ie. top_height + bottom_height */
int getTotalHeight();
diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/Point.java b/src/nativewindow/classes/javax/media/nativewindow/util/Point.java
index 4c233bb16..aba515d52 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/util/Point.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/util/Point.java
@@ -45,7 +45,7 @@ public class Point implements Cloneable, PointImmutable {
public Object cloneMutable() {
return clone();
}
-
+
public Object clone() {
try {
return super.clone();
@@ -58,7 +58,7 @@ public class Point implements Cloneable, PointImmutable {
public int compareTo(final PointImmutable d) {
final int sq = x*y;
final int xsq = d.getX()*d.getY();
-
+
if(sq > xsq) {
return 1;
} else if(sq < xsq) {
@@ -66,7 +66,7 @@ public class Point implements Cloneable, PointImmutable {
}
return 0;
}
-
+
@Override
public boolean equals(Object obj) {
if(this == obj) { return true; }
@@ -120,5 +120,5 @@ public class Point implements Cloneable, PointImmutable {
y *= sy ;
return this;
}
-
+
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/PointImmutable.java b/src/nativewindow/classes/javax/media/nativewindow/util/PointImmutable.java
index b00329bb5..f5377e059 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/util/PointImmutable.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/util/PointImmutable.java
@@ -41,12 +41,12 @@ public interface PointImmutable extends WriteCloneable, Comparable
* Compares the square of the position.
- *
+ *
* {@inheritDoc}
*/
@Override
public int compareTo(final PointImmutable d);
-
+
/**
* Checks whether two points objects are equal. Two instances
* of PointReadOnly are equal if the two components
@@ -57,5 +57,5 @@ public interface PointImmutable extends WriteCloneable, Comparable xsq) {
return 1;
} else if(sq < xsq) {
@@ -160,7 +160,7 @@ public class Rectangle implements Cloneable, RectangleImmutable {
{
final int sq = x*y;
final int xsq = d.getX()*d.getY();
-
+
if(sq > xsq) {
return 1;
} else if(sq < xsq) {
@@ -169,7 +169,7 @@ public class Rectangle implements Cloneable, RectangleImmutable {
}
return 0;
}
-
+
@Override
public boolean equals(Object obj) {
if(this == obj) { return true; }
diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/RectangleImmutable.java b/src/nativewindow/classes/javax/media/nativewindow/util/RectangleImmutable.java
index 440d9e000..ce735f53f 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/util/RectangleImmutable.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/util/RectangleImmutable.java
@@ -49,7 +49,7 @@ public interface RectangleImmutable extends WriteCloneable, Comparable0.0 and 1.0.
*
* Coverage is computed by:
@@ -57,19 +57,19 @@ public interface RectangleImmutable extends WriteCloneable, Comparable
- *
* Compares square of size 1st, if equal the square of position.
- *
+ *
* {@inheritDoc}
*/
@Override
public int compareTo(final RectangleImmutable d);
-
+
/**
* Checks whether two rect objects are equal. Two instances
* of Rectangle are equal if the four integer values
diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/SurfaceSize.java b/src/nativewindow/classes/javax/media/nativewindow/util/SurfaceSize.java
index 3084816a5..917f7e230 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/util/SurfaceSize.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/util/SurfaceSize.java
@@ -4,14 +4,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -21,15 +21,15 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package javax.media.nativewindow.util;
-/**
+/**
* Immutable SurfaceSize Class, consisting of it's read only components:
*
*
{@link javax.media.nativewindow.util.DimensionImmutable} size in pixels
@@ -63,7 +63,7 @@ public class SurfaceSize implements Comparable {
/**
*
* Compares {@link DimensionImmutable#compareTo(DimensionImmutable) resolution} 1st, if equal the bitsPerPixel.
- *
+ *
* {@inheritDoc}
*/
@Override
@@ -72,7 +72,7 @@ public class SurfaceSize implements Comparable {
if( 0 != rres ) {
return rres;
}
- final int xbpp = ssz.getBitsPerPixel();
+ final int xbpp = ssz.getBitsPerPixel();
if(bitsPerPixel > xbpp) {
return 1;
} else if(bitsPerPixel < xbpp) {
@@ -80,7 +80,7 @@ public class SurfaceSize implements Comparable {
}
return 0;
}
-
+
/**
* Checks whether two size objects are equal. Two instances
* of SurfaceSize are equal if the two components
diff --git a/src/nativewindow/classes/jogamp/nativewindow/Debug.java b/src/nativewindow/classes/jogamp/nativewindow/Debug.java
index c5e316364..a7bf536ec 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/Debug.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/Debug.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,11 +29,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -51,7 +51,7 @@ public class Debug extends PropertyAccess {
// Some common properties
private static final boolean verbose;
private static final boolean debugAll;
-
+
static {
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
diff --git a/src/nativewindow/classes/jogamp/nativewindow/DefaultGraphicsConfigurationFactoryImpl.java b/src/nativewindow/classes/jogamp/nativewindow/DefaultGraphicsConfigurationFactoryImpl.java
index 52e9c8308..b3b5d2131 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/DefaultGraphicsConfigurationFactoryImpl.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/DefaultGraphicsConfigurationFactoryImpl.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
diff --git a/src/nativewindow/classes/jogamp/nativewindow/GlobalToolkitLock.java b/src/nativewindow/classes/jogamp/nativewindow/GlobalToolkitLock.java
index c9f830811..5fdbbf697 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/GlobalToolkitLock.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/GlobalToolkitLock.java
@@ -36,20 +36,20 @@ import com.jogamp.common.util.locks.RecursiveLock;
/**
* Implementing a global recursive {@link javax.media.nativewindow.ToolkitLock}.
*
- * This is the last resort for unstable driver where multiple X11 display connections
+ * This is the last resort for unstable driver where multiple X11 display connections
* to the same connection name are not treated thread safe within the GL/X11 driver.
*
*/
public class GlobalToolkitLock implements ToolkitLock {
private static final RecursiveLock globalLock = LockFactory.createRecursiveLock();
private static GlobalToolkitLock singleton = new GlobalToolkitLock();
-
+
public static final GlobalToolkitLock getSingleton() {
return singleton;
}
-
+
private GlobalToolkitLock() { }
-
+
@Override
public final void lock() {
globalLock.lock();
@@ -61,17 +61,17 @@ public class GlobalToolkitLock implements ToolkitLock {
if(TRACE_LOCK) { System.err.println("GlobalToolkitLock.unlock()"); }
globalLock.unlock(); // implicit lock validation
}
-
+
@Override
public final void validateLocked() throws RuntimeException {
globalLock.validateLocked();
}
-
+
@Override
public final void dispose() {
// nop
}
-
+
public String toString() {
return "GlobalToolkitLock[obj 0x"+Integer.toHexString(hashCode())+", isOwner "+globalLock.isOwner(Thread.currentThread())+", "+globalLock.toString()+"]";
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/NWJNILibLoader.java b/src/nativewindow/classes/jogamp/nativewindow/NWJNILibLoader.java
index 1a106b1b9..36a25acfb 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/NWJNILibLoader.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/NWJNILibLoader.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package jogamp.nativewindow;
@@ -36,7 +36,7 @@ import com.jogamp.common.jvm.JNILibLoaderBase;
import com.jogamp.common.os.Platform;
import com.jogamp.common.util.cache.TempJarCache;
-public class NWJNILibLoader extends JNILibLoaderBase {
+public class NWJNILibLoader extends JNILibLoaderBase {
public static boolean loadNativeWindow(final String ossuffix) {
return AccessController.doPrivileged(new PrivilegedAction() {
public Boolean run() {
diff --git a/src/nativewindow/classes/jogamp/nativewindow/NativeWindowFactoryImpl.java b/src/nativewindow/classes/jogamp/nativewindow/NativeWindowFactoryImpl.java
index a3a66b7f1..e3f6ab5ca 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/NativeWindowFactoryImpl.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/NativeWindowFactoryImpl.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -48,7 +48,7 @@ public class NativeWindowFactoryImpl extends NativeWindowFactory {
public static ToolkitLock getNullToolkitLock() {
return nullToolkitLock;
}
-
+
// This subclass of NativeWindowFactory handles the case of
// NativeWindows being passed in
protected NativeWindow getNativeWindowImpl(Object winObj, AbstractGraphicsConfiguration config) throws IllegalArgumentException {
@@ -69,7 +69,7 @@ public class NativeWindowFactoryImpl extends NativeWindowFactory {
winObj.getClass().getName() + " is unsupported; expected " +
"javax.media.nativewindow.NativeWindow or "+AWTNames.ComponentClass);
}
-
+
private Constructor> nativeWindowConstructor = null;
private NativeWindow getAWTNativeWindow(Object winObj, AbstractGraphicsConfiguration config) {
@@ -93,7 +93,7 @@ public class NativeWindowFactoryImpl extends NativeWindowFactory {
}
nativeWindowConstructor = ReflectionUtil.getConstructor(
- windowClassName, new Class[] { Object.class, AbstractGraphicsConfiguration.class },
+ windowClassName, new Class[] { Object.class, AbstractGraphicsConfiguration.class },
getClass().getClassLoader());
} catch (Exception e) {
throw new IllegalArgumentException(e);
diff --git a/src/nativewindow/classes/jogamp/nativewindow/NullToolkitLock.java b/src/nativewindow/classes/jogamp/nativewindow/NullToolkitLock.java
index 5fc5fe376..d8ce98acb 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/NullToolkitLock.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/NullToolkitLock.java
@@ -38,7 +38,7 @@ import javax.media.nativewindow.ToolkitLock;
public class NullToolkitLock implements ToolkitLock {
/** Singleton via {@link NativeWindowFactoryImpl#getNullToolkitLock()} */
protected NullToolkitLock() { }
-
+
@Override
public final void lock() {
if(TRACE_LOCK) {
@@ -51,21 +51,21 @@ public class NullToolkitLock implements ToolkitLock {
public final void unlock() {
if(TRACE_LOCK) { System.err.println("NullToolkitLock.unlock()"); }
}
-
+
@Override
public final void validateLocked() throws RuntimeException {
if( NativeWindowFactory.requiresToolkitLock() ) {
throw new RuntimeException("NullToolkitLock does not lock, but locking is required.");
}
}
-
+
@Override
public final void dispose() {
// nop
}
-
+
public String toString() {
return "NullToolkitLock[]";
}
-
+
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/ProxySurfaceImpl.java b/src/nativewindow/classes/jogamp/nativewindow/ProxySurfaceImpl.java
index 56e342793..8a1048c6f 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/ProxySurfaceImpl.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/ProxySurfaceImpl.java
@@ -40,7 +40,7 @@ import javax.media.nativewindow.UpstreamSurfaceHook;
import com.jogamp.common.util.locks.LockFactory;
import com.jogamp.common.util.locks.RecursiveLock;
-public abstract class ProxySurfaceImpl implements ProxySurface {
+public abstract class ProxySurfaceImpl implements ProxySurface {
private final SurfaceUpdatedHelper surfaceUpdatedHelper = new SurfaceUpdatedHelper();
private AbstractGraphicsConfiguration config; // control access due to delegation
private UpstreamSurfaceHook upstream;
@@ -70,15 +70,15 @@ public abstract class ProxySurfaceImpl implements ProxySurface {
this.upstreamSurfaceHookLifecycleEnabled = true;
if(ownsDevice) {
addUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_DEVICE );
- }
+ }
}
@Override
public NativeSurface getUpstreamSurface() { return null; }
-
+
@Override
public final UpstreamSurfaceHook getUpstreamSurfaceHook() { return upstream; }
-
+
@Override
public void setUpstreamSurfaceHook(UpstreamSurfaceHook hook) {
if(null == hook) {
@@ -86,14 +86,14 @@ public abstract class ProxySurfaceImpl implements ProxySurface {
}
upstream = hook;
}
-
+
@Override
public final void enableUpstreamSurfaceHookLifecycle(boolean enable) {
upstreamSurfaceHookLifecycleEnabled = enable;
}
-
+
@Override
- public void createNotify() {
+ public void createNotify() {
if(upstreamSurfaceHookLifecycleEnabled) {
upstream.create(this);
}
@@ -113,15 +113,15 @@ public abstract class ProxySurfaceImpl implements ProxySurface {
}
this.surfaceHandle_old = 0;
}
-
- /**
+
+ /**
* Must be overridden by implementations allowing having a {@link UpstreamSurfaceHook} being passed.
- * @see #destroyNotify()
+ * @see #destroyNotify()
*/
protected void invalidateImpl() {
- throw new InternalError("UpstreamSurfaceHook given, but required method not implemented.");
+ throw new InternalError("UpstreamSurfaceHook given, but required method not implemented.");
}
-
+
protected final AbstractGraphicsConfiguration getPrivateGraphicsConfiguration() {
return config;
}
@@ -140,7 +140,7 @@ public abstract class ProxySurfaceImpl implements ProxySurface {
public final void setGraphicsConfiguration(AbstractGraphicsConfiguration cfg) {
config = cfg;
}
-
+
@Override
public final int getScreenIndex() {
return getGraphicsConfiguration().getScreen().getIndex();
@@ -151,7 +151,7 @@ public abstract class ProxySurfaceImpl implements ProxySurface {
@Override
public abstract void setSurfaceHandle(long surfaceHandle);
-
+
@Override
public final int getWidth() {
return upstream.getWidth(this);
@@ -252,7 +252,7 @@ public abstract class ProxySurfaceImpl implements ProxySurface {
public final Thread getSurfaceLockOwner() {
return surfaceLock.getOwner();
}
-
+
public final StringBuilder getUpstreamOptionBits(StringBuilder sink) {
if(null == sink) {
sink = new StringBuilder();
@@ -284,21 +284,21 @@ public abstract class ProxySurfaceImpl implements ProxySurface {
sink.append(" ]");
return sink;
}
-
+
@Override
public final int getUpstreamOptionBits() { return implBitfield; }
-
+
@Override
public final boolean containsUpstreamOptionBits(int v) {
return v == ( implBitfield & v ) ;
}
-
+
@Override
public final void addUpstreamOptionBits(int v) { implBitfield |= v; }
-
+
@Override
public final void clearUpstreamOptionBits(int v) { implBitfield &= ~v; }
-
+
@Override
public StringBuilder toString(StringBuilder sink) {
if(null == sink) {
@@ -315,7 +315,7 @@ public abstract class ProxySurfaceImpl implements ProxySurface {
// append("\n, upstreamSurface "+getUpstreamSurface());
return sink;
}
-
+
@Override
public String toString() {
StringBuilder msg = new StringBuilder();
diff --git a/src/nativewindow/classes/jogamp/nativewindow/ResourceToolkitLock.java b/src/nativewindow/classes/jogamp/nativewindow/ResourceToolkitLock.java
index 5b79de0b8..51dd58543 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/ResourceToolkitLock.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/ResourceToolkitLock.java
@@ -50,7 +50,7 @@ public class ResourceToolkitLock implements ToolkitLock {
private ResourceToolkitLock() {
this.lock = LockFactory.createRecursiveLock();
}
-
+
@Override
public final void lock() {
lock.lock();
@@ -62,17 +62,17 @@ public class ResourceToolkitLock implements ToolkitLock {
if(TRACE_LOCK) { System.err.println("ResourceToolkitLock.unlock()"); }
lock.unlock(); // implicit lock validation
}
-
+
@Override
public final void validateLocked() throws RuntimeException {
lock.validateLocked();
}
-
+
@Override
public final void dispose() {
// nop
}
-
+
public String toString() {
return "ResourceToolkitLock[obj 0x"+Integer.toHexString(hashCode())+", isOwner "+lock.isOwner(Thread.currentThread())+", "+lock.toString()+"]";
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/SharedResourceToolkitLock.java b/src/nativewindow/classes/jogamp/nativewindow/SharedResourceToolkitLock.java
index 94d12e6fc..e20d3d138 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/SharedResourceToolkitLock.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/SharedResourceToolkitLock.java
@@ -54,8 +54,8 @@ public class SharedResourceToolkitLock implements ToolkitLock {
handle2Lock = new LongObjectHashMap();
handle2Lock.setKeyNotFoundValue(null);
}
-
- /**
+
+ /**
* @return number of unclosed EGL Displays.
*/
public static int shutdown(boolean verbose) {
@@ -70,7 +70,7 @@ public class SharedResourceToolkitLock implements ToolkitLock {
}
return handle2Lock.size();
}
-
+
public static void dumpOpenDisplayConnections() {
System.err.println("SharedResourceToolkitLock: Open ResourceToolkitLock's: "+handle2Lock.size());
int i=0;
@@ -79,7 +79,7 @@ public class SharedResourceToolkitLock implements ToolkitLock {
System.err.println("SharedResourceToolkitLock: Open["+i+"]: "+e.value);
}
}
-
+
public static final SharedResourceToolkitLock get(long handle) {
SharedResourceToolkitLock res;
synchronized(handle2Lock) {
@@ -106,8 +106,8 @@ public class SharedResourceToolkitLock implements ToolkitLock {
this.handle = handle;
this.refCount = 0;
}
-
-
+
+
@Override
public final void lock() {
lock.lock();
@@ -119,12 +119,12 @@ public class SharedResourceToolkitLock implements ToolkitLock {
if(TRACE_LOCK) { System.err.println("SharedResourceToolkitLock.unlock()"); }
lock.unlock();
}
-
+
@Override
public final void validateLocked() throws RuntimeException {
lock.validateLocked();
}
-
+
@Override
public final void dispose() {
if(0 < refCount) { // volatile OK
@@ -141,7 +141,7 @@ public class SharedResourceToolkitLock implements ToolkitLock {
if(DEBUG || TRACE_LOCK) { System.err.println("SharedResourceToolkitLock.dispose() * NULL *: "+this); }
}
}
-
+
public String toString() {
return "SharedResourceToolkitLock[refCount "+refCount+", handle 0x"+Long.toHexString(handle)+", obj 0x"+Integer.toHexString(hashCode())+", isOwner "+lock.isOwner(Thread.currentThread())+", "+lock.toString()+"]";
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/SurfaceUpdatedHelper.java b/src/nativewindow/classes/jogamp/nativewindow/SurfaceUpdatedHelper.java
index 4f68c6945..d11e240fa 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/SurfaceUpdatedHelper.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/SurfaceUpdatedHelper.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -39,27 +39,27 @@ public class SurfaceUpdatedHelper implements SurfaceUpdatedListener {
//
// Management Utils
- //
+ //
public int size() { return surfaceUpdatedListeners.size(); }
public SurfaceUpdatedListener get(int i) { return surfaceUpdatedListeners.get(i); }
-
+
//
// Implementation of NativeSurface SurfaceUpdatedListener methods
- //
-
+ //
+
public void addSurfaceUpdatedListener(SurfaceUpdatedListener l) {
addSurfaceUpdatedListener(-1, l);
}
- public void addSurfaceUpdatedListener(int index, SurfaceUpdatedListener l)
+ public void addSurfaceUpdatedListener(int index, SurfaceUpdatedListener l)
throws IndexOutOfBoundsException
{
if(l == null) {
return;
}
synchronized(surfaceUpdatedListenersLock) {
- if(0>index) {
- index = surfaceUpdatedListeners.size();
+ if(0>index) {
+ index = surfaceUpdatedListeners.size();
}
surfaceUpdatedListeners.add(index, l);
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/ToolkitProperties.java b/src/nativewindow/classes/jogamp/nativewindow/ToolkitProperties.java
index ed23def8f..47b3e63fa 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/ToolkitProperties.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/ToolkitProperties.java
@@ -8,14 +8,14 @@ import javax.media.nativewindow.NativeWindowFactory;
* Implementation requires to provide static methods:
*
public static void initSingleton() {}
-
+
public static void shutdown() {}
-
+
public static boolean requiresToolkitLock() {}
-
+
public static boolean hasThreadingIssues() {}
*
- * Above static methods are invoked by {@link NativeWindowFactory#initSingleton()},
+ * Above static methods are invoked by {@link NativeWindowFactory#initSingleton()},
* or {@link NativeWindowFactory#shutdown()} via reflection.
*
*/
@@ -25,23 +25,23 @@ public interface ToolkitProperties {
* Called by {@link NativeWindowFactory#initSingleton()}
*/
// void initSingleton();
-
- /**
+
+ /**
* Cleanup resources.
*
* Called by {@link NativeWindowFactory#shutdown()}
*
*/
// void shutdown();
-
+
/**
* Called by {@link NativeWindowFactory#initSingleton()}
*/
// boolean requiresToolkitLock();
-
+
/**
* Called by {@link NativeWindowFactory#initSingleton()}
*/
- // boolean hasThreadingIssues();
-
+ // boolean hasThreadingIssues();
+
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java b/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java
index c94f249a1..f622db8cc 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java
@@ -37,7 +37,7 @@ import com.jogamp.nativewindow.UpstreamSurfaceHookMutableSize;
/**
* Generic Surface implementation which wraps an existing window handle.
- *
+ *
* @see ProxySurface
*/
public class WrappedSurface extends ProxySurfaceImpl {
@@ -46,7 +46,7 @@ public class WrappedSurface extends ProxySurfaceImpl {
/**
* Utilizes a {@link UpstreamSurfaceHook.MutableSize} to hold the size information,
* which is being passed to the {@link ProxySurface} instance.
- *
+ *
* @param cfg the {@link AbstractGraphicsConfiguration} to be used
* @param handle the wrapped pre-existing native surface handle, maybe 0 if not yet determined
* @param initialWidth
@@ -59,7 +59,7 @@ public class WrappedSurface extends ProxySurfaceImpl {
super(cfg, new UpstreamSurfaceHookMutableSize(initialWidth, initialHeight), ownsDevice);
surfaceHandle=handle;
}
-
+
/**
* @param cfg the {@link AbstractGraphicsConfiguration} to be used
* @param handle the wrapped pre-existing native surface handle, maybe 0 if not yet determined
@@ -74,7 +74,7 @@ public class WrappedSurface extends ProxySurfaceImpl {
}
@Override
- protected void invalidateImpl() {
+ protected void invalidateImpl() {
surfaceHandle = 0;
}
@@ -87,7 +87,7 @@ public class WrappedSurface extends ProxySurfaceImpl {
public final void setSurfaceHandle(long surfaceHandle) {
this.surfaceHandle=surfaceHandle;
}
-
+
@Override
protected final int lockSurfaceImpl() {
return LOCK_SUCCESS;
diff --git a/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java b/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java
index 23c48d20e..0fa5006cc 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java
@@ -71,19 +71,19 @@ public class AWTMisc {
}
return (Container) c;
}
-
+
/**
* Return insets of the component w/o traversing up to parent,
* i.e. trying Window and JComponent.
*
- * Exception is JRootPane.
+ * Exception is JRootPane.
* Return it's parent's Window component's insets if available,
* otherwise return JRootPane's insets.
- * This is due to experience that some JRootPane's
+ * This is due to experience that some JRootPane's
* do not expose valid insets value.
*
* @param topLevelOnly if true only returns insets of top-level components, i.e. Window and JRootPanel,
- * otherwise for JComponent as well.
+ * otherwise for JComponent as well.
*/
public static Insets getInsets(Component c, boolean topLevelOnly) {
if( c instanceof Window ) {
@@ -108,7 +108,7 @@ public class AWTMisc {
*/
public void run(Component c);
}
-
+
public static int performAction(Container c, Class> cType, ComponentAction action) {
int count = 0;
final int cc = c.getComponentCount();
@@ -128,18 +128,18 @@ public class AWTMisc {
}
return count;
}
-
+
/**
* Traverse to the next forward or backward component using the
* container's FocusTraversalPolicy.
- *
- * @param comp the assumed current focuse component
+ *
+ * @param comp the assumed current focuse component
* @param forward if true, returns the next focus component, otherwise the previous one.
* @return
*/
public static Component getNextFocus(Component comp, boolean forward) {
Container focusContainer = comp.getFocusCycleRootAncestor();
- while ( focusContainer != null &&
+ while ( focusContainer != null &&
( !focusContainer.isShowing() || !focusContainer.isFocusable() || !focusContainer.isEnabled() ) )
{
comp = focusContainer;
@@ -155,7 +155,7 @@ public class AWTMisc {
}
return next;
}
-
+
/**
* Issue this when your non AWT toolkit gains focus to clear AWT menu path
*/
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTJNILibLoader.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTJNILibLoader.java
index f579da217..815facbee 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTJNILibLoader.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTJNILibLoader.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -47,7 +47,7 @@ import java.awt.Toolkit;
import java.security.AccessController;
import java.security.PrivilegedAction;
-public class JAWTJNILibLoader extends NWJNILibLoader {
+public class JAWTJNILibLoader extends NWJNILibLoader {
static {
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
@@ -55,7 +55,7 @@ public class JAWTJNILibLoader extends NWJNILibLoader {
// a Dialog with "awt.dll not found" might pop up.
// See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4481947.
Toolkit.getDefaultToolkit();
-
+
// Must pre-load JAWT on all non-Mac platforms to
// ensure references from jogl_awt shared object
// will succeed since JAWT shared object isn't in
@@ -74,9 +74,9 @@ public class JAWTJNILibLoader extends NWJNILibLoader {
}
});
}
-
+
public static void initSingleton() {
- // just exist to ensure static init has been run
+ // just exist to ensure static init has been run
}
-
+
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java
index 844b17469..32946fe2d 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
@@ -63,13 +63,13 @@ public class JAWTUtil {
/** OSX JAWT version option to use CALayer */
public static final int JAWT_MACOSX_USE_CALAYER = 0x80000000;
-
+
/** OSX JAWT CALayer availability on Mac OS X >= 10.6 Update 4 (recommended) */
public static final VersionNumber JAWT_MacOSXCALayerMinVersion = new VersionNumber(10,6,4);
-
+
/** OSX JAWT CALayer required with Java >= 1.7.0 (implies OS X >= 10.7 */
public static final VersionNumber JAWT_MacOSXCALayerRequiredForJavaVersion = Platform.Version17;
-
+
// See whether we're running in headless mode
private static final boolean headlessMode;
private static final JAWT jawtLockObject;
@@ -81,27 +81,27 @@ public class JAWTUtil {
private static final Method sunToolkitAWTLockMethod;
private static final Method sunToolkitAWTUnlockMethod;
private static final boolean hasSunToolkitAWTLock;
-
+
private static final RecursiveLock jawtLock;
private static final ToolkitLock jawtToolkitLock;
private static class PrivilegedDataBlob1 {
PrivilegedDataBlob1() {
ok = false;
- }
+ }
Method sunToolkitAWTLockMethod;
Method sunToolkitAWTUnlockMethod;
boolean ok;
}
-
+
/**
* Returns true if this platform's JAWT implementation supports offscreen layer.
*/
public static boolean isOffscreenLayerSupported() {
return Platform.OS_TYPE == Platform.OSType.MACOS &&
- Platform.OS_VERSION_NUMBER.compareTo(JAWTUtil.JAWT_MacOSXCALayerMinVersion) >= 0;
+ Platform.OS_VERSION_NUMBER.compareTo(JAWTUtil.JAWT_MacOSXCALayerMinVersion) >= 0;
}
-
+
/**
* Returns true if this platform's JAWT implementation requires using offscreen layer.
*/
@@ -109,8 +109,8 @@ public class JAWTUtil {
return Platform.OS_TYPE == Platform.OSType.MACOS &&
Platform.JAVA_VERSION_NUMBER.compareTo(JAWT_MacOSXCALayerRequiredForJavaVersion)>=0;
}
-
- /**
+
+ /**
* CALayer size needs to be set using the AWT component size.
*
* AWT's super-calayer, i.e. the AWT's own component CALayer,
@@ -120,13 +120,13 @@ public class JAWTUtil {
*
* As of today, this flag is enabled for all known AWT versions.
*
- *
+ *
* Sync w/ NativeWindowProtocols.h
- *
+ *
*/
public static final int JAWT_OSX_CALAYER_QUIRK_SIZE = 1 << 0;
-
- /**
+
+ /**
* CALayer position needs to be set to zero.
*
* AWT's super-calayer, i.e. the AWT's own component CALayer,
@@ -137,19 +137,19 @@ public class JAWTUtil {
*
*
* Further more a re-layout seems to be required in this case,
- * i.e. a programmatic forced resize +1 and it's inverted resize -1.
+ * i.e. a programmatic forced resize +1 and it's inverted resize -1.
*
*
- * This flag is enabled w/ AWT < 1.7.0_40.
+ * This flag is enabled w/ AWT < 1.7.0_40.
*
- *
+ *
* Sync w/ NativeWindowProtocols.h
- *
+ *
*/
public static final int JAWT_OSX_CALAYER_QUIRK_POSITION = 1 << 1;
-
- /**
- * CALayer position needs to be derived from AWT position
+
+ /**
+ * CALayer position needs to be derived from AWT position
* in relation to super CALayer.
*
* AWT's super-calayer, i.e. the AWT top-container's CALayer,
@@ -165,7 +165,7 @@ public class JAWTUtil {
*
*
* The super-calayer lies within the AWT top-container client space (content).
- *
+ *
*
* Component's location in super-calayer:
*
@@ -188,12 +188,12 @@ public class JAWTUtil {
*
* As of today, this flag is enabled for w/ AWT >= 1.7.0_40.
*
- *
+ *
* Sync w/ NativeWindowProtocols.h
- *
+ *
*/
public static final int JAWT_OSX_CALAYER_QUIRK_LAYOUT = 1 << 2;
-
+
/**
* Returns bitfield of required JAWT OSX CALayer quirks to mediate AWT impl. bugs.
*
@@ -211,12 +211,12 @@ public class JAWTUtil {
*/
public static int getOSXCALayerQuirks() {
int res = 0;
- if( Platform.OS_TYPE == Platform.OSType.MACOS &&
+ if( Platform.OS_TYPE == Platform.OSType.MACOS &&
Platform.OS_VERSION_NUMBER.compareTo(JAWTUtil.JAWT_MacOSXCALayerMinVersion) >= 0 ) {
-
+
/** Knowing impl. all expose the SIZE bug */
res |= JAWT_OSX_CALAYER_QUIRK_SIZE;
-
+
final int c = Platform.JAVA_VERSION_NUMBER.compareTo(Platform.Version17);
if( c < 0 || c == 0 && Platform.JAVA_VERSION_UPDATE < 40 ) {
res |= JAWT_OSX_CALAYER_QUIRK_POSITION;
@@ -226,20 +226,20 @@ public class JAWTUtil {
}
return res;
}
-
+
/**
* @param useOffscreenLayerIfAvailable
* @return
*/
public static JAWT getJAWT(boolean useOffscreenLayerIfAvailable) {
- final int jawt_version_flags = JAWTFactory.JAWT_VERSION_1_4;
+ final int jawt_version_flags = JAWTFactory.JAWT_VERSION_1_4;
JAWT jawt = JAWT.create();
-
+
// default queries
boolean tryOffscreenLayer;
boolean tryOnscreen;
int jawt_version_flags_offscreen = jawt_version_flags;
-
+
if(isOffscreenLayerRequired()) {
if(Platform.OS_TYPE == Platform.OSType.MACOS) {
if(Platform.OS_VERSION_NUMBER.compareTo(JAWTUtil.JAWT_MacOSXCALayerMinVersion) >= 0) {
@@ -263,11 +263,11 @@ public class JAWTUtil {
} else {
tryOffscreenLayer = false;
tryOnscreen = true;
- }
+ }
if(DEBUG) {
System.err.println("JAWTUtil.getJAWT(tryOffscreenLayer "+tryOffscreenLayer+", tryOnscreen "+tryOnscreen+")");
}
-
+
StringBuilder errsb = new StringBuilder();
if(tryOffscreenLayer) {
errsb.append("Offscreen 0x").append(Integer.toHexString(jawt_version_flags_offscreen));
@@ -282,15 +282,15 @@ public class JAWTUtil {
errsb.append("Onscreen 0x").append(Integer.toHexString(jawt_version_flags));
if( JAWT.getJAWT(jawt, jawt_version_flags) ) {
return jawt;
- }
+ }
}
throw new RuntimeException("Unable to initialize JAWT, trials: "+errsb.toString());
}
-
+
public static boolean isJAWTUsingOffscreenLayer(JAWT jawt) {
return 0 != ( jawt.getCachedVersion() & JAWTUtil.JAWT_MACOSX_USE_CALAYER );
}
-
+
static {
if(DEBUG) {
System.err.println("JAWTUtil initialization (JAWT/JNI/...");
@@ -319,10 +319,10 @@ public class JAWTUtil {
isQueueFlusherThread = m;
j2dExist = ok;
- PrivilegedDataBlob1 pdb1 = (PrivilegedDataBlob1) AccessController.doPrivileged(new PrivilegedAction() {
+ PrivilegedDataBlob1 pdb1 = (PrivilegedDataBlob1) AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
PrivilegedDataBlob1 d = new PrivilegedDataBlob1();
- try {
+ try {
final Class> sunToolkitClass = Class.forName("sun.awt.SunToolkit");
d.sunToolkitAWTLockMethod = sunToolkitClass.getDeclaredMethod("awtLock", new Class[]{});
d.sunToolkitAWTLockMethod.setAccessible(true);
@@ -337,7 +337,7 @@ public class JAWTUtil {
});
sunToolkitAWTLockMethod = pdb1.sunToolkitAWTLockMethod;
sunToolkitAWTUnlockMethod = pdb1.sunToolkitAWTUnlockMethod;
-
+
boolean _hasSunToolkitAWTLock = false;
if ( pdb1.ok ) {
try {
@@ -351,10 +351,10 @@ public class JAWTUtil {
// hasSunToolkitAWTLock = false;
jawtLock = LockFactory.createRecursiveLock();
- jawtToolkitLock = new ToolkitLock() {
+ jawtToolkitLock = new ToolkitLock() {
public final void lock() {
JAWTUtil.lockToolkit();
- }
+ }
public final void unlock() {
JAWTUtil.unlockToolkit();
}
@@ -411,11 +411,11 @@ public class JAWTUtil {
public static void initSingleton() {
// just exist to ensure static init has been run
}
-
+
/**
* Called by {@link NativeWindowFactory#shutdown()}
*/
- public static void shutdown() {
+ public static void shutdown() {
}
public static boolean hasJava2D() {
@@ -443,7 +443,7 @@ public class JAWTUtil {
* which just uses AWT's global ReentrantLock.
*
*
- * AWT locking is wrapped through a recursive lock object.
+ * AWT locking is wrapped through a recursive lock object.
*
*/
public static void lockToolkit() throws NativeWindowException {
@@ -471,11 +471,11 @@ public class JAWTUtil {
* which just uses AWT's global ReentrantLock.
*
*
- * AWT unlocking is wrapped through a recursive lock object.
+ * AWT unlocking is wrapped through a recursive lock object.
*
*/
public static void unlockToolkit() {
- jawtLock.validateLocked();
+ jawtLock.validateLocked();
if(ToolkitLock.TRACE_LOCK) { System.err.println("JAWTUtil-ToolkitLock.unlock(): "+jawtLock); }
if( 1 == jawtLock.getHoldCount() ) {
if(!headlessMode && !isJava2DQueueFlusherThread()) {
@@ -492,14 +492,14 @@ public class JAWTUtil {
}
jawtLock.unlock();
}
-
+
public static final void validateLocked() throws RuntimeException {
jawtLock.validateLocked();
- }
+ }
public static ToolkitLock getJAWTToolkitLock() {
return jawtToolkitLock;
}
-
+
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWT_PlatformInfo.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWT_PlatformInfo.java
index 40d7b8032..4f12d1925 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWT_PlatformInfo.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWT_PlatformInfo.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java
index b712f6a1a..87e3d3dd8 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,11 +29,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -102,7 +102,7 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface {
}
windowHandle=0;
}
-
+
@Override
protected void attachSurfaceLayerImpl(final long layerHandle) {
OSXUtil.RunOnMainThread(false, new Runnable() {
@@ -119,7 +119,7 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface {
if( null != outterInsets ) {
p1.translate(-outterInsets.left, -outterInsets.top);
}
-
+
if( DEBUG ) {
final java.awt.Point pA0 = component.getLocationOnScreen();
final Point pA1 = new Point(pA0.x, pA0.y);
@@ -133,7 +133,7 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface {
OSXUtil.AddCASublayer(rootSurfaceLayer, layerHandle, p1.getX(), p1.getY(), getWidth(), getHeight(), JAWTUtil.getOSXCALayerQuirks());
} } );
}
-
+
@Override
protected void layoutSurfaceLayerImpl(long layerHandle, boolean visible) {
final int caLayerQuirks = JAWTUtil.getOSXCALayerQuirks();
@@ -149,7 +149,7 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface {
if( null != outterInsets ) {
p1.translate(-outterInsets.left, -outterInsets.top);
}
-
+
if( DEBUG ) {
final java.awt.Point pA0 = component.getLocationOnScreen();
final Point pA1 = new Point(pA0.x, pA0.y);
@@ -163,7 +163,7 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface {
}
OSXUtil.FixCALayerLayout(rootSurfaceLayer, layerHandle, visible, p1.getX(), p1.getY(), getWidth(), getHeight(), caLayerQuirks);
}
-
+
@Override
protected void detachSurfaceLayerImpl(final long layerHandle, final Runnable detachNotify) {
OSXUtil.RunOnMainThread(false, new Runnable() {
@@ -172,17 +172,17 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface {
OSXUtil.RemoveCASublayer(rootSurfaceLayer, layerHandle);
} } );
}
-
+
@Override
public final long getWindowHandle() {
return windowHandle;
}
-
+
@Override
public final long getSurfaceHandle() {
return offscreenSurfaceDrawableSet ? offscreenSurfaceDrawable : drawable /* super.getSurfaceHandle() */ ;
}
-
+
public void setSurfaceHandle(long surfaceHandle) {
if( !isOffscreenLayerSurfaceEnabled() ) {
throw new java.lang.UnsupportedOperationException("Not using CALAYER");
@@ -198,7 +198,7 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface {
// use offscreen if supported and [ applet or requested ]
return JAWTUtil.getJAWT(getShallUseOffscreenLayer() || isApplet());
}
-
+
protected int lockSurfaceImpl() throws NativeWindowException {
int ret = NativeWindow.LOCK_SURFACE_NOT_READY;
ds = getJAWT().GetDrawingSurface(component);
@@ -247,7 +247,7 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface {
return NativeWindow.LOCK_SURFACE_NOT_READY;
}
drawable = macosxdsi.getCocoaViewRef();
-
+
if (drawable == 0) {
unlockSurfaceImpl();
return NativeWindow.LOCK_SURFACE_NOT_READY;
@@ -259,9 +259,9 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface {
/**
* Only create a fake invisible NSWindow for the drawable handle
* to please frameworks requiring such (eg. NEWT).
- *
- * The actual surface/ca-layer shall be created/attached
- * by the upper framework (JOGL) since they require more information.
+ *
+ * The actual surface/ca-layer shall be created/attached
+ * by the upper framework (JOGL) since they require more information.
*/
String errMsg = null;
if(0 == drawable) {
@@ -286,10 +286,10 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface {
OSXUtil.RunOnMainThread(false, new Runnable() {
public void run() {
String errMsg = null;
- if(0 == rootSurfaceLayer && 0 != jawtSurfaceLayersHandle) {
+ if(0 == rootSurfaceLayer && 0 != jawtSurfaceLayersHandle) {
rootSurfaceLayer = OSXUtil.CreateCALayer(bounds.getWidth(), bounds.getHeight());
if(0 == rootSurfaceLayer) {
- errMsg = "Could not create root CALayer";
+ errMsg = "Could not create root CALayer";
} else {
try {
SetJAWTRootSurfaceLayer0(jawtSurfaceLayersHandle, rootSurfaceLayer);
@@ -318,10 +318,10 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface {
}
ret = NativeWindow.LOCK_SUCCESS;
}
-
+
return ret;
}
-
+
protected void unlockSurfaceImpl() throws NativeWindowException {
if(null!=ds) {
if (null!=dsi) {
@@ -340,7 +340,7 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface {
System.err.println("MaxOSXJAWTWindow: 0x"+Integer.toHexString(this.hashCode())+" - thread: "+Thread.currentThread().getName());
dumpJAWTInfo();
}
-
+
/**
* {@inheritDoc}
*
@@ -350,9 +350,9 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface {
* ..
* ds = getJAWT().GetDrawingSurface(component);
* due to a SIGSEGV.
- *
+ *
* Hence we have some threading / sync issues with the native JAWT implementation.
- *
+ *
*/
@Override
public Point getLocationOnScreen(Point storage) {
@@ -361,36 +361,36 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface {
}
getLocationOnScreenNonBlocking(storage, component);
return storage;
- }
+ }
protected Point getLocationOnScreenNativeImpl(final int x0, final int y0) { return null; }
-
-
+
+
private static native long GetJAWTSurfaceLayersHandle0(Buffer jawtDrawingSurfaceInfoBuffer);
-
- /**
+
+ /**
* Set the given root CALayer in the JAWT surface
- */
+ */
private static native void SetJAWTRootSurfaceLayer0(long jawtSurfaceLayersHandle, long caLayer);
-
- /**
+
+ /**
* Unset the given root CALayer in the JAWT surface, passing the NIO DrawingSurfaceInfo buffer
- */
+ */
private static native void UnsetJAWTRootSurfaceLayer0(long jawtSurfaceLayersHandle, long caLayer);
-
+
// Variables for lockSurface/unlockSurface
private JAWT_DrawingSurface ds;
private boolean dsLocked;
private JAWT_DrawingSurfaceInfo dsi;
private long jawtSurfaceLayersHandle;
-
+
private JAWT_MacOSXDrawingSurfaceInfo macosxdsi;
-
+
private volatile long rootSurfaceLayer = 0; // attached to the JAWT_SurfaceLayer
-
+
private long windowHandle = 0;
private long offscreenSurfaceDrawable = 0;
private boolean offscreenSurfaceDrawableSet = false;
-
+
// Workaround for instance of 4796548
private boolean firstLock = true;
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/Win32SunJDKReflection.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/Win32SunJDKReflection.java
index 74dabb67f..876531151 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/Win32SunJDKReflection.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/Win32SunJDKReflection.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,11 +29,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/WindowsJAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/WindowsJAWTWindow.java
index 905a313d5..64e177155 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/WindowsJAWTWindow.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/WindowsJAWTWindow.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,11 +29,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -67,7 +67,7 @@ public class WindowsJAWTWindow extends JAWTWindow {
protected JAWT fetchJAWTImpl() throws NativeWindowException {
return JAWTUtil.getJAWT(false); // no offscreen
}
-
+
protected int lockSurfaceImpl() throws NativeWindowException {
int ret = NativeWindow.LOCK_SUCCESS;
ds = getJAWT().GetDrawingSurface(component);
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java
index 2e5dc7fb5..b08a7d83a 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
@@ -62,7 +62,7 @@ public class X11JAWTWindow extends JAWTWindow {
protected JAWT fetchJAWTImpl() throws NativeWindowException {
return JAWTUtil.getJAWT(false); // no offscreen
}
-
+
protected int lockSurfaceImpl() throws NativeWindowException {
int ret = NativeWindow.LOCK_SUCCESS;
ds = getJAWT().GetDrawingSurface(component);
@@ -123,11 +123,11 @@ public class X11JAWTWindow extends JAWTWindow {
// surface is locked and hence the device
return X11Lib.GetRelativeLocation(getDisplayHandle(), getScreenIndex(), getWindowHandle(), 0 /*root win*/, x, y);
}
-
+
// Variables for lockSurface/unlockSurface
private JAWT_DrawingSurface ds;
private boolean dsLocked;
private JAWT_DrawingSurfaceInfo dsi;
private JAWT_X11DrawingSurfaceInfo x11dsi;
-
+
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11SunJDKReflection.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11SunJDKReflection.java
index 27e0a5e50..f1104d02f 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11SunJDKReflection.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11SunJDKReflection.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,11 +29,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
diff --git a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXDummyUpstreamSurfaceHook.java b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXDummyUpstreamSurfaceHook.java
index de3206c0c..b71af1042 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXDummyUpstreamSurfaceHook.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXDummyUpstreamSurfaceHook.java
@@ -9,12 +9,12 @@ import com.jogamp.nativewindow.UpstreamSurfaceHookMutableSize;
public class OSXDummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize {
long nsWindow;
-
+
/**
- * @param width the initial width as returned by {@link NativeSurface#getWidth()} via {@link UpstreamSurfaceHook#getWidth(ProxySurface)},
- * not the actual dummy surface width.
+ * @param width the initial width as returned by {@link NativeSurface#getWidth()} via {@link UpstreamSurfaceHook#getWidth(ProxySurface)},
+ * not the actual dummy surface width.
* The latter is platform specific and small
- * @param height the initial height as returned by {@link NativeSurface#getHeight()} via {@link UpstreamSurfaceHook#getHeight(ProxySurface)},
+ * @param height the initial height as returned by {@link NativeSurface#getHeight()} via {@link UpstreamSurfaceHook#getHeight(ProxySurface)},
* not the actual dummy surface height,
* The latter is platform specific and small
*/
@@ -22,7 +22,7 @@ public class OSXDummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize
super(width, height);
nsWindow = 0;
}
-
+
@Override
public final void create(ProxySurface s) {
if(0 == nsWindow && 0 == s.getSurfaceHandle()) {
@@ -35,11 +35,11 @@ public class OSXDummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize
throw new NativeWindowException("Error NS view 0");
}
s.setSurfaceHandle(nsView);
- s.addUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE );
+ s.addUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE );
}
s.addUpstreamOptionBits(ProxySurface.OPT_UPSTREAM_WINDOW_INVISIBLE);
}
-
+
@Override
public final void destroy(ProxySurface s) {
if( s.containsUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ) ) {
diff --git a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java
index 0d498fa54..004a91a42 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java
@@ -41,9 +41,9 @@ import jogamp.nativewindow.NWJNILibLoader;
import jogamp.nativewindow.ToolkitProperties;
public class OSXUtil implements ToolkitProperties {
- private static boolean isInit = false;
+ private static boolean isInit = false;
private static final boolean DEBUG = Debug.debug("OSXUtil");
-
+
/**
* Called by {@link NativeWindowFactory#initSingleton()}
* @see ToolkitProperties
@@ -56,10 +56,10 @@ public class OSXUtil implements ToolkitProperties {
if(!NWJNILibLoader.loadNativeWindow("macosx")) {
throw new NativeWindowException("NativeWindow MacOSX native library load error.");
}
-
+
if( !initIDs0() ) {
throw new NativeWindowException("MacOSX: Could not initialized native stub");
- }
+ }
isInit = true;
}
}
@@ -69,27 +69,27 @@ public class OSXUtil implements ToolkitProperties {
* @see ToolkitProperties
*/
public static void shutdown() { }
-
+
/**
* Called by {@link NativeWindowFactory#initSingleton()}
* @see ToolkitProperties
*/
public static boolean requiresToolkitLock() { return false; }
-
+
/**
* Called by {@link NativeWindowFactory#initSingleton()}
* @see ToolkitProperties
*/
public static final boolean hasThreadingIssues() { return false; }
-
+
public static boolean isNSView(long object) {
return 0 != object ? isNSView0(object) : false;
}
-
+
public static boolean isNSWindow(long object) {
return 0 != object ? isNSWindow0(object) : false;
}
-
+
/**
* In case the windowOrView is top-level,
* you shall set topLevel to true where
@@ -108,7 +108,7 @@ public class OSXUtil implements ToolkitProperties {
* @param src_y
* @return the client position
*/
- public static Point GetLocationOnScreen(long windowOrView, boolean topLevel, int src_x, int src_y) {
+ public static Point GetLocationOnScreen(long windowOrView, boolean topLevel, int src_x, int src_y) {
final Point los = (Point) GetLocationOnScreen0(windowOrView, src_x, src_y);
if(topLevel) {
// top-level position -> client window position
@@ -117,11 +117,11 @@ public class OSXUtil implements ToolkitProperties {
}
return los;
}
-
+
public static Insets GetInsets(long windowOrView) {
return (Insets) GetInsets0(windowOrView);
}
-
+
public static long CreateNSWindow(int x, int y, int width, int height) {
return CreateNSWindow0(x, y, width, height);
}
@@ -134,11 +134,11 @@ public class OSXUtil implements ToolkitProperties {
public static long GetNSWindow(long nsView) {
return GetNSWindow0(nsView);
}
-
- /**
+
+ /**
* Create a CALayer suitable to act as a root CALayer.
* @see #DestroyCALayer(long)
- * @see #AddCASublayer(long, long)
+ * @see #AddCASublayer(long, long)
*/
public static long CreateCALayer(final int width, final int height) {
final long l = CreateCALayer0(width, height);
@@ -147,8 +147,8 @@ public class OSXUtil implements ToolkitProperties {
}
return l;
}
-
- /**
+
+ /**
* Attach a sub CALayer to the root CALayer
*
* Method will trigger a display
@@ -156,7 +156,7 @@ public class OSXUtil implements ToolkitProperties {
*
*
* Hence it is important that related resources are not locked if
- * they will be used for creation.
+ * they will be used for creation.
*
* @param caLayerQuirks TODO
* @see #CreateCALayer(int, int)
@@ -171,18 +171,18 @@ public class OSXUtil implements ToolkitProperties {
}
AddCASublayer0(rootCALayer, subCALayer, x, y, width, height, caLayerQuirks);
}
-
- /**
+
+ /**
* Fix root and sub CALayer position to 0/0 and size
*
* If the sub CALayer implements the Objective-C NativeWindow protocol NWDedicatedSize (e.g. JOGL's MyNSOpenGLLayer),
- * the dedicated size is passed to the layer, which propagates it appropriately.
+ * the dedicated size is passed to the layer, which propagates it appropriately.
*
*
* On OSX/Java7 our root CALayer's frame position and size gets corrupted by its NSView,
* hence we have created the NWDedicatedSize protocol.
*
- *
+ *
* @param rootCALayer the root surface layer, maybe null.
* @param subCALayer the client surface layer, maybe null.
* @param visible TODO
@@ -196,8 +196,8 @@ public class OSXUtil implements ToolkitProperties {
}
FixCALayerLayout0(rootCALayer, subCALayer, visible, x, y, width, height, caLayerQuirks);
}
-
- /**
+
+ /**
* Detach a sub CALayer from the root CALayer.
*/
public static void RemoveCASublayer(final long rootCALayer, final long subCALayer) {
@@ -209,11 +209,11 @@ public class OSXUtil implements ToolkitProperties {
}
RemoveCASublayer0(rootCALayer, subCALayer);
}
-
- /**
+
+ /**
* Destroy a CALayer.
* @see #CreateCALayer(int, int)
- */
+ */
public static void DestroyCALayer(final long caLayer) {
if(0==caLayer) {
throw new IllegalArgumentException("caLayer 0x"+Long.toHexString(caLayer));
@@ -223,13 +223,13 @@ public class OSXUtil implements ToolkitProperties {
}
DestroyCALayer0(caLayer);
}
-
+
/**
* Run on OSX UI main thread.
- *
+ *
* 'waitUntilDone' is implemented on Java site via lock/wait on {@link RunnableTask} to not freeze OSX main thread.
*
- *
+ *
* @param waitUntilDone
* @param runnable
*/
@@ -238,10 +238,10 @@ public class OSXUtil implements ToolkitProperties {
runnable.run(); // don't leave the JVM
} else {
// Utilize Java side lock/wait and simply pass the Runnable async to OSX main thread,
- // otherwise we may freeze the OSX main thread.
+ // otherwise we may freeze the OSX main thread.
Throwable throwable = null;
final Object sync = new Object();
- final RunnableTask rt = new RunnableTask( runnable, waitUntilDone ? sync : null, true, waitUntilDone ? null : System.err );
+ final RunnableTask rt = new RunnableTask( runnable, waitUntilDone ? sync : null, true, waitUntilDone ? null : System.err );
synchronized(sync) {
RunOnMainThread0(rt);
if( waitUntilDone ) {
@@ -260,7 +260,7 @@ public class OSXUtil implements ToolkitProperties {
}
}
}
-
+
/**
* Run later on ..
* @param onMain if true, run on main-thread, otherwise on the current OSX thread.
@@ -270,20 +270,20 @@ public class OSXUtil implements ToolkitProperties {
public static void RunLater(boolean onMain, Runnable runnable, int delay) {
RunLater0(onMain, new RunnableTask( runnable, null, true, System.err ), delay);
}
-
+
private static Runnable _nop = new Runnable() { public void run() {}; };
-
- /** Issues a {@link #RunOnMainThread(boolean, Runnable)} w/ an NOP runnable, while waiting until done. */
+
+ /** Issues a {@link #RunOnMainThread(boolean, Runnable)} w/ an NOP runnable, while waiting until done. */
public static void WaitUntilFinish() {
RunOnMainThread(true, _nop);
}
-
+
/**
* Run on OSX UI main thread.
- *
+ *
* 'waitUntilDone' is implemented on Java site via lock/wait on {@link FunctionTask} to not freeze OSX main thread.
*
- *
+ *
* @param waitUntilDone
* @param func
*/
@@ -292,10 +292,10 @@ public class OSXUtil implements ToolkitProperties {
return func.eval(args); // don't leave the JVM
} else {
// Utilize Java side lock/wait and simply pass the Runnable async to OSX main thread,
- // otherwise we may freeze the OSX main thread.
+ // otherwise we may freeze the OSX main thread.
Throwable throwable = null;
final Object sync = new Object();
- final FunctionTask rt = new FunctionTask( func, waitUntilDone ? sync : null, true, waitUntilDone ? null : System.err );
+ final FunctionTask rt = new FunctionTask( func, waitUntilDone ? sync : null, true, waitUntilDone ? null : System.err );
synchronized(sync) {
rt.setArgs(args);
RunOnMainThread0(rt);
@@ -316,20 +316,20 @@ public class OSXUtil implements ToolkitProperties {
return rt.getResult();
}
}
-
+
public static boolean IsMainThread() {
return IsMainThread0();
}
-
+
/** Returns the screen refresh rate in Hz. If unavailable, returns 60Hz. */
public static int GetScreenRefreshRate(int scrn_idx) {
return GetScreenRefreshRate0(scrn_idx);
}
-
+
/***
private static boolean isAWTEDTMainThreadInit = false;
private static boolean isAWTEDTMainThread;
-
+
public synchronized static boolean isAWTEDTMainThread() {
if(!isAWTEDTMainThreadInit) {
isAWTEDTMainThreadInit = true;
@@ -343,10 +343,10 @@ public class OSXUtil implements ToolkitProperties {
} else {
isAWTEDTMainThread = false;
}
- }
+ }
return isAWTEDTMainThread;
} */
-
+
private static native boolean initIDs0();
private static native boolean isNSView0(long object);
private static native boolean isNSWindow0(long object);
diff --git a/src/nativewindow/classes/jogamp/nativewindow/windows/GDIDummyUpstreamSurfaceHook.java b/src/nativewindow/classes/jogamp/nativewindow/windows/GDIDummyUpstreamSurfaceHook.java
index aa5f3dac5..e5de43c0a 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/windows/GDIDummyUpstreamSurfaceHook.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/windows/GDIDummyUpstreamSurfaceHook.java
@@ -9,31 +9,31 @@ import com.jogamp.nativewindow.UpstreamSurfaceHookMutableSize;
public class GDIDummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize {
/**
- * @param width the initial width as returned by {@link NativeSurface#getWidth()} via {@link UpstreamSurfaceHook#getWidth(ProxySurface)},
- * not the actual dummy surface width.
+ * @param width the initial width as returned by {@link NativeSurface#getWidth()} via {@link UpstreamSurfaceHook#getWidth(ProxySurface)},
+ * not the actual dummy surface width.
* The latter is platform specific and small
- * @param height the initial height as returned by {@link NativeSurface#getHeight()} via {@link UpstreamSurfaceHook#getHeight(ProxySurface)},
+ * @param height the initial height as returned by {@link NativeSurface#getHeight()} via {@link UpstreamSurfaceHook#getHeight(ProxySurface)},
* not the actual dummy surface height,
* The latter is platform specific and small
*/
public GDIDummyUpstreamSurfaceHook(int width, int height) {
super(width, height);
}
-
+
@Override
public final void create(ProxySurface s) {
final GDISurface ms = (GDISurface)s;
- if(0 == ms.getWindowHandle()) {
+ if(0 == ms.getWindowHandle()) {
final long windowHandle = GDIUtil.CreateDummyWindow(0, 0, 64, 64);
if(0 == windowHandle) {
throw new NativeWindowException("Error windowHandle 0, werr: "+GDI.GetLastError());
- }
+ }
ms.setWindowHandle(windowHandle);
- ms.addUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE );
+ ms.addUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE );
}
s.addUpstreamOptionBits(ProxySurface.OPT_UPSTREAM_WINDOW_INVISIBLE);
}
-
+
@Override
public final void destroy(ProxySurface s) {
final GDISurface ms = (GDISurface)s;
@@ -46,5 +46,5 @@ public class GDIDummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize
ms.setWindowHandle(0);
ms.clearUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE );
}
- }
+ }
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/windows/GDISurface.java b/src/nativewindow/classes/jogamp/nativewindow/windows/GDISurface.java
index cc9c9853b..3e07b2a9e 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/windows/GDISurface.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/windows/GDISurface.java
@@ -43,7 +43,7 @@ import jogamp.nativewindow.windows.GDI;
* allowing the use of HDC via lockSurface()/unlockSurface() protocol.
* The latter will get and release the HDC.
* The size via getWidth()/getHeight() is invalid.
- *
+ *
* @see ProxySurface
*/
public class GDISurface extends ProxySurfaceImpl {
@@ -65,20 +65,20 @@ public class GDISurface extends ProxySurfaceImpl {
}
@Override
- protected void invalidateImpl() {
+ protected void invalidateImpl() {
if(0 != surfaceHandle) {
throw new NativeWindowException("didn't release surface Handle: "+this);
}
windowHandle = 0;
// surfaceHandle = 0;
}
-
+
/**
* {@inheritDoc}
*
- * Actually the window handle (HWND), since the surfaceHandle (HDC) is derived
+ * Actually the window handle (HWND), since the surfaceHandle (HDC) is derived
* from it at {@link #lockSurface()}.
- *
+ *
*/
@Override
public final void setSurfaceHandle(long surfaceHandle) {
@@ -86,7 +86,7 @@ public class GDISurface extends ProxySurfaceImpl {
}
/**
- * Sets the window handle (HWND).
+ * Sets the window handle (HWND).
*/
public final void setWindowHandle(long windowHandle) {
this.windowHandle = windowHandle;
@@ -118,7 +118,7 @@ public class GDISurface extends ProxySurfaceImpl {
final protected void unlockSurfaceImpl() {
if (0 != surfaceHandle) {
if(0 == GDI.ReleaseDC(windowHandle, surfaceHandle)) {
- throw new NativeWindowException("DC not released: "+this+", isWindow "+GDI.IsWindow(windowHandle)+", werr "+GDI.GetLastError()+", thread: "+Thread.currentThread().getName());
+ throw new NativeWindowException("DC not released: "+this+", isWindow "+GDI.IsWindow(windowHandle)+", werr "+GDI.GetLastError()+", thread: "+Thread.currentThread().getName());
}
surfaceHandle=0;
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java b/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java
index 00741a328..db61b1efd 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java
@@ -37,11 +37,11 @@ import jogamp.nativewindow.ToolkitProperties;
public class GDIUtil implements ToolkitProperties {
private static final boolean DEBUG = Debug.debug("GDIUtil");
-
+
private static final String dummyWindowClassNameBase = "_dummyWindow_clazz" ;
private static RegisteredClassFactory dummyWindowClassFactory;
private static boolean isInit = false;
-
+
/**
* Called by {@link NativeWindowFactory#initSingleton()}
* @see ToolkitProperties
@@ -59,42 +59,42 @@ public class GDIUtil implements ToolkitProperties {
if( !initIDs0() ) {
throw new NativeWindowException("GDI: Could not initialized native stub");
}
- dummyWindowClassFactory = new RegisteredClassFactory(dummyWindowClassNameBase, getDummyWndProc0());
+ dummyWindowClassFactory = new RegisteredClassFactory(dummyWindowClassNameBase, getDummyWndProc0());
isInit = true;
}
}
}
}
-
+
/**
* Called by {@link NativeWindowFactory#shutdown()}
* @see ToolkitProperties
*/
- public static void shutdown() {
+ public static void shutdown() {
}
-
+
/**
* Called by {@link NativeWindowFactory#initSingleton()}
* @see ToolkitProperties
*/
public static boolean requiresToolkitLock() { return false; }
-
+
/**
* Called by {@link NativeWindowFactory#initSingleton()}
* @see ToolkitProperties
*/
public static final boolean hasThreadingIssues() { return false; }
-
+
private static RegisteredClass dummyWindowClass = null;
private static Object dummyWindowSync = new Object();
-
+
public static long CreateDummyWindow(int x, int y, int width, int height) {
synchronized(dummyWindowSync) {
dummyWindowClass = dummyWindowClassFactory.getSharedClass();
return CreateDummyWindow0(dummyWindowClass.getHInstance(), dummyWindowClass.getName(), dummyWindowClass.getName(), x, y, width, height);
}
}
-
+
public static boolean DestroyDummyWindow(long hwnd) {
boolean res;
synchronized(dummyWindowSync) {
@@ -106,27 +106,27 @@ public class GDIUtil implements ToolkitProperties {
}
return res;
}
-
+
public static Point GetRelativeLocation(long src_win, long dest_win, int src_x, int src_y) {
return (Point) GetRelativeLocation0(src_win, dest_win, src_x, src_y);
}
-
+
public static boolean IsUndecorated(long win) {
return IsUndecorated0(win);
}
-
+
public static boolean IsChild(long win) {
return IsChild0(win);
}
-
+
public static native boolean CreateWindowClass(long hInstance, String clazzName, long wndProc);
public static native boolean DestroyWindowClass(long hInstance, String className);
-
+
private static native boolean initIDs0();
- private static native long getDummyWndProc0();
+ private static native long getDummyWndProc0();
private static native Object GetRelativeLocation0(long src_win, long dest_win, int src_x, int src_y);
private static native boolean IsChild0(long win);
private static native boolean IsUndecorated0(long win);
-
- static native long CreateDummyWindow0(long hInstance, String className, String windowName, int x, int y, int width, int height);
+
+ static native long CreateDummyWindow0(long hInstance, String className, String windowName, int x, int y, int width, int height);
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClass.java b/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClass.java
index 949f5d06d..976693e3a 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClass.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClass.java
@@ -39,7 +39,7 @@ public class RegisteredClass {
/** Application handle, same as {@link RegisteredClassFactory#getHInstance()}. */
public final long getHInstance() { return hInstance; }
-
+
/** Unique Window Class Name */
public final String getName() { return className; }
diff --git a/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClassFactory.java b/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClassFactory.java
index 0280b0df7..e033a9f66 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClassFactory.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClassFactory.java
@@ -34,9 +34,9 @@ import javax.media.nativewindow.NativeWindowException;
public class RegisteredClassFactory {
private static final boolean DEBUG = Debug.debug("RegisteredClass");
- private static final ArrayList registeredFactories;
+ private static final ArrayList registeredFactories;
private static final long hInstance;
-
+
static {
hInstance = GDI.GetApplicationHandle();
if( 0 == hInstance ) {
@@ -44,7 +44,7 @@ public class RegisteredClassFactory {
}
registeredFactories = new ArrayList();
}
-
+
private String classBaseName;
private long wndProc;
@@ -52,9 +52,9 @@ public class RegisteredClassFactory {
private int classIter = 0;
private int sharedRefCount = 0;
private final Object sync = new Object();
-
+
/**
- * Release the {@link RegisteredClass} of all {@link RegisteredClassFactory}.
+ * Release the {@link RegisteredClass} of all {@link RegisteredClassFactory}.
*/
public static void shutdownSharedClasses() {
synchronized(registeredFactories) {
@@ -65,7 +65,7 @@ public class RegisteredClassFactory {
GDIUtil.DestroyWindowClass(rcf.sharedClass.getHInstance(), rcf.sharedClass.getName());
rcf.sharedClass = null;
rcf.sharedRefCount = 0;
- rcf.classIter = 0;
+ rcf.classIter = 0;
if(DEBUG) {
System.err.println("RegisteredClassFactory #"+j+"/"+registeredFactories.size()+" shutdownSharedClasses : "+rcf.sharedClass);
}
@@ -74,7 +74,7 @@ public class RegisteredClassFactory {
}
}
}
-
+
/** Application handle. */
public static long getHInstance() { return hInstance; }
@@ -94,7 +94,7 @@ public class RegisteredClassFactory {
}
String clazzName = null;
boolean registered = false;
- final int classIterMark = classIter - 1;
+ final int classIterMark = classIter - 1;
while ( !registered && classIterMark != classIter ) {
// Retry with next clazz name, this could happen if more than one JVM is running
clazzName = classBaseName + classIter;
diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/X11DummyUpstreamSurfaceHook.java b/src/nativewindow/classes/jogamp/nativewindow/x11/X11DummyUpstreamSurfaceHook.java
index 827862002..2c8ef642c 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/x11/X11DummyUpstreamSurfaceHook.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/x11/X11DummyUpstreamSurfaceHook.java
@@ -14,17 +14,17 @@ import com.jogamp.nativewindow.x11.X11GraphicsScreen;
public class X11DummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize {
/**
- * @param width the initial width as returned by {@link NativeSurface#getWidth()} via {@link UpstreamSurfaceHook#getWidth(ProxySurface)},
- * not the actual dummy surface width.
+ * @param width the initial width as returned by {@link NativeSurface#getWidth()} via {@link UpstreamSurfaceHook#getWidth(ProxySurface)},
+ * not the actual dummy surface width.
* The latter is platform specific and small
- * @param height the initial height as returned by {@link NativeSurface#getHeight()} via {@link UpstreamSurfaceHook#getHeight(ProxySurface)},
+ * @param height the initial height as returned by {@link NativeSurface#getHeight()} via {@link UpstreamSurfaceHook#getHeight(ProxySurface)},
* not the actual dummy surface height,
* The latter is platform specific and small
*/
public X11DummyUpstreamSurfaceHook(int width, int height) {
super(width, height);
}
-
+
@Override
public final void create(ProxySurface s) {
final X11GraphicsConfiguration cfg = (X11GraphicsConfiguration) s.getGraphicsConfiguration();
@@ -42,14 +42,14 @@ public class X11DummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize
throw new NativeWindowException("Creating dummy window failed w/ "+cfg);
}
s.setSurfaceHandle(windowHandle);
- s.addUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE );
+ s.addUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE );
}
s.addUpstreamOptionBits(ProxySurface.OPT_UPSTREAM_WINDOW_INVISIBLE);
} finally {
device.unlock();
}
}
-
+
@Override
public final void destroy(ProxySurface s) {
if( s.containsUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ) ) {
@@ -59,7 +59,7 @@ public class X11DummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize
}
device.lock();
try {
- X11Lib.DestroyWindow(device.getHandle(), s.getSurfaceHandle());
+ X11Lib.DestroyWindow(device.getHandle(), s.getSurfaceHandle());
s.setSurfaceHandle(0);
s.clearUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE );
} finally {
diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/X11GraphicsConfigurationFactory.java b/src/nativewindow/classes/jogamp/nativewindow/x11/X11GraphicsConfigurationFactory.java
index b11dd1df1..d6e7b5970 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/x11/X11GraphicsConfigurationFactory.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/x11/X11GraphicsConfigurationFactory.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -47,10 +47,10 @@ import com.jogamp.nativewindow.x11.X11GraphicsScreen;
public class X11GraphicsConfigurationFactory extends GraphicsConfigurationFactory {
public static void registerFactory() {
GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.x11.X11GraphicsDevice.class, CapabilitiesImmutable.class, new X11GraphicsConfigurationFactory());
- }
+ }
private X11GraphicsConfigurationFactory() {
}
-
+
protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl(
CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested, CapabilitiesChooser chooser, AbstractGraphicsScreen screen, int nativeVisualID)
throws IllegalArgumentException, NativeWindowException {
@@ -109,7 +109,7 @@ public class X11GraphicsConfigurationFactory extends GraphicsConfigurationFactor
XVisualInfo best=null;
int rdepth = capabilities.getRedBits() + capabilities.getGreenBits() + capabilities.getBlueBits() + capabilities.getAlphaBits();
for (int i = 0; vinfos!=null && i < num[0]; i++) {
- if ( best == null ||
+ if ( best == null ||
best.getDepth() < vinfos[i].getDepth() )
{
best = vinfos[i];
diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java
index 78e432b7f..6431fb3f5 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -54,16 +54,16 @@ import com.jogamp.nativewindow.x11.X11GraphicsDevice;
*/
public class X11Util implements ToolkitProperties {
public static final boolean DEBUG = Debug.debug("X11Util");
-
- /**
+
+ /**
* See Bug 515 - https://jogamp.org/bugzilla/show_bug.cgi?id=515
- *
+ *
* It is observed that ATI X11 drivers, eg.
- *
+ *
*
fglrx 8.78.6,
*
fglrx 11.08/8.881 and
*
fglrx 11.11/8.911
- *
+ *
* are quite sensitive to multiple Display connections.
*
*
@@ -81,11 +81,11 @@ public class X11Util implements ToolkitProperties {
*
*
* With ATI X11 drivers all connections must be closed at JVM shutdown,
- * otherwise a SIGSEGV (after JVM safepoint) will be caused.
+ * otherwise a SIGSEGV (after JVM safepoint) will be caused.
*
*/
public static final boolean ATI_HAS_XCLOSEDISPLAY_BUG = !Debug.isPropertyDefined("nativewindow.debug.X11Util.ATI_HAS_NO_XCLOSEDISPLAY_BUG", true);
-
+
/** See {@link #ATI_HAS_XCLOSEDISPLAY_BUG}. */
public static final boolean HAS_XCLOSEDISPLAY_BUG = Debug.isPropertyDefined("nativewindow.debug.X11Util.HAS_XCLOSEDISPLAY_BUG", true);
@@ -105,7 +105,7 @@ public class X11Util implements ToolkitProperties {
private static final Object setX11ErrorHandlerLock = new Object();
private static final String X11_EXTENSION_ATIFGLRXDRI = "ATIFGLRXDRI";
private static final String X11_EXTENSION_ATIFGLEXTENSION = "ATIFGLEXTENSION";
-
+
/**
* Called by {@link NativeWindowFactory#initSingleton()}
* @see ToolkitProperties
@@ -121,15 +121,15 @@ public class X11Util implements ToolkitProperties {
if(!NWJNILibLoader.loadNativeWindow("x11")) {
throw new NativeWindowException("NativeWindow X11 native library load error.");
}
-
+
final boolean isInitOK = initialize0( XERROR_STACKDUMP );
-
+
final boolean hasX11_EXTENSION_ATIFGLRXDRI, hasX11_EXTENSION_ATIFGLEXTENSION;
final long dpy = X11Lib.XOpenDisplay(PropertyAccess.getProperty("nativewindow.x11.display.default", true));
if(0 != dpy) {
if(XSYNC_ENABLED) {
X11Lib.XSynchronize(dpy, true);
- }
+ }
try {
nullDisplayName = X11Lib.XDisplayString(dpy);
hasX11_EXTENSION_ATIFGLRXDRI = X11Lib.QueryExtension(dpy, X11_EXTENSION_ATIFGLRXDRI);
@@ -147,7 +147,7 @@ public class X11Util implements ToolkitProperties {
if ( !markAllDisplaysUnclosable ) {
markAllDisplaysUnclosable = ( ATI_HAS_XCLOSEDISPLAY_BUG && isATIFGLRX ) || HAS_XCLOSEDISPLAY_BUG;
}
-
+
if(DEBUG) {
System.err.println("X11Util.initSingleton(): OK "+isInitOK+"]"+
",\n\t X11 Display(NULL) <"+nullDisplayName+">"+
@@ -164,17 +164,17 @@ public class X11Util implements ToolkitProperties {
}
}
}
-
+
// not exactly thread safe, but good enough for our purpose,
// which is to tag a NamedDisplay uncloseable after creation.
- private static Object globalLock = new Object();
+ private static Object globalLock = new Object();
private static LongObjectHashMap openDisplayMap = new LongObjectHashMap(); // handle -> name
private static List openDisplayList = new ArrayList(); // open, no close attempt
private static List reusableDisplayList = new ArrayList(); // close attempt, marked uncloseable, for reuse
private static List pendingDisplayList = new ArrayList(); // all open (close attempt or reusable) in creation order
private static final HashMap displayXineramaEnabledMap = new HashMap();
-
- /**
+
+ /**
* Cleanup resources.
*
* Called by {@link NativeWindowFactory#shutdown()}
@@ -184,7 +184,7 @@ public class X11Util implements ToolkitProperties {
public static void shutdown() {
if(isInit) {
synchronized(X11Util.class) {
- if(isInit) {
+ if(isInit) {
final boolean isJVMShuttingDown = NativeWindowFactory.isJVMShuttingDown() ;
if( DEBUG ||
( ( openDisplayMap.size() > 0 || reusableDisplayList.size() > 0 || pendingDisplayList.size() > 0 ) &&
@@ -207,9 +207,9 @@ public class X11Util implements ToolkitProperties {
}
}
}
-
- // Only at JVM shutdown time, since AWT impl. seems to
- // dislike closing of X11 Display's (w/ ATI driver).
+
+ // Only at JVM shutdown time, since AWT impl. seems to
+ // dislike closing of X11 Display's (w/ ATI driver).
if( isJVMShuttingDown ) {
synchronized(globalLock) {
isInit = false;
@@ -226,7 +226,7 @@ public class X11Util implements ToolkitProperties {
}
}
}
-
+
/**
* Called by {@link NativeWindowFactory#initSingleton()}
* @see ToolkitProperties
@@ -234,15 +234,15 @@ public class X11Util implements ToolkitProperties {
public static final boolean requiresToolkitLock() {
return true; // JAWT locking: yes, instead of native X11 locking w use a recursive lock per display connection.
}
-
+
/**
* Called by {@link NativeWindowFactory#initSingleton()}
* @see ToolkitProperties
*/
public static final boolean hasThreadingIssues() {
- return hasThreadingIssues; // JOGL impl. may utilize special locking "somewhere"
+ return hasThreadingIssues; // JOGL impl. may utilize special locking "somewhere"
}
-
+
public static void setX11ErrorHandler(boolean onoff, boolean quiet) {
synchronized(setX11ErrorHandlerLock) {
setX11ErrorHandler0(onoff, quiet);
@@ -271,7 +271,7 @@ public class X11Util implements ToolkitProperties {
public static boolean getMarkAllDisplaysUnclosable() {
return markAllDisplaysUnclosable;
}
-
+
private X11Util() {}
public static class NamedDisplay {
@@ -303,7 +303,7 @@ public class X11Util implements ToolkitProperties {
public final int hashCode() {
return hash32;
}
-
+
public final boolean equals(Object obj) {
if(this == obj) { return true; }
if(obj instanceof NamedDisplay) {
@@ -311,10 +311,10 @@ public class X11Util implements ToolkitProperties {
}
return false;
}
-
+
public final void addRef() { refCount++; }
public final void removeRef() { refCount--; }
-
+
public final String getName() { return name; }
public final long getHandle() { return handle; }
public final int getRefCount() { return refCount; }
@@ -365,7 +365,7 @@ public class X11Util implements ToolkitProperties {
return openDisplayList.size();
}
}
-
+
public static void dumpOpenDisplayConnections() {
synchronized(globalLock) {
System.err.println("X11Util: Open X11 Display Connections: "+openDisplayList.size());
@@ -381,7 +381,7 @@ public class X11Util implements ToolkitProperties {
}
}
}
-
+
public static int getReusableDisplayConnectionNumber() {
synchronized(globalLock) {
return reusableDisplayList.size();
@@ -439,7 +439,7 @@ public class X11Util implements ToolkitProperties {
NamedDisplay namedDpy = null;
name = validateDisplayName(name);
boolean reused = false;
-
+
synchronized(globalLock) {
for(int i=0; i
- * If usrEDTUtil is null,
+ * If usrEDTUtil is null,
* the device's default EDTUtil is created and used.
*
*
- * If a previous one exists and it differs from usrEDTUtil,
+ * If a previous one exists and it differs from usrEDTUtil,
* it's being stopped, wait-until-idle.
*
*
@@ -167,7 +167,7 @@ public abstract class Display {
*
*/
public abstract EDTUtil setEDTUtil(EDTUtil usrEDTUtil);
-
+
public abstract EDTUtil getEDTUtil();
/**
@@ -176,7 +176,7 @@ public abstract class Display {
public abstract boolean isEDTRunning();
public abstract void dispatchMessages();
-
+
// Global Displays
protected static final ArrayList> displayList = new ArrayList>();
protected static int displaysActive = 0;
@@ -193,12 +193,12 @@ public abstract class Display {
}
/**
- *
+ *
* @param type
* @param name
* @param fromIndex start index, then increasing until found or end of list
- * @paran shared if true, only shared instances are found, otherwise also exclusive
- * @return
+ * @paran shared if true, only shared instances are found, otherwise also exclusive
+ * @return
*/
public static Display getFirstDisplayOf(String type, String name, int fromIndex, boolean shared) {
return getDisplayOfImpl(type, name, fromIndex, 1, shared);
@@ -209,7 +209,7 @@ public abstract class Display {
* @param type
* @param name
* @param fromIndex start index, then decreasing until found or end of list. -1 is interpreted as size - 1.
- * @paran shared if true, only shared instances are found, otherwise also exclusive
+ * @paran shared if true, only shared instances are found, otherwise also exclusive
* @return
*/
public static Display getLastDisplayOf(String type, String name, int fromIndex, boolean shared) {
@@ -231,7 +231,7 @@ public abstract class Display {
} else {
if( display.getType().equals(type) &&
display.getName().equals(name) &&
- ( !shared || shared && !display.isExclusive() )
+ ( !shared || shared && !display.isExclusive() )
) {
return display;
}
@@ -241,7 +241,7 @@ public abstract class Display {
}
return null;
}
-
+
protected static void addDisplay2List(Display display) {
synchronized(displayList) {
// GC before add
@@ -256,7 +256,7 @@ public abstract class Display {
displayList.add(new WeakReference(display));
}
}
-
+
/** Returns the global display collection */
public static Collection getAllDisplays() {
ArrayList list;
diff --git a/src/newt/classes/com/jogamp/newt/MonitorDevice.java b/src/newt/classes/com/jogamp/newt/MonitorDevice.java
index 42ac34240..625a7b39f 100644
--- a/src/newt/classes/com/jogamp/newt/MonitorDevice.java
+++ b/src/newt/classes/com/jogamp/newt/MonitorDevice.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.newt;
import java.util.List;
@@ -36,7 +36,7 @@ import javax.media.nativewindow.util.RectangleImmutable;
import com.jogamp.common.util.ArrayHashSet;
-/**
+/**
* Visual output device, i.e. a CRT, LED ..consisting of it's components:
*
*
Immutable
@@ -55,7 +55,7 @@ import com.jogamp.common.util.ArrayHashSet;
*/
public abstract class MonitorDevice {
protected final Screen screen; // backref
- protected final int nativeId; // unique monitor device ID
+ protected final int nativeId; // unique monitor device ID
protected final DimensionImmutable sizeMM; // in [mm]
protected final MonitorMode originalMode;
protected final ArrayHashSet supportedModes; // FIXME: May need to support mutable mode, i.e. adding modes on the fly!
@@ -73,14 +73,14 @@ public abstract class MonitorDevice {
this.viewport = viewport;
this.modeChanged = false;
}
-
+
/** Returns the {@link Screen} owning this monitor. */
public final Screen getScreen() {
return screen;
}
-
+
/**
- * Tests equality of two MonitorDevice objects
+ * Tests equality of two MonitorDevice objects
* by evaluating equality of it's components:
*
*
nativeID
@@ -105,10 +105,10 @@ public abstract class MonitorDevice {
public final int hashCode() {
return nativeId;
}
-
+
/** @return the immutable unique native Id of this monitor device. */
public final int getId() { return nativeId; }
-
+
/**
* @return the immutable monitor size in millimeters.
*/
@@ -140,11 +140,11 @@ public abstract class MonitorDevice {
return supportedModes.getData();
}
- /** Returns the {@link RectangleImmutable rectangular} portion of the rotated virtual {@link Screen} size represented by this monitor. */
+ /** Returns the {@link RectangleImmutable rectangular} portion of the rotated virtual {@link Screen} size represented by this monitor. */
public final RectangleImmutable getViewport() {
return viewport;
}
-
+
/** Returns true if given coordinates are contained by this {@link #getViewport() viewport}, otherwise false. */
public final boolean contains(int x, int y) {
return x >= viewport.getX() &&
@@ -152,8 +152,8 @@ public abstract class MonitorDevice {
y >= viewport.getY() &&
y < viewport.getY() + viewport.getHeight() ;
}
-
- /**
+
+ /**
* Returns the coverage of given rectangle w/ this this {@link #getViewport() viewport}, i.e. between 0.0 and 1.0.
*
* Coverage is computed by:
@@ -161,12 +161,12 @@ public abstract class MonitorDevice {
* isect = viewport.intersection(r);
* coverage = area( isect ) / area( viewport ) ;
*
- *
+ *
*/
public final float coverage(RectangleImmutable r) {
return viewport.coverage(r);
}
-
+
/**
* Returns the union of the given monitor's {@link #getViewport() viewport}.
* @param result storage for result, will be returned
@@ -186,14 +186,14 @@ public abstract class MonitorDevice {
result.set(x1, y1, x2 - x1, y2 - y1);
return result;
}
-
+
public final boolean isOriginalMode() {
return currentMode.hashCode() == originalMode.hashCode();
}
-
+
/**
* Returns true if the {@link MonitorMode}
- * has been changed programmatic via this API only, otherwise false.
+ * has been changed programmatic via this API only, otherwise false.
*
* Note: We cannot guarantee that we won't interfere w/ another running
* application's screen mode change or vice versa.
@@ -202,7 +202,7 @@ public abstract class MonitorDevice {
public final boolean isModeChangedByUs() {
return modeChanged && !isOriginalMode();
}
-
+
/**
* Returns the cached current {@link MonitorMode} w/o native query.
*
@@ -212,7 +212,7 @@ public abstract class MonitorDevice {
public final MonitorMode getCurrentMode() {
return currentMode;
}
-
+
/**
* Returns the current {@link MonitorMode} resulting from a native query.
*
@@ -79,7 +79,7 @@ import com.jogamp.newt.util.MonitorModeUtil;
// Pick the monitor:
// Either the one used by a window ..
MonitorDevice monitor = window.getMainMonitor();
-
+
// Or arbitrary from the list ..
List allMonitor = getMonitorDevices();
MonitorDevice monitor = allMonitor.get(0);
@@ -87,7 +87,7 @@ import com.jogamp.newt.util.MonitorModeUtil;
// Current and original modes ..
MonitorMode mmCurrent = monitor.queryCurrentMode();
MonitorMode mmOrig = monitor.getOriginalMode();
-
+
// Target resolution
Dimension res = new Dimension(800, 600);
@@ -102,7 +102,7 @@ import com.jogamp.newt.util.MonitorModeUtil;
monitorModes = MonitorModeUtil.filterByFlags(monitorModes, 0); // no interlace, double-scan etc
monitorModes = MonitorModeUtil.filterByRotation(monitorModes, rot);
monitorModes = MonitorModeUtil.filterByResolution(monitorModes, res);
- monitorModes = MonitorModeUtil.filterByRate(monitorModes, freq);
+ monitorModes = MonitorModeUtil.filterByRate(monitorModes, freq);
monitorModes = MonitorModeUtil.getHighestAvailableBpp(monitorModes);
// pick 1st one and set to current ..
@@ -111,20 +111,20 @@ import com.jogamp.newt.util.MonitorModeUtil;
*
*/
public class MonitorMode implements Comparable {
-
+
/** Comparator for 2 {@link MonitorMode}s, following comparison order as described in {@link MonitorMode#compareTo(MonitorMode)}, returning the ascending order. */
public static final Comparator monitorModeComparator = new Comparator() {
public int compare(MonitorMode mm1, MonitorMode mm2) {
return mm1.compareTo(mm2);
} };
-
+
/** Comparator for 2 {@link MonitorMode}s, following comparison order as described in {@link MonitorMode#compareTo(MonitorMode)}, returning the descending order. */
public static final Comparator monitorModeComparatorInv = new Comparator() {
public int compare(MonitorMode mm1, MonitorMode mm2) {
return mm2.compareTo(mm1);
} };
-
- /**
+
+ /**
* Immutable surfaceSize, flags and refreshRate Class, consisting of it's read only components:
*
*
nativeId
@@ -141,7 +141,7 @@ public class MonitorMode implements Comparable {
/** Vertical refresh rate */
public final float refreshRate;
public final int hashCode;
-
+
public SizeAndRRate(SurfaceSize surfaceSize, float refreshRate, int flags) {
if(null==surfaceSize) {
throw new IllegalArgumentException("surfaceSize must be set ("+surfaceSize+")");
@@ -151,11 +151,11 @@ public class MonitorMode implements Comparable {
this.refreshRate=refreshRate;
this.hashCode = getHashCode();
}
-
+
private final static String STR_INTERLACE = "Interlace";
private final static String STR_DOUBLESCAN = "DoubleScan";
private final static String STR_SEP = ", ";
-
+
public static final StringBuilder flags2String(int flags) {
final StringBuilder sb = new StringBuilder();
boolean sp = false;
@@ -175,11 +175,11 @@ public class MonitorMode implements Comparable {
public final String toString() {
return new String(surfaceSize+" @ "+refreshRate+" Hz, flags ["+flags2String(flags).toString()+"]");
}
-
+
/**
*
* Compares {@link SurfaceSize#compareTo(SurfaceSize) surfaceSize} 1st, then {@link #flags}, then {@link #refreshRate}.
- *
+ *
*
* Flags are compared as follows:
*
@@ -196,7 +196,7 @@ public class MonitorMode implements Comparable {
final int rssz = surfaceSize.compareTo(sszr.surfaceSize);
if( 0 != rssz ) {
return rssz;
- }
+ }
final int tflags = 0 == flags ? Integer.MAX_VALUE : flags; // normalize NONE
final int xflags = 0 == sszr.flags ? Integer.MAX_VALUE : sszr.flags; // normalize NONE
if( tflags == xflags ) {
@@ -218,9 +218,9 @@ public class MonitorMode implements Comparable {
return 0;
}
}
-
+
/**
- * Tests equality of two {@link SizeAndRRate} objects
+ * Tests equality of two {@link SizeAndRRate} objects
* by evaluating equality of it's components:
*
*
surfaceSize
@@ -238,7 +238,7 @@ public class MonitorMode implements Comparable {
}
return false;
}
-
+
/**
* Returns a combined hash code of it's elements:
*
@@ -249,16 +249,16 @@ public class MonitorMode implements Comparable {
*/
public final int hashCode() {
return hashCode;
- }
+ }
private final int getHashCode() {
// 31 * x == (x << 5) - x
int hash = 31 + surfaceSize.hashCode();
hash = ((hash << 5) - hash) + flags;
hash = ((hash << 5) - hash) + (int)(refreshRate*100.0f);
return hash;
- }
+ }
}
-
+
/** zero rotation, compared to normal settings */
public static final int ROTATE_0 = 0;
@@ -270,15 +270,15 @@ public class MonitorMode implements Comparable {
/** 270 degrees CCW rotation */
public static final int ROTATE_270 = 270;
-
+
/** Frame is split into two fields. See {@link #getFlags()}. */
public static final int FLAG_INTERLACE = 1 << 0;
-
+
/** Lines are doubled. See {@link #getFlags()}. */
public static final int FLAG_DOUBLESCAN = 1 << 1;
/** The immutable native Id of this instance, which may not be unique. */
- private final int nativeId;
+ private final int nativeId;
private final SizeAndRRate sizeAndRRate;
private final int rotation;
private final int hashCode;
@@ -301,7 +301,7 @@ public class MonitorMode implements Comparable {
this.rotation = rotation;
this.hashCode = getHashCode();
}
-
+
/**
* Creates a user instance w/o {@link #getId() identity} to filter our matching modes w/ identity.
*
@@ -314,16 +314,16 @@ public class MonitorMode implements Comparable {
*/
public MonitorMode(SurfaceSize surfaceSize, float refreshRate, int flags, int rotation) {
this(0, new SizeAndRRate(surfaceSize, refreshRate, flags), rotation);
- }
+ }
/** @return the immutable native Id of this mode, may not be unique, may be 0. */
public final int getId() { return nativeId; }
-
+
/** Returns the surfaceSize and refreshRate instance. */
- public final SizeAndRRate getSizeAndRRate() {
+ public final SizeAndRRate getSizeAndRRate() {
return sizeAndRRate;
}
-
+
/** Returns the unrotated {@link SurfaceSize} */
public final SurfaceSize getSurfaceSize() {
return sizeAndRRate.surfaceSize;
@@ -338,23 +338,23 @@ public class MonitorMode implements Comparable {
public final int getFlags() {
return sizeAndRRate.flags;
}
-
+
/** Returns the CCW rotation of this mode */
public final int getRotation() {
return rotation;
}
-
- /** Returns the rotated screen width,
+
+ /** Returns the rotated screen width,
* derived from getMonitorMode().getSurfaceSize().getResolution()
- * and getRotation()
+ * and getRotation()
*/
public final int getRotatedWidth() {
return getRotatedWH(true);
}
-
- /** Returns the rotated screen height,
+
+ /** Returns the rotated screen height,
* derived from getMonitorMode().getSurfaceSize().getResolution()
- * and getRotation()
+ * and getRotation()
*/
public final int getRotatedHeight() {
return getRotatedWH(false);
@@ -367,9 +367,9 @@ public class MonitorMode implements Comparable {
/**
*
- * Rotation is compared inverted, i.e. 360 - rotation,
+ * Rotation is compared inverted, i.e. 360 - rotation,
* so the lowest rotation reflects a higher value.
*
*
@@ -380,7 +380,7 @@ public class MonitorMode implements Comparable {
*
flags
*
refresh rate
*
rotation
- *
+ *
*
* {@inheritDoc}
*/
@@ -399,9 +399,9 @@ public class MonitorMode implements Comparable {
}
return 0;
}
-
+
/**
- * Tests equality of two {@link MonitorMode} objects
+ * Tests equality of two {@link MonitorMode} objects
* by evaluating equality of it's components:
*
*
nativeId
@@ -438,7 +438,7 @@ public class MonitorMode implements Comparable {
hash = ((hash << 5) - hash) + getRotation();
return hash;
}
-
+
private final int getRotatedWH(boolean width) {
final DimensionImmutable d = sizeAndRRate.surfaceSize.getResolution();
final boolean swap = MonitorMode.ROTATE_90 == rotation || MonitorMode.ROTATE_270 == rotation ;
@@ -446,5 +446,5 @@ public class MonitorMode implements Comparable {
return d.getHeight();
}
return d.getWidth();
- }
+ }
}
diff --git a/src/newt/classes/com/jogamp/newt/NewtFactory.java b/src/newt/classes/com/jogamp/newt/NewtFactory.java
index e66b2f624..7116877a3 100644
--- a/src/newt/classes/com/jogamp/newt/NewtFactory.java
+++ b/src/newt/classes/com/jogamp/newt/NewtFactory.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package com.jogamp.newt;
@@ -53,16 +53,16 @@ public class NewtFactory {
public static final boolean DEBUG_IMPLEMENTATION = Debug.debug("Window");
public static final String DRIVER_DEFAULT_ROOT_PACKAGE = "jogamp.newt.driver";
-
+
static {
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
NativeWindowFactory.initSingleton(); // last resort ..
-
+
// Work-around for initialization order problems on Mac OS X
// between native Newt and (apparently) Fmod
WindowImpl.init(NativeWindowFactory.getNativeWindowType(true));
-
+
return null;
} } );
}
@@ -75,7 +75,7 @@ public class NewtFactory {
clazzName = DRIVER_DEFAULT_ROOT_PACKAGE + packageName + "." + classBaseName ;
} else {
clazzName = packageName + "." + classBaseName ;
- }
+ }
try {
clazz = Class.forName(clazzName);
} catch (Throwable t) {
@@ -90,7 +90,7 @@ public class NewtFactory {
private static boolean useEDT = true;
- /**
+ /**
* Toggles the usage of an EventDispatchThread while creating a Display.
* The default is enabled.
* The EventDispatchThread is thread local to the Display instance.
@@ -108,7 +108,7 @@ public class NewtFactory {
* Native creation is lazily done at usage, ie. {@link Display#addReference()}.
*
*
- * An already existing display connection of the same name will be reused.
+ * An already existing display connection of the same name will be reused.
*
* @param name the display connection name which is a technical platform specific detail,
* see {@link AbstractGraphicsDevice#getConnection()}. Use null for default.
diff --git a/src/newt/classes/com/jogamp/newt/NewtVersion.java b/src/newt/classes/com/jogamp/newt/NewtVersion.java
index 9adb7aac5..e70d63f88 100644
--- a/src/newt/classes/com/jogamp/newt/NewtVersion.java
+++ b/src/newt/classes/com/jogamp/newt/NewtVersion.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.newt;
import com.jogamp.common.GlueGenVersion;
diff --git a/src/newt/classes/com/jogamp/newt/Screen.java b/src/newt/classes/com/jogamp/newt/Screen.java
index f56ee344b..1274b3459 100644
--- a/src/newt/classes/com/jogamp/newt/Screen.java
+++ b/src/newt/classes/com/jogamp/newt/Screen.java
@@ -39,7 +39,7 @@ import javax.media.nativewindow.NativeWindowException;
import javax.media.nativewindow.util.Rectangle;
import javax.media.nativewindow.util.RectangleImmutable;
-/**
+/**
* A screen may span multiple {@link MonitorDevice}s representing their combined virtual size.
*/
public abstract class Screen {
@@ -102,7 +102,7 @@ public abstract class Screen {
/**
* See {@link Display#addReference()}
- *
+ *
* @return number of references post operation
* @throws NativeWindowException if the native creation failed.
* @see #removeReference()
@@ -113,7 +113,7 @@ public abstract class Screen {
/**
* See {@link Display#removeReference()}
- *
+ *
* @return number of references post operation
* @see #addReference()
* @see #setDestroyWhenUnused(boolean)
@@ -132,12 +132,12 @@ public abstract class Screen {
* @return the x position of the virtual viewport's top-left origin.
*/
public abstract int getX();
-
+
/**
* @return the y position of the virtual viewport's top-left origin.
*/
public abstract int getY();
-
+
/**
* @return the rotated virtual viewport's width.
*/
@@ -152,19 +152,19 @@ public abstract class Screen {
* @return the rotated virtual viewport, i.e. origin and size.
*/
public abstract RectangleImmutable getViewport();
-
+
/**
* @return the associated Display
*/
public abstract Display getDisplay();
- /**
+ /**
* @return The screen fully qualified Screen name,
* which is a key of {@link com.jogamp.newt.Display#getFQName()} + {@link #getIndex()}.
*/
public abstract String getFQName();
- /**
+ /**
* Return a list of all {@link MonitorMode}s for all {@link MonitorDevice}s.
*
* The list is ordered in descending order,
@@ -173,23 +173,23 @@ public abstract class Screen {
*/
public abstract List getMonitorModes();
- /**
+ /**
* Return a list of available {@link MonitorDevice}s.
*/
public abstract List getMonitorDevices();
/**
- * Returns the {@link MonitorDevice} which {@link MonitorDevice#getViewport() viewport}
+ * Returns the {@link MonitorDevice} which {@link MonitorDevice#getViewport() viewport}
* {@link MonitorDevice#coverage(RectangleImmutable) covers} the given rectangle the most.
*
- * If no coverage is detected the first {@link MonitorDevice} is returned.
+ * If no coverage is detected the first {@link MonitorDevice} is returned.
*
*/
public final MonitorDevice getMainMonitor(RectangleImmutable r) {
MonitorDevice res = null;
float maxCoverage = Float.MIN_VALUE;
final List monitors = getMonitorDevices();
- for(int i=monitors.size()-1; i>=0; i--) {
+ for(int i=monitors.size()-1; i>=0; i--) {
final MonitorDevice monitor = monitors.get(i);
final float coverage = monitor.coverage(r);
if( coverage > maxCoverage ) {
@@ -207,14 +207,14 @@ public abstract class Screen {
* Returns the union of all monitor's {@link MonitorDevice#getViewport() viewport}.
*
* Should be equal to {@link #getX()}, {@link #getY()}, {@link #getWidth()} and {@link #getHeight()},
- * however, some native toolkits may choose a different virtual screen area.
+ * however, some native toolkits may choose a different virtual screen area.
*
* @param result storage for result, will be returned
*/
public final Rectangle unionOfMonitorViewportSize(final Rectangle result) {
return MonitorDevice.unionOfViewports(result, getMonitorDevices());
}
-
+
/**
* @param sml {@link MonitorModeListener} to be added for {@link MonitorEvent}
*/
@@ -274,7 +274,7 @@ public abstract class Screen {
}
return null;
}
-
+
protected static void addScreen2List(Screen screen) {
synchronized(screenList) {
// GC before add
@@ -289,7 +289,7 @@ public abstract class Screen {
screenList.add(new WeakReference(screen));
}
}
-
+
/** Returns the global screen collection */
public static Collection getAllScreens() {
ArrayList list;
@@ -308,7 +308,7 @@ public abstract class Screen {
}
return list;
}
-
+
public static int getActiveScreenNumber() {
synchronized(screenList) {
return screensActive;
diff --git a/src/newt/classes/com/jogamp/newt/Window.java b/src/newt/classes/com/jogamp/newt/Window.java
index 02727353f..04eb07a25 100644
--- a/src/newt/classes/com/jogamp/newt/Window.java
+++ b/src/newt/classes/com/jogamp/newt/Window.java
@@ -58,8 +58,8 @@ import javax.media.nativewindow.util.RectangleImmutable;
*
... and more
*
*
- * One use case is {@link com.jogamp.newt.opengl.GLWindow}, which delegates
- * window operation to an instance of this interface while providing OpenGL
+ * One use case is {@link com.jogamp.newt.opengl.GLWindow}, which delegates
+ * window operation to an instance of this interface while providing OpenGL
* functionality.
*
*/
@@ -90,14 +90,14 @@ public interface Window extends NativeWindow, WindowClosingProtocol {
Screen getScreen();
/**
- * Returns the {@link MonitorDevice} which {@link MonitorDevice#getViewport() viewport}
+ * Returns the {@link MonitorDevice} which {@link MonitorDevice#getViewport() viewport}
* {@link MonitorDevice#coverage(RectangleImmutable) covers} this window the most.
*
- * If no coverage is detected the first {@link MonitorDevice} is returned.
+ * If no coverage is detected the first {@link MonitorDevice} is returned.
*
*/
MonitorDevice getMainMonitor();
-
+
/**
* Set the CapabilitiesChooser to help determine the native visual type.
*
@@ -129,7 +129,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol {
* Visibility is set to false.
*
*
- * Method sends out {@link WindowEvent#EVENT_WINDOW_DESTROY_NOTIFY pre-} and
+ * Method sends out {@link WindowEvent#EVENT_WINDOW_DESTROY_NOTIFY pre-} and
* {@link WindowEvent#EVENT_WINDOW_DESTROYED post-} destruction events
* to all of it's {@link WindowListener}.
*
@@ -151,7 +151,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol {
* Set a custom action handling destruction issued by a {@link WindowImpl#windowDestroyNotify(boolean) toolkit triggered window destroy}
* replacing the default {@link #destroy()} action.
*
- * The custom action shall call {@link #destroy()}
+ * The custom action shall call {@link #destroy()}
* but may perform further tasks before and after.
*
*/
@@ -369,7 +369,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol {
* @param x new top-level position, use -1 for default position.
* @param y new top-level position, use -1 for default position.
* @param forceDestroyCreate if true, uses re-creation strategy for reparenting, default is false.
- *
+ *
* @return The issued reparent action type (strategy) as defined in Window.ReparentAction
* @see #reparentWindow(NativeWindow)
*/
@@ -378,7 +378,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol {
/**
* Enable or disable fullscreen mode for this window.
*
- * Fullscreen mode is established on the {@link #getMainMonitor() main monitor}.
+ * Fullscreen mode is established on the {@link #getMainMonitor() main monitor}.
*
* Disable fullscreen via {@link #setFullscreen(boolean)}.
*
- * @param monitors if null fullscreen will be spanned across all {@link MonitorDevice}s,
+ * @param monitors if null fullscreen will be spanned across all {@link MonitorDevice}s,
* otherwise across the given list of {@link MonitorDevice}.
* @return success
* @see #setFullscreen(boolean)
* @see #isFullscreen()
*/
boolean setFullscreen(List monitors);
-
+
boolean isFullscreen();
static interface FocusRunnable {
@@ -429,7 +429,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol {
* and to perform focus traversal with a 3rd party toolkit.
*
*
- * The {@link KeyListener} methods are not invoked for {@link KeyEvent#isAutoRepeat() auto-repeat} events.
+ * The {@link KeyListener} methods are not invoked for {@link KeyEvent#isAutoRepeat() auto-repeat} events.
*
* @param l
*/
@@ -469,7 +469,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol {
/**
* Send a {@link WindowEvent} to all {@link WindowListener}.
- * @param eventType a {@link WindowEvent} type, e.g. {@link WindowEvent#EVENT_WINDOW_REPAINT}.
+ * @param eventType a {@link WindowEvent} type, e.g. {@link WindowEvent#EVENT_WINDOW_REPAINT}.
*/
public void sendWindowEvent(int eventType);
@@ -585,8 +585,8 @@ public interface Window extends NativeWindow, WindowClosingProtocol {
* Returns all {@link MouseListener}
*/
MouseListener[] getMouseListeners();
-
- /** Enable or disable default {@link GestureHandler}. Default is enabled. */
+
+ /** Enable or disable default {@link GestureHandler}. Default is enabled. */
void setDefaultGesturesEnabled(boolean enable);
/** Return true if default {@link GestureHandler} are enabled. */
boolean areDefaultGesturesEnabled();
@@ -627,5 +627,5 @@ public interface Window extends NativeWindow, WindowClosingProtocol {
/**
* Removes the given {@link GestureHandler.GestureListener} from the list.
*/
- void removeGestureListener(GestureHandler.GestureListener gl);
+ void removeGestureListener(GestureHandler.GestureListener gl);
}
diff --git a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
index 13affdf49..de1b7224f 100644
--- a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
+++ b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.newt.awt;
@@ -84,11 +84,11 @@ import com.jogamp.opengl.util.TileRenderer;
/**
* AWT {@link java.awt.Canvas Canvas} containing a NEWT {@link Window} using native parenting.
- *
+ *
*
- *
+ *
* {@link OffscreenLayerOption#setShallUseOffscreenLayer(boolean) setShallUseOffscreenLayer(true)}
- * maybe called to use an offscreen drawable (FBO or PBuffer) allowing
+ * maybe called to use an offscreen drawable (FBO or PBuffer) allowing
* the underlying JAWT mechanism to composite the image, if supported.
*/
@SuppressWarnings("serial")
@@ -104,7 +104,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
private AWTParentWindowAdapter awtAdapter = null;
private AWTAdapter awtMouseAdapter = null;
private AWTAdapter awtKeyAdapter = null;
-
+
private AWTWindowClosingProtocol awtWindowClosingProtocol =
new AWTWindowClosingProtocol(this, new Runnable() {
public void run() {
@@ -115,7 +115,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
if( newtChild != null ) {
newtChild.sendWindowEvent(WindowEvent.EVENT_WINDOW_DESTROY_NOTIFY);
}
- }
+ }
} );
/**
@@ -147,36 +147,36 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
super(gc);
setNEWTChild(child);
}
-
+
public void setShallUseOffscreenLayer(boolean v) {
shallUseOffscreenLayer = v;
}
-
+
public final boolean getShallUseOffscreenLayer() {
- return shallUseOffscreenLayer;
+ return shallUseOffscreenLayer;
}
-
- public final boolean isOffscreenLayerSurfaceEnabled() {
+
+ public final boolean isOffscreenLayerSurfaceEnabled() {
return jawtWindow.isOffscreenLayerSurfaceEnabled();
}
-
- /**
- * Returns true if the AWT component is parented to an {@link java.applet.Applet},
- * otherwise false. This information is valid only after {@link #addNotify()} is issued,
- * ie. before adding the component to the AWT tree and make it visible.
+
+ /**
+ * Returns true if the AWT component is parented to an {@link java.applet.Applet},
+ * otherwise false. This information is valid only after {@link #addNotify()} is issued,
+ * ie. before adding the component to the AWT tree and make it visible.
*/
public boolean isApplet() {
return jawtWindow.isApplet();
}
boolean isParent() {
- return null!=newtChild && jawtWindow == newtChild.getParent();
+ return null!=newtChild && jawtWindow == newtChild.getParent();
}
-
+
boolean isFullscreen() {
return null != newtChild && newtChild.isFullscreen();
}
-
+
class FocusAction implements Window.FocusRunnable {
public boolean run() {
final boolean isParent = isParent();
@@ -199,7 +199,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
}
}
private FocusAction focusAction = new FocusAction();
-
+
WindowListener clearAWTMenusOnNewtFocus = new WindowAdapter() {
@Override
public void windowResized(WindowEvent e) {
@@ -224,15 +224,15 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
handleKey(e, true);
}
}
-
- void handleKey(KeyEvent evt, boolean onRelease) {
+
+ void handleKey(KeyEvent evt, boolean onRelease) {
if(null == keyboardFocusManager) {
throw new InternalError("XXX");
}
final AWTKeyStroke ks = AWTKeyStroke.getAWTKeyStroke(evt.getKeyCode(), evt.getModifiers(), onRelease);
boolean suppress = false;
if(null != ks) {
- final Set fwdKeys = keyboardFocusManager.getDefaultFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS);
+ final Set fwdKeys = keyboardFocusManager.getDefaultFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS);
final Set bwdKeys = keyboardFocusManager.getDefaultFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS);
if(fwdKeys.contains(ks)) {
final Component nextFocus = AWTMisc.getNextFocus(NewtCanvasAWT.this, true /* forward */);
@@ -253,38 +253,38 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
}
}
if(suppress) {
- evt.setConsumed(true);
+ evt.setConsumed(true);
}
if(DEBUG) {
System.err.println("NewtCanvasAWT.focusKey: XXX: "+ks);
}
}
}
- private final FocusTraversalKeyListener newtFocusTraversalKeyListener = new FocusTraversalKeyListener();
+ private final FocusTraversalKeyListener newtFocusTraversalKeyListener = new FocusTraversalKeyListener();
class FocusPropertyChangeListener implements PropertyChangeListener {
public void propertyChange(PropertyChangeEvent evt) {
final Object oldF = evt.getOldValue();
final Object newF = evt.getNewValue();
final boolean isParent = isParent();
- final boolean isFullscreen = isFullscreen();
+ final boolean isFullscreen = isFullscreen();
if(DEBUG) {
System.err.println("NewtCanvasAWT.FocusProperty: "+evt.getPropertyName()+", src "+evt.getSource()+", "+oldF+" -> "+newF+", isParent "+isParent+", isFS "+isFullscreen);
}
if(isParent && !isFullscreen) {
if(newF == NewtCanvasAWT.this) {
- if(DEBUG) {
+ if(DEBUG) {
System.err.println("NewtCanvasAWT.FocusProperty: AWT focus -> NEWT focus traversal");
}
requestFocusNEWTChild();
} else if(oldF == NewtCanvasAWT.this && newF == null) {
// focus traversal to NEWT - NOP
- if(DEBUG) {
+ if(DEBUG) {
System.err.println("NewtCanvasAWT.FocusProperty: NEWT focus");
}
} else if(null != newF && newF != NewtCanvasAWT.this) {
// focus traversal to another AWT component
- if(DEBUG) {
+ if(DEBUG) {
System.err.println("NewtCanvasAWT.FocusProperty: lost focus - clear focus");
}
if(newtChild.getDelegatedWindow() instanceof DriverClearFocus) {
@@ -292,7 +292,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
}
}
}
- }
+ }
}
private final FocusPropertyChangeListener focusPropertyChangeListener = new FocusPropertyChangeListener();
private volatile KeyboardFocusManager keyboardFocusManager = null;
@@ -300,7 +300,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
private final void requestFocusNEWTChild() {
if(null!=newtChild) {
newtChild.setFocusAction(null);
- if(isOnscreen) {
+ if(isOnscreen) {
KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwner();
}
newtChild.requestFocus();
@@ -308,17 +308,17 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
}
}
- /**
+ /**
* Sets a new NEWT child, provoking reparenting.
*
* A previously detached newChild will be released to top-level status
- * and made invisible.
+ * and made invisible.
*
*
- * Note: When switching NEWT child's, detaching the previous first via setNEWTChild(null)
- * produced much cleaner visual results.
+ * Note: When switching NEWT child's, detaching the previous first via setNEWTChild(null)
+ * produced much cleaner visual results.
*
- * @return the previous attached newt child.
+ * @return the previous attached newt child.
*/
public Window setNEWTChild(Window newChild) {
final Window prevChild = newtChild;
@@ -336,17 +336,17 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
updateLayoutSize();
// will be done later at paint/display/..: attachNewtChild(cont);
-
+
return prevChild;
}
-
+
private final void updateLayoutSize() {
if( null != newtChild ) {
// use NEWT child's size for min/pref size!
java.awt.Dimension minSize = new java.awt.Dimension(newtChild.getWidth(), newtChild.getHeight());
setMinimumSize(minSize);
setPreferredSize(minSize);
- }
+ }
}
/** @return the current NEWT child */
@@ -357,7 +357,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
/** @return this AWT Canvas NativeWindow representation, may be null in case {@link #removeNotify()} has been called,
* or {@link #addNotify()} hasn't been called yet.*/
public NativeWindow getNativeWindow() { return jawtWindow; }
-
+
public WindowClosingMode getDefaultCloseOperation() {
return awtWindowClosingProtocol.getDefaultCloseOperation();
}
@@ -373,16 +373,16 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
} else {
// before native peer is valid: X11
disableBackgroundErase();
-
+
// creates the native peer
super.addNotify();
-
+
// after native peer is valid: Windows
disableBackgroundErase();
-
- jawtWindow = NewtFactoryAWT.getNativeWindow(this, null != newtChild ? newtChild.getRequestedCapabilities() : null);
+
+ jawtWindow = NewtFactoryAWT.getNativeWindow(this, null != newtChild ? newtChild.getRequestedCapabilities() : null);
jawtWindow.setShallUseOffscreenLayer(shallUseOffscreenLayer);
-
+
if(DEBUG) {
// if ( isShowing() == false ) -> Container was not visible yet.
// if ( isShowing() == true ) -> Container is already visible.
@@ -397,7 +397,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
@Override
public void removeNotify() {
awtWindowClosingProtocol.removeClosingListener();
-
+
if( Beans.isDesignTime() ) {
super.removeNotify();
} else {
@@ -419,7 +419,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
public final void destroy() {
destroyImpl(false /* removeNotify */, false /* windowClosing */);
}
-
+
private final void destroyImpl(boolean removeNotify, boolean windowClosing) {
if( null !=newtChild ) {
java.awt.Container cont = AWTMisc.getContainer(this);
@@ -427,7 +427,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
System.err.println("NewtCanvasAWT.destroy(removeNotify "+removeNotify+", windowClosing "+windowClosing+"): nw "+newtWinHandleToHexString(newtChild)+", from "+cont);
}
detachNewtChild(cont);
-
+
if( !removeNotify ) {
final Window cWin = newtChild;
final Window dWin = cWin.getDelegatedWindow();
@@ -437,14 +437,14 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
} else {
cWin.destroy();
}
- }
+ }
}
if( ( removeNotify || windowClosing ) && null!=jawtWindow ) {
NewtFactoryAWT.destroyNativeWindow(jawtWindow);
jawtWindow=null;
- }
+ }
}
-
+
@Override
public void paint(Graphics g) {
if( validateComponent(true) && !printActive ) {
@@ -469,9 +469,9 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
}
}
}
-
+
private volatile boolean printActive = false;
- private GLAnimatorControl printAnimator = null;
+ private GLAnimatorControl printAnimator = null;
private GLAutoDrawable printGLAD = null;
private AWTTilePainter printAWTTiles = null;
@@ -481,15 +481,15 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
}
return null;
}
-
+
@Override
public void setupPrint(double scaleMatX, double scaleMatY, int numSamples, int tileWidth, int tileHeight) {
- printActive = true;
+ printActive = true;
final int componentCount = isOpaque() ? 3 : 4;
final TileRenderer printRenderer = new TileRenderer();
printAWTTiles = new AWTTilePainter(printRenderer, componentCount, scaleMatX, scaleMatY, numSamples, tileWidth, tileHeight, DEBUG);
AWTEDTExecutor.singleton.invoke(getTreeLock(), true /* allowOnNonEDT */, true /* wait */, setupPrintOnEDT);
- }
+ }
private final Runnable setupPrintOnEDT = new Runnable() {
@Override
public void run() {
@@ -497,14 +497,14 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
if(DEBUG) {
System.err.println(getThreadName()+": Info: NewtCanvasAWT setupPrint - skipped GL render, drawable not valid yet");
}
- printActive = false;
+ printActive = false;
return; // not yet available ..
}
if( !isVisible() ) {
if(DEBUG) {
System.err.println(getThreadName()+": Info: NewtCanvasAWT setupPrint - skipped GL render, drawable visible");
}
- printActive = false;
+ printActive = false;
return; // not yet available ..
}
final GLAutoDrawable glad = getGLAD();
@@ -512,14 +512,14 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
if( DEBUG ) {
System.err.println("AWT print.setup exit, newtChild not a GLAutoDrawable: "+newtChild);
}
- printActive = false;
+ printActive = false;
return;
}
printAnimator = glad.getAnimator();
if( null != printAnimator ) {
printAnimator.remove(glad);
}
- printGLAD = glad; // _not_ default, shall be replaced by offscreen GLAD
+ printGLAD = glad; // _not_ default, shall be replaced by offscreen GLAD
final GLCapabilities caps = (GLCapabilities)glad.getChosenGLCapabilities().cloneMutable();
final int printNumSamples = printAWTTiles.getNumSamples(caps);
GLDrawable printDrawable = printGLAD.getDelegatedDrawable();
@@ -527,7 +527,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
final boolean reqNewGLADSize = printAWTTiles.customTileWidth != -1 && printAWTTiles.customTileWidth != printDrawable.getWidth() ||
printAWTTiles.customTileHeight != -1 && printAWTTiles.customTileHeight != printDrawable.getHeight();
final boolean reqNewGLADOnscrn = caps.isOnscreen();
-
+
// It is desired to use a new offscreen GLAD, however Bug 830 forbids this for AA onscreen context.
// Bug 830: swapGLContextAndAllGLEventListener and onscreen MSAA w/ NV/GLX
final boolean reqNewGLAD = !caps.getSampleBuffers() && ( reqNewGLADOnscrn || reqNewGLADSamples || reqNewGLADSize );
@@ -546,8 +546,8 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
caps.setNumSamples(printNumSamples);
}
final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile());
- printGLAD = factory.createOffscreenAutoDrawable(null, caps, null,
- printAWTTiles.customTileWidth != -1 ? printAWTTiles.customTileWidth : DEFAULT_PRINT_TILE_SIZE,
+ printGLAD = factory.createOffscreenAutoDrawable(null, caps, null,
+ printAWTTiles.customTileWidth != -1 ? printAWTTiles.customTileWidth : DEFAULT_PRINT_TILE_SIZE,
printAWTTiles.customTileHeight != -1 ? printAWTTiles.customTileHeight : DEFAULT_PRINT_TILE_SIZE,
null);
GLDrawableUtil.swapGLContextAndAllGLEventListener(glad, printGLAD);
@@ -634,7 +634,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
System.err.println("AWT print.X: "+printAWTTiles);
}
}
-
+
private final boolean validateComponent(boolean attachNewtChild) {
if( Beans.isDesignTime() || !isDisplayable() ) {
return false;
@@ -645,14 +645,14 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
if( 0 >= getWidth() || 0 >= getHeight() ) {
return false;
}
-
+
if( attachNewtChild && !newtChildAttached && null != newtChild ) {
attachNewtChild();
}
return true;
}
-
+
private final void configureNewtChild(boolean attach) {
if(null!=awtAdapter) {
awtAdapter.removeFrom(this);
@@ -670,13 +670,13 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
keyboardFocusManager.removePropertyChangeListener("focusOwner", focusPropertyChangeListener);
keyboardFocusManager = null;
}
-
+
if( null != newtChild ) {
newtChild.setKeyboardFocusHandler(null);
if(attach) {
if(null == jawtWindow.getGraphicsConfiguration()) {
throw new InternalError("XXX");
- }
+ }
isOnscreen = jawtWindow.getGraphicsConfiguration().getChosenCapabilities().isOnscreen();
awtAdapter = (AWTParentWindowAdapter) new AWTParentWindowAdapter(jawtWindow, newtChild).addTo(this);
awtAdapter.removeWindowClosingFrom(this); // we utilize AWTWindowClosingProtocol triggered destruction!
@@ -733,13 +733,13 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
newtChild.reparentWindow(jawtWindow);
newtChild.addSurfaceUpdatedListener(jawtWindow);
if( jawtWindow.isOffscreenLayerSurfaceEnabled() &&
- 0 != ( JAWTUtil.JAWT_OSX_CALAYER_QUIRK_POSITION & JAWTUtil.getOSXCALayerQuirks() ) ) {
+ 0 != ( JAWTUtil.JAWT_OSX_CALAYER_QUIRK_POSITION & JAWTUtil.getOSXCALayerQuirks() ) ) {
AWTEDTExecutor.singleton.invoke(false, forceRelayout);
}
newtChild.setVisible(true);
configureNewtChild(true);
newtChild.sendWindowEvent(WindowEvent.EVENT_WINDOW_RESIZED); // trigger a resize/relayout to listener
-
+
if(DEBUG) {
System.err.println("NewtCanvasAWT.attachNewtChild.X: win "+newtWinHandleToHexString(newtChild)+", EDTUtil: cur "+newtChild.getScreen().getDisplay().getEDTUtil()+", comp "+this);
}
@@ -759,7 +759,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
System.err.println("NewtCanvasAWT.forceRelayout.X");
}
} };
-
+
private final void detachNewtChild(java.awt.Container cont) {
if( null == newtChild || null == jawtWindow || !newtChildAttached ) {
return; // nop
@@ -773,14 +773,14 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
", cont "+cont);
}
- newtChild.removeSurfaceUpdatedListener(jawtWindow);
+ newtChild.removeSurfaceUpdatedListener(jawtWindow);
newtChildAttached = false;
newtChild.setFocusAction(null); // no AWT focus traversal ..
configureNewtChild(false);
newtChild.setVisible(false);
-
+
newtChild.reparentWindow(null); // will destroy context (offscreen -> onscreen) and implicit detachSurfaceLayer
-
+
if(DEBUG) {
System.err.println("NewtCanvasAWT.detachNewtChild.X: win "+newtWinHandleToHexString(newtChild)+", EDTUtil: cur "+newtChild.getScreen().getDisplay().getEDTUtil()+", comp "+this);
}
@@ -837,7 +837,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
}
protected static String getThreadName() { return Thread.currentThread().getName(); }
-
+
static String newtWinHandleToHexString(Window w) {
return null != w ? toHexString(w.getWindowHandle()) : "nil";
}
diff --git a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java
index c7153840f..9b1b82297 100644
--- a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java
+++ b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java
@@ -47,12 +47,12 @@ import jogamp.nativewindow.jawt.JAWTUtil;
import com.jogamp.newt.awt.NewtCanvasAWT;
import com.jogamp.newt.opengl.GLWindow;
-/**
+/**
* Simple GLEventListener deployment as an applet using JOGL. This demo must be
* referenced from a web page via an <applet> tag.
- *
+ *
*
- * Example of an applet tag using GearsES2 within the applet area (normal case):
+ * Example of an applet tag using GearsES2 within the applet area (normal case):
*
- * Example of an applet tag using GearsES2 in an undecorated, translucent, closeable and always-on-top window:
+ * Example of an applet tag using GearsES2 in an undecorated, translucent, closeable and always-on-top window:
*
<applet width=1 height=1>
<param name="java_arguments" value="-Dsun.java2d.noddraw=true">
@@ -95,12 +95,12 @@ import com.jogamp.newt.opengl.GLWindow;
@SuppressWarnings("serial")
public class JOGLNewtApplet1Run extends Applet {
public static final boolean DEBUG = JOGLNewtAppletBase.DEBUG;
-
+
GLWindow glWindow = null;
NewtCanvasAWT newtCanvasAWT = null;
JOGLNewtAppletBase base = null;
/** if valid glStandalone:=true (own window) ! */
- int glXd=Integer.MAX_VALUE, glYd=Integer.MAX_VALUE, glWidth=Integer.MAX_VALUE, glHeight=Integer.MAX_VALUE;
+ int glXd=Integer.MAX_VALUE, glYd=Integer.MAX_VALUE, glWidth=Integer.MAX_VALUE, glHeight=Integer.MAX_VALUE;
public void init() {
if(DEBUG) {
@@ -135,7 +135,7 @@ public class JOGLNewtApplet1Run extends Applet {
glCloseable = JOGLNewtAppletBase.str2Bool(getParameter("gl_closeable"), glCloseable);
glOpaque = JOGLNewtAppletBase.str2Bool(getParameter("gl_opaque"), glOpaque);
glAlphaBits = JOGLNewtAppletBase.str2Int(getParameter("gl_alpha"), glAlphaBits);
- glNumMultisampleBuffer = JOGLNewtAppletBase.str2Int(getParameter("gl_multisamplebuffer"), glNumMultisampleBuffer);
+ glNumMultisampleBuffer = JOGLNewtAppletBase.str2Int(getParameter("gl_multisamplebuffer"), glNumMultisampleBuffer);
glXd = JOGLNewtAppletBase.str2Int(getParameter("gl_dx"), glXd);
glYd = JOGLNewtAppletBase.str2Int(getParameter("gl_dy"), glYd);
glWidth = JOGLNewtAppletBase.str2Int(getParameter("gl_width"), glWidth);
@@ -168,8 +168,8 @@ public class JOGLNewtApplet1Run extends Applet {
System.err.println("glNumMultisampleBuffer: "+glNumMultisampleBuffer);
System.err.println("glNoDefaultKeyListener: "+glNoDefaultKeyListener);
}
-
- base = new JOGLNewtAppletBase(glEventListenerClazzName,
+
+ base = new JOGLNewtAppletBase(glEventListenerClazzName,
glSwapInterval,
glNoDefaultKeyListener,
glCloseable,
@@ -252,9 +252,9 @@ public class JOGLNewtApplet1Run extends Applet {
System.err.println("GLWindow: "+glWindow);
}
base.start();
- if( null != newtCanvasAWT &&
+ if( null != newtCanvasAWT &&
newtCanvasAWT.isOffscreenLayerSurfaceEnabled() &&
- 0 != ( JAWTUtil.JAWT_OSX_CALAYER_QUIRK_POSITION & JAWTUtil.getOSXCALayerQuirks() ) ) {
+ 0 != ( JAWTUtil.JAWT_OSX_CALAYER_QUIRK_POSITION & JAWTUtil.getOSXCALayerQuirks() ) ) {
// force relayout
final int cW = newtCanvasAWT.getWidth();
final int cH = newtCanvasAWT.getHeight();
diff --git a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java
index 1004adb8e..a6a30a8bf 100644
--- a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java
+++ b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java
@@ -57,7 +57,7 @@ import com.jogamp.opengl.util.Animator;
public class JOGLNewtAppletBase implements KeyListener, GLEventListener {
public static final boolean DEBUG = Debug.debug("Applet");
-
+
String glEventListenerClazzName;
int glSwapInterval;
boolean noDefaultKeyListener;
@@ -71,13 +71,13 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener {
boolean isValid = false;
NativeWindow awtParent;
- public JOGLNewtAppletBase(String glEventListenerClazzName,
+ public JOGLNewtAppletBase(String glEventListenerClazzName,
int glSwapInterval,
boolean noDefaultKeyListener,
boolean glClosable,
boolean glDebug,
boolean glTrace) {
-
+
this.glEventListenerClazzName=glEventListenerClazzName;
this.glSwapInterval=glSwapInterval;
this.noDefaultKeyListener = noDefaultKeyListener;
@@ -174,8 +174,8 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener {
glWindow.reparentWindow(awtParent);
}
}
- }).start();
- }
+ }).start();
+ }
}
} } );
@@ -203,7 +203,7 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener {
if(glEventListener instanceof KeyListener) {
glWindow.addKeyListener((KeyListener)glEventListener);
}
-
+
if(!noDefaultKeyListener) {
glWindow.addKeyListener(this);
}
@@ -216,7 +216,7 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener {
glAnimator.setThreadGroup(tg);
glAnimator.add(glWindow);
glAnimator.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, null);
-
+
} catch (Throwable t) {
throw new RuntimeException(t);
}
@@ -262,14 +262,14 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener {
if(glDebug) {
try {
_gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", null, _gl, null) );
- } catch (Exception e) {e.printStackTrace();}
+ } catch (Exception e) {e.printStackTrace();}
}
if(glTrace) {
try {
// Trace ..
_gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", null, _gl, new Object[] { System.err } ) );
- } catch (Exception e) {e.printStackTrace();}
+ } catch (Exception e) {e.printStackTrace();}
}
if(glSwapInterval>=0) {
@@ -317,9 +317,9 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener {
}
}
}
-
+
@Override
- public void keyReleased(KeyEvent e) {
+ public void keyReleased(KeyEvent e) {
}
}
diff --git a/src/newt/classes/com/jogamp/newt/event/DoubleTapScrollGesture.java b/src/newt/classes/com/jogamp/newt/event/DoubleTapScrollGesture.java
index bc67cbee6..7dda47534 100644
--- a/src/newt/classes/com/jogamp/newt/event/DoubleTapScrollGesture.java
+++ b/src/newt/classes/com/jogamp/newt/event/DoubleTapScrollGesture.java
@@ -41,15 +41,15 @@ import jogamp.newt.Debug;
*
* - touchSlop (scaled in pixels):
* - Min. movement w/ 2 pointer within ScaledDoubleTapSlop starting 'scroll' mode
- *
+ *
* - Avoid computation if not within gesture, especially for MOVE/DRAG
- *
+ *
* - Only allow gesture to start with PRESS
- *
- * - Leave gesture completely with RELEASE of both/all fingers, or dist-diff exceeds doubleTapSlop
- *
+ *
+ * - Leave gesture completely with RELEASE of both/all fingers, or dist-diff exceeds doubleTapSlop
+ *
* - Tolerate temporary lift 1 of 2 pointer
- *
+ *
* - Always validate pointer-id
*
*
@@ -74,27 +74,27 @@ public class DoubleTapScrollGesture implements GestureHandler {
public static final int SCROLL_SLOP_PIXEL;
/** Two pointer 'double tap' slop in pixels (fallback), defaults to 104 pixels. Can be overriden by integer property newt.event.double_tap_slop_pixel.*/
public static final int DOUBLE_TAP_SLOP_PIXEL;
-
+
/** Scroll threshold in millimeter, defaults to 3 mm. Can be overriden by integer property newt.event.scroll_slop_mm.*/
public static final float SCROLL_SLOP_MM;
/** Two pointer 'double tap' slop in millimeter, defaults to 20 mm. Can be overriden by integer property newt.event.double_tap_slop_mm.*/
public static final float DOUBLE_TAP_SLOP_MM;
-
+
static {
Debug.initSingleton();
-
+
SCROLL_SLOP_PIXEL = Debug.getIntProperty("newt.event.scroll_slop_pixel", true, 16);
DOUBLE_TAP_SLOP_PIXEL = Debug.getIntProperty("newt.event.double_tap_slop_pixel", true, 104);
SCROLL_SLOP_MM = Debug.getIntProperty("newt.event.scroll_slop_mm", true, 3);
DOUBLE_TAP_SLOP_MM = Debug.getIntProperty("newt.event.double_tap_slop_mm", true, 20);
}
-
+
private static final int ST_NONE = 0;
private static final int ST_1PRESS = 1;
private static final int ST_2PRESS_T = 2;
private static final int ST_2PRESS_C = 3;
private static final int ST_SCROLL = 4;
-
+
private final int scrollSlop, scrollSlopSquare, doubleTapSlop, doubleTapSlopSquare;
private final float[] scrollDistance = new float[] { 0f, 0f };
private int[] pIds = new int[] { -1, -1 };
@@ -104,18 +104,18 @@ public class DoubleTapScrollGesture implements GestureHandler {
private int lastX, lastY;
private int pointerDownCount;
private MouseEvent hitGestureEvent;
-
+
private static final int getSquareDistance(float x1, float y1, float x2, float y2) {
final int deltaX = (int) x1 - (int) x2;
final int deltaY = (int) y1 - (int) y2;
return deltaX * deltaX + deltaY * deltaY;
}
-
+
private int gesturePointers(final MouseEvent e, final int excludeIndex) {
- int j = 0;
+ int j = 0;
for(int i=e.getPointerCount()-1; i>=0; i--) {
if( excludeIndex != i ) {
- final int id = e.getPointerId(i);
+ final int id = e.getPointerId(i);
if( pIds[0] == id || pIds[1] == id ) {
j++;
}
@@ -123,10 +123,10 @@ public class DoubleTapScrollGesture implements GestureHandler {
}
return j;
}
-
+
/**
* scaledScrollSlop < scaledDoubleTapSlop
- * @param scaledScrollSlop Distance a pointer can wander before we think the user is scrolling in pixels.
+ * @param scaledScrollSlop Distance a pointer can wander before we think the user is scrolling in pixels.
* @param scaledDoubleTapSlop Distance in pixels between the first touch and second touch to still be considered a double tap.
*/
public DoubleTapScrollGesture(int scaledScrollSlop, int scaledDoubleTapSlop) {
@@ -137,9 +137,9 @@ public class DoubleTapScrollGesture implements GestureHandler {
pointerDownCount = 0;
clear(true);
if(DEBUG) {
- System.err.println("DoubleTapScroll scrollSlop (scaled) "+scrollSlop);
- System.err.println("DoubleTapScroll doubleTapSlop (scaled) "+doubleTapSlop);
- }
+ System.err.println("DoubleTapScroll scrollSlop (scaled) "+scrollSlop);
+ System.err.println("DoubleTapScroll doubleTapSlop (scaled) "+doubleTapSlop);
+ }
}
public String toString() {
@@ -160,17 +160,17 @@ public class DoubleTapScrollGesture implements GestureHandler {
lastY = 0;
}
}
-
+
@Override
public boolean isWithinGesture() {
return ST_2PRESS_C <= gestureState;
}
-
+
@Override
public boolean hasGesture() {
return null != hitGestureEvent;
}
-
+
@Override
public InputEvent getGestureEvent() {
if( null != hitGestureEvent ) {
@@ -184,17 +184,17 @@ public class DoubleTapScrollGesture implements GestureHandler {
modifiers |= com.jogamp.newt.event.InputEvent.SHIFT_MASK;
}
return new MouseEvent(MouseEvent.EVENT_MOUSE_WHEEL_MOVED, ge.getSource(), ge.getWhen(), modifiers,
- ge.getAllPointerTypes(), ge.getAllPointerIDs(),
- ge.getAllX(), ge.getAllY(), ge.getAllPressures(), ge.getMaxPressure(),
+ ge.getAllPointerTypes(), ge.getAllPointerIDs(),
+ ge.getAllX(), ge.getAllY(), ge.getAllPressures(), ge.getMaxPressure(),
ge.getButton(), ge.getClickCount(), rotationXYZ, scrollSlop);
}
return null;
}
-
+
public final float[] getScrollDistanceXY() {
return scrollDistance;
}
-
+
@Override
public boolean process(final InputEvent in) {
if( null != hitGestureEvent || !(in instanceof MouseEvent) ) {
@@ -220,7 +220,7 @@ public class DoubleTapScrollGesture implements GestureHandler {
final int y1 = pe.getY(1);
final int xm = (x0+x1)/2;
final int ym = (y0+y1)/2;
-
+
if( ST_1PRESS == gestureState ) {
final int sqDist = getSquareDistance(x0, y0, x1, y1);
final boolean isDistWithinDoubleTapSlop = sqDist < doubleTapSlopSquare;
@@ -254,7 +254,7 @@ public class DoubleTapScrollGesture implements GestureHandler {
System.err.println(this+".pressed: gPtr "+gPtr+", this "+lastX+"/"+lastY+", "+pe);
}
} break;
-
+
case MouseEvent.EVENT_MOUSE_RELEASED: {
pointerDownCount--; // lifted
final int gPtr = gesturePointers(pe, 0); // w/o lifted pointer
@@ -269,7 +269,7 @@ public class DoubleTapScrollGesture implements GestureHandler {
System.err.println(this+".released: gPtr "+gPtr+", "+pe);
}
} break;
-
+
case MouseEvent.EVENT_MOUSE_DRAGGED: {
if( 2 == pointerDownCount && ST_1PRESS < gestureState ) {
final int gPtr = gesturePointers(pe, -1);
@@ -289,11 +289,11 @@ public class DoubleTapScrollGesture implements GestureHandler {
gestureState = ST_SCROLL;
}
} break;
-
+
case ST_2PRESS_C:
gestureState = ST_SCROLL;
break;
-
+
case ST_SCROLL:
scrollDistance[0] = lastX - xm;
scrollDistance[1] = lastY - ym;
@@ -338,7 +338,7 @@ public class DoubleTapScrollGesture implements GestureHandler {
}
}
} break;
-
+
default:
}
return null != hitGestureEvent;
diff --git a/src/newt/classes/com/jogamp/newt/event/GestureHandler.java b/src/newt/classes/com/jogamp/newt/event/GestureHandler.java
index 2c8f29bb7..2e98a8a01 100644
--- a/src/newt/classes/com/jogamp/newt/event/GestureHandler.java
+++ b/src/newt/classes/com/jogamp/newt/event/GestureHandler.java
@@ -30,7 +30,7 @@ package com.jogamp.newt.event;
import jogamp.newt.Debug;
/**
- * Generic gesture handler interface designed to allow pass-through
+ * Generic gesture handler interface designed to allow pass-through
* filtering of {@link InputEvent}s.
*
* To avoid negative impact on event processing,
@@ -44,18 +44,18 @@ import jogamp.newt.Debug;
*/
public interface GestureHandler {
public static final boolean DEBUG = Debug.debug("Window.MouseEvent");
-
+
/** A custom gesture event */
@SuppressWarnings("serial")
public static class GestureEvent extends InputEvent {
/** A gesture has been detected. */
public static final short EVENT_GESTURE_DETECTED = 400;
-
+
private final GestureHandler handler;
-
+
/**
* Creates a gesture event with default type {@link #EVENT_GESTURE_DETECTED}.
- *
+ *
* @param source
* @param when
* @param modifiers
@@ -65,7 +65,7 @@ public interface GestureHandler {
super(EVENT_GESTURE_DETECTED, source, when, modifiers);
this.handler = handler;
}
-
+
/**
* Creates a gesture event with custom event_type !
* @param event_type must lie within [400..599]
@@ -78,14 +78,14 @@ public interface GestureHandler {
super(event_type, source, when, modifiers);
this.handler = handler;
}
-
+
/** Return the {@link GestureHandler}, which produced the event. */
public final GestureHandler getHandler() { return handler; }
}
-
+
/**
* Listener for {@link GestureEvent}s.
- *
+ *
* @see GestureEvent
*/
public static interface GestureListener extends NEWTEventListener
@@ -93,50 +93,50 @@ public interface GestureHandler {
/** {@link GestureHandler} {@link GestureHandler#hasGesture() has detected} the gesture. */
public void gestureDetected(GestureEvent gh);
}
-
- /**
- * Clears state of handler, i.e. resets all states incl. previous detected gesture.
+
+ /**
+ * Clears state of handler, i.e. resets all states incl. previous detected gesture.
* @param clearStarted if true, also clears {@link #isWithinGesture() started} state,
* otherwise stay within gesture - if appropriate.
- * Staying within a gesture allows fluent continuous gesture sequence,
- * e.g. for scrolling.
+ * Staying within a gesture allows fluent continuous gesture sequence,
+ * e.g. for scrolling.
*/
public void clear(boolean clearStarted);
-
- /**
+
+ /**
* Returns true if a previous {@link #process(InputEvent)} command produced a gesture,
- * which has not been {@link #clear(boolean) cleared}.
+ * which has not been {@link #clear(boolean) cleared}.
* Otherwise returns false.
- */
+ */
public boolean hasGesture();
-
- /**
+
+ /**
* Returns the corresponding {@link InputEvent} for the gesture as detected by
* a previous {@link #process(InputEvent)}, which has not been {@link #clear(boolean) cleared}.
* Otherwise returns null.
*
* Only implemented for gestures mapping to {@link InputEvent}s.
- *
- */
+ *
+ */
public InputEvent getGestureEvent();
-
- /**
+
+ /**
* Returns true if within a gesture as detected by a previous {@link #process(InputEvent)} command,
- * which has not been {@link #clear(boolean) cleared}.
+ * which has not been {@link #clear(boolean) cleared}.
* Otherwise returns false.
- */
+ */
public boolean isWithinGesture();
/**
* Process the given {@link InputEvent} and returns true if it produced the gesture.
* Otherwise returns false.
*
- * If a gesture was already detected previously and has not been cleared,
- * method does not process the event and returns true.
+ * If a gesture was already detected previously and has not been cleared,
+ * method does not process the event and returns true.
*
*
- * Besides validation of the event's details,
- * the handler may also validate the {@link InputEvent.InputClass} and/or {@link InputEvent.InputType}.
+ * Besides validation of the event's details,
+ * the handler may also validate the {@link InputEvent.InputClass} and/or {@link InputEvent.InputType}.
*
*/
public boolean process(InputEvent e);
diff --git a/src/newt/classes/com/jogamp/newt/event/InputEvent.java b/src/newt/classes/com/jogamp/newt/event/InputEvent.java
index 1bd67efa5..6520dafcf 100644
--- a/src/newt/classes/com/jogamp/newt/event/InputEvent.java
+++ b/src/newt/classes/com/jogamp/newt/event/InputEvent.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package com.jogamp.newt.event;
@@ -43,17 +43,17 @@ public abstract class InputEvent extends NEWTEvent
/** Interface marking class of input types */
public static interface InputClass {
}
-
+
/** Interface marking type of input devices */
public static interface InputType {
}
-
+
public static final int SHIFT_MASK = 1 << 0;
public static final int CTRL_MASK = 1 << 1;
public static final int META_MASK = 1 << 2;
public static final int ALT_MASK = 1 << 3;
public static final int ALT_GRAPH_MASK = 1 << 4;
-
+
public static final int BUTTON1_MASK = 1 << 5;
public static final int BUTTON2_MASK = 1 << 6;
public static final int BUTTON3_MASK = 1 << 7;
@@ -63,23 +63,23 @@ public abstract class InputEvent extends NEWTEvent
public static final int BUTTON7_MASK = 1 << 11;
public static final int BUTTON8_MASK = 1 << 12;
public static final int BUTTON9_MASK = 1 << 13;
-
+
public static final int BUTTONLAST_MASK = 1 << 20; // 16 buttons
public static final int BUTTONALL_MASK = 0xffff << 5 ; // 16 buttons
-
+
/** Event is caused by auto-repeat. */
public static final int AUTOREPEAT_MASK = 1 << 29;
-
+
/** Pointer is confined, see {@link Window#confinePointer(boolean)}. */
public static final int CONFINED_MASK = 1 << 30;
-
+
/** Pointer is invisible, see {@link Window#setPointerVisible(boolean)}. */
public static final int INVISIBLE_MASK = 1 << 31;
- /**
+ /**
* Returns the corresponding button mask for the given button.
*
- * In case the given button lies outside
+ * In case the given button lies outside
* of the valid range [{@link MouseEvent#BUTTON1} .. {@link MouseEvent#BUTTON_COUNT}],
* null is returned.
*
@@ -90,7 +90,7 @@ public abstract class InputEvent extends NEWTEvent
}
return 0;
}
-
+
protected InputEvent(short eventType, Object source, long when, int modifiers) {
super(eventType, source, when);
this.modifiers=modifiers;
@@ -128,11 +128,11 @@ public abstract class InputEvent extends NEWTEvent
public boolean isConfined() {
return (modifiers&CONFINED_MASK)!=0;
}
- /** {@link #getModifiers()} contains {@link #INVISIBLE_MASK}. Pointer is invisible, see {@link Window#setPointerVisible(boolean)}. */
+ /** {@link #getModifiers()} contains {@link #INVISIBLE_MASK}. Pointer is invisible, see {@link Window#setPointerVisible(boolean)}. */
public boolean isInvisible() {
return (modifiers&INVISIBLE_MASK)!=0;
}
-
+
public StringBuilder getModifiersString(StringBuilder sb) {
if(null == sb) {
sb = new StringBuilder();
@@ -141,7 +141,7 @@ public abstract class InputEvent extends NEWTEvent
boolean isFirst = true;
if(isShiftDown()) { if(!isFirst) { sb.append(", "); } isFirst = false; sb.append("shift"); }
if(isControlDown()) { if(!isFirst) { sb.append(", "); } isFirst = false; sb.append("ctrl"); }
- if(isMetaDown()) { if(!isFirst) { sb.append(", "); } isFirst = false; sb.append("meta"); }
+ if(isMetaDown()) { if(!isFirst) { sb.append(", "); } isFirst = false; sb.append("meta"); }
if(isAltDown()) { if(!isFirst) { sb.append(", "); } isFirst = false; sb.append("alt"); }
if(isAltGraphDown()) { if(!isFirst) { sb.append(", "); } isFirst = false; sb.append("altgr"); }
if(isAutoRepeat()) { if(!isFirst) { sb.append(", "); } isFirst = false; sb.append("repeat"); }
@@ -151,18 +151,18 @@ public abstract class InputEvent extends NEWTEvent
if(isConfined()) { if(!isFirst) { sb.append(", "); } isFirst = false; sb.append("confined"); }
if(isInvisible()) { if(!isFirst) { sb.append(", "); } isFirst = false; sb.append("invisible"); }
sb.append("]");
-
+
return sb;
}
/**
* See also {@link MouseEvent}'s section about Multiple-Pointer Events.
- * @return Array of pressed mouse buttons [{@link MouseEvent#BUTTON1} .. {@link MouseEvent#BUTTON6}].
+ * @return Array of pressed mouse buttons [{@link MouseEvent#BUTTON1} .. {@link MouseEvent#BUTTON6}].
* If none is down, the resulting array is of length 0.
*/
public final short[] getButtonsDown() {
final int len = getButtonDownCount();
-
+
final short[] res = new short[len];
int j = 0;
for(int i=1; i<=MouseEvent.BUTTON_COUNT; i++) {
@@ -174,13 +174,13 @@ public abstract class InputEvent extends NEWTEvent
/**
* See also {@link MouseEvent}'s section about Multiple-Pointer Events.
* @param button the button to test
- * @return true if the given button is down
+ * @return true if the given button is down
*/
public final boolean isButtonDown(int button) {
return ( modifiers & getButtonMask(button) ) != 0;
}
- /**
+ /**
* Returns the number of pressed buttons by counting the set bits:
*
* getBitCount(modifiers & BUTTONALL_MASK);
@@ -194,8 +194,8 @@ public abstract class InputEvent extends NEWTEvent
public final int getButtonDownCount() {
return IntBitfield.getBitCount(modifiers & BUTTONALL_MASK);
}
-
- /**
+
+ /**
* Returns true if at least one button is pressed, otherwise false:
*
* 0 != ( modifiers & BUTTONALL_MASK )
@@ -209,11 +209,11 @@ public abstract class InputEvent extends NEWTEvent
public final boolean isAnyButtonDown() {
return 0 != ( modifiers & BUTTONALL_MASK );
}
-
+
public String toString() {
return toString(null).toString();
}
-
+
public StringBuilder toString(StringBuilder sb) {
if(null == sb) {
sb = new StringBuilder();
diff --git a/src/newt/classes/com/jogamp/newt/event/KeyAdapter.java b/src/newt/classes/com/jogamp/newt/event/KeyAdapter.java
index 42ebea722..a89148574 100644
--- a/src/newt/classes/com/jogamp/newt/event/KeyAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/KeyAdapter.java
@@ -4,14 +4,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -21,12 +21,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.newt.event;
public abstract class KeyAdapter implements KeyListener
diff --git a/src/newt/classes/com/jogamp/newt/event/KeyEvent.java b/src/newt/classes/com/jogamp/newt/event/KeyEvent.java
index 085f598dc..81680bf32 100644
--- a/src/newt/classes/com/jogamp/newt/event/KeyEvent.java
+++ b/src/newt/classes/com/jogamp/newt/event/KeyEvent.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package com.jogamp.newt.event;
@@ -37,8 +37,8 @@ package com.jogamp.newt.event;
import com.jogamp.common.util.IntBitfield;
/**
- *
*
* In case the native platform does not
- * deliver keyboard events in the above order or skip events,
- * the NEWT driver will reorder and inject synthetic events if required.
+ * deliver keyboard events in the above order or skip events,
+ * the NEWT driver will reorder and inject synthetic events if required.
*
- * Besides regular modifiers like {@link InputEvent#SHIFT_MASK} etc.,
+ * Besides regular modifiers like {@link InputEvent#SHIFT_MASK} etc.,
* the {@link InputEvent#AUTOREPEAT_MASK} bit is added if repetition is detected, following above constraints.
*
* The idea is if you mask out auto-repeat in your event listener
* you just get one long pressed P/R tuple for {@link #isPrintableKey() printable} and {@link #isActionKey() Action} keys.
*
*
- * {@link #isActionKey() Action} keys will produce {@link #EVENT_KEY_PRESSED pressed}
+ * {@link #isActionKey() Action} keys will produce {@link #EVENT_KEY_PRESSED pressed}
* and {@link #EVENT_KEY_RELEASED released} events including {@link #isAutoRepeat() auto-repeat}.
*
*
* {@link #isPrintableKey() Printable} keys will produce {@link #EVENT_KEY_PRESSED pressed} and {@link #EVENT_KEY_RELEASED released} events.
*
*
- * {@link #isModifierKey() Modifier} keys will produce {@link #EVENT_KEY_PRESSED pressed} and {@link #EVENT_KEY_RELEASED released} events
+ * {@link #isModifierKey() Modifier} keys will produce {@link #EVENT_KEY_PRESSED pressed} and {@link #EVENT_KEY_RELEASED released} events
* excluding {@link #isAutoRepeat() auto-repeat}.
* They will also influence subsequent event's {@link #getModifiers() modifier} bits while pressed.
*
- * {@link #getKeyChar() Key-chars}, as well as
+ * {@link #getKeyChar() Key-chars}, as well as
* {@link #isPrintableKey() printable} {@link #getKeyCode() key-codes} and {@link #getKeySymbol() key-symbols}
- * use the UTF-16 unicode space w/o collision.
- *
+ * use the UTF-16 unicode space w/o collision.
+ *
*
*
- * Non-{@link #isPrintableKey() printable} {@link #getKeyCode() key-codes} and {@link #getKeySymbol() key-symbols},
+ * Non-{@link #isPrintableKey() printable} {@link #getKeyCode() key-codes} and {@link #getKeySymbol() key-symbols},
* i.e. {@link #isModifierKey() modifier-} and {@link #isActionKey() action-}keys,
* are mapped to unicode's control and private range and do not collide w/ {@link #isPrintableKey() printable} unicode values
* with the following exception.
*
* The following {@link #getKeyCode() Key-code}s and {@link #getKeySymbol() key-symbol}s collide w/ unicode space:
@@ -103,9 +103,9 @@ import com.jogamp.common.util.IntBitfield;
*
* Collision was chosen for {@link #getKeyCode() Key-code} and {@link #getKeySymbol() key-symbol} mapping
* to allow a minimal code range, i.e. [0..255].
- * The reduced code range in turn allows the implementation to utilize fast and small lookup tables,
- * e.g. to implement a key-press state tracker.
- *
+ * The reduced code range in turn allows the implementation to utilize fast and small lookup tables,
+ * e.g. to implement a key-press state tracker.
+ *
*
* http://www.utf8-chartable.de/unicode-utf8-table.pl
* http://www.unicode.org/Public/5.1.0/ucd/PropList.txt
@@ -136,7 +136,7 @@ public class KeyEvent extends InputEvent
}
}
flags = _flags;
-
+
//
// Validate flags
//
@@ -147,12 +147,12 @@ public class KeyEvent extends InputEvent
}
}
}
-
+
public static KeyEvent create(short eventType, Object source, long when, int modifiers, short keyCode, short keySym, char keyChar) {
return new KeyEvent(eventType, source, when, modifiers, keyCode, keySym, getModifierMask(keySym), keyChar);
}
- /**
+ /**
* Returns the UTF-16 character reflecting the {@link #getKeySymbol() key symbol}
* incl. active {@link #isModifierKey() modifiers}.
* @see #getKeySymbol()
@@ -162,12 +162,12 @@ public class KeyEvent extends InputEvent
return keyChar;
}
- /**
+ /**
* Returns the virtual key symbol reflecting the current keyboard layout.
*
* For {@link #isPrintableKey() printable keys}, the key symbol is the {@link #isModifierKey() unmodified}
- * representation of the UTF-16 {@link #getKeyChar() key char}.
- * E.g. symbol [{@link #VK_A}, 'A'] for char 'a'.
+ * representation of the UTF-16 {@link #getKeyChar() key char}.
+ * E.g. symbol [{@link #VK_A}, 'A'] for char 'a'.
*
* @see #isPrintableKey()
* @see #getKeyChar()
@@ -176,18 +176,18 @@ public class KeyEvent extends InputEvent
public final short getKeySymbol() {
return keySym;
}
-
- /**
+
+ /**
* Returns the virtual key code using a fixed mapping to the US keyboard layout.
*
- * In contrast to {@link #getKeySymbol() key symbol}, key code
- * uses a fixed US keyboard layout and therefore is keyboard layout independent.
+ * In contrast to {@link #getKeySymbol() key symbol}, key code
+ * uses a fixed US keyboard layout and therefore is keyboard layout independent.
*
*
- * E.g. virtual key code {@link #VK_Y} denotes the same physical key
- * regardless whether keyboard layoutQWERTY or
+ * E.g. virtual key code {@link #VK_Y} denotes the same physical key
+ * regardless whether keyboard layoutQWERTY or
* QWERTZ is active. The {@link #getKeySymbol() key symbol} of the former is
- * {@link #VK_Y}, where the latter produces {@link #VK_Y}.
+ * {@link #VK_Y}, where the latter produces {@link #VK_Y}.
*
* @see #getKeyChar()
* @see #getKeySymbol()
@@ -228,9 +228,9 @@ public class KeyEvent extends InputEvent
}
return (short) keyChar;
}
-
- /**
- * Returns true if the given virtualKey represents a modifier key, otherwise false.
+
+ /**
+ * Returns true if the given virtualKey represents a modifier key, otherwise false.
*
* A modifier key is one of {@link #VK_SHIFT}, {@link #VK_CONTROL}, {@link #VK_ALT}, {@link #VK_ALT_GRAPH}, {@link #VK_META}.
*
@@ -247,10 +247,10 @@ public class KeyEvent extends InputEvent
return false;
}
}
-
+
/**
* If vKey is a {@link #isModifierKey() modifier key}, method returns the corresponding modifier mask,
- * otherwise 0.
+ * otherwise 0.
*/
public static int getModifierMask(short vKey) {
switch (vKey) {
@@ -266,10 +266,10 @@ public class KeyEvent extends InputEvent
}
return 0;
}
-
- /**
+
+ /**
* Returns true if {@link #getKeySymbol() key symbol} represents a modifier key,
- * otherwise false.
+ * otherwise false.
*
* See {@link #isModifierKey(short)} for details.
*
@@ -280,8 +280,8 @@ public class KeyEvent extends InputEvent
public final boolean isModifierKey() {
return 0 != ( F_MODIFIER_MASK & flags ) ;
}
-
- /**
+
+ /**
* Returns true if {@link #getKeySymbol() key symbol} represents a non-printable and
* non-{@link #isModifierKey(short) modifier} action key, otherwise false.
*
@@ -289,12 +289,12 @@ public class KeyEvent extends InputEvent
* A = U - ( P + M )
*
* @see #isPrintableKey()
- * @see #isModifierKey()
+ * @see #isModifierKey()
*/
public final boolean isActionKey() {
return 0 != ( F_ACTION_MASK & flags ) ;
}
-
+
/**
* Returns true if given uniChar represents a printable character,
* i.e. a value other than {@link #VK_UNDEFINED} and not a control or non-printable private code.
@@ -307,7 +307,7 @@ public class KeyEvent extends InputEvent
*
* Distinction of key character and virtual key code is made due to unicode collision.
*
- *
+ *
* @param uniChar the UTF-16 unicode value, which maybe a virtual key code or key character.
* @param isKeyChar true if uniChar is a key character, otherwise a virtual key code
*/
@@ -333,9 +333,9 @@ public class KeyEvent extends InputEvent
return VK_UNDEFINED != uniChar;
}
- /**
- * Returns true if {@link #getKeySymbol() key symbol} and {@link #getKeyChar() key char}
- * represents a printable character, i.e. a value other than {@link #VK_UNDEFINED}
+ /**
+ * Returns true if {@link #getKeySymbol() key symbol} and {@link #getKeyChar() key char}
+ * represents a printable character, i.e. a value other than {@link #VK_UNDEFINED}
* and not a control or non-printable private code.
*
* A printable character is neither a {@link #isModifierKey(short) modifier key}, nor an {@link #isActionKey(short) action key}.
@@ -347,7 +347,7 @@ public class KeyEvent extends InputEvent
public final boolean isPrintableKey() {
return 0 != ( F_PRINTABLE_MASK & flags ) ;
}
-
+
private final short keyCode;
private final short keySym;
private final char keyChar;
@@ -370,7 +370,7 @@ public class KeyEvent extends InputEvent
public static class NonPrintableRange {
/** min. unicode value, inclusive */
- public short min;
+ public short min;
/** max. unicode value, inclusive */
public short max;
/** true if valid for keyChar values as well, otherwise only valid for keyCode and keySym due to collision. */
@@ -381,7 +381,7 @@ public class KeyEvent extends InputEvent
this.inclKeyChar = inclKeyChar;
}
};
- /**
+ /**
* Non printable key ranges, currently fixed to an array of size 4.
*
* Not included, queried upfront:
@@ -390,98 +390,98 @@ public class KeyEvent extends InputEvent
*
{@link #VK_TAB}
*
{@link #VK_ENTER}
*
- *
+ *
*/
- public final static NonPrintableRange[] nonPrintableKeys = {
+ public final static NonPrintableRange[] nonPrintableKeys = {
new NonPrintableRange( (short)0x0000, (short)0x001F, true ), // Unicode: Non printable controls: [0x00 - 0x1F], see exclusion above
new NonPrintableRange( (short)0x0061, (short)0x0078, false), // Small 'a' thru 'z' (0x61 - 0x7a) - Not used for keyCode / keySym - Re-used for Fn (collision)
- new NonPrintableRange( (short)0x008F, (short)0x009F, true ), // Unicode: Non printable controls: [0x7F - 0x9F], Numpad keys [0x7F - 0x8E] are printable!
+ new NonPrintableRange( (short)0x008F, (short)0x009F, true ), // Unicode: Non printable controls: [0x7F - 0x9F], Numpad keys [0x7F - 0x8E] are printable!
new NonPrintableRange( (short)0xE000, (short)0xF8FF, true ) // Unicode: Private 0xE000 - 0xF8FF (Marked Non-Printable)
};
-
+
//
// Unicode: Non printable controls: [0x00 - 0x1F]
//
-
+
/**
* This value, {@value}, is used to indicate that the keyCode is unknown.
*/
public static final short VK_UNDEFINED = (short) 0x0;
-
+
static final short VK_FREE01 = (short) 0x01;
-
+
/** Constant for the HOME function key. ASCII: Start Of Text. */
public static final short VK_HOME = (short) 0x02;
-
+
/** Constant for the END function key. ASCII: End Of Text. */
public static final short VK_END = (short) 0x03;
-
+
/** Constant for the END function key. ASCII: End Of Transmission. */
public static final short VK_FINAL = (short) 0x04;
/** Constant for the PRINT function key. ASCII: Enquiry. */
public static final short VK_PRINTSCREEN = (short) 0x05;
-
+
static final short VK_FREE06 = (short) 0x06;
static final short VK_FREE07 = (short) 0x07;
-
+
/** Constant for the BACK SPACE key "\b", matching ASCII. Printable! */
public static final short VK_BACK_SPACE = (short) 0x08;
-
+
/** Constant for the HORIZ TAB key "\t", matching ASCII. Printable! */
public static final short VK_TAB = (short) 0x09;
-
+
/** LINE_FEED "\n", matching ASCII, n/a on keyboard. */
static final short VK_FREE0A = (short) 0x0A;
-
+
/** Constant for the PAGE DOWN function key. ASCII: Vertical Tabulation. */
public static final short VK_PAGE_DOWN = (short) 0x0B;
-
+
/** Constant for the CLEAR key, i.e. FORM FEED, matching ASCII. */
public static final short VK_CLEAR = (short) 0x0C;
-
+
/** Constant for the ENTER key, i.e. CARRIAGE RETURN, matching ASCII. Printable! */
public static final short VK_ENTER = (short) 0x0D;
-
+
static final short VK_FREE0E = (short) 0x0E;
-
+
/** Constant for the CTRL function key. ASCII: shift-in. */
public static final short VK_SHIFT = (short) 0x0F;
/** Constant for the PAGE UP function key. ASCII: Data Link Escape. */
public static final short VK_PAGE_UP = (short) 0x10;
-
+
/** Constant for the CTRL function key. ASCII: device-ctrl-one. */
public static final short VK_CONTROL = (short) 0x11;
-
+
/** Constant for the left ALT function key. ASCII: device-ctrl-two. */
public static final short VK_ALT = (short) 0x12;
-
+
/** Constant for the ALT_GRAPH function key, i.e. right ALT key. ASCII: device-ctrl-three. */
public static final short VK_ALT_GRAPH = (short) 0x13;
-
+
/** Constant for the CAPS LOCK function key. ASCII: device-ctrl-four. */
public static final short VK_CAPS_LOCK = (short) 0x14;
-
+
static final short VK_FREE15 = (short) 0x15;
-
+
/** Constant for the PAUSE function key. ASCII: sync-idle. */
public static final short VK_PAUSE = (short) 0x16;
-
+
/** scroll lock key. ASCII: End Of Transmission Block. */
public static final short VK_SCROLL_LOCK = (short) 0x17;
-
+
/** Constant for the CANCEL function key. ASCII: Cancel. */
public static final short VK_CANCEL = (short) 0x18;
-
+
static final short VK_FREE19 = (short) 0x19;
-
+
/** Constant for the INSERT function key. ASCII: Substitute. */
public static final short VK_INSERT = (short) 0x1A;
-
+
/** Constant for the ESCAPE function key. ASCII: Escape. */
public static final short VK_ESCAPE = (short) 0x1B;
-
+
/** Constant for the Convert function key, Japanese "henkan". ASCII: File Separator. */
public static final short VK_CONVERT = (short) 0x1C;
@@ -496,48 +496,48 @@ public class KeyEvent extends InputEvent
//
// Unicode: Printable [0x20 - 0x7E]
- // NOTE: Collision of 'a' - 'x' [0x61 .. 0x78], used for keyCode/keySym Fn function keys
+ // NOTE: Collision of 'a' - 'x' [0x61 .. 0x78], used for keyCode/keySym Fn function keys
//
-
+
/** Constant for the SPACE function key. ASCII: SPACE. */
public static final short VK_SPACE = (short) 0x20;
-
+
/** Constant for the "!" key. */
public static final short VK_EXCLAMATION_MARK = (short) 0x21;
/** Constant for the """ key. */
public static final short VK_QUOTEDBL = (short) 0x22;
-
+
/** Constant for the "#" key. */
public static final short VK_NUMBER_SIGN = (short) 0x23;
/** Constant for the "$" key. */
public static final short VK_DOLLAR = (short) 0x24;
-
+
/** Constant for the "%" key. */
public static final short VK_PERCENT = (short) 0x25;
-
+
/** Constant for the "&" key. */
public static final short VK_AMPERSAND = (short) 0x26;
-
+
/** Constant for the "'" key. */
public static final short VK_QUOTE = (short) 0x27;
-
+
/** Constant for the "(" key. */
public static final short VK_LEFT_PARENTHESIS = (short) 0x28;
-
+
/** Constant for the ")" key. */
public static final short VK_RIGHT_PARENTHESIS = (short) 0x29;
-
+
/** Constant for the "*" key */
public static final short VK_ASTERISK = (short) 0x2A;
-
+
/** Constant for the "+" key. */
public static final short VK_PLUS = (short) 0x2B;
-
+
/** Constant for the comma key, "," */
public static final short VK_COMMA = (short) 0x2C;
-
+
/** Constant for the minus key, "-" */
public static final short VK_MINUS = (short) 0x2D;
@@ -582,13 +582,13 @@ public class KeyEvent extends InputEvent
/** Constant for the equals key, ">" */
public static final short VK_GREATER = (short) 0x3E;
-
+
/** Constant for the equals key, "?" */
public static final short VK_QUESTIONMARK = (short) 0x3F;
-
+
/** Constant for the equals key, "@" */
public static final short VK_AT = (short) 0x40;
-
+
/** VK_A thru VK_Z are the same as Capital UTF16/ASCII 'A' thru 'Z' (0x41 - 0x5A) */
public static final short VK_A = (short) 0x41;
/** See {@link #VK_A}. */
@@ -656,17 +656,17 @@ public class KeyEvent extends InputEvent
/** Constant for the "_" key */
public static final short VK_UNDERSCORE = (short) 0x5F;
-
+
/** Constant for the "`" key */
public static final short VK_BACK_QUOTE = (short) 0x60;
-
+
/** Small UTF/ASCII 'a' thru 'z' (0x61 - 0x7a) - Not used for keyCode / keySym. */
-
- /**
- * Constant for the Fn function keys.
+
+ /**
+ * Constant for the Fn function keys.
*
* F1..F24, i.e. Fn, are mapped from on 0x60+n -> [0x61 .. 0x78].
- *
+ *
*
* Warning: The Fn function keys do collide with unicode characters small 'a' thru 'x'!
* See Unicode Collision for details.
@@ -743,26 +743,26 @@ public class KeyEvent extends InputEvent
/** Constant for the F24 function key. See {@link #VK_F1}. */
public static final short VK_F24 = (short) ( 0x60+24 );
-
+
/** Constant for the "{" key */
public static final short VK_LEFT_BRACE = (short) 0x7B;
/** Constant for the "|" key */
public static final short VK_PIPE = (short) 0x7C;
/** Constant for the "}" key */
public static final short VK_RIGHT_BRACE = (short) 0x7D;
-
+
/** Constant for the "~" key, matching ASCII */
public static final short VK_TILDE = (short) 0x7E;
-
+
//
// Unicode: Non printable controls: [0x7F - 0x9F]
//
// Numpad keys [0x7F - 0x8E] are printable
//
-
+
/** Numeric keypad decimal separator key. Non printable UTF control. */
public static final short VK_SEPARATOR = (short) 0x7F;
-
+
/** Numeric keypad VK_NUMPAD0 thru VK_NUMPAD9 are mapped to UTF control (0x80 - 0x89). Non printable UTF control. */
public static final short VK_NUMPAD0 = (short) 0x80;
/** See {@link #VK_NUMPAD0}. */
@@ -783,28 +783,28 @@ public class KeyEvent extends InputEvent
public static final short VK_NUMPAD8 = (short) 0x88;
/** See {@link #VK_NUMPAD0}. */
public static final short VK_NUMPAD9 = (short) 0x89;
-
+
/** Numeric keypad decimal separator key. Non printable UTF control. */
public static final short VK_DECIMAL = (short) 0x8A;
-
+
/** Numeric keypad add key. Non printable UTF control. */
public static final short VK_ADD = (short) 0x8B;
/** Numeric keypad subtract key. Non printable UTF control. */
public static final short VK_SUBTRACT = (short) 0x8C;
-
+
/** Numeric keypad multiply key. Non printable UTF control. */
public static final short VK_MULTIPLY = (short) 0x8D;
-
+
/** Numeric keypad divide key. Non printable UTF control. */
public static final short VK_DIVIDE = (short) 0x8E;
-
+
/** Constant for the DEL key, matching ASCII. Non printable UTF control. */
public static final short VK_DELETE = (short) 0x93;
-
+
/** Numeric keypad num lock key. Non printable UTF control. */
public static final short VK_NUM_LOCK = (short) 0x94;
-
+
/** Constant for the cursor- or numerical-pad left arrow key. Non printable UTF control. */
public static final short VK_LEFT = (short) 0x95;
@@ -816,22 +816,22 @@ public class KeyEvent extends InputEvent
/** Constant for the cursor- or numerical pad down arrow key. Non printable UTF control. */
public static final short VK_DOWN = (short) 0x98;
-
+
/** Constant for the Context Menu key. Non printable UTF control. */
public static final short VK_CONTEXT_MENU = (short) 0x99;
/**
* Constant for the MS "Windows" function key.
- * It is used for both the left and right version of the key.
+ * It is used for both the left and right version of the key.
*/
public static final short VK_WINDOWS = (short) 0x9A;
/** Constant for the Meta function key. */
public static final short VK_META = (short) 0x9B;
-
+
/** Constant for the Help function key. */
public static final short VK_HELP = (short) 0x9C;
-
+
/** Constant for the Compose function key. */
public static final short VK_COMPOSE = (short) 0x9D;
@@ -840,21 +840,21 @@ public class KeyEvent extends InputEvent
/** Constant for the Stop function key. */
public static final short VK_STOP = (short) 0x9F;
-
+
//
// Unicode: Printable [0x00A0 - 0xDFFF]
//
-
+
/** Constant for the inverted exclamation mark key. */
public static final short VK_INVERTED_EXCLAMATION_MARK = (short) 0xA1;
-
+
/** Constant for the Euro currency sign key. */
public static final short VK_EURO_SIGN = (short) 0x20AC;
//
// Unicode: Private 0xE000 - 0xF8FF (Marked Non-Printable)
//
-
+
/* for Sun keyboards */
public static final short VK_CUT = (short) 0xF879;
public static final short VK_COPY = (short) 0xF87A;
@@ -871,7 +871,7 @@ public class KeyEvent extends InputEvent
*/
/* Japanese PC 106 keyboard: kanji. Japanese Solaris keyboard: nihongo */
public static final short VK_INPUT_METHOD_ON_OFF = (short) 0xF890;
-
+
/**
* Constant for the Code Input function key.
*/
diff --git a/src/newt/classes/com/jogamp/newt/event/KeyListener.java b/src/newt/classes/com/jogamp/newt/event/KeyListener.java
index b3927d81a..4b16ab61e 100644
--- a/src/newt/classes/com/jogamp/newt/event/KeyListener.java
+++ b/src/newt/classes/com/jogamp/newt/event/KeyListener.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,22 +29,22 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package com.jogamp.newt.event;
/**
* Listener for {@link KeyEvent}s.
- *
+ *
* @see KeyEvent
*/
public interface KeyListener extends NEWTEventListener
{
/** A key has been {@link KeyEvent#EVENT_KEY_PRESSED pressed}, excluding {@link #isAutoRepeat() auto-repeat} {@link #isModifierKey() modifier} keys. See {@link KeyEvent}. */
public void keyPressed(KeyEvent e);
-
- /**
+
+ /**
* A key has been {@link KeyEvent#EVENT_KEY_RELEASED released}, excluding {@link #isAutoRepeat() auto-repeat} {@link #isModifierKey() modifier} keys. See {@link KeyEvent}.
*
* To simulated the removed keyTyped(KeyEvent e) semantics,
@@ -52,9 +52,9 @@ public interface KeyListener extends NEWTEventListener
*
- *
+ *
*/
public void keyReleased(KeyEvent e);
}
diff --git a/src/newt/classes/com/jogamp/newt/event/MonitorEvent.java b/src/newt/classes/com/jogamp/newt/event/MonitorEvent.java
index c47936a7a..77c66a2da 100644
--- a/src/newt/classes/com/jogamp/newt/event/MonitorEvent.java
+++ b/src/newt/classes/com/jogamp/newt/event/MonitorEvent.java
@@ -35,19 +35,19 @@ import com.jogamp.newt.MonitorMode;
public class MonitorEvent extends OutputEvent {
public static final short EVENT_MONITOR_MODE_CHANGE_NOTIFY = 600;
public static final short EVENT_MONITOR_MODE_CHANGED = 601;
-
+
private final MonitorMode mode;
-
+
public MonitorEvent (short eventType, MonitorDevice source, long when, MonitorMode mode) {
super(eventType, source, when);
this.mode = mode;
}
-
+
/** Returns the {@link #getSource() source}, which is a {@link MonitorDevice}. */
public final MonitorDevice getMonitor() { return (MonitorDevice)source; }
-
+
public final MonitorMode getMode() { return mode; }
-
+
public static String getEventTypeString(short type) {
switch(type) {
case EVENT_MONITOR_MODE_CHANGE_NOTIFY: return "EVENT_MONITOR_MODE_CHANGE_NOTIFY";
@@ -55,7 +55,7 @@ public class MonitorEvent extends OutputEvent {
default: return "unknown (" + type + ")";
}
}
-
+
public final String toString() {
return toString(null).toString();
}
diff --git a/src/newt/classes/com/jogamp/newt/event/MouseAdapter.java b/src/newt/classes/com/jogamp/newt/event/MouseAdapter.java
index 3607ae634..652f87d5b 100644
--- a/src/newt/classes/com/jogamp/newt/event/MouseAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/MouseAdapter.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.newt.event;
public abstract class MouseAdapter implements MouseListener
diff --git a/src/newt/classes/com/jogamp/newt/event/MouseEvent.java b/src/newt/classes/com/jogamp/newt/event/MouseEvent.java
index 57dd7e68c..4d7cc3b36 100644
--- a/src/newt/classes/com/jogamp/newt/event/MouseEvent.java
+++ b/src/newt/classes/com/jogamp/newt/event/MouseEvent.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package com.jogamp.newt.event;
@@ -37,12 +37,12 @@ package com.jogamp.newt.event;
/**
* Pointer event of type {@link PointerType}.
*
- * The historical misleading class name may change in the future to PointerEvent.
+ * The historical misleading class name may change in the future to PointerEvent.
*
* In case an instance represents a multiple-pointer event, i.e. {@link #getPointerCount()} is > 1,
* the first data element of the multiple-pointer fields represents the pointer triggering this event.
@@ -62,10 +62,10 @@ package com.jogamp.newt.event;
*
*
* If representing a multiple-pointer event, the {@link #getButton() button number} is mapped to the first {@link #getPointerId(int) pointer ID}
- * triggering the event and the {@link InputEvent#BUTTON1_MASK button mask bits} in the {@link #getModifiers() modifiers}
+ * triggering the event and the {@link InputEvent#BUTTON1_MASK button mask bits} in the {@link #getModifiers() modifiers}
* field represent the pressed pointer IDs.
* Hence users can query the pressed button count as well as the pressed pointer count via {@link InputEvent#getButtonDownCount()}
- * or use the simple query {@link InputEvent#isAnyButtonDown()}.
+ * or use the simple query {@link InputEvent#isAnyButtonDown()}.
*
*/
@SuppressWarnings("serial")
@@ -75,7 +75,7 @@ public class MouseEvent extends InputEvent
public static enum PointerClass implements InputEvent.InputClass {
Offscreen, Onscreen, Undefined;
}
-
+
/** Type of pointer devices */
public static enum PointerType implements InputEvent.InputType {
/** {@link PointerClass#Offscreen} mouse. Ordinal 0. */
@@ -88,10 +88,10 @@ public class MouseEvent extends InputEvent
Pen(PointerClass.Onscreen),
/** {@link PointerClass#Undefined} ?. Ordinal 4. */
Undefined(PointerClass.Undefined);
-
+
public PointerClass getPointerClass() { return pc; }
-
- /**
+
+ /**
* Returns the matching PointerType value corresponding to the given PointerType's integer ordinal.
*
* given:
@@ -108,8 +108,8 @@ public class MouseEvent extends InputEvent
}
throw new IllegalArgumentException("Ordinal "+ordinal+" out of range of PointerType.values()[0.."+(all.length-1)+"]");
}
-
- /**
+
+ /**
* Returns the PointerType array of matching PointerType values corresponding to the given PointerType's integer ordinal values.
*
* See {@link #valueOf(int)}.
@@ -124,13 +124,13 @@ public class MouseEvent extends InputEvent
}
return types;
}
-
+
private PointerType(PointerClass pc) {
this.pc = pc;
}
PointerClass pc;
}
-
+
/** ID for button 1, value 1 */
public static final short BUTTON1 = 1;
/** ID for button 2, value 2 */
@@ -149,17 +149,17 @@ public class MouseEvent extends InputEvent
public static final short BUTTON8 = 8;
/** ID for button 6, value 9 */
public static final short BUTTON9 = 9;
-
+
/** Maximum number of buttons, value 16 */
public static final short BUTTON_COUNT = 16;
- /**
+ /**
* Maximum number of buttons, value 16.
* @deprecated Use {@link #BUTTON_COUNT} .. semantics.
*/
public static final short BUTTON_NUMBER = 16;
-
- /** Returns the 3-axis XYZ rotation array by given rotation on Y axis or X axis (if SHIFT_MASK is given in mods). */
+
+ /** Returns the 3-axis XYZ rotation array by given rotation on Y axis or X axis (if SHIFT_MASK is given in mods). */
public static final float[] getRotationXYZ(final float rotationXorY, final int mods) {
final float[] rotationXYZ = new float[] { 0f, 0f, 0f };
if( 0 != ( mods & InputEvent.SHIFT_MASK ) ) {
@@ -169,14 +169,14 @@ public class MouseEvent extends InputEvent
}
return rotationXYZ;
}
-
- public static final short getClickTimeout() {
- return 300;
+
+ public static final short getClickTimeout() {
+ return 300;
}
-
- /**
+
+ /**
* Constructor for traditional one-pointer event.
- *
+ *
* @param eventType
* @param source
* @param when
@@ -193,7 +193,7 @@ public class MouseEvent extends InputEvent
int modifiers, int x, int y, short clickCount, short button,
float[] rotationXYZ, float rotationScale)
{
- super(eventType, source, when, modifiers);
+ super(eventType, source, when, modifiers);
this.x = new int[]{x};
this.y = new int[]{y};
switch(eventType) {
@@ -214,15 +214,15 @@ public class MouseEvent extends InputEvent
this.pointerType = constMousePointerTypes;
}
- /**
+ /**
* Constructor for a multiple-pointer event.
*
* First element of multiple-pointer arrays represents the pointer which triggered the event!
*
- *
+ *
* @param eventType
* @param source
* @param when
@@ -239,12 +239,12 @@ public class MouseEvent extends InputEvent
* @param rotationXYZ Rotation of all axis
* @param rotationScale Rotation scale
*/
- public MouseEvent(short eventType, Object source, long when, int modifiers,
- PointerType pointerType[], short[] pointerID,
- int[] x, int[] y, float[] pressure, float maxPressure,
+ public MouseEvent(short eventType, Object source, long when, int modifiers,
+ PointerType pointerType[], short[] pointerID,
+ int[] x, int[] y, float[] pressure, float maxPressure,
short button, short clickCount, float[] rotationXYZ, float rotationScale)
{
- super(eventType, source, when, modifiers);
+ super(eventType, source, when, modifiers);
this.x = x;
this.y = y;
final int pointerCount = pointerType.length;
@@ -266,12 +266,12 @@ public class MouseEvent extends InputEvent
this.rotationScale = rotationScale;
this.pointerType = pointerType;
}
-
+
public MouseEvent createVariant(short newEventType) {
return new MouseEvent(newEventType, source, getWhen(), getModifiers(), pointerType, pointerID,
x, y, pressure, maxPressure, button, clickCount, rotationXYZ, rotationScale);
}
-
+
/**
* See details for multiple-pointer events.
* @return the count of pointers involved in this event
@@ -279,7 +279,7 @@ public class MouseEvent extends InputEvent
public final int getPointerCount() {
return pointerType.length;
}
-
+
/**
* See details for multiple-pointer events.
* @return the {@link PointerType} for the data at index or null if index not available.
@@ -290,7 +290,7 @@ public class MouseEvent extends InputEvent
}
return pointerType[index];
}
-
+
/**
* See details for multiple-pointer events.
* @return array of all {@link PointerType}s for all pointers
@@ -298,10 +298,10 @@ public class MouseEvent extends InputEvent
public final PointerType[] getAllPointerTypes() {
return pointerType;
}
-
+
/**
* Return the pointer id for the given index or -1 if index not available.
- *
+ *
* IDs start w/ 0 and are consecutive numbers.
*
*
@@ -317,7 +317,7 @@ public class MouseEvent extends InputEvent
}
return pointerID[index];
}
-
+
/**
* See details for multiple-pointer events.
* @return the pointer index for the given pointer id or -1 if id not available.
@@ -332,7 +332,7 @@ public class MouseEvent extends InputEvent
}
return -1;
}
-
+
/**
* See details for multiple-pointer events.
* @return array of all pointer IDs for all pointers. IDs start w/ 0 and are consecutive numbers.
@@ -340,15 +340,15 @@ public class MouseEvent extends InputEvent
public final short[] getAllPointerIDs() {
return pointerID;
}
-
- /**
+
+ /**
* Returns the button number, e.g. [{@link #BUTTON1}..{@link #BUTTON_COUNT}-1].
*
* A button value of 0 denotes no button activity, i.e. {@link PointerType#Mouse} move.
*
+ *
*/
public final short getButton() {
return button;
@@ -357,16 +357,16 @@ public class MouseEvent extends InputEvent
public final short getClickCount() {
return clickCount;
}
-
+
public final int getX() {
return x[0];
}
-
+
public final int getY() {
return y[0];
}
- /**
+ /**
* See details for multiple-pointer events.
* @param index pointer-index within [0 .. {@link #getPointerCount()}-1]
* @return X-Coord associated with the pointer-index.
@@ -376,7 +376,7 @@ public class MouseEvent extends InputEvent
return x[index];
}
- /**
+ /**
* See details for multiple-pointer events.
* @param index pointer-index within [0 .. {@link #getPointerCount()}-1]
* @return Y-Coord associated with the pointer-index.
@@ -385,7 +385,7 @@ public class MouseEvent extends InputEvent
public final int getY(int index) {
return y[index];
}
-
+
/**
* See details for multiple-pointer events.
* @return array of all X-Coords for all pointers
@@ -393,7 +393,7 @@ public class MouseEvent extends InputEvent
public final int[] getAllX() {
return x;
}
-
+
/**
* See details for multiple-pointer events.
* @return array of all Y-Coords for all pointers
@@ -401,9 +401,9 @@ public class MouseEvent extends InputEvent
public final int[] getAllY() {
return y;
}
-
+
/**
- * @param normalized if true, method returns the normalized pressure, i.e. pressure / maxPressure
+ * @param normalized if true, method returns the normalized pressure, i.e. pressure / maxPressure
* @return The pressure associated with the pointer-index 0.
* The value of zero is return if not available.
* @see #getMaxPressure()
@@ -411,11 +411,11 @@ public class MouseEvent extends InputEvent
public final float getPressure(boolean normalized){
return normalized ? pressure[0] / maxPressure : pressure[0];
}
-
+
/**
* See details for multiple-pointer events.
* @param index pointer-index within [0 .. {@link #getPointerCount()}-1]
- * @param normalized if true, method returns the normalized pressure, i.e. pressure / maxPressure
+ * @param normalized if true, method returns the normalized pressure, i.e. pressure / maxPressure
* @return The pressure associated with the pointer-index.
* The value of zero is return if not available.
* @see #getMaxPressure()
@@ -423,7 +423,7 @@ public class MouseEvent extends InputEvent
public final float getPressure(int index, boolean normalized){
return normalized ? pressure[index] / maxPressure : pressure[index];
}
-
+
/**
* See details for multiple-pointer events.
* @return array of all raw, un-normalized pressures for all pointers
@@ -431,12 +431,12 @@ public class MouseEvent extends InputEvent
public final float[] getAllPressures() {
return pressure;
}
-
- /**
+
+ /**
* Returns the maximum pressure known for the input device generating this event.
*
* This value may be self calibrating on devices/OS, where no known maximum pressure is known.
- * Hence subsequent events may return a higher value.
+ * Hence subsequent events may return a higher value.
*
*
* Self calibrating maximum pressure is performed on:
@@ -448,25 +448,25 @@ public class MouseEvent extends InputEvent
public final float getMaxPressure() {
return maxPressure;
}
-
+
/**
* Returns a 3-component float array filled with the values of the rotational axis
* in the following order: horizontal-, vertical- and z-axis.
- *
+ *
* A vertical rotation of > 0.0f is up and < 0.0f is down.
*
*
- * A horizontal rotation of > 0.0f is left and < 0.0f is right.
+ * A horizontal rotation of > 0.0f is left and < 0.0f is right.
*
*
- * A z-axis rotation of > 0.0f is back and < 0.0f is front.
+ * A z-axis rotation of > 0.0f is back and < 0.0f is front.
*
*
* However, on some OS this might be flipped due to the OS default behavior.
* The latter is true for OS X 10.7 (Lion) for example.
*
*
- * On PointerClass {@link PointerClass#Onscreen onscreen} devices, i.e. {@link PointerType#TouchScreen touch screens},
+ * On PointerClass {@link PointerClass#Onscreen onscreen} devices, i.e. {@link PointerType#TouchScreen touch screens},
* rotation events are usually produced by a 2-finger movement, where horizontal and vertical rotation values are filled.
*
*
@@ -475,13 +475,13 @@ public class MouseEvent extends InputEvent
*
*
* The {@link InputEvent#SHIFT_MASK} modifier is set in case |horizontal| > |vertical| value.
- * This can be utilized to implement only one 2d rotation direction, you may use {@link #isShiftDown()} to query it.
+ * This can be utilized to implement only one 2d rotation direction, you may use {@link #isShiftDown()} to query it.
*
*
* In case the pointer type is {@link PointerType#Mouse mouse},
* events are usually send in steps of one, ie. -1.0f and 1.0f.
* Higher values may result due to fast scrolling.
- * Fractional values may result due to slow scrolling with high resolution devices.
+ * Fractional values may result due to slow scrolling with high resolution devices.
* Here the button number refers to the wheel number.
*
*
@@ -492,24 +492,24 @@ public class MouseEvent extends InputEvent
public final float[] getRotation() {
return rotationXYZ;
}
-
- /**
+
+ /**
* Returns the scale used to determine the {@link #getRotation() rotation value},
* which semantics depends on the {@link #getPointerType() pointer type's} {@link PointerClass}.
*
* For {@link PointerClass#Offscreen}, the scale is usually 1.0f and denominates
* an abstract value without association to a physical value.
- *
+ *
*
* For {@link PointerClass#Onscreen}, the scale varies and denominates
- * the divisor of the distance the finger[s] have moved on the screen.
- * Hence scale * rotation reproduces the screen distance in pixels the finger[s] have moved.
- *
+ * the divisor of the distance the finger[s] have moved on the screen.
+ * Hence scale * rotation reproduces the screen distance in pixels the finger[s] have moved.
+ *
*/
public final float getRotationScale() {
return rotationScale;
}
-
+
public final String toString() {
return toString(null).toString();
}
@@ -533,7 +533,7 @@ public class MouseEvent extends InputEvent
.append("p[").append(pressure[i]).append("/").append(maxPressure).append("=").append(pressure[i]/maxPressure).append("]");
}
sb.append("]");
- }
+ }
sb.append(", ");
return super.toString(sb).append("]");
}
@@ -551,14 +551,14 @@ public class MouseEvent extends InputEvent
default: return "unknown (" + type + ")";
}
}
-
+
/** PointerType for each pointer (multiple pointer) */
private final PointerType pointerType[];
- /**
+ /**
* Pointer-ID for each pointer (multiple pointer). IDs start w/ 0 and are consecutive numbers.
- *
+ *
* A pointer-ID of -1 may also denote no pointer/button activity, i.e. {@link PointerType#Mouse} move.
- *
+ *
*/
private final short pointerID[];
/** X-axis for each pointer (multiple pointer) */
@@ -581,11 +581,11 @@ public class MouseEvent extends InputEvent
/** Rotation scale */
private final float rotationScale;
private final float maxPressure;
-
+
private static final float[] constMousePressure0 = new float[]{0f};
private static final float[] constMousePressure1 = new float[]{1f};
private static final PointerType[] constMousePointerTypes = new PointerType[] { PointerType.Mouse };
-
+
public static final short EVENT_MOUSE_CLICKED = 200;
public static final short EVENT_MOUSE_ENTERED = 201;
public static final short EVENT_MOUSE_EXITED = 202;
diff --git a/src/newt/classes/com/jogamp/newt/event/MouseListener.java b/src/newt/classes/com/jogamp/newt/event/MouseListener.java
index ce6796081..5378080b9 100644
--- a/src/newt/classes/com/jogamp/newt/event/MouseListener.java
+++ b/src/newt/classes/com/jogamp/newt/event/MouseListener.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package com.jogamp.newt.event;
@@ -38,7 +38,7 @@ import com.jogamp.newt.event.MouseEvent.PointerType;
/**
* Listener for {@link MouseEvent}s.
- *
+ *
* @see MouseEvent
*/
public interface MouseListener extends NEWTEventListener
@@ -50,13 +50,13 @@ public interface MouseListener extends NEWTEventListener
public void mouseReleased(MouseEvent e);
public void mouseMoved(MouseEvent e);
public void mouseDragged(MouseEvent e);
-
+
/**
* Traditional event name originally produced by a {@link PointerType#Mouse mouse} pointer type.
*
* Triggered for any rotational pointer events, see
- * {@link MouseEvent#getRotation()} and {@link MouseEvent#getRotationScale()}.
- *
+ * {@link MouseEvent#getRotation()} and {@link MouseEvent#getRotationScale()}.
+ *
*/
public void mouseWheelMoved(MouseEvent e);
}
diff --git a/src/newt/classes/com/jogamp/newt/event/NEWTEvent.java b/src/newt/classes/com/jogamp/newt/event/NEWTEvent.java
index 02bb4f929..022e2d0e1 100644
--- a/src/newt/classes/com/jogamp/newt/event/NEWTEvent.java
+++ b/src/newt/classes/com/jogamp/newt/event/NEWTEvent.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package com.jogamp.newt.event;
@@ -50,7 +50,7 @@ package com.jogamp.newt.event;
*/
@SuppressWarnings("serial")
public class NEWTEvent extends java.util.EventObject {
- /**
+ /**
* See {@link #setConsumed(boolean)} for description.
*/
public static final Object consumedTag = new Object();
@@ -78,11 +78,11 @@ public class NEWTEvent extends java.util.EventObject {
return when;
}
- /**
+ /**
* Attach the passed object to this event.
* If an object was previously attached, it will be replaced.
* Attachments to NEWT events allow users to pass on information
- * from one custom listener to another, ie custom listener to listener
+ * from one custom listener to another, ie custom listener to listener
* communication.
* @param attachment User application specific object
*/
@@ -90,14 +90,14 @@ public class NEWTEvent extends java.util.EventObject {
this.attachment = attachment;
}
- /**
+ /**
* @return The user application specific attachment, or null
*/
public final Object getAttachment() {
return attachment;
}
-
- /**
+
+ /**
* Returns true if this events has been {@link #setConsumed(boolean) consumed},
* otherwise false.
* @see #setConsumed(boolean)
@@ -105,8 +105,8 @@ public class NEWTEvent extends java.util.EventObject {
public final boolean isConsumed() {
return consumedTag == attachment;
}
-
- /**
+
+ /**
* If consumed is true, this event is marked as consumed,
* ie. the event will not be propagated any further to potential other event listener.
* Otherwise the event will be propagated to other event listener, the default.
@@ -130,7 +130,7 @@ public class NEWTEvent extends java.util.EventObject {
setAttachment( null );
}
}
-
+
public String toString() {
return toString(null).toString();
}
diff --git a/src/newt/classes/com/jogamp/newt/event/NEWTEventConsumer.java b/src/newt/classes/com/jogamp/newt/event/NEWTEventConsumer.java
index 6aa19e5f8..14fba6742 100644
--- a/src/newt/classes/com/jogamp/newt/event/NEWTEventConsumer.java
+++ b/src/newt/classes/com/jogamp/newt/event/NEWTEventConsumer.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,18 +20,18 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.newt.event;
public interface NEWTEventConsumer {
- /**
- * Consume the event
+ /**
+ * Consume the event
*
* @return true if the event has been consumed,
* otherwise it returns false for later propagation.
diff --git a/src/newt/classes/com/jogamp/newt/event/NEWTEventFiFo.java b/src/newt/classes/com/jogamp/newt/event/NEWTEventFiFo.java
index fe224bba6..7dd56ad1e 100644
--- a/src/newt/classes/com/jogamp/newt/event/NEWTEventFiFo.java
+++ b/src/newt/classes/com/jogamp/newt/event/NEWTEventFiFo.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.newt.event;
import java.util.LinkedList;
diff --git a/src/newt/classes/com/jogamp/newt/event/NEWTEventListener.java b/src/newt/classes/com/jogamp/newt/event/NEWTEventListener.java
index 677136573..f7ee3d739 100644
--- a/src/newt/classes/com/jogamp/newt/event/NEWTEventListener.java
+++ b/src/newt/classes/com/jogamp/newt/event/NEWTEventListener.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package com.jogamp.newt.event;
diff --git a/src/newt/classes/com/jogamp/newt/event/OutputEvent.java b/src/newt/classes/com/jogamp/newt/event/OutputEvent.java
index 86fa95877..80c7780f8 100644
--- a/src/newt/classes/com/jogamp/newt/event/OutputEvent.java
+++ b/src/newt/classes/com/jogamp/newt/event/OutputEvent.java
@@ -39,7 +39,7 @@ public abstract class OutputEvent extends NEWTEvent
public String toString() {
return toString(null).toString();
}
-
+
public StringBuilder toString(StringBuilder sb) {
if(null == sb) {
sb = new StringBuilder();
diff --git a/src/newt/classes/com/jogamp/newt/event/PinchToZoomGesture.java b/src/newt/classes/com/jogamp/newt/event/PinchToZoomGesture.java
index eceea053d..d275eab46 100644
--- a/src/newt/classes/com/jogamp/newt/event/PinchToZoomGesture.java
+++ b/src/newt/classes/com/jogamp/newt/event/PinchToZoomGesture.java
@@ -35,7 +35,7 @@ import jogamp.newt.Debug;
* 2 pointer zoom, a.k.a. pinch to zoom, gesture handler processing {@link MouseEvent}s
* while producing {@link ZoomEvent}s if gesture is completed.
*
- * Zoom value lies within [0..2], with 1 as 1:1.
+ * Zoom value lies within [0..2], with 1 as 1:1.
*
*
* - choosing the smallest surface edge (width/height -> x/y)
@@ -44,7 +44,7 @@ import jogamp.newt.Debug;
*/
public class PinchToZoomGesture implements GestureHandler {
public static final boolean DEBUG = Debug.debug("Window.MouseEvent");
-
+
/** A {@link GestureHandler.GestureEvent} denominating zoom. */
@SuppressWarnings("serial")
public static class ZoomEvent extends GestureEvent {
@@ -57,10 +57,10 @@ public class PinchToZoomGesture implements GestureHandler {
}
/** Triggering {@link MouseEvent} */
public final MouseEvent getTrigger() { return pe; }
- /** Zoom value lies within [0..2], with 1 as 1:1. */
+ /** Zoom value lies within [0..2], with 1 as 1:1. */
public final float getZoom() { return zoom; }
}
-
+
private final NativeSurface surface;
private float zoom;
private int zoomLastEdgeDist;
@@ -68,7 +68,7 @@ public class PinchToZoomGesture implements GestureHandler {
private boolean zoomMode;
private ZoomEvent zoomEvent;
private short[] pIds = new short[] { -1, -1 };
-
+
public PinchToZoomGesture(NativeSurface surface) {
clear(true);
this.surface = surface;
@@ -80,10 +80,10 @@ public class PinchToZoomGesture implements GestureHandler {
}
private int gesturePointers(final MouseEvent e, final int excludeIndex) {
- int j = 0;
+ int j = 0;
for(int i=e.getPointerCount()-1; i>=0; i--) {
if( excludeIndex != i ) {
- final int id = e.getPointerId(i);
+ final int id = e.getPointerId(i);
if( pIds[0] == id || pIds[1] == id ) {
j++;
}
@@ -91,7 +91,7 @@ public class PinchToZoomGesture implements GestureHandler {
}
return j;
}
-
+
@Override
public void clear(boolean clearStarted) {
zoomEvent = null;
@@ -103,31 +103,31 @@ public class PinchToZoomGesture implements GestureHandler {
pIds[1] = -1;
}
}
-
+
@Override
public boolean isWithinGesture() {
return zoomMode;
}
-
+
@Override
public boolean hasGesture() {
return null != zoomEvent;
}
-
+
@Override
public InputEvent getGestureEvent() {
return zoomEvent;
}
-
- /** Zoom value lies within [0..2], with 1 as 1:1. */
+
+ /** Zoom value lies within [0..2], with 1 as 1:1. */
public final float getZoom() {
return zoom;
}
- /** Set zoom value within [0..2], with 1 as 1:1. */
+ /** Set zoom value within [0..2], with 1 as 1:1. */
public final void setZoom(float zoom) {
this.zoom=zoom;
}
-
+
@Override
public boolean process(final InputEvent in) {
if( null != zoomEvent || !(in instanceof MouseEvent) ) {
@@ -137,15 +137,15 @@ public class PinchToZoomGesture implements GestureHandler {
if( pe.getPointerType(0).getPointerClass() != MouseEvent.PointerClass.Onscreen ) {
return false;
}
-
+
final int pointerDownCount = pe.getPointerCount();
final int eventType = pe.getEventType();
final boolean useY = surface.getWidth() >= surface.getHeight(); // use smallest dimension
switch ( eventType ) {
case MouseEvent.EVENT_MOUSE_PRESSED: {
if( 1 == pointerDownCount ) {
- pIds[0] = pe.getPointerId(0);
- pIds[1] = -1;
+ pIds[0] = pe.getPointerId(0);
+ pIds[1] = -1;
} else if ( 2 <= pointerDownCount ) { // && 1 == gesturePointers(pe, 0) /* w/o pressed pointer */) {
pIds[0] = pe.getPointerId(0);
pIds[1] = pe.getPointerId(1);
@@ -155,13 +155,13 @@ public class PinchToZoomGesture implements GestureHandler {
System.err.println(this+".pressed: down "+pointerDownCount+", gPtr "+gesturePointers(pe, -1)+", event "+pe);
}
} break;
-
+
case MouseEvent.EVENT_MOUSE_RELEASED: {
final int gPtr = gesturePointers(pe, 0); // w/o lifted pointer
if ( 1 == gPtr ) {
zoomFirstTouch = true;
zoomMode = false;
- } else if( 0 == gPtr ) {
+ } else if( 0 == gPtr ) {
// all lifted
clear(true);
}
@@ -169,7 +169,7 @@ public class PinchToZoomGesture implements GestureHandler {
System.err.println(this+".released: down "+pointerDownCount+", gPtr "+gPtr+", event "+pe);
}
} break;
-
+
case MouseEvent.EVENT_MOUSE_DRAGGED: {
if( 2 <= pointerDownCount ) {
final int gPtr = gesturePointers(pe, -1);
@@ -187,13 +187,13 @@ public class PinchToZoomGesture implements GestureHandler {
zoomMode = true;
} else if( zoomMode ) {
final int d = Math.abs(edge0-edge1);
- final int dd = d - zoomLastEdgeDist;
+ final int dd = d - zoomLastEdgeDist;
final float screenEdge = useY ? surface.getHeight() : surface.getWidth();
final float incr = (float)dd / screenEdge; // [-1..1]
if(DEBUG) {
System.err.println("XXX2: id0 "+pIds[0]+" -> idx0 "+p0Idx+", id1 "+pIds[1]+" -> idx1 "+p1Idx);
System.err.println("XXX3: d "+d+", ld "+zoomLastEdgeDist+", dd "+dd+", screen "+screenEdge+" -> incr "+incr+", zoom "+zoom+" -> "+(zoom+incr));
- }
+ }
zoom += incr;
// clip value
if( 2f < zoom ) {
@@ -211,7 +211,7 @@ public class PinchToZoomGesture implements GestureHandler {
}
}
} break;
-
+
default:
}
return null != zoomEvent;
diff --git a/src/newt/classes/com/jogamp/newt/event/TraceKeyAdapter.java b/src/newt/classes/com/jogamp/newt/event/TraceKeyAdapter.java
index 629dc50d7..e826f4a6a 100644
--- a/src/newt/classes/com/jogamp/newt/event/TraceKeyAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/TraceKeyAdapter.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.newt.event;
public class TraceKeyAdapter implements KeyListener {
diff --git a/src/newt/classes/com/jogamp/newt/event/TraceMouseAdapter.java b/src/newt/classes/com/jogamp/newt/event/TraceMouseAdapter.java
index 14ee633a0..d035091c4 100644
--- a/src/newt/classes/com/jogamp/newt/event/TraceMouseAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/TraceMouseAdapter.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.newt.event;
public class TraceMouseAdapter implements MouseListener {
diff --git a/src/newt/classes/com/jogamp/newt/event/TraceWindowAdapter.java b/src/newt/classes/com/jogamp/newt/event/TraceWindowAdapter.java
index 8542820c4..630e85303 100644
--- a/src/newt/classes/com/jogamp/newt/event/TraceWindowAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/TraceWindowAdapter.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.newt.event;
public class TraceWindowAdapter implements WindowListener {
diff --git a/src/newt/classes/com/jogamp/newt/event/WindowAdapter.java b/src/newt/classes/com/jogamp/newt/event/WindowAdapter.java
index b9e487e9b..e237c0d80 100644
--- a/src/newt/classes/com/jogamp/newt/event/WindowAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/WindowAdapter.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.newt.event;
public abstract class WindowAdapter implements WindowListener
diff --git a/src/newt/classes/com/jogamp/newt/event/WindowEvent.java b/src/newt/classes/com/jogamp/newt/event/WindowEvent.java
index 24b3b380a..8c7abfe99 100644
--- a/src/newt/classes/com/jogamp/newt/event/WindowEvent.java
+++ b/src/newt/classes/com/jogamp/newt/event/WindowEvent.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package com.jogamp.newt.event;
@@ -42,7 +42,7 @@ package com.jogamp.newt.event;
@SuppressWarnings("serial")
public class WindowEvent extends NEWTEvent {
public static final short EVENT_WINDOW_RESIZED = 100;
- public static final short EVENT_WINDOW_MOVED = 101;
+ public static final short EVENT_WINDOW_MOVED = 101;
public static final short EVENT_WINDOW_DESTROY_NOTIFY = 102;
public static final short EVENT_WINDOW_GAINED_FOCUS = 103;
public static final short EVENT_WINDOW_LOST_FOCUS = 104;
@@ -65,7 +65,7 @@ public class WindowEvent extends NEWTEvent {
default: return "unknown (" + type + ")";
}
}
-
+
public String toString() {
return toString(null).toString();
}
diff --git a/src/newt/classes/com/jogamp/newt/event/WindowListener.java b/src/newt/classes/com/jogamp/newt/event/WindowListener.java
index dde182510..e097edf23 100644
--- a/src/newt/classes/com/jogamp/newt/event/WindowListener.java
+++ b/src/newt/classes/com/jogamp/newt/event/WindowListener.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package com.jogamp.newt.event;
@@ -44,17 +44,17 @@ public interface WindowListener extends NEWTEventListener {
/** Window has been moved. */
public void windowMoved(WindowEvent e);
- /**
+ /**
* Window destruction has been requested.
*
* Depending on the {@link WindowClosingProtocol#getDefaultCloseOperation() default close operation},
* the window maybe destroyed or not.
*
- * In case the window will be destroyed (see above), release of resources is recommended.
+ * In case the window will be destroyed (see above), release of resources is recommended.
**/
public void windowDestroyNotify(WindowEvent e);
- /**
+ /**
* Window has been destroyed.
*/
public void windowDestroyed(WindowEvent e);
diff --git a/src/newt/classes/com/jogamp/newt/event/WindowUpdateEvent.java b/src/newt/classes/com/jogamp/newt/event/WindowUpdateEvent.java
index a0f6e2cb4..8a204d234 100644
--- a/src/newt/classes/com/jogamp/newt/event/WindowUpdateEvent.java
+++ b/src/newt/classes/com/jogamp/newt/event/WindowUpdateEvent.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.newt.event;
import javax.media.nativewindow.util.Rectangle;
diff --git a/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java b/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java
index 6de2eee45..e3bf18448 100644
--- a/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.newt.event.awt;
import jogamp.newt.Debug;
@@ -48,10 +48,10 @@ import jogamp.newt.Debug;
* Common:
*
// your demo/render code
- javax.media.opengl.GLEvenListener demo1 = new javax.media.opengl.GLEvenListener() { ... } ;
+ javax.media.opengl.GLEvenListener demo1 = new javax.media.opengl.GLEvenListener() { ... } ;
// your AWT agnostic NEWT mouse listener code
- com.jogamp.newt.event.MouseListener mouseListener = new com.jogamp.newt.event.MouseAdapter() { ... } ;
+ com.jogamp.newt.event.MouseListener mouseListener = new com.jogamp.newt.event.MouseAdapter() { ... } ;
*
*
* Default NEWT use case, without using the AWTAdapter:
@@ -96,7 +96,7 @@ import jogamp.newt.Debug;
new AWTMouseAdapter(mouseListener, glWindow).addTo(comp);
*
- *
+ *
* Last but not least, the AWTAdapter maybe used as a general AWT event forwarder to NEWT.
*
*
@@ -108,7 +108,7 @@ import jogamp.newt.Debug;
new AWTMouseAdapter(glWindow).addTo(comp); // forward all AWT events to glWindow, as NEWT events
*
- *
+ *
* @see #attachTo
*/
public abstract class AWTAdapter implements java.util.EventListener
@@ -118,7 +118,7 @@ public abstract class AWTAdapter implements java.util.EventListener
com.jogamp.newt.event.NEWTEventListener newtListener;
com.jogamp.newt.Window newtWindow;
- /**
+ /**
* Simply wrap aroung a NEWT EventListener, exposed as an AWT EventListener.
* The NEWT EventListener will be called when an event happens.
*/
@@ -130,7 +130,7 @@ public abstract class AWTAdapter implements java.util.EventListener
this.newtWindow = null;
}
- /**
+ /**
* Wrap aroung a NEWT EventListener, exposed as an AWT EventListener,
* where the given NEWT Window impersonates as the event's source.
* The NEWT EventListener will be called when an event happens.
@@ -146,7 +146,7 @@ public abstract class AWTAdapter implements java.util.EventListener
this.newtWindow = newtProxy;
}
- /**
+ /**
* Create a pipeline adapter, AWT EventListener.
* Once attached to an AWT component, it sends the converted AWT events to the NEWT downstream window.
* This is only supported with EDT enabled!
@@ -162,15 +162,15 @@ public abstract class AWTAdapter implements java.util.EventListener
}
}
- public final com.jogamp.newt.Window getNewtWindow() {
- return newtWindow;
+ public final com.jogamp.newt.Window getNewtWindow() {
+ return newtWindow;
}
-
+
public final com.jogamp.newt.event.NEWTEventListener getNewtEventListener() {
- return newtListener;
+ return newtListener;
}
-
- /**
+
+ /**
* Due to the fact that some NEWT {@link com.jogamp.newt.event.NEWTEventListener}
* are mapped to more than one {@link java.util.EventListener},
* this method is for your convenience to use this Adapter as a listener for all types.
diff --git a/src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java b/src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java
index bef2e5d0f..1b53671ba 100644
--- a/src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,18 +20,18 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.newt.event.awt;
import jogamp.newt.awt.event.AWTNewtEventFactory;
/**
- * AWT:
+ * AWT:
* printable: PRESSED (t0), TYPED (t0), RELEASED (t1)
* non-printable: PRESSED (t0), RELEASED (t1)
*/
diff --git a/src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java b/src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java
index 115743a0d..ab4bf7a3f 100644
--- a/src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,17 +20,17 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.newt.event.awt;
import jogamp.newt.awt.event.AWTNewtEventFactory;
-public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseListener,
+public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseListener,
java.awt.event.MouseMotionListener,
java.awt.event.MouseWheelListener
{
diff --git a/src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java b/src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java
index e91bb2f82..8c9781b77 100644
--- a/src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,20 +20,20 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.newt.event.awt;
import java.awt.Dimension;
import jogamp.newt.awt.event.AWTNewtEventFactory;
-public class AWTWindowAdapter
- extends AWTAdapter
+public class AWTWindowAdapter
+ extends AWTAdapter
implements java.awt.event.ComponentListener, java.awt.event.WindowListener, java.awt.event.FocusListener
{
WindowClosingListener windowClosingListener;
@@ -63,17 +63,17 @@ public class AWTWindowAdapter
if(awtComponent instanceof java.awt.Window) {
((java.awt.Window)awtComponent).addWindowListener(this);
}
- return this;
+ return this;
}
-
+
public AWTAdapter removeWindowClosingFrom(java.awt.Component awtComponent) {
java.awt.Window win = getWindow(awtComponent);
if( null != win && null != windowClosingListener ) {
win.removeWindowListener(windowClosingListener);
}
- return this;
+ return this;
}
-
+
public AWTAdapter removeFrom(java.awt.Component awtComponent) {
awtComponent.removeFocusListener(this);
awtComponent.removeComponentListener(this);
@@ -225,7 +225,7 @@ public class AWTWindowAdapter
enqueueEvent(true, event);
}
}
- public void windowClosed(java.awt.event.WindowEvent e) {
+ public void windowClosed(java.awt.event.WindowEvent e) {
com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, newtWindow);
if(null!=newtListener) {
((com.jogamp.newt.event.WindowListener)newtListener).windowDestroyed(event);
diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
index cae1a06a2..ac81e8469 100644
--- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
+++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
@@ -127,7 +127,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
}
@Override
- public void windowResized(WindowEvent e) {
+ public void windowResized(WindowEvent e) {
defaultWindowResizedOp(getWidth(), getHeight());
}
@@ -139,7 +139,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
public final Object getUpstreamWidget() {
return window;
}
-
+
/**
* Creates a new GLWindow attaching a new Window referencing a
* new default Screen and default Display with the given GLCapabilities.
@@ -218,7 +218,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
@Override
public final CapabilitiesImmutable getChosenCapabilities() {
final GLDrawable _drawable = drawable;
- return null != _drawable ? _drawable.getChosenGLCapabilities() : window.getChosenCapabilities();
+ return null != _drawable ? _drawable.getChosenGLCapabilities() : window.getChosenCapabilities();
}
@Override
@@ -339,7 +339,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
public final int getY() {
return window.getY();
}
-
+
@Override
public final int getWidth() {
return window.getWidth();
@@ -349,7 +349,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
public final int getHeight() {
return window.getHeight();
}
-
+
@Override
public final void setPosition(int x, int y) {
window.setPosition(x, y);
@@ -363,7 +363,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
public final boolean setFullscreen(boolean fullscreen) {
return window.setFullscreen(fullscreen);
}
-
+
@Override
public boolean setFullscreen(List monitors) {
return window.setFullscreen(monitors);
@@ -418,7 +418,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
public void setWindowDestroyNotifyAction(Runnable r) {
window.setWindowDestroyNotifyAction(r);
}
-
+
@Override
public final void setVisible(boolean visible) {
window.setVisible(visible);
@@ -450,7 +450,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
public void preserveGLStateAtDestroy(boolean value) {
GLWindow.this.preserveGLStateAtDestroy(value);
}
-
+
@Override
public synchronized void destroyActionPreLock() {
// nop
@@ -464,7 +464,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
//Exception e1 = new Exception(msg);
//e1.printStackTrace();
}
-
+
destroyImplInLock();
if(Window.DEBUG_IMPLEMENTATION) {
@@ -493,7 +493,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
} else {
t0 = 0;
}
-
+
if (null == drawable && visible && 0 != window.getWindowHandle() && 0
* At native creation, {@link #setVisible(boolean) setVisible(true)},
@@ -619,7 +619,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
setVisible(true);
}
}
-
+
/**
* {@inheritDoc}
*
@@ -643,7 +643,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
public final void swapBuffers() throws GLException {
defaultSwapBuffers();
}
-
+
//----------------------------------------------------------------------
// NEWTEventConsumer
//
@@ -807,7 +807,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
public final void removeGestureListener(GestureHandler.GestureListener gl) {
window.removeGestureListener(gl);
}
-
+
//----------------------------------------------------------------------
// NativeWindow completion
//
@@ -893,7 +893,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
_forceGL3 = true;
} else if(args[i].equals("-gl4es3")) {
_forceGL4ES3 = true;
- }
+ }
}
}
forceES2 = _forceES2;
@@ -905,7 +905,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
System.err.println("forceES3 "+forceES3);
System.err.println("forceGL3 "+forceGL3);
System.err.println("forceGL4ES3 "+forceGL4ES3);
-
+
System.err.println(VersionUtil.getPlatformInfo());
System.err.println(GlueGenVersion.getInstance());
System.err.println(JoglVersion.getInstance());
diff --git a/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java b/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java
index a2135273b..a25b43777 100644
--- a/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java
+++ b/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -71,9 +71,9 @@ import com.jogamp.newt.util.EDTUtil;
public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
private static final boolean DEBUG = Debug.debug("Window");
private static final boolean isOSX = NativeWindowFactory.TYPE_MACOSX == NativeWindowFactory.getNativeWindowType(false);
-
- private final AbstractGraphicsScreen screen;
-
+
+ private final AbstractGraphicsScreen screen;
+
private WindowClosingMode newtChildCloseOp = WindowClosingMode.DISPOSE_ON_CLOSE;
private volatile Rectangle clientArea;
@@ -82,22 +82,22 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
private volatile boolean newtChildReady = false; // ready if SWTEDTUtil is set and newtChild parented
private volatile boolean postSetSize = false; // pending resize
- /**
- * Creates an instance using {@link #NewtCanvasSWT(Composite, int, Window)}
+ /**
+ * Creates an instance using {@link #NewtCanvasSWT(Composite, int, Window)}
* on the SWT thread.
- *
+ *
*
* Note: The NEWT child {@link Display}'s {@link EDTUtil} is being set to an SWT conform implementation
- * via {@link Display#setEDTUtil(EDTUtil)}.
+ * via {@link Display#setEDTUtil(EDTUtil)}.
*
- *
+ *
* @param parent the SWT composite
- * @param style additional styles to SWT#NO_BACKGROUND
- * @param child optional preassigned {@link #Window}, maybe null
+ * @param style additional styles to SWT#NO_BACKGROUND
+ * @param child optional preassigned {@link #Window}, maybe null
* @return a new instance
*/
public static NewtCanvasSWT create(final Composite parent, final int style, final Window child) {
- final NewtCanvasSWT[] res = new NewtCanvasSWT[] { null };
+ final NewtCanvasSWT[] res = new NewtCanvasSWT[] { null };
parent.getDisplay().syncExec( new Runnable() {
public void run() {
res[0] = new NewtCanvasSWT( parent, style, child);
@@ -105,22 +105,22 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
});
return res[0];
}
-
+
/**
* Instantiates a NewtCanvas with a NEWT child.
- *
+ *
*
* Note: The NEWT child {@link Display}'s {@link EDTUtil} is being set to an SWT conform implementation
- * via {@link Display#setEDTUtil(EDTUtil)}.
+ * via {@link Display#setEDTUtil(EDTUtil)}.
*
- *
+ *
* @param parent the SWT composite
- * @param style additional styles to SWT#NO_BACKGROUND
- * @param child optional preassigned {@link #Window}, maybe null
+ * @param style additional styles to SWT#NO_BACKGROUND
+ * @param child optional preassigned {@link #Window}, maybe null
*/
public NewtCanvasSWT(final Composite parent, final int style, Window child) {
super(parent, style | SWT.NO_BACKGROUND);
-
+
SWTAccessor.setRealized(this, true);
clientArea = getClientArea();
@@ -128,7 +128,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
final AbstractGraphicsDevice device = SWTAccessor.getDevice(this);
screen = SWTAccessor.getScreen(device, -1 /* default */);
nativeWindow = null;
-
+
if(null != child) {
setNEWTChild(child);
}
@@ -161,12 +161,12 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
addListener (SWT.Paint, listener);
addListener (SWT.Dispose, listener);
}
-
+
/** assumes nativeWindow == null ! */
protected final boolean validateNative() {
updateSizeCheck();
final Rectangle nClientArea = clientArea;
- if(0 >= nClientArea.width || 0 >= nClientArea.height) {
+ if(0 >= nClientArea.width || 0 >= nClientArea.height) {
return false;
}
screen.getDevice().open();
@@ -177,9 +177,9 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
final boolean visualIDValid = NativeWindowFactory.isNativeVisualIDValidForProcessing(visualID);
if(DEBUG) {
System.err.println("NewtCanvasSWT.validateNative() windowHandle 0x"+Long.toHexString(nativeWindowHandle)+", visualID 0x"+Integer.toHexString(visualID)+", valid "+visualIDValid);
- }
+ }
if( visualIDValid ) {
- /* Get the nativewindow-Graphics Device associated with this control (which is determined by the parent Composite).
+ /* Get the nativewindow-Graphics Device associated with this control (which is determined by the parent Composite).
* Note: SWT is owner of the native handle, hence no closing operation will be a NOP. */
final CapabilitiesImmutable caps = new Capabilities();
final GraphicsConfigurationFactory factory = GraphicsConfigurationFactory.getFactory(screen.getDevice(), caps);
@@ -187,7 +187,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
if(DEBUG) {
System.err.println("NewtCanvasSWT.validateNative() factory: "+factory+", windowHandle 0x"+Long.toHexString(nativeWindowHandle)+", visualID 0x"+Integer.toHexString(visualID)+", chosen config: "+config);
// Thread.dumpStack();
- }
+ }
if (null == config) {
throw new NativeWindowException("Error choosing GraphicsConfiguration creating window: "+this);
}
@@ -198,11 +198,11 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
return null != nativeWindow;
}
-
+
protected final void updateSizeCheck() {
final Rectangle oClientArea = clientArea;
final Rectangle nClientArea = getClientArea();
- if ( nClientArea != null &&
+ if ( nClientArea != null &&
( nClientArea.width != oClientArea.width || nClientArea.height != oClientArea.height )
) {
clientArea = nClientArea; // write back new value
@@ -217,12 +217,12 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
}
}
}
-
+
@Override
public void update() {
// don't paint background etc .. nop avoids flickering
}
-
+
/**
* Destroys this resource:
*
@@ -248,12 +248,12 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
}
screen.getDevice().close();
nativeWindow = null;
- super.dispose();
+ super.dispose();
}
-
+
/** @return this SWT Canvas NativeWindow representation, may be null in case it has not been realized. */
public NativeWindow getNativeWindow() { return nativeWindow; }
-
+
public WindowClosingMode getDefaultCloseOperation() {
return newtChildCloseOp; // TODO: implement ?!
}
@@ -264,28 +264,28 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
boolean isParent() {
- return null!=newtChild ;
+ return null!=newtChild ;
}
boolean isFullscreen() {
return null != newtChild && newtChild.isFullscreen();
}
- /**
+ /**
* Sets a new NEWT child, provoking reparenting.
*
* A previously detached newChild will be released to top-level status
- * and made invisible.
+ * and made invisible.
*
*
- * Note: When switching NEWT child's, detaching the previous first via setNEWTChild(null)
- * produced much cleaner visual results.
+ * Note: When switching NEWT child's, detaching the previous first via setNEWTChild(null)
+ * produced much cleaner visual results.
*
*
* Note: The NEWT child {@link Display}'s {@link EDTUtil} is being set to an SWT conform implementation
- * via {@link Display#setEDTUtil(EDTUtil)}.
+ * via {@link Display#setEDTUtil(EDTUtil)}.
*
- * @return the previous attached newt child.
+ * @return the previous attached newt child.
*/
public Window setNEWTChild(final Window newChild) {
final Window prevChild = newtChild;
@@ -302,14 +302,14 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
if(null != nativeWindow && null != newChild) {
reparentWindow( true );
}
- return prevChild;
+ return prevChild;
}
-
+
/** @return the current NEWT child */
public Window getNEWTChild() {
return newtChild;
}
-
+
@Override
public boolean setParent(Composite parent) {
return super.setParent(parent);
@@ -319,11 +319,11 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
newtChildReady = attach;
if( null != newtChild ) {
newtChild.setKeyboardFocusHandler(null);
- if(attach) {
- newtChildCloseOp = newtChild.setDefaultCloseOperation(WindowClosingMode.DO_NOTHING_ON_CLOSE);
+ if(attach) {
+ newtChildCloseOp = newtChild.setDefaultCloseOperation(WindowClosingMode.DO_NOTHING_ON_CLOSE);
} else {
newtChild.setFocusAction(null);
- newtChild.setDefaultCloseOperation(newtChildCloseOp);
+ newtChild.setDefaultCloseOperation(newtChildCloseOp);
}
}
}
@@ -335,13 +335,13 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
if(DEBUG) {
System.err.println("NewtCanvasSWT.reparentWindow.0: add="+add+", win "+newtWinHandleToHexString(newtChild)+", EDTUtil: cur "+newtChild.getScreen().getDisplay().getEDTUtil());
}
-
+
newtChild.setFocusAction(null); // no AWT focus traversal ..
if(add) {
updateSizeCheck();
final int w = clientArea.width;
final int h = clientArea.height;
-
+
// set SWT EDT and start it
{
final Display newtDisplay = newtChild.getScreen().getDisplay();
@@ -349,14 +349,14 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
edtUtil.start();
newtDisplay.setEDTUtil( edtUtil );
}
-
- newtChild.setSize(w, h);
+
+ newtChild.setSize(w, h);
newtChild.reparentWindow(nativeWindow);
newtChild.setVisible(true);
- configureNewtChild(true);
+ configureNewtChild(true);
newtChild.sendWindowEvent(WindowEvent.EVENT_WINDOW_RESIZED); // trigger a resize/relayout to listener
-
- // force this SWT Canvas to be focus-able,
+
+ // force this SWT Canvas to be focus-able,
// since it is completely covered by the newtChild (z-order).
setEnabled(true);
} else {
@@ -375,19 +375,19 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
newtChild.requestFocus();
}
}
-
+
@Override
public boolean forceFocus() {
final boolean res = NewtCanvasSWT.super.forceFocus();
requestFocusNEWTChild();
- return res;
+ return res;
}
-
+
private class SWTNativeWindow implements NativeWindow {
private final AbstractGraphicsConfiguration config;
private final long nativeWindowHandle;
private final InsetsImmutable insets; // only required to allow proper client position calculation on OSX
-
+
public SWTNativeWindow(AbstractGraphicsConfiguration config, long nativeWindowHandle) {
this.config = config;
this.nativeWindowHandle = nativeWindowHandle;
@@ -397,7 +397,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
this.insets = new Insets(0, 0, 0, 0);
}
}
-
+
@Override
public int lockSurface() throws NativeWindowException, RuntimeException {
return NativeSurface.LOCK_SUCCESS;
@@ -432,7 +432,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
public void removeSurfaceUpdatedListener(SurfaceUpdatedListener l) { }
@Override
- public long getSurfaceHandle() {
+ public long getSurfaceHandle() {
return 0;
}
@@ -462,7 +462,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
}
@Override
- public void surfaceUpdated(Object updater, NativeSurface ns, long when) { }
+ public void surfaceUpdated(Object updater, NativeSurface ns, long when) { }
@Override
public void destroy() { }
@@ -497,7 +497,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
if( isOSX ) {
final Point los = OSXUtil.GetLocationOnScreen(nativeWindowHandle, false, 0, 0);
// top-level position -> client window position
- los.set(los.getX() + insets.getLeftWidth(), los.getY() + insets.getTopHeight());
+ los.set(los.getX() + insets.getLeftWidth(), los.getY() + insets.getTopHeight());
if(null!=point) {
return point.translate(los);
} else {
@@ -506,7 +506,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
} else {
// client position on 'normal' windowing systems is 0/0
if(null == point) {
- point = new Point(0, 0);
+ point = new Point(0, 0);
}
return point;
}
@@ -515,7 +515,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
@Override
public boolean hasFocus() {
return isFocusControl();
- }
+ }
};
static String newtWinHandleToHexString(Window w) {
diff --git a/src/newt/classes/com/jogamp/newt/util/EDTUtil.java b/src/newt/classes/com/jogamp/newt/util/EDTUtil.java
index 52ca95682..582dc3e1f 100644
--- a/src/newt/classes/com/jogamp/newt/util/EDTUtil.java
+++ b/src/newt/classes/com/jogamp/newt/util/EDTUtil.java
@@ -63,17 +63,17 @@ public interface EDTUtil {
* @param ms poll period in milliseconds
*/
public void setPollPeriod(long ms);
-
+
/**
* Starts the EDT after it's creation or after {@link #invokeStop(boolean, Runnable) stopping}.
*
* If the EDT is running, it must be {@link #invokeStop(boolean, Runnable) stopped} first
* and the caller should wait {@link #waitUntilStopped() until it's stopped}.
*
- *
+ *
* @return true if EDT has been successfully restarted, otherwise false
* @throws IllegalStateException if EDT is running and not subject to be stopped, i.e. {@link #isRunning()} returns true
- *
+ *
* @see #invokeStop(boolean, java.lang.Runnable)
* @see #waitUntilStopped()
*/
@@ -82,11 +82,11 @@ public interface EDTUtil {
/**
* Returns true if the current thread is the event dispatch thread (EDT).
*
- * The EDT is the platform specific thread dispatching toolkit-events
+ * The EDT is the platform specific thread dispatching toolkit-events
* and executing toolkit-tasks enqueued via {@link #invoke(boolean, Runnable)}.
*
*
- * Usually it is the same thread as used to dequeue informal {@link NEWTEvent}s (NEDT), see {@link #isCurrentThreadNEDT()},
+ * Usually it is the same thread as used to dequeue informal {@link NEWTEvent}s (NEDT), see {@link #isCurrentThreadNEDT()},
* however, this may differ, e.g. SWT and AWT implementation.
*
*/
@@ -95,28 +95,28 @@ public interface EDTUtil {
/**
* Returns true if the current thread is the internal NEWT event dequeue thread (NEDT).
*
- * The NEDT is the NEWT thread used to dequeue informal {@link NEWTEvent}s enqueued internally
+ * The NEDT is the NEWT thread used to dequeue informal {@link NEWTEvent}s enqueued internally
* via {@link DisplayImpl#enqueueEvent(boolean, NEWTEvent)}.
*
*
- * Usually it is the same thread as the EDT, see {@link #isCurrentThreadEDT()},
+ * Usually it is the same thread as the EDT, see {@link #isCurrentThreadEDT()},
* however, this may differ, e.g. SWT and AWT implementation.
*
*/
public boolean isCurrentThreadNEDT();
-
+
/**
* Returns true if either {@link #isCurrentThreadEDT()} or {@link #isCurrentThreadNEDT()} is true,
* otherwise false.
*/
public boolean isCurrentThreadEDTorNEDT();
-
+
/**
* @return True if EDT is running and not subject to be stopped.
*/
public boolean isRunning();
- /**
+ /**
* Append the final task to the EDT task queue,
* signals EDT to stop.
*
@@ -133,22 +133,22 @@ public interface EDTUtil {
*
{@link #start()} may follow immediately, ie creating a new EDT
*
*
- * @return true if task has been executed or queued for later execution, otherwise false
+ * @return true if task has been executed or queued for later execution, otherwise false
*/
public boolean invokeStop(boolean wait, Runnable finalTask);
- /**
+ /**
* Appends task to the EDT task queue if current thread is not EDT,
- * otherwise execute task immediately.
+ * otherwise execute task immediately.
*
* Wait until execution is finished if wait == true.
*
* Can be issued from within EDT, ie from within an enqueued task.
- * @return true if task has been executed or queued for later execution, otherwise false
+ * @return true if task has been executed or queued for later execution, otherwise false
*/
public boolean invoke(boolean wait, Runnable task);
- /**
+ /**
* Wait until the EDT task queue is empty.
* The last task may still be in execution when this method returns.
* @return true if waited for idle, otherwise false, i.e. in case of current thread is EDT or NEDT
diff --git a/src/newt/classes/com/jogamp/newt/util/MainThread.java b/src/newt/classes/com/jogamp/newt/util/MainThread.java
index 5e79e9b49..049320b21 100644
--- a/src/newt/classes/com/jogamp/newt/util/MainThread.java
+++ b/src/newt/classes/com/jogamp/newt/util/MainThread.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
@@ -54,13 +54,13 @@ import jogamp.newt.NEWTJNILibLoader;
* NEWT Utility class MainThread
*
*
- * FIXME: Update this documentation!
+ * FIXME: Update this documentation!
* This class just provides a main-thread utility, forking of a main java class
* on another thread while being able to continue doing platform specific things
* on the main-thread. The latter is essential for eg. MacOSX, where we continue
* to run NSApp.run().
*
- *
+ *
* This class provides a startup singleton main thread,
* from which a new thread with the users main class is launched.
*
@@ -72,17 +72,17 @@ import jogamp.newt.NEWTJNILibLoader;
* use a NEWT multithreaded application with window handling within the different threads,
* even on these restricted platforms.
*
- * To support your NEWT Window platform,
+ * To support your NEWT Window platform,
* you have to pass your main thread actions to {@link #invoke invoke(..)},
* have a look at the {@link jogamp.newt.driver.macosx.WindowDriver NEWT Mac OSX Window} driver implementation.
- * TODO: Some hardcoded dependencies exist in this implementation,
+ * TODO: Some hardcoded dependencies exist in this implementation,
* where you have to patch this code or factor it out.
- *
+ *
* If your platform is not Mac OS X, but you want to test your code without modifying
* this class, you have to set the system property newt.MainThread.force to true.
*
* The code is compatible with all other platform, which support multithreaded windowing handling.
- * Since those platforms won't trigger the main thread serialization, the main method
+ * Since those platforms won't trigger the main thread serialization, the main method
* will be simply executed, in case you haven't set newt.MainThread.force to true.
*
* Test case on Mac OS X (or any other platform):
@@ -96,35 +96,35 @@ public class MainThread {
private static final Platform.OSType osType;
private static final boolean isMacOSX;
private static final ThreadGroup rootThreadGroup;
-
+
/** if true, use the main thread EDT, otherwise AWT's EDT */
public static final boolean HINT_USE_MAIN_THREAD;
-
+
static {
NativeWindowFactory.initSingleton();
NEWTJNILibLoader.loadNEWT();
- HINT_USE_MAIN_THREAD = !NativeWindowFactory.isAWTAvailable() ||
+ HINT_USE_MAIN_THREAD = !NativeWindowFactory.isAWTAvailable() ||
Debug.getBooleanProperty("newt.MainThread.force", true);
osType = Platform.getOSType();
isMacOSX = osType == Platform.OSType.MACOS;
rootThreadGroup = getRootThreadGroup();
}
-
+
public static boolean useMainThread = false;
-
+
protected static final boolean DEBUG = Debug.debug("MainThread");
private static final MainThread singletonMainThread = new MainThread(); // one singleton MainThread
-
+
private static final ThreadGroup getRootThreadGroup() {
ThreadGroup rootGroup = Thread.currentThread( ).getThreadGroup( );
ThreadGroup parentGroup;
while ( ( parentGroup = rootGroup.getParent() ) != null ) {
rootGroup = parentGroup;
}
- return rootGroup;
+ return rootGroup;
}
-
+
private static final Thread[] getAllThreads(int[] count) {
int tn;
Thread[] threads = new Thread[ rootThreadGroup.activeCount() ];
@@ -149,17 +149,17 @@ public class MainThread {
t.printStackTrace();
}
}
- return res;
+ return res;
}
private static final int getNonDaemonThreadCount(List ignoreThreads) {
int res = 0;
int[] tn = { 0 };
Thread[] threads = getAllThreads(tn);
-
+
for(int i = tn[0] - 1; i >= 0; i--) {
final Thread thread = threads[i];
try {
- if(thread.isAlive() && !thread.isDaemon() && !ignoreThreads.contains(thread)) {
+ if(thread.isAlive() && !thread.isDaemon() && !ignoreThreads.contains(thread)) {
res++;
if(DEBUG) System.err.println("MainAction.run(): non daemon thread: "+thread);
}
@@ -167,9 +167,9 @@ public class MainThread {
t.printStackTrace();
}
}
- return res;
+ return res;
}
-
+
static class UserApp extends Thread {
private final String mainClassNameShort;
private final String mainClassName;
@@ -181,7 +181,7 @@ public class MainThread {
super();
this.mainClassName=mainClassName;
this.mainClassArgs=mainClassArgs;
-
+
final Class> mainClass = ReflectionUtil.getClass(mainClassName, true, getClass().getClassLoader());
if(null==mainClass) {
throw new ClassNotFoundException("MainAction couldn't find main class "+mainClassName);
@@ -192,7 +192,7 @@ public class MainThread {
setName(getName()+"-UserApp-"+mainClassNameShort);
setDaemon(false);
-
+
if(DEBUG) System.err.println("MainAction(): instantiated: "+getName()+", is daemon "+isDaemon()+", main-class: "+mainClass.getName());
}
@@ -230,32 +230,32 @@ public class MainThread {
if(isMacOSX) {
try {
if(DEBUG) {
- System.err.println("MainAction.main(): "+Thread.currentThread()+" MainAction fin - stopNSApp.0");
+ System.err.println("MainAction.main(): "+Thread.currentThread()+" MainAction fin - stopNSApp.0");
}
- ReflectionUtil.callStaticMethod(MACOSXDisplayClassName, "stopNSApplication",
+ ReflectionUtil.callStaticMethod(MACOSXDisplayClassName, "stopNSApplication",
null, null, MainThread.class.getClassLoader());
if(DEBUG) {
- System.err.println("MainAction.main(): "+Thread.currentThread()+" MainAction fin - stopNSApp.X");
+ System.err.println("MainAction.main(): "+Thread.currentThread()+" MainAction fin - stopNSApp.X");
}
} catch (Exception e) {
e.printStackTrace();
}
} else {
if(DEBUG) System.err.println("MainAction.run(): "+Thread.currentThread().getName()+" MainAction fin - System.exit(0)");
- System.exit(0);
- }
+ System.exit(0);
+ }
}
}
}
private static UserApp mainAction;
- /** Your new java application main entry, which pipelines your application
- * @throws ClassNotFoundException
- * @throws NoSuchMethodException
+ /** Your new java application main entry, which pipelines your application
+ * @throws ClassNotFoundException
+ * @throws NoSuchMethodException
* @throws SecurityException */
public static void main(String[] args) throws SecurityException, NoSuchMethodException, ClassNotFoundException {
final Thread cur = Thread.currentThread();
-
+
useMainThread = HINT_USE_MAIN_THREAD;
if(DEBUG) {
@@ -268,7 +268,7 @@ public class MainThread {
if(!useMainThread && !NativeWindowFactory.isAWTAvailable()) {
throw new RuntimeException("!USE_MAIN_THREAD and no AWT available");
}
-
+
if(args.length==0) {
return;
}
@@ -282,7 +282,7 @@ public class MainThread {
mainAction = new UserApp(mainClassName, mainClassArgs);
if(isMacOSX) {
- ReflectionUtil.callStaticMethod(MACOSXDisplayClassName, "initSingleton",
+ ReflectionUtil.callStaticMethod(MACOSXDisplayClassName, "initSingleton",
null, null, MainThread.class.getClassLoader());
}
@@ -290,24 +290,24 @@ public class MainThread {
try {
cur.setName(cur.getName()+"-MainThread");
} catch (Exception e) {}
-
+
// dispatch user's main thread ..
mainAction.start();
-
+
if(isMacOSX) {
try {
if(DEBUG) {
- System.err.println("MainThread.main(): "+cur.getName()+"- runNSApp");
+ System.err.println("MainThread.main(): "+cur.getName()+"- runNSApp");
}
- ReflectionUtil.callStaticMethod(MACOSXDisplayClassName, "runNSApplication",
+ ReflectionUtil.callStaticMethod(MACOSXDisplayClassName, "runNSApplication",
null, null, MainThread.class.getClassLoader());
} catch (Exception e) {
e.printStackTrace();
}
- }
- if(DEBUG) { System.err.println("MainThread - wait until last non daemon thread ends ..."); }
+ }
+ if(DEBUG) { System.err.println("MainThread - wait until last non daemon thread ends ..."); }
} else {
- // run user's main in this thread
+ // run user's main in this thread
mainAction.run();
}
}
diff --git a/src/newt/classes/com/jogamp/newt/util/MonitorModeUtil.java b/src/newt/classes/com/jogamp/newt/util/MonitorModeUtil.java
index c30b427d6..fdd7985fe 100644
--- a/src/newt/classes/com/jogamp/newt/util/MonitorModeUtil.java
+++ b/src/newt/classes/com/jogamp/newt/util/MonitorModeUtil.java
@@ -42,7 +42,7 @@ import javax.media.nativewindow.util.SurfaceSize;
* filters etc.
*/
public class MonitorModeUtil {
-
+
public static int getIndex(List monitorModes, MonitorMode search) {
return monitorModes.indexOf(search);
}
@@ -69,7 +69,7 @@ public class MonitorModeUtil {
}
return null;
}
-
+
/** Sort the given {@link MonitorMode} collection w/ {@link MonitorMode#compareTo(MonitorMode)} function. */
public static void sort(List monitorModes, boolean ascendingOrder) {
if( ascendingOrder ) {
@@ -78,9 +78,9 @@ public class MonitorModeUtil {
Collections.sort(monitorModes, MonitorMode.monitorModeComparatorInv);
}
}
-
+
/**
- *
+ *
* @param monitorModes
* @param surfaceSize
* @return modes with exact {@link SurfaceSize}. May return zero sized list for non.
@@ -99,7 +99,7 @@ public class MonitorModeUtil {
}
/**
- *
+ *
* @param monitorModes
* @param rotation
* @return modes with exact rotation. May return zero sized list for non.
@@ -118,7 +118,7 @@ public class MonitorModeUtil {
}
/**
- *
+ *
* @param monitorModes
* @param bitsPerPixel
* @return modes with exact bpp. May return zero sized list for non.
@@ -137,7 +137,7 @@ public class MonitorModeUtil {
}
/**
- *
+ *
* @param monitorModes
* @param flags
* @return modes with exact flags. May return zero sized list for non.
@@ -165,7 +165,7 @@ public class MonitorModeUtil {
if( null!=monitorModes && monitorModes.size()>0 ) {
final int resolution_sq = resolution.getHeight()*resolution.getWidth();
int mode_dsq=Integer.MAX_VALUE, mode_dsq_idx=0;
-
+
for (int i=0; null!=monitorModes && i() {
public Object run() {
PropertyAccess.addTrustedPrefix("newt.");
return null;
} } );
-
+
verbose = isPropertyDefined("newt.verbose", true);
debugAll = isPropertyDefined("newt.debug", true);
if (verbose) {
diff --git a/src/newt/classes/jogamp/newt/DefaultEDTUtil.java b/src/newt/classes/jogamp/newt/DefaultEDTUtil.java
index 3d1037ad5..f33b4744e 100644
--- a/src/newt/classes/jogamp/newt/DefaultEDTUtil.java
+++ b/src/newt/classes/jogamp/newt/DefaultEDTUtil.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
@@ -51,7 +51,7 @@ public class DefaultEDTUtil implements EDTUtil {
public static final boolean DEBUG = Debug.debug("EDT");
private final Object edtLock = new Object(); // locking the EDT start/stop state
- private /* final */ ThreadGroup threadGroup;
+ private /* final */ ThreadGroup threadGroup;
private final String name;
private final Runnable dispatchMessages;
private NEDT edt = null;
@@ -75,7 +75,7 @@ public class DefaultEDTUtil implements EDTUtil {
final public void setPollPeriod(long ms) {
pollPeriod = ms;
}
-
+
@Override
public final boolean start() throws IllegalStateException {
synchronized(edtLock) {
@@ -117,7 +117,7 @@ public class DefaultEDTUtil implements EDTUtil {
public final boolean isCurrentThreadEDT() {
return edt == Thread.currentThread(); // EDT == NEDT
}
-
+
@Override
public final boolean isCurrentThreadNEDT() {
return edt == Thread.currentThread(); // EDT == NEDT
@@ -126,8 +126,8 @@ public class DefaultEDTUtil implements EDTUtil {
@Override
public final boolean isCurrentThreadEDTorNEDT() {
return edt == Thread.currentThread(); // EDT == NEDT
- }
-
+ }
+
@Override
public final boolean isRunning() {
return edt.isRunning() ;
@@ -149,9 +149,9 @@ public class DefaultEDTUtil implements EDTUtil {
private static Runnable nullTask = new Runnable() {
@Override
- public void run() { }
+ public void run() { }
};
-
+
private final boolean invokeImpl(boolean wait, Runnable task, boolean stop) {
Throwable throwable = null;
RunnableTask rTask = null;
@@ -201,7 +201,7 @@ public class DefaultEDTUtil implements EDTUtil {
synchronized(edt.tasks) {
rTask = new RunnableTask(task,
wait ? rTaskLock : null,
- true /* always catch and report Exceptions, don't disturb EDT */,
+ true /* always catch and report Exceptions, don't disturb EDT */,
wait ? null : System.err);
if(stop) {
rTask.setAttachment(new Boolean(true)); // mark final task, will imply shouldStop:=true
@@ -305,8 +305,8 @@ public class DefaultEDTUtil implements EDTUtil {
throw new InternalError("XXX");
}
}
-
- /**
+
+ /**
* Utilizing locking only on tasks and its execution,
* not for event dispatching.
*/
@@ -315,7 +315,7 @@ public class DefaultEDTUtil implements EDTUtil {
if(DEBUG) {
System.err.println(getName()+": Default-EDT run() START "+ getName());
}
- if(Lock.DEBUG) {
+ if(Lock.DEBUG) {
validateNoRecursiveLocksHold();
}
RuntimeException error = null;
@@ -368,7 +368,7 @@ public class DefaultEDTUtil implements EDTUtil {
} finally {
if(DEBUG) {
RunnableTask rt = ( tasks.size() > 0 ) ? tasks.get(0) : null ;
- System.err.println(getName()+": Default-EDT run() END "+ getName()+", tasks: "+tasks.size()+", "+rt+", "+error);
+ System.err.println(getName()+": Default-EDT run() END "+ getName()+", tasks: "+tasks.size()+", "+rt+", "+error);
}
synchronized(edtLock) {
isRunning = false;
diff --git a/src/newt/classes/jogamp/newt/DisplayImpl.java b/src/newt/classes/jogamp/newt/DisplayImpl.java
index 0f47c87a0..c6cb706a4 100644
--- a/src/newt/classes/jogamp/newt/DisplayImpl.java
+++ b/src/newt/classes/jogamp/newt/DisplayImpl.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt;
@@ -60,16 +60,16 @@ public abstract class DisplayImpl extends Display {
}
});
}
-
+
/** Ensure static init has been run. */
/* pp */static void initSingleton() { }
-
- private static Class> getDisplayClass(String type)
- throws ClassNotFoundException
+
+ private static Class> getDisplayClass(String type)
+ throws ClassNotFoundException
{
final Class> displayClass = NewtFactory.getCustomClass(type, "DisplayDriver");
if(null==displayClass) {
- throw new ClassNotFoundException("Failed to find NEWT Display Class <"+type+".DisplayDriver>");
+ throw new ClassNotFoundException("Failed to find NEWT Display Class <"+type+".DisplayDriver>");
}
return displayClass;
}
@@ -100,7 +100,7 @@ public abstract class DisplayImpl extends Display {
display.setEDTUtil( display.edtUtil ); // device's default if EDT is used, or null
Display.addDisplay2List(display);
}
-
+
if(DEBUG) {
System.err.println("Display.create() NEW: "+display+" "+getThreadName());
}
@@ -109,7 +109,7 @@ public abstract class DisplayImpl extends Display {
throw new RuntimeException(e);
}
}
-
+
@Override
public boolean equals(Object obj) {
if (obj == null) {
@@ -168,7 +168,7 @@ public abstract class DisplayImpl extends Display {
protected EDTUtil createEDTUtil() {
final EDTUtil def;
if(NewtFactory.useEDT()) {
- def = new DefaultEDTUtil(Thread.currentThread().getThreadGroup(), "Display-"+getFQName(), dispatchMessagesRunnable);
+ def = new DefaultEDTUtil(Thread.currentThread().getThreadGroup(), "Display-"+getFQName(), dispatchMessagesRunnable);
if(DEBUG) {
System.err.println("Display.createEDTUtil("+getFQName()+"): "+def.getClass().getName());
}
@@ -271,7 +271,7 @@ public abstract class DisplayImpl extends Display {
if(DEBUG) {
System.err.println("Display.destroy(): "+this+", active "+displaysActive+" "+getThreadName());
}
- }
+ }
final DisplayImpl f_dpy = this;
final AbstractGraphicsDevice f_aDevice = aDevice;
aDevice = null;
@@ -287,10 +287,10 @@ public abstract class DisplayImpl extends Display {
dumpDisplayList("Display.destroy("+getFQName()+") END");
}
}
-
+
/** May be utilized at a shutdown hook, impl. does not block. */
/* pp */ static final void shutdownAll() {
- final int dCount = displayList.size();
+ final int dCount = displayList.size();
if(DEBUG) {
dumpDisplayList("Display.shutdownAll "+dCount+" instances, on thread "+getThreadName());
}
@@ -306,7 +306,7 @@ public abstract class DisplayImpl extends Display {
final EDTUtil edtUtil = d.getEDTUtil();
final AbstractGraphicsDevice f_aDevice = d.aDevice;
d.aDevice = null;
- d.refCount=0;
+ d.refCount=0;
final Runnable closeNativeTask = new Runnable() {
public void run() {
if ( null != d.getGraphicsDevice() ) {
@@ -381,7 +381,7 @@ public abstract class DisplayImpl extends Display {
public final String getFQName() {
return fqname;
}
-
+
@Override
public final boolean isExclusive() {
return exclusive;
@@ -438,7 +438,7 @@ public abstract class DisplayImpl extends Display {
@Override
public String toString() {
final EDTUtil _edtUtil = edtUtil;
- final boolean _edtUtilRunning = ( null != _edtUtil ) ? _edtUtil.isRunning() : false;
+ final boolean _edtUtilRunning = ( null != _edtUtil ) ? _edtUtil.isRunning() : false;
return "NEWT-Display["+getFQName()+", excl "+exclusive+", refCount "+refCount+", hasEDT "+(null!=_edtUtil)+", edtRunning "+_edtUtilRunning+", "+aDevice+"]";
}
@@ -455,8 +455,8 @@ public abstract class DisplayImpl extends Display {
} };
final void dispatchMessage(final NEWTEvent event) {
- try {
- final Object source = event.getSource();
+ try {
+ final Object source = event.getSource();
if(source instanceof NEWTEventConsumer) {
final NEWTEventConsumer consumer = (NEWTEventConsumer) source ;
if(!consumer.consumeEvent(event)) {
@@ -476,10 +476,10 @@ public abstract class DisplayImpl extends Display {
throw re;
}
}
-
+
final void dispatchMessage(final NEWTEventTask eventTask) {
final NEWTEvent event = eventTask.get();
- try {
+ try {
if(null == event) {
// Ooops ?
System.err.println("Warning: event of eventTask is NULL");
@@ -495,15 +495,15 @@ public abstract class DisplayImpl extends Display {
throw re;
}
}
- eventTask.notifyCaller();
+ eventTask.notifyCaller();
}
-
+
@Override
public void dispatchMessages() {
// System.err.println("Display.dispatchMessages() 0 "+this+" "+getThreadName());
- if(0==refCount || // no screens
+ if(0==refCount || // no screens
null==getGraphicsDevice() // no native device
- )
+ )
{
return;
}
@@ -541,13 +541,13 @@ public abstract class DisplayImpl extends Display {
}
return;
}
-
+
// can't wait if we are on EDT or NEDT -> consume right away
if(wait && _edtUtil.isCurrentThreadEDTorNEDT() ) {
dispatchMessage(e);
return;
}
-
+
final Object lock = new Object();
final NEWTEventTask eTask = new NEWTEventTask(e, wait?lock:null);
synchronized(lock) {
@@ -565,13 +565,13 @@ public abstract class DisplayImpl extends Display {
if( null != eTask.getException() ) {
throw eTask.getException();
}
- }
+ }
}
}
public interface DisplayRunnable {
T run(long dpy);
- }
+ }
public static final T runWithLockedDevice(AbstractGraphicsDevice device, DisplayRunnable action) {
T res;
device.lock();
@@ -589,7 +589,7 @@ public abstract class DisplayImpl extends Display {
}
return runWithLockedDevice(device, action);
}
-
+
protected volatile EDTUtil edtUtil = null;
protected int id;
protected String name;
diff --git a/src/newt/classes/jogamp/newt/MonitorDeviceImpl.java b/src/newt/classes/jogamp/newt/MonitorDeviceImpl.java
index 43d558515..9e10879c4 100644
--- a/src/newt/classes/jogamp/newt/MonitorDeviceImpl.java
+++ b/src/newt/classes/jogamp/newt/MonitorDeviceImpl.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package jogamp.newt;
import javax.media.nativewindow.util.DimensionImmutable;
@@ -41,7 +41,7 @@ public class MonitorDeviceImpl extends MonitorDevice {
public MonitorDeviceImpl(ScreenImpl screen, int nativeId, DimensionImmutable sizeMM, Rectangle viewport, MonitorMode currentMode, ArrayHashSet supportedModes) {
super(screen, nativeId, sizeMM, viewport, currentMode, supportedModes);
}
-
+
@Override
public final MonitorMode queryCurrentMode() {
final ScreenImpl screenImpl = (ScreenImpl)screen;
@@ -54,7 +54,7 @@ public class MonitorDeviceImpl extends MonitorDevice {
}
MonitorMode mmU = supportedModes.get(mm0); // unified instance
if( null == mmU ) {
- // add new mode avoiding exception!
+ // add new mode avoiding exception!
mmU = sms.getMonitorModes().getOrAdd(mm0);
mmU = supportedModes.getOrAdd(mmU);
if( Screen.DEBUG ) {
@@ -89,21 +89,21 @@ public class MonitorDeviceImpl extends MonitorDevice {
if( mmU.equals( mmC ) ) {
if(Screen.DEBUG) {
System.err.println("Screen.setCurrentMode: 0.0 is-current (skip) "+mmU+" == "+mmC);
- }
+ }
return true;
}
final long tStart;
if(Screen.DEBUG) {
- tStart = System.currentTimeMillis();
+ tStart = System.currentTimeMillis();
} else {
tStart = 0;
}
-
+
sms.fireMonitorModeChangeNotify(this, mmU);
if(Screen.DEBUG) {
System.err.println("Screen.setCurrentMode ("+(System.currentTimeMillis()-tStart)+"ms): fireModeChangeNotify() "+mmU);
}
-
+
boolean success = screenImpl.setCurrentMonitorModeImpl(this, mmU);
if(success) {
if(Screen.DEBUG) {
@@ -135,13 +135,13 @@ public class MonitorDeviceImpl extends MonitorDevice {
private final void setCurrentModeValue(MonitorMode currentMode) {
this.currentMode = currentMode;
}
-
+
/* pp */ final void setViewportValue(Rectangle viewport) {
this.viewport = viewport;
}
-
+
/* pp */ ArrayHashSet getSupportedModesImpl() {
return supportedModes;
}
-
+
}
diff --git a/src/newt/classes/jogamp/newt/MonitorModeProps.java b/src/newt/classes/jogamp/newt/MonitorModeProps.java
index 820807e15..9d8f4919c 100644
--- a/src/newt/classes/jogamp/newt/MonitorModeProps.java
+++ b/src/newt/classes/jogamp/newt/MonitorModeProps.java
@@ -54,12 +54,12 @@ public class MonitorModeProps {
* 1: bpp
*/
public static final int NUM_SURFACE_SIZE_PROPERTIES = 1;
-
+
/** WARNING: must be synchronized with ScreenMode.h, native implementation
* 2: refresh-rate (Hz*100), flags
*/
public static final int NUM_SIZEANDRATE_PROPERTIES = 2;
-
+
/** WARNING: must be synchronized with ScreenMode.h, native implementation
* 2: id, rotation
*/
@@ -69,7 +69,7 @@ public class MonitorModeProps {
* count + all the above
*/
public static final int NUM_MONITOR_MODE_PROPERTIES_ALL = 8;
-
+
public static final int IDX_MONITOR_MODE_BPP = 1 // count
+ MonitorModeProps.NUM_RESOLUTION_PROPERTIES
;
@@ -79,7 +79,7 @@ public class MonitorModeProps {
+ MonitorModeProps.NUM_SIZEANDRATE_PROPERTIES
+ 1 // id of MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES
;
-
+
/** WARNING: must be synchronized with ScreenMode.h, native implementation
* 10: count + id, ScreenSizeMM[width, height], rotated Viewport[x, y, width, height], currentMonitorModeId, rotation, supportedModeId+
*/
@@ -89,15 +89,15 @@ public class MonitorModeProps {
+ 1 // native mode
+ MonitorModeProps.NUM_RESOLUTION_PROPERTIES // sizeMM
;
-
+
public static class Cache {
public final ArrayHashSet resolutions = new ArrayHashSet();
public final ArrayHashSet surfaceSizes = new ArrayHashSet();
- public final ArrayHashSet sizeAndRates = new ArrayHashSet();
+ public final ArrayHashSet sizeAndRates = new ArrayHashSet();
public final ArrayHashSet monitorModes = new ArrayHashSet();
public final ArrayHashSet monitorDevices = new ArrayHashSet();
}
-
+
/** WARNING: must be synchronized with ScreenMode.h, native implementation */
private static DimensionImmutable streamInResolution(int[] resolutionProperties, int offset) {
Dimension resolution = new Dimension(resolutionProperties[offset++], resolutionProperties[offset++]);
@@ -116,7 +116,7 @@ public class MonitorModeProps {
final int flags = sizeAndRRateProperties[offset++];
return new MonitorMode.SizeAndRRate(surfaceSize, refreshRate, flags);
}
-
+
/** WARNING: must be synchronized with ScreenMode.h, native implementation */
private static MonitorMode streamInMonitorMode0(MonitorMode.SizeAndRRate sizeAndRate, int[] modeProperties, int offset) {
final int id = modeProperties[offset++];
@@ -161,7 +161,7 @@ public class MonitorModeProps {
if(null!=cache) {
sizeAndRate = cache.sizeAndRates.getOrAdd(sizeAndRate);
}
-
+
MonitorMode monitorMode = MonitorModeProps.streamInMonitorMode0(sizeAndRate, modeProperties, offset);
if(null!=cache) {
monitorMode = cache.monitorModes.getOrAdd(monitorMode);
@@ -193,12 +193,12 @@ public class MonitorModeProps {
}
return data;
}
-
- /**
+
+ /**
* WARNING: must be synchronized with ScreenMode.h, native implementation
*
* Note: This variant only works for impl. w/ a unique mode key pair modeId, rotation.
- *
+ *
* @param mode_idx if not null, returns the index of resulting {@link MonitorDevice} within {@link Cache#monitorDevices}.
* @param cache hash arrays of unique {@link MonitorMode} components and {@link MonitorDevice}s, allowing to avoid duplicates
* @param modeProperties the input data
@@ -218,7 +218,7 @@ public class MonitorModeProps {
if(count > monitorProperties.length-offset) {
throw new RuntimeException("properties array too short (count), should be >= "+count+", is "+(monitorProperties.length-offset));
}
- final int limit = offset + count;
+ final int limit = offset + count;
offset++;
final List allMonitorModes = cache.monitorModes.getData();
final int id = monitorProperties[offset++];
@@ -252,7 +252,7 @@ public class MonitorModeProps {
monitor_idx[0] = _monitorIdx;
}
return monitorDevice;
- }
+ }
private static MonitorMode getByNativeIdAndRotation(List monitorModes, int modeId, int rotation) {
if( null!=monitorModes && monitorModes.size()>0 ) {
for (int i=0; i
* This variant expects count to be {@link MIN_MONITOR_DEVICE_PROPERTIES} - 1 - {@link NUM_MONITOR_MODE_PROPERTIES},
- * due to lack of supported mode and current mode.
+ * due to lack of supported mode and current mode.
*
*
* @param mode_idx if not null, returns the index of resulting {@link MonitorDevice} within {@link Cache#monitorDevices}.
@@ -310,7 +310,7 @@ public class MonitorModeProps {
}
return monitorDevice;
}
-
+
/** WARNING: must be synchronized with ScreenMode.h, native implementation */
public static int[] streamOutMonitorDevice (MonitorDevice monitorDevice) {
// min 11: count, id, ScreenSizeMM[width, height], Viewport[x, y, width, height], currentMonitorModeId, rotation, supportedModeId+
@@ -339,7 +339,7 @@ public class MonitorModeProps {
}
return data;
}
-
+
public final void swapRotatePair(int rotation, int[] pairs, int offset, int numPairs) {
if( MonitorMode.ROTATE_0 == rotation || MonitorMode.ROTATE_180 == rotation ) {
// nop
@@ -347,9 +347,9 @@ public class MonitorModeProps {
}
for(int i=0; i() {
public Boolean run() {
diff --git a/src/newt/classes/jogamp/newt/OffscreenWindow.java b/src/newt/classes/jogamp/newt/OffscreenWindow.java
index 0a302d76b..eba844230 100644
--- a/src/newt/classes/jogamp/newt/OffscreenWindow.java
+++ b/src/newt/classes/jogamp/newt/OffscreenWindow.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt;
@@ -50,7 +50,7 @@ import com.jogamp.newt.MonitorDevice;
public class OffscreenWindow extends WindowImpl implements MutableSurface {
long surfaceHandle;
-
+
public OffscreenWindow() {
surfaceHandle = 0;
}
@@ -72,7 +72,7 @@ public class OffscreenWindow extends WindowImpl implements MutableSurface {
synchronized(OffscreenWindow.class) {
setWindowHandle(nextWindowHandle++);
}
- visibleChanged(false, true);
+ visibleChanged(false, true);
}
protected void closeNativeImpl() {
@@ -92,7 +92,7 @@ public class OffscreenWindow extends WindowImpl implements MutableSurface {
@Override
public long getSurfaceHandle() {
return surfaceHandle;
- }
+ }
protected void requestFocusImpl(boolean reparented) {
}
@@ -101,7 +101,7 @@ public class OffscreenWindow extends WindowImpl implements MutableSurface {
public void setPosition(int x, int y) {
// nop
}
-
+
@Override
public boolean setFullscreen(boolean fullscreen) {
return false; // nop
@@ -112,7 +112,7 @@ public class OffscreenWindow extends WindowImpl implements MutableSurface {
return false; // nop
}
-
+
protected boolean reconfigureWindowImpl(int x, int y, int width, int height, int flags) {
sizeChanged(false, width, height, false);
if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) {
@@ -137,13 +137,13 @@ public class OffscreenWindow extends WindowImpl implements MutableSurface {
}
return new Point(0,0);
}
-
+
protected Point getLocationOnScreenImpl(int x, int y) {
return new Point(x,y);
}
-
+
protected void updateInsetsImpl(Insets insets) {
- // nop ..
+ // nop ..
}
}
diff --git a/src/newt/classes/jogamp/newt/ScreenImpl.java b/src/newt/classes/jogamp/newt/ScreenImpl.java
index 7068d7464..d7e6c641c 100644
--- a/src/newt/classes/jogamp/newt/ScreenImpl.java
+++ b/src/newt/classes/jogamp/newt/ScreenImpl.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt;
@@ -56,7 +56,7 @@ import com.jogamp.newt.util.MonitorModeUtil;
public abstract class ScreenImpl extends Screen implements MonitorModeListener {
protected static final boolean DEBUG_TEST_SCREENMODE_DISABLED;
-
+
static {
Debug.initSingleton();
DEBUG_TEST_SCREENMODE_DISABLED = Debug.isPropertyDefined("newt.test.Screen.disableScreenMode", true);
@@ -67,14 +67,14 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
public static final int default_sm_heightmm = 324;
public static final int default_sm_rate = 60;
public static final int default_sm_rotation = 0;
-
+
static {
DisplayImpl.initSingleton();
}
-
+
/** Ensure static init has been run. */
/* pp */static void initSingleton() { }
-
+
protected DisplayImpl display;
protected int screen_idx;
protected String fqname;
@@ -85,14 +85,14 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
protected static Dimension usrSize = null; // property values: newt.ws.swidth and newt.ws.sheight
protected static volatile boolean usrSizeQueried = false;
private ArrayList refMonitorModeListener = new ArrayList();
-
+
private long tCreated; // creationTime
- private static Class> getScreenClass(String type) throws ClassNotFoundException
+ private static Class> getScreenClass(String type) throws ClassNotFoundException
{
final Class> screenClass = NewtFactory.getCustomClass(type, "ScreenDriver");
if(null==screenClass) {
- throw new ClassNotFoundException("Failed to find NEWT Screen Class <"+type+".ScreenDriver>");
+ throw new ClassNotFoundException("Failed to find NEWT Screen Class <"+type+".ScreenDriver>");
}
return screenClass;
}
@@ -104,7 +104,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
if(!usrSizeQueried) {
usrSizeQueried = true;
final int w = Debug.getIntProperty("newt.ws.swidth", true, 0);
- final int h = Debug.getIntProperty("newt.ws.sheight", true, 0);
+ final int h = Debug.getIntProperty("newt.ws.sheight", true, 0);
if(w>0 && h>0) {
usrSize = new Dimension(w, h);
System.err.println("User screen size "+usrSize);
@@ -135,7 +135,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
System.err.println("Screen.create() NEW: "+screen+" "+Display.getThreadName());
}
return screen;
- }
+ }
} catch (Exception e) {
throw new RuntimeException(e);
}
@@ -167,16 +167,16 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
@Override
public synchronized final void createNative()
throws NativeWindowException
- {
+ {
if(null == aScreen) {
if(DEBUG) {
tCreated = System.nanoTime();
System.err.println("Screen.createNative() START ("+DisplayImpl.getThreadName()+", "+this+")");
} else {
tCreated = 0;
- }
+ }
display.addReference();
-
+
createNativeImpl();
if(null == aScreen) {
throw new NativeWindowException("Screen.createNative() failed to instanciate an AbstractGraphicsScreen");
@@ -249,7 +249,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
protected abstract void createNativeImpl();
protected abstract void closeNativeImpl();
-
+
/**
* Returns the validated screen index, which is either the passed idx
* value or 0.
@@ -258,23 +258,23 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
*
*/
protected abstract int validateScreenIndex(int idx);
-
+
/**
* Stores the virtual origin and virtual rotated screen size.
*
- * This method is called after the MonitorMode has been set or changed,
+ * This method is called after the MonitorMode has been set or changed,
* hence you may utilize it.
*
*
* Default implementation uses the union of all monitor's viewport,
- * calculated via {@link #unionOfMonitorViewportSize()}.
+ * calculated via {@link #unionOfMonitorViewportSize()}.
*
* @param vOriginSize storage for result
*/
- protected void calcVirtualScreenOriginAndSize(final Rectangle vOriginSize) {
+ protected void calcVirtualScreenOriginAndSize(final Rectangle vOriginSize) {
unionOfMonitorViewportSize(vOriginSize);
}
-
+
@Override
public final String getFQName() {
return fqname;
@@ -335,15 +335,15 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
}
//
- // MonitorDevice and MonitorMode
+ // MonitorDevice and MonitorMode
//
-
+
/**
* To be implemented by the native specification.
* Is called within a thread safe environment.
* Is called only to collect the {@link MonitorMode}s and {@link MonitorDevice}s, usually at startup setting up modes.
*
- * WARNING: must be synchronized with
+ * WARNING: must be synchronized with
*
*
{@link MonitorModeProps#NUM_SCREEN_MODE_PROPERTIES} and
@@ -356,19 +356,19 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
* @param cache memory pool caching the result
*/
protected abstract void collectNativeMonitorModesAndDevicesImpl(MonitorModeProps.Cache cache);
-
+
protected Rectangle getNativeMonitorDeviceViewportImpl(MonitorDevice monitor) { return null; }
-
+
/**
* To be implemented by the native specification.
* Is called within a thread safe environment.
*
- * Implementation shall not unify the result w/ monitor's supported modes or a locally
+ * Implementation shall not unify the result w/ monitor's supported modes or a locally
* saved {@link MonitorModeProps.Cache}, since caller will perform such tasks.
*
*/
protected abstract MonitorMode queryCurrentMonitorModeImpl(MonitorDevice monitor);
-
+
/**
* To be implemented by the native specification.
* Is called within a thread safe environment.
@@ -378,13 +378,13 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
@Override
public final List getMonitorModes() {
final ScreenMonitorState sms = getScreenMonitorStatus(false);
- return null != sms ? sms.getMonitorModes().getData() : null;
+ return null != sms ? sms.getMonitorModes().getData() : null;
}
-
+
@Override
public final List getMonitorDevices() {
final ScreenMonitorState sms = getScreenMonitorStatus(false);
- return null != sms ? sms.getMonitorDevices().getData() : null;
+ return null != sms ? sms.getMonitorDevices().getData() : null;
}
final ScreenMonitorState getScreenMonitorStatus(boolean throwException) {
@@ -395,7 +395,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
}
return res;
}
-
+
@Override
public void monitorModeChangeNotify(MonitorEvent me) {
if(DEBUG) {
@@ -417,9 +417,9 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
if( null != newViewport ) {
monitor.setViewportValue(newViewport);
}
- }
+ }
}
-
+
@Override
public void monitorModeChanged(MonitorEvent me, boolean success) {
if(success) {
@@ -443,9 +443,9 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
public synchronized final void removeMonitorModeListener(MonitorModeListener sml) {
refMonitorModeListener.remove(sml);
}
-
+
/**
- *
+ *
* @param cache optional ..
* @param modeId
* @return
@@ -468,7 +468,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
}
/**
- *
+ *
* @param cache mandatory !
* @param monitorId
* @param currentMode
@@ -493,7 +493,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
}
return MonitorModeProps.streamInMonitorDevice(null, cache, this, props, 0);
}
-
+
/**
* Utilizes {@link #getCurrentMonitorModeImpl()}, if the latter returns null it uses
* the current screen size and dummy values.
@@ -530,7 +530,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
sms = ScreenMonitorState.getScreenMonitorState(this.getFQName());
if(null==sms) {
final MonitorModeProps.Cache cache = new MonitorModeProps.Cache();
- if( 0 >= collectNativeMonitorModes(cache) ) {
+ if( 0 >= collectNativeMonitorModes(cache) ) {
updateVirtualScreenOriginAndSize();
vScrnSizeUpdated = true;
final MonitorMode mode = getVirtualMonitorMode(cache, 0);
@@ -557,7 +557,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
System.err.println("["+i+"]["+j+"]: "+iMode.next());
}
}
- }
+ }
sms = new ScreenMonitorState(cache.monitorDevices, cache.monitorModes);
ScreenMonitorState.mapScreenMonitorState(this.getFQName(), sms);
}
@@ -580,7 +580,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
* Collects {@link MonitorDevice}s and {@link MonitorMode}s within the given cache.
*
*/
- private final int collectNativeMonitorModes(MonitorModeProps.Cache cache) {
+ private final int collectNativeMonitorModes(MonitorModeProps.Cache cache) {
if(!DEBUG_TEST_SCREENMODE_DISABLED) {
collectNativeMonitorModesAndDevicesImpl(cache);
}
@@ -639,12 +639,12 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
} finally {
sms.unlock();
}
- }
+ }
} finally {
ScreenMonitorState.unlockScreenMonitorState();
}
}
-
+
private final void shutdown() {
ScreenMonitorState sms = ScreenMonitorState.getScreenMonitorStateUnlocked(getFQName());
if(null != sms) {
@@ -661,11 +661,11 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
}
}
ScreenMonitorState.unmapScreenMonitorStateUnlocked(getFQName());
- }
+ }
}
-
+
/** pp */ static final void shutdownAll() {
- final int sCount = screenList.size();
+ final int sCount = screenList.size();
if(DEBUG) {
System.err.println("Screen.shutdownAll "+sCount+" instances, on thread "+Display.getThreadName());
}
diff --git a/src/newt/classes/jogamp/newt/ScreenMonitorState.java b/src/newt/classes/jogamp/newt/ScreenMonitorState.java
index 66e75be16..01e6cfee9 100644
--- a/src/newt/classes/jogamp/newt/ScreenMonitorState.java
+++ b/src/newt/classes/jogamp/newt/ScreenMonitorState.java
@@ -42,7 +42,7 @@ import java.util.HashMap;
public class ScreenMonitorState {
private static boolean DEBUG = Screen.DEBUG;
-
+
private final RecursiveLock lock = LockFactory.createRecursiveLock();
private final ArrayHashSet allMonitors;
private final ArrayHashSet allMonitorModes;
@@ -105,21 +105,21 @@ public class ScreenMonitorState {
protected static void unlockScreenMonitorState() {
screen2ScreenMonitorState.unlock();
}
-
+
public ScreenMonitorState(ArrayHashSet allMonitors,
ArrayHashSet allMonitorModes) {
- this.allMonitors = allMonitors;
+ this.allMonitors = allMonitors;
this.allMonitorModes = allMonitorModes;
}
- protected ArrayHashSet getMonitorDevices() {
+ protected ArrayHashSet getMonitorDevices() {
return allMonitors;
}
-
- protected ArrayHashSet getMonitorModes() {
+
+ protected ArrayHashSet getMonitorModes() {
return allMonitorModes;
}
-
+
protected final int addListener(MonitorModeListener l) {
lock();
try {
@@ -151,14 +151,14 @@ public class ScreenMonitorState {
protected final MonitorDevice getMonitor(MonitorDevice monitor) {
return allMonitors.get(monitor);
}
-
+
protected final void validateMonitor(MonitorDevice monitor) {
final MonitorDevice md = allMonitors.get(monitor);
if( null == md ) {
throw new InternalError("Monitor unknown: "+monitor);
}
}
-
+
protected final void fireMonitorModeChangeNotify(MonitorDevice monitor, MonitorMode desiredMode) {
lock();
try {
diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java
index a35d89408..a0ef8816b 100644
--- a/src/newt/classes/jogamp/newt/WindowImpl.java
+++ b/src/newt/classes/jogamp/newt/WindowImpl.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt;
@@ -87,19 +87,19 @@ import jogamp.nativewindow.SurfaceUpdatedHelper;
public abstract class WindowImpl implements Window, NEWTEventConsumer
{
public static final boolean DEBUG_TEST_REPARENT_INCOMPATIBLE;
-
+
static {
Debug.initSingleton();
DEBUG_TEST_REPARENT_INCOMPATIBLE = Debug.isPropertyDefined("newt.test.Window.reparent.incompatible", true);
-
+
ScreenImpl.initSingleton();
}
-
- protected static final ArrayList> windowList = new ArrayList>();
-
+
+ protected static final ArrayList> windowList = new ArrayList>();
+
/** Maybe utilized at a shutdown hook, impl. does not block. */
public static final void shutdownAll() {
- final int wCount = windowList.size();
+ final int wCount = windowList.size();
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window.shutdownAll "+wCount+" instances, on thread "+getThreadName());
}
@@ -132,25 +132,25 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
}
}
-
+
/** Timeout of queued events (repaint and resize) */
- static final long QUEUED_EVENT_TO = 1200; // ms
+ static final long QUEUED_EVENT_TO = 1200; // ms
private static final PointerType[] constMousePointerTypes = new PointerType[] { PointerType.Mouse };
-
+
//
// Volatile: Multithread Mutable Access
- //
+ //
private volatile long windowHandle = 0; // lifecycle critical
private volatile boolean visible = false; // lifecycle critical
- private volatile boolean hasFocus = false;
+ private volatile boolean hasFocus = false;
private volatile int width = 128, height = 128; // client-area size w/o insets, default: may be overwritten by user
private volatile int x = 64, y = 64; // client-area pos w/o insets
private volatile Insets insets = new Insets(); // insets of decoration (if top-level && decorated)
-
+
private RecursiveLock windowLock = LockFactory.createRecursiveLock(); // Window instance wide lock
private int surfaceLockCount = 0; // surface lock recursion count
-
+
private ScreenImpl screen; // never null after create - may change reference though (reparent)
private boolean screenReferenceAdded = false;
private NativeWindow parentWindow = null;
@@ -162,7 +162,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
private List fullscreenMonitors = null;
private boolean fullscreenUseMainMonitor = true;
private boolean autoPosition = true; // default: true (allow WM to choose top-level position, if not set by user)
-
+
private int nfs_width, nfs_height, nfs_x, nfs_y; // non fullscreen client-area size/pos w/o insets
private NativeWindow nfs_parent = null; // non fullscreen parent, in case explicit reparenting is performed (offscreen)
private String title = "Newt Window";
@@ -178,26 +178,26 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
private KeyListener keyboardFocusHandler = null;
private SurfaceUpdatedHelper surfaceUpdatedHelper = new SurfaceUpdatedHelper();
-
+
private Object childWindowsLock = new Object();
private ArrayList childWindows = new ArrayList();
private ArrayList mouseListeners = new ArrayList();
-
+
/** from event passing: {@link WindowImpl#consumePointerEvent(MouseEvent)}. */
private static class PointerState0 {
/** mouse entered window - is inside the window (may be synthetic) */
boolean insideWindow = false;
-
+
/** last time when a mouse button was pressed */
long lastButtonPressTime = 0;
-
+
void clearButton() {
lastButtonPressTime = 0;
}
}
private PointerState0 pState0 = new PointerState0();
-
+
/** from direct input: {@link WindowImpl#doPointerEvent(boolean, boolean, int[], short, int, int, boolean, short[], int[], int[], float[], float, float[], float)}. */
private static class PointerState1 extends PointerState0 {
/** current pressed mouse button number */
@@ -206,15 +206,15 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
int buttonPressedMask = 0;
/** last mouse button click count */
short lastButtonClickCount = (short)0;
-
+
final void clearButton() {
super.clearButton();
lastButtonPressTime = 0;
- lastButtonClickCount = (short)0;
+ lastButtonClickCount = (short)0;
buttonPressed = 0;
- buttonPressedMask = 0;
+ buttonPressedMask = 0;
}
-
+
/** last pointer-move position for 8 touch-down pointers */
final Point[] movePositions = new Point[] {
new Point(), new Point(), new Point(), new Point(),
@@ -227,16 +227,16 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
}
private PointerState1 pState1 = new PointerState1();
-
+
/** pointer names -> pointer ID (consecutive index, starting w/ 0) */
private final ArrayHashSet pName2pID = new ArrayHashSet();
-
+
private boolean defaultGestureHandlerEnabled = true;
private DoubleTapScrollGesture gesture2PtrTouchScroll = null;
private ArrayList pointerGestureHandler = new ArrayList();
-
+
private ArrayList gestureListeners = new ArrayList();
-
+
private ArrayList keyListeners = new ArrayList();
private ArrayList windowListeners = new ArrayList();
@@ -267,7 +267,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
{
final Class> windowClass = NewtFactory.getCustomClass(type, "WindowDriver");
if(null==windowClass) {
- throw new ClassNotFoundException("Failed to find NEWT Window Class <"+type+".WindowDriver>");
+ throw new ClassNotFoundException("Failed to find NEWT Window Class <"+type+".WindowDriver>");
}
return windowClass;
}
@@ -293,7 +293,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
throw new NativeWindowException(t);
}
}
-
+
public static WindowImpl create(Object[] cstrArguments, Screen screen, CapabilitiesImmutable caps) {
try {
Class> windowClass = getWindowClass(screen.getDisplay().getType());
@@ -329,11 +329,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
hasFocus = false;
parentWindowHandle = 0;
}
-
+
protected final void setGraphicsConfiguration(AbstractGraphicsConfiguration cfg) {
config = cfg;
}
-
+
public static interface LifecycleHook {
/**
* Reset of internal state counter, ie totalFrames, etc.
@@ -341,8 +341,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
*/
public abstract void resetCounter();
- /**
- * Invoked after Window setVisible,
+ /**
+ * Invoked after Window setVisible,
* allows allocating resources depending on the native Window.
* Called from EDT while window is locked.
*/
@@ -354,9 +354,9 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
* @param value true to set the one-shot preservation if supported, otherwise clears it.
*/
void preserveGLStateAtDestroy(boolean value);
-
- /**
- * Invoked before Window destroy action,
+
+ /**
+ * Invoked before Window destroy action,
* allows releasing of resources depending on the native Window.
* Surface not locked yet.
* Called not necessarily from EDT.
@@ -388,12 +388,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
* @see #pauseRenderingAction()
*/
void resumeRenderingAction();
-
+
/**
* Shutdown rendering action (thread) abnormally.
*
* Should be called only at shutdown, if necessary.
- *
+ *
*/
void shutdownRenderingAction();
}
@@ -406,14 +406,14 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
} else {
tStart = 0;
}
-
- if( null != parentWindow &&
+
+ if( null != parentWindow &&
NativeSurface.LOCK_SURFACE_NOT_READY >= parentWindow.lockSurface() ) {
throw new NativeWindowException("Parent surface lock: not ready: "+parentWindow);
}
-
+
// child window: position defaults to 0/0, no auto position, no negative position
- if( null != parentWindow && ( autoPosition || 0>getX() || 0>getY() ) ) {
+ if( null != parentWindow && ( autoPosition || 0>getX() || 0>getY() ) ) {
definePosition(0, 0);
}
boolean postParentlockFocus = false;
@@ -556,28 +556,28 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
/**
* Notifies the driver impl. that the instantiation is finished,
- * ie. instance created and all fields set.
+ * ie. instance created and all fields set.
*/
protected void instantiationFinished() {
// nop
}
-
+
protected boolean canCreateNativeImpl() {
return true; // default: always able to be created
}
-
- /**
+
+ /**
* The native implementation must set the native windowHandle.
*
*
* The implementation shall respect the states {@link #isAlwaysOnTop()}/{@link #FLAG_IS_ALWAYSONTOP} and
* {@link #isUndecorated()}/{@link #FLAG_IS_UNDECORATED}, ie. the created window shall reflect those settings.
*
- *
+ *
*
* The implementation should invoke the referenced java state callbacks
* to notify this Java object of state changes.
- *
+ *
* @see #windowDestroyNotify(boolean)
* @see #focusChanged(boolean, boolean)
* @see #visibleChanged(boolean, boolean)
@@ -589,16 +589,16 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
protected abstract void closeNativeImpl();
- /**
+ /**
* Async request which shall be performed within {@link #TIMEOUT_NATIVEWINDOW}.
*
- * If if force == false the native implementation
+ * If if force == false the native implementation
* may only request focus if not yet owner.
*
* {@link #focusChanged(boolean, boolean)} should be called
- * to notify about the focus traversal.
- *
- *
+ * to notify about the focus traversal.
+ *
+ *
* @param force if true, bypass {@link #focusChanged(boolean, boolean)} and force focus request
*/
protected abstract void requestFocusImpl(boolean force);
@@ -608,7 +608,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
public static final int FLAG_CHANGE_FULLSCREEN = 1 << 2;
public static final int FLAG_CHANGE_ALWAYSONTOP = 1 << 3;
public static final int FLAG_CHANGE_VISIBILITY = 1 << 4;
-
+
public static final int FLAG_HAS_PARENT = 1 << 8;
public static final int FLAG_IS_UNDECORATED = 1 << 9;
public static final int FLAG_IS_FULLSCREEN = 1 << 10;
@@ -619,12 +619,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
/**
* The native implementation should invoke the referenced java state callbacks
* to notify this Java object of state changes.
- *
+ *
*
* Implementations shall set x/y to 0, in case it's negative. This could happen due
* to insets and positioning a decorated window to 0/0, which would place the frame
* outside of the screen.
- *
+ *
* @param x client-area position, or <0 if unchanged
* @param y client-area position, or <0 if unchanged
* @param width client-area size, or <=0 if unchanged
@@ -635,12 +635,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
* @see #positionChanged(boolean,int, int)
*/
protected abstract boolean reconfigureWindowImpl(int x, int y, int width, int height, int flags);
-
- /**
+
+ /**
* Tests whether a single reconfigure flag is supported by implementation.
*
* Default is all but {@link #FLAG_IS_FULLSCREEN_SPAN}
- *
+ *
*/
protected boolean isReconfigureFlagSupported(int changeFlags) {
return 0 == ( changeFlags & FLAG_IS_FULLSCREEN_SPAN );
@@ -656,14 +656,14 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
protected static String getReconfigureFlagsAsString(StringBuilder sb, int flags) {
if(null == sb) { sb = new StringBuilder(); }
sb.append("[");
-
+
if( 0 != ( FLAG_CHANGE_PARENTING & flags) ) {
sb.append("*");
}
sb.append("PARENT_");
sb.append(0 != ( FLAG_HAS_PARENT & flags));
sb.append(", ");
-
+
if( 0 != ( FLAG_CHANGE_FULLSCREEN & flags) ) {
sb.append("*");
}
@@ -679,24 +679,24 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
sb.append("UNDECOR_");
sb.append(0 != ( FLAG_IS_UNDECORATED & flags));
sb.append(", ");
-
+
if( 0 != ( FLAG_CHANGE_ALWAYSONTOP & flags) ) {
sb.append("*");
}
sb.append("ALWAYSONTOP_");
sb.append(0 != ( FLAG_IS_ALWAYSONTOP & flags));
sb.append(", ");
-
+
if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) {
sb.append("*");
}
sb.append("VISIBLE_");
sb.append(0 != ( FLAG_IS_VISIBLE & flags));
-
+
sb.append("]");
return sb.toString();
}
-
+
protected void setTitleImpl(String title) {}
/**
@@ -713,11 +713,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
* @return if not null, the screen location of the given coordinates
*/
protected abstract Point getLocationOnScreenImpl(int x, int y);
-
+
/** Triggered by user via {@link #getInsets()}.
- * Implementations may implement this hook to update the insets.
+ * Implementations may implement this hook to update the insets.
* However, they may prefer the event driven path via {@link #insetsChanged(boolean, int, int, int, int)}.
- *
+ *
* @see #getInsets()
* @see #insetsChanged(boolean, int, int, int, int)
*/
@@ -726,7 +726,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
protected boolean setPointerVisibleImpl(boolean pointerVisible) { return false; }
protected boolean confinePointerImpl(boolean confine) { return false; }
protected void warpPointerImpl(int x, int y) { }
-
+
//----------------------------------------------------------------------
// NativeSurface
//
@@ -791,7 +791,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
public final RecursiveLock getLock() {
return windowLock;
}
-
+
@Override
public long getSurfaceHandle() {
return windowHandle; // default: return window handle
@@ -810,7 +810,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
@Override
public final long getDisplayHandle() {
return config.getNativeGraphicsConfiguration().getScreen().getDevice().getHandle();
- }
+ }
@Override
public final int getScreenIndex() {
@@ -879,19 +879,19 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
public final Screen getScreen() {
return screen;
}
-
+
@Override
public final MonitorDevice getMainMonitor() {
return screen.getMainMonitor(new Rectangle(getX(), getY(), getWidth(), getHeight()));
}
-
+
protected final void setVisibleImpl(boolean visible, int x, int y, int width, int height) {
- reconfigureWindowImpl(x, y, width, height, getReconfigureFlags(FLAG_CHANGE_VISIBILITY, visible));
- }
+ reconfigureWindowImpl(x, y, width, height, getReconfigureFlags(FLAG_CHANGE_VISIBILITY, visible));
+ }
final void setVisibleActionImpl(boolean visible) {
boolean nativeWindowCreated = false;
boolean madeVisible = false;
-
+
final RecursiveLock _lock = windowLock;
_lock.lock();
try {
@@ -911,7 +911,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
madeVisible = nativeWindowCreated;
}
// always flag visible, allowing a retry ..
- WindowImpl.this.visible = true;
+ WindowImpl.this.visible = true;
} else if(WindowImpl.this.visible != visible) {
if(isNativeValid()) {
setVisibleImpl(visible, getX(), getY(), getWidth(), getHeight());
@@ -965,14 +965,14 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window setVisible: START ("+getThreadName()+") "+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight()+", fs "+fullscreen+", windowHandle "+toHexString(windowHandle)+", visible: "+this.visible+" -> "+visible+", parentWindowHandle "+toHexString(parentWindowHandle)+", parentWindow "+(null!=parentWindow));
}
- runOnEDTIfAvail(wait, new VisibleAction(visible));
+ runOnEDTIfAvail(wait, new VisibleAction(visible));
}
@Override
public void setVisible(boolean visible) {
setVisible(true, visible);
}
-
+
private class SetSizeAction implements Runnable {
int width, height;
boolean disregardFS;
@@ -1024,11 +1024,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
private void setFullscreenSize(int width, int height) {
runOnEDTIfAvail(true, new SetSizeAction(width, height, true));
- }
+ }
@Override
public void setSize(int width, int height) {
runOnEDTIfAvail(true, new SetSizeAction(width, height, false));
- }
+ }
@Override
public void setTopLevelSize(int width, int height) {
setSize(width - getInsets().getTotalWidth(), height - getInsets().getTotalHeight());
@@ -1049,10 +1049,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window DestroyAction() hasScreen "+(null != screen)+", isNativeValid "+isNativeValid()+" - "+getThreadName());
}
-
+
// send synced destroy-notify notification
sendWindowEvent(WindowEvent.EVENT_WINDOW_DESTROY_NOTIFY);
-
+
// Childs first ..
synchronized(childWindowsLock) {
if(childWindows.size()>0) {
@@ -1111,30 +1111,30 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if(animatorPaused) {
lifecycleHook.resumeRenderingAction();
}
-
+
// these refs shall be kept alive - resurrection via setVisible(true)
/**
if(null!=parentWindow && parentWindow instanceof Window) {
((Window)parentWindow).removeChild(WindowImpl.this);
- }
+ }
childWindows = null;
surfaceUpdatedListeners = null;
mouseListeners = null;
keyListeners = null;
capsRequested = null;
lifecycleHook = null;
-
- screen = null;
+
+ screen = null;
windowListeners = null;
parentWindow = null;
- */
+ */
}
}
private final DestroyAction destroyAction = new DestroyAction();
@Override
public void destroy() {
- visible = false; // Immediately mark synchronized visibility flag, avoiding possible recreation
+ visible = false; // Immediately mark synchronized visibility flag, avoiding possible recreation
runOnEDTIfAvail(true, destroyAction);
}
@@ -1144,15 +1144,15 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
destroy();
}
-
+
/**
* @param cWin child window, must not be null
* @param pWin parent window, may be null
- * @return true if at least one of both window's configurations is offscreen
+ * @return true if at least one of both window's configurations is offscreen
*/
protected static boolean isOffscreenInstance(NativeWindow cWin, NativeWindow pWin) {
boolean ofs = false;
- final AbstractGraphicsConfiguration cWinCfg = cWin.getGraphicsConfiguration();
+ final AbstractGraphicsConfiguration cWinCfg = cWin.getGraphicsConfiguration();
if( null != cWinCfg ) {
ofs = !cWinCfg.getChosenCapabilities().isOnscreen();
}
@@ -1164,7 +1164,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
return ofs;
}
-
+
private class ReparentAction implements Runnable {
final NativeWindow newParentWindow;
final int topLevelX, topLevelY;
@@ -1187,7 +1187,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
removeScreenReference();
screen = newScreen;
}
-
+
public final void run() {
boolean animatorPaused = false;
if(null!=lifecycleHook) {
@@ -1198,7 +1198,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
lifecycleHook.resumeRenderingAction();
}
}
-
+
private void reparent() {
// mirror pos/size so native change notification can get overwritten
final int oldX = getX();
@@ -1209,7 +1209,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
int width = oldWidth;
int height = oldHeight;
boolean wasVisible;
-
+
final RecursiveLock _lock = windowLock;
_lock.lock();
try {
@@ -1217,7 +1217,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
// force recreation if offscreen, since it may become onscreen
forceDestroyCreate |= isOffscreenInstance(WindowImpl.this, newParentWindow);
}
-
+
wasVisible = isVisible();
Window newParentWindowNEWT = null;
@@ -1233,7 +1233,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if(null!=newParentWindow) {
// REPARENT TO CHILD WINDOW
-
+
// reset position to 0/0 within parent space
x = 0;
y = 0;
@@ -1278,7 +1278,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
operation = ReparentOperation.ACTION_NATIVE_CREATION_PENDING;
}
} else if ( forceDestroyCreate || !NewtFactory.isScreenCompatible(newParentWindow, screen) ) {
- // Destroy this window, may create a new compatible Screen/Display, while trying to preserve resources if becoming visible again.
+ // Destroy this window, may create a new compatible Screen/Display, while trying to preserve resources if becoming visible again.
destroy( wasVisible );
if(null!=newParentWindowNEWT) {
setScreen( (ScreenImpl) newParentWindowNEWT.getScreen() );
@@ -1333,11 +1333,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if ( ReparentOperation.ACTION_INVALID == operation ) {
throw new NativeWindowException("Internal Error: reparentAction not set");
}
-
+
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window.reparent: ACTION ("+getThreadName()+") windowHandle "+toHexString(windowHandle)+" new parentWindowHandle "+toHexString(newParentWindowHandle)+", reparentAction "+operation+", pos/size "+x+"/"+y+" "+width+"x"+height+", visible "+wasVisible);
}
-
+
if( ReparentOperation.ACTION_NOP == operation ) {
return;
}
@@ -1401,18 +1401,18 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
if(ok) {
requestFocusInt( 0 == parentWindowHandle /* skipFocusAction if top-level */);
- display.dispatchMessagesNative(); // status up2date
+ display.dispatchMessagesNative(); // status up2date
}
}
}
if(!ok || !wasVisible) {
- // make size and position persistent manual,
+ // make size and position persistent manual,
// since we don't have a WM feedback (invisible or recreation)
definePosition(x, y);
defineSize(width, height);
}
-
+
if(!ok) {
// native reparent failed -> try creation, while trying to preserve resources if becoming visible again.
if(DEBUG_IMPLEMENTATION) {
@@ -1430,7 +1430,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
definePosition(x, y);
defineSize(width, height);
}
-
+
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window.reparent: END-1 ("+getThreadName()+") windowHandle "+toHexString(windowHandle)+", visible: "+visible+", parentWindowHandle "+toHexString(parentWindowHandle)+", parentWindow "+ Display.hashCodeNullSafe(parentWindow)+" "+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight());
}
@@ -1451,7 +1451,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
// This may run on the new Display/Screen connection, hence a new EDT task
runOnEDTIfAvail(true, reparentActionRecreate);
break;
-
+
default:
}
}
@@ -1566,7 +1566,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if(WindowImpl.this.alwaysOnTop != alwaysOnTop) {
// set current state
WindowImpl.this.alwaysOnTop = alwaysOnTop;
-
+
if( isNativeValid() ) {
// Mirror pos/size so native change notification can get overwritten
final int x = getX();
@@ -1591,12 +1591,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
public final void setAlwaysOnTop(boolean value) {
runOnEDTIfAvail(true, new AlwaysOnTopAction(value));
}
-
+
@Override
public final boolean isAlwaysOnTop() {
return alwaysOnTop;
}
-
+
@Override
public String getTitle() {
return title;
@@ -1624,7 +1624,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
setVal = setPointerVisibleImpl(pointerVisible);
}
if(setVal) {
- this.pointerVisible = pointerVisible;
+ this.pointerVisible = pointerVisible;
}
}
}
@@ -1632,7 +1632,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
public boolean isPointerConfined() {
return pointerConfined;
}
-
+
@Override
public void confinePointer(boolean confine) {
if(this.pointerConfined != confine) {
@@ -1652,18 +1652,18 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
}
if(setVal) {
- this.pointerConfined = confine;
+ this.pointerConfined = confine;
}
- }
+ }
}
-
+
@Override
public void warpPointer(int x, int y) {
if(0 != getWindowHandle()) {
warpPointerImpl(x, y);
}
}
-
+
@Override
public final InsetsImmutable getInsets() {
if(isUndecorated()) {
@@ -1672,7 +1672,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
updateInsetsImpl(insets);
return insets;
}
-
+
@Override
public final int getWidth() {
return width;
@@ -1694,8 +1694,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
protected final boolean autoPosition() { return autoPosition; }
-
- /** Sets the position fields {@link #x} and {@link #y} to the given values and {@link #autoPosition} to false. */
+
+ /** Sets the position fields {@link #x} and {@link #y} to the given values and {@link #autoPosition} to false. */
protected final void definePosition(int x, int y) {
if(DEBUG_IMPLEMENTATION) {
System.err.println("definePosition: "+this.x+"/"+this.y+" -> "+x+"/"+y);
@@ -1705,7 +1705,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
this.x = x; this.y = y;
}
- /** Sets the size fields {@link #width} and {@link #height} to the given values. */
+ /** Sets the size fields {@link #width} and {@link #height} to the given values. */
protected final void defineSize(int width, int height) {
if(DEBUG_IMPLEMENTATION) {
System.err.println("defineSize: "+this.width+"x"+this.height+" -> "+width+"x"+height);
@@ -1713,7 +1713,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
this.width = width; this.height = height;
}
-
+
@Override
public final boolean isVisible() {
return visible;
@@ -1732,7 +1732,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
public final Window getDelegatedWindow() {
return this;
}
-
+
//----------------------------------------------------------------------
// WindowImpl
//
@@ -1755,8 +1755,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
return old;
}
- /**
- * If this Window actually wraps a {@link NativeSurface} from another instance or toolkit,
+ /**
+ * If this Window actually wraps a {@link NativeSurface} from another instance or toolkit,
* it will return such reference. Otherwise returns null.
*/
public NativeSurface getWrappedSurface() {
@@ -1768,13 +1768,13 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
windowDestroyNotifyAction = r;
}
- /**
- * Returns the non delegated {@link AbstractGraphicsConfiguration},
+ /**
+ * Returns the non delegated {@link AbstractGraphicsConfiguration},
* see {@link #getGraphicsConfiguration()}. */
public final AbstractGraphicsConfiguration getPrivateGraphicsConfiguration() {
return config;
}
-
+
protected final long getParentWindowHandle() {
return isFullscreen() ? 0 : parentWindowHandle;
}
@@ -1864,7 +1864,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
public void requestFocus(boolean wait) {
requestFocus(wait /* wait */, false /* skipFocusAction */, brokenFocusChange /* force */);
}
-
+
private void requestFocus(boolean wait, boolean skipFocusAction, boolean force) {
if( isNativeValid() &&
( force || !hasFocus() ) &&
@@ -1872,7 +1872,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
runOnEDTIfAvail(wait, force ? requestFocusActionForced : requestFocusAction);
}
}
-
+
/** Internally forcing request focus on current thread */
private void requestFocusInt(boolean skipFocusAction) {
if( skipFocusAction || !focusAction() ) {
@@ -1880,14 +1880,14 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
System.err.println("Window.RequestFocusInt: forcing - ("+getThreadName()+"): skipFocusAction "+skipFocusAction+", focus "+hasFocus+" -> true - windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle));
}
requestFocusImpl(true);
- }
+ }
}
-
+
@Override
public void setFocusAction(FocusRunnable focusAction) {
this.focusAction = focusAction;
}
-
+
private boolean focusAction() {
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window.focusAction() START - "+getThreadName()+", focusAction: "+focusAction+" - windowHandle "+toHexString(getWindowHandle()));
@@ -1903,16 +1903,16 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
return res;
}
-
+
protected void setBrokenFocusChange(boolean v) {
brokenFocusChange = v;
}
-
+
@Override
public void setKeyboardFocusHandler(KeyListener l) {
keyboardFocusHandler = l;
}
-
+
private class SetPositionAction implements Runnable {
int x, y;
@@ -1932,7 +1932,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if(isNativeValid()) {
// this.x/this.y will be set by sizeChanged, triggered by windowing event system
reconfigureWindowImpl(x, y, getWidth(), getHeight(), getReconfigureFlags(0, isVisible()));
-
+
// Wait until custom position is reached within tolerances
waitForPosition(true, x, y, Window.TIMEOUT_NATIVEWINDOW);
} else {
@@ -1950,16 +1950,16 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
autoPosition = false;
runOnEDTIfAvail(true, new SetPositionAction(x, y));
}
-
+
@Override
public void setTopLevelPosition(int x, int y) {
setPosition(x + getInsets().getLeftWidth(), y + getInsets().getTopHeight());
}
-
+
private class FullScreenAction implements Runnable {
boolean fullscreen;
- private boolean init(boolean fullscreen) {
+ private boolean init(boolean fullscreen) {
if(isNativeValid()) {
this.fullscreen = fullscreen;
return isFullscreen() != fullscreen;
@@ -1967,7 +1967,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
WindowImpl.this.fullscreen = fullscreen; // set current state for createNative(..)
return false;
}
- }
+ }
public boolean fsOn() { return fullscreen; }
public final void run() {
@@ -1981,9 +1981,9 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
final int oldY = getY();
final int oldWidth = getWidth();
final int oldHeight = getHeight();
-
+
int x,y,w,h;
-
+
final RectangleImmutable sviewport = screen.getViewport();
final RectangleImmutable viewport;
final int fs_span_flag;
@@ -2007,7 +2007,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
nfs_y = oldY;
nfs_width = oldWidth;
nfs_height = oldHeight;
- x = viewport.getX();
+ x = viewport.getX();
y = viewport.getY();
w = viewport.getWidth();
h = viewport.getHeight();
@@ -2020,12 +2020,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
y = nfs_y;
w = nfs_width;
h = nfs_height;
-
+
if(null!=parentWindow) {
// reset position to 0/0 within parent space
x = 0;
y = 0;
-
+
// refit if size is bigger than parent
if( w > parentWindow.getWidth() ) {
w = parentWindow.getWidth();
@@ -2044,7 +2044,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
final DisplayImpl display = (DisplayImpl) screen.getDisplay();
display.dispatchMessagesNative(); // status up2date
final boolean wasVisible = isVisible();
-
+
// Lock parentWindow only during reparenting (attempt)
final NativeWindow parentWindowLocked;
if( null != parentWindow ) {
@@ -2065,8 +2065,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
parentWindowLocked = null;
}
try {
- reconfigureWindowImpl(x, y, w, h,
- getReconfigureFlags( ( ( null != parentWindowLocked ) ? FLAG_CHANGE_PARENTING : 0 ) |
+ reconfigureWindowImpl(x, y, w, h,
+ getReconfigureFlags( ( ( null != parentWindowLocked ) ? FLAG_CHANGE_PARENTING : 0 ) |
fs_span_flag | FLAG_CHANGE_FULLSCREEN | FLAG_CHANGE_DECORATION, isVisible()) );
} finally {
if(null!=parentWindowLocked) {
@@ -2074,7 +2074,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
}
display.dispatchMessagesNative(); // status up2date
-
+
if(wasVisible) {
setVisibleImpl(true, x, y, w, h);
boolean ok = 0 <= WindowImpl.this.waitForVisible(true, false);
@@ -2086,7 +2086,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
if(ok) {
requestFocusInt(fullscreen /* skipFocusAction if fullscreen */);
- display.dispatchMessagesNative(); // status up2date
+ display.dispatchMessagesNative(); // status up2date
}
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window fs done: ok " + ok + ", " + WindowImpl.this);
@@ -2098,24 +2098,24 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
sendWindowEvent(WindowEvent.EVENT_WINDOW_RESIZED); // trigger a resize/relayout and repaint to listener
}
}
- private final FullScreenAction fullScreenAction = new FullScreenAction();
+ private final FullScreenAction fullScreenAction = new FullScreenAction();
@Override
public boolean setFullscreen(boolean fullscreen) {
return setFullscreenImpl(fullscreen, true, null);
}
-
+
@Override
public boolean setFullscreen(List monitors) {
return setFullscreenImpl(true, false, monitors);
}
-
+
private boolean setFullscreenImpl(boolean fullscreen, boolean useMainMonitor, List monitors) {
synchronized(fullScreenAction) {
fullscreenMonitors = monitors;
fullscreenUseMainMonitor = useMainMonitor;
if( fullScreenAction.init(fullscreen) ) {
- if(fullScreenAction.fsOn() && isOffscreenInstance(WindowImpl.this, parentWindow)) {
+ if(fullScreenAction.fsOn() && isOffscreenInstance(WindowImpl.this, parentWindow)) {
// enable fullscreen on offscreen instance
if(null != parentWindow) {
nfs_parent = parentWindow;
@@ -2124,19 +2124,19 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
throw new InternalError("Offscreen instance w/o parent unhandled");
}
}
-
+
runOnEDTIfAvail(true, fullScreenAction);
-
+
if(!fullScreenAction.fsOn() && null != nfs_parent) {
// disable fullscreen on offscreen instance
reparentWindow(nfs_parent, -1, -1, true /* forceDestroyCreate */);
nfs_parent = null;
}
}
- return this.fullscreen;
+ return this.fullscreen;
}
}
-
+
private class MonitorModeListenerImpl implements MonitorModeListener {
boolean animatorPaused = false;
boolean hadFocus = false;
@@ -2226,7 +2226,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
//----------------------------------------------------------------------
// Child Window Management
- //
+ //
@Override
public final boolean removeChild(NativeWindow win) {
@@ -2282,7 +2282,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window.consumeEvent: REPAINT "+Thread.currentThread().getName()+" - queued "+e+", discard-to "+discardTO);
// Thread.dumpStack();
- }
+ }
return discardTO; // discardTO:=true -> consumed
}
return true;
@@ -2343,11 +2343,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
//
// MouseListener/Event Support
//
-
+
//
// Native MouseEvents pre-processed to be enqueued or consumed directly
//
-
+
public final void sendMouseEvent(short eventType, int modifiers,
int x, int y, short button, float rotation) {
doMouseEvent(false, false, eventType, modifiers, x, y, button, MouseEvent.getRotationXYZ(rotation, modifiers), 1f);
@@ -2369,11 +2369,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
int x, int y, short button, float[] rotationXYZ, float rotationScale) {
doMouseEvent(true, wait, eventType, modifiers, x, y, button, rotationXYZ, rotationScale);
} */
-
+
/**
* Send mouse event (one-pointer) either to be directly consumed or to be enqueued
- *
- * @param enqueue if true, event will be {@link #enqueueEvent(boolean, NEWTEvent) enqueued},
+ *
+ * @param enqueue if true, event will be {@link #enqueueEvent(boolean, NEWTEvent) enqueued},
* otherwise {@link #consumeEvent(NEWTEvent) consumed} directly.
* @param wait if true wait until {@link #consumeEvent(NEWTEvent) consumed}.
*/
@@ -2383,7 +2383,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
throw new NativeWindowException("Invalid mouse button number" + button);
}
doPointerEvent(enqueue, wait, constMousePointerTypes, eventType, modifiers,
- 0 /*actionIdx*/, new short[] { (short)(button-1) },
+ 0 /*actionIdx*/, new short[] { (short)(button-1) },
new int[]{x}, new int[]{y}, new float[]{0f} /*pressure*/,
1f /*maxPressure*/, rotationXYZ, rotationScale);
}
@@ -2396,11 +2396,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
*
*
* The given pointer names, pNames, are mapped to consecutive pointer IDs starting w/ 0
- * using a hash-map if normalPNames is false.
- * Otherwise a simple int to short type cast is performed.
+ * using a hash-map if normalPNames is false.
+ * Otherwise a simple int to short type cast is performed.
*
- *
- * @param enqueue if true, event will be {@link #enqueueEvent(boolean, NEWTEvent) enqueued},
+ *
+ * @param enqueue if true, event will be {@link #enqueueEvent(boolean, NEWTEvent) enqueued},
* otherwise {@link #consumeEvent(NEWTEvent) consumed} directly.
* @param wait if true wait until {@link #consumeEvent(NEWTEvent) consumed}.
* @param pTypes {@link MouseEvent.PointerType} for each pointer (multiple pointer)
@@ -2410,14 +2410,14 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
* @param normalPNames see pName below.
* @param pNames Pointer name for each pointer (multiple pointer).
* We assume consecutive pointer names starting w/ 0 if normalPIDs is true.
- * Otherwise we hash-map the values during state pressed to retrieve the normal ID.
+ * Otherwise we hash-map the values during state pressed to retrieve the normal ID.
* @param pX X-axis for each pointer (multiple pointer)
* @param pY Y-axis for each pointer (multiple pointer)
* @param pPressure Pressure for each pointer (multiple pointer)
* @param maxPressure Maximum pointer pressure for all pointer
*/
public final void doPointerEvent(boolean enqueue, boolean wait,
- final PointerType[] pTypes, short eventType, int modifiers,
+ final PointerType[] pTypes, short eventType, int modifiers,
int actionIdx, boolean normalPNames, final int[] pNames,
final int[] pX, final int[] pY, float[] pPressure,
float maxPressure, final float[] rotationXYZ, final float rotationScale) {
@@ -2447,25 +2447,25 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
pIDs[i] = (short)pNames[i];
}
}
- doPointerEvent(enqueue, wait, pTypes, eventType, modifiers, actionIdx, pIDs,
+ doPointerEvent(enqueue, wait, pTypes, eventType, modifiers, actionIdx, pIDs,
pX, pY, pPressure, maxPressure, rotationXYZ, rotationScale);
}
-
+
/**
* Send multiple-pointer event either to be directly consumed or to be enqueued
*
* The index for the element of multiple-pointer arrays represents the pointer which triggered the event
* is passed via actionIdx.
- *
- *
- * @param enqueue if true, event will be {@link #enqueueEvent(boolean, NEWTEvent) enqueued},
+ *
+ *
+ * @param enqueue if true, event will be {@link #enqueueEvent(boolean, NEWTEvent) enqueued},
* otherwise {@link #consumeEvent(NEWTEvent) consumed} directly.
* @param wait if true wait until {@link #consumeEvent(NEWTEvent) consumed}.
* @param pTypes {@link MouseEvent.PointerType} for each pointer (multiple pointer)
* @param eventType
* @param modifiers
* @param pActionIdx index of multiple-pointer arrays representing the pointer which triggered the event
- * @param pID Pointer ID for each pointer (multiple pointer). We assume consecutive pointerIDs starting w/ 0.
+ * @param pID Pointer ID for each pointer (multiple pointer). We assume consecutive pointerIDs starting w/ 0.
* A pointer-ID of -1 may also denote no pointer/button activity, i.e. {@link PointerType#Mouse} move.
* @param pX X-axis for each pointer (multiple pointer)
* @param pY Y-axis for each pointer (multiple pointer)
@@ -2473,14 +2473,14 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
* @param maxPressure Maximum pointer pressure for all pointer
*/
public final void doPointerEvent(boolean enqueue, boolean wait,
- final PointerType[] pTypes, short eventType, int modifiers,
+ final PointerType[] pTypes, short eventType, int modifiers,
int pActionIdx, final short[] pID, final int[] pX, final int[] pY, final float[] pPressure,
float maxPressure, final float[] rotationXYZ, float rotationScale) {
final long when = System.currentTimeMillis();
final int pCount = pTypes.length;
-
+
if( 0 > pActionIdx || pActionIdx >= pCount) {
- throw new IllegalArgumentException("actionIdx out of bounds [0.."+(pCount-1)+"]");
+ throw new IllegalArgumentException("actionIdx out of bounds [0.."+(pCount-1)+"]");
}
if( 0 < pActionIdx ) {
// swap values to make idx 0 the triggering pointer
@@ -2518,11 +2518,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
button = com.jogamp.newt.event.MouseEvent.BUTTON1;
}
}
-
+
//
// - Determine ENTERED/EXITED state
// - Remove redundant move/drag events
- // - Reset states if applicable
+ // - Reset states if applicable
//
int x = pX[0];
int y = pY[0];
@@ -2537,7 +2537,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
movePositionP0.set(0, 0);
}
// Fall through intended!
-
+
case MouseEvent.EVENT_MOUSE_ENTERED:
// clip coordinates to window dimension
x = Math.min(Math.max(x, 0), getWidth()-1);
@@ -2545,11 +2545,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
pState1.insideWindow = eventType == MouseEvent.EVENT_MOUSE_ENTERED;
pState1.clearButton();
break;
-
+
case MouseEvent.EVENT_MOUSE_MOVED:
case MouseEvent.EVENT_MOUSE_DRAGGED:
if( null != movePositionP0 ) {
- if( pState1.insideWindow && movePositionP0.getX() == x && movePositionP0.getY() == y ) {
+ if( pState1.insideWindow && movePositionP0.getX() == x && movePositionP0.getY() == y ) {
if(DEBUG_MOUSE_EVENT) {
System.err.println("doPointerEvent: skip "+MouseEvent.getEventTypeString(eventType)+" w/ same position: "+movePositionP0);
}
@@ -2557,16 +2557,16 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
movePositionP0.set(x, y);
}
-
+
// Fall through intended !
-
+
default:
if(!pState1.insideWindow) {
- pState1.insideWindow = true;
+ pState1.insideWindow = true;
pState1.clearButton();
}
}
-
+
if( x < 0 || y < 0 || x >= getWidth() || y >= getHeight() ) {
if(DEBUG_MOUSE_EVENT) {
System.err.println("doPointerEvent: drop: "+MouseEvent.getEventTypeString(eventType)+
@@ -2582,29 +2582,29 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
final int buttonMask = InputEvent.getButtonMask(button);
modifiers |= buttonMask; // Always add current button to modifier mask (Bug 571)
modifiers |= pState1.buttonPressedMask; // Always add currently pressed mouse buttons to modifier mask
-
+
if( isPointerConfined() ) {
modifiers |= InputEvent.CONFINED_MASK;
}
if( !isPointerVisible() ) {
modifiers |= InputEvent.INVISIBLE_MASK;
}
-
+
pX[0] = x;
pY[0] = y;
-
+
//
// - Determine CLICK COUNT
// - Ignore sent CLICKED
// - Track buttonPressed incl. buttonPressedMask
// - Fix MOVED/DRAGGED event
//
- final MouseEvent e;
+ final MouseEvent e;
switch( eventType ) {
case MouseEvent.EVENT_MOUSE_CLICKED:
e = null;
break;
-
+
case MouseEvent.EVENT_MOUSE_PRESSED:
if( 0 >= pPressure[0] ) {
pPressure[0] = maxPressure;
@@ -2618,16 +2618,16 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
pState1.lastButtonPressTime = when;
pState1.buttonPressed = button;
- e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID,
+ e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID,
pX, pY, pPressure, maxPressure, button, pState1.lastButtonClickCount, rotationXYZ, rotationScale);
} else {
- e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID,
+ e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID,
pX, pY, pPressure, maxPressure, button, (short)1, rotationXYZ, rotationScale);
}
break;
case MouseEvent.EVENT_MOUSE_RELEASED:
if( 1 == pCount ) {
- e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID,
+ e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID,
pX, pY, pPressure, maxPressure, button, pState1.lastButtonClickCount, rotationXYZ, rotationScale);
if( when - pState1.lastButtonPressTime >= MouseEvent.getClickTimeout() ) {
pState1.lastButtonClickCount = (short)0;
@@ -2635,7 +2635,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
pState1.buttonPressed = 0;
} else {
- e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID,
+ e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID,
pX, pY, pPressure, maxPressure, button, (short)1, rotationXYZ, rotationScale);
}
pState1.buttonPressedMask &= ~buttonMask;
@@ -2645,10 +2645,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
break;
case MouseEvent.EVENT_MOUSE_MOVED:
if ( 0 != pState1.buttonPressedMask ) { // any button or pointer move -> drag
- e = new MouseEvent(MouseEvent.EVENT_MOUSE_DRAGGED, this, when, modifiers, pTypes, pID,
+ e = new MouseEvent(MouseEvent.EVENT_MOUSE_DRAGGED, this, when, modifiers, pTypes, pID,
pX, pY, pPressure, maxPressure, pState1.buttonPressed, (short)1, rotationXYZ, rotationScale);
} else {
- e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID,
+ e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID,
pX, pY, pPressure, maxPressure, button, (short)0, rotationXYZ, rotationScale);
}
break;
@@ -2658,12 +2658,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
// Fall through intended!
default:
- e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID,
+ e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID,
pX, pY, pPressure, maxPressure, button, (short)0, rotationXYZ, rotationScale);
}
doEvent(enqueue, wait, e); // actual mouse event
}
-
+
@Override
public final void addMouseListener(MouseListener l) {
addMouseListener(-1, l);
@@ -2676,8 +2676,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
@SuppressWarnings("unchecked")
ArrayList clonedListeners = (ArrayList) mouseListeners.clone();
- if(0>index) {
- index = clonedListeners.size();
+ if(0>index) {
+ index = clonedListeners.size();
}
clonedListeners.add(index, l);
mouseListeners = clonedListeners;
@@ -2698,8 +2698,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
public final MouseListener getMouseListener(int index) {
@SuppressWarnings("unchecked")
ArrayList clonedListeners = (ArrayList) mouseListeners.clone();
- if(0>index) {
- index = clonedListeners.size()-1;
+ if(0>index) {
+ index = clonedListeners.size()-1;
}
return clonedListeners.get(index);
}
@@ -2717,7 +2717,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
public final boolean areDefaultGesturesEnabled() {
return defaultGestureHandlerEnabled;
}
-
+
@Override
public final void addGestureHandler(GestureHandler gh) {
addGestureHandler(-1, gh);
@@ -2729,7 +2729,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
@SuppressWarnings("unchecked")
ArrayList cloned = (ArrayList) pointerGestureHandler.clone();
- if(0>index) {
+ if(0>index) {
index = cloned.size();
}
cloned.add(index, gh);
@@ -2756,7 +2756,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
@SuppressWarnings("unchecked")
ArrayList cloned = (ArrayList) gestureListeners.clone();
- if(0>index) {
+ if(0>index) {
index = cloned.size();
}
cloned.add(index, gl);
@@ -2772,11 +2772,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
cloned.remove(gl);
gestureListeners= cloned;
}
-
+
private static int step(int lower, int edge, int value) {
return value < edge ? lower : value;
}
-
+
/**
* Consume the {@link MouseEvent}, i.e.
*
@@ -2786,18 +2786,18 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
* - dispatch event to listener
*
*/
- protected void consumePointerEvent(MouseEvent pe) {
+ protected void consumePointerEvent(MouseEvent pe) {
int x = pe.getX();
int y = pe.getY();
-
+
if(DEBUG_MOUSE_EVENT) {
System.err.println("consumePointerEvent.in: "+pe);
}
-
+
//
// - Determine ENTERED/EXITED state
// - Synthesize ENTERED event
- // - Reset states if applicable
+ // - Reset states if applicable
//
final long when = pe.getWhen();
int eventType = pe.getEventType();
@@ -2812,7 +2812,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
pState0.clearButton();
eEntered = null;
break;
-
+
default:
if(!pState0.insideWindow) {
pState0.insideWindow = true;
@@ -2833,12 +2833,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
return; // .. invalid ..
}
-
+
//
// Handle Default Gestures
//
if( defaultGestureHandlerEnabled &&
- pe.getPointerType(0).getPointerClass() == MouseEvent.PointerClass.Onscreen )
+ pe.getPointerType(0).getPointerClass() == MouseEvent.PointerClass.Onscreen )
{
if( null == gesture2PtrTouchScroll ) {
final int scaledScrollSlop;
@@ -2849,16 +2849,16 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
final float pixWPerMM = (float)monitor.getCurrentMode().getRotatedWidth() / (float)mm.getWidth();
final float pixHPerMM = (float)monitor.getCurrentMode().getRotatedHeight() / (float)mm.getHeight();
final float pixPerMM = Math.min(pixHPerMM, pixWPerMM);
- scaledScrollSlop = Math.round(DoubleTapScrollGesture.SCROLL_SLOP_MM * pixPerMM);
- scaledDoubleTapSlop = Math.round(DoubleTapScrollGesture.DOUBLE_TAP_SLOP_MM * pixPerMM);
+ scaledScrollSlop = Math.round(DoubleTapScrollGesture.SCROLL_SLOP_MM * pixPerMM);
+ scaledDoubleTapSlop = Math.round(DoubleTapScrollGesture.DOUBLE_TAP_SLOP_MM * pixPerMM);
if(DEBUG_MOUSE_EVENT) {
System.err.println("consumePointerEvent.gscroll: scrollSlop "+scaledScrollSlop+", doubleTapSlop "+scaledDoubleTapSlop+", pixPerMM "+pixPerMM+", "+monitor);
}
} else {
scaledScrollSlop = DoubleTapScrollGesture.SCROLL_SLOP_PIXEL;
- scaledDoubleTapSlop = DoubleTapScrollGesture.DOUBLE_TAP_SLOP_PIXEL;
+ scaledDoubleTapSlop = DoubleTapScrollGesture.DOUBLE_TAP_SLOP_PIXEL;
}
- gesture2PtrTouchScroll = new DoubleTapScrollGesture(step(DoubleTapScrollGesture.SCROLL_SLOP_PIXEL, DoubleTapScrollGesture.SCROLL_SLOP_PIXEL/2, scaledScrollSlop),
+ gesture2PtrTouchScroll = new DoubleTapScrollGesture(step(DoubleTapScrollGesture.SCROLL_SLOP_PIXEL, DoubleTapScrollGesture.SCROLL_SLOP_PIXEL/2, scaledScrollSlop),
step(DoubleTapScrollGesture.DOUBLE_TAP_SLOP_PIXEL, DoubleTapScrollGesture.DOUBLE_TAP_SLOP_PIXEL/2, scaledDoubleTapSlop));
}
if( gesture2PtrTouchScroll.process(pe) ) {
@@ -2903,11 +2903,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
}
}
-
+
//
// - Synthesize mouse CLICKED
// - Ignore sent CLICKED
- //
+ //
final MouseEvent eClicked;
switch( eventType ) {
case MouseEvent.EVENT_MOUSE_PRESSED:
@@ -2921,7 +2921,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
eClicked = pe.createVariant(MouseEvent.EVENT_MOUSE_CLICKED);
} else {
eClicked = null;
- pState0.lastButtonPressTime = 0;
+ pState0.lastButtonPressTime = 0;
}
break;
case MouseEvent.EVENT_MOUSE_CLICKED:
@@ -2935,7 +2935,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
default:
eClicked = null;
}
-
+
if( null != pe ) {
if(DEBUG_MOUSE_EVENT) {
System.err.println("consumePointerEvent.send.1: "+pe);
@@ -2949,7 +2949,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
dispatchMouseEvent(eClicked);
}
}
-
+
private final void dispatchMouseEvent(MouseEvent e) {
for(int i = 0; !e.isConsumed() && i < mouseListeners.size(); i++ ) {
MouseListener l = mouseListeners.get(i);
@@ -2989,15 +2989,15 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
//
private static final int keyTrackingRange = 255;
private final IntBitfield keyPressedState = new IntBitfield( keyTrackingRange + 1 );
-
+
protected final boolean isKeyCodeTracked(final short keyCode) {
return ( 0xFFFF & (int)keyCode ) <= keyTrackingRange;
}
-
+
/**
* @param keyCode the keyCode to set pressed state
* @param pressed true if pressed, otherwise false
- * @return the previus pressed value
+ * @return the previus pressed value
*/
protected final boolean setKeyPressed(short keyCode, boolean pressed) {
final int v = 0xFFFF & (int)keyCode;
@@ -3008,7 +3008,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
/**
* @param keyCode the keyCode to test pressed state
- * @return true if pressed, otherwise false
+ * @return true if pressed, otherwise false
*/
protected final boolean isKeyPressed(short keyCode) {
final int v = 0xFFFF & (int)keyCode;
@@ -3017,7 +3017,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
return false;
}
-
+
public void sendKeyEvent(short eventType, int modifiers, short keyCode, short keySym, char keyChar) {
// Always add currently pressed mouse buttons to modifier mask
consumeKeyEvent( KeyEvent.create(eventType, this, System.currentTimeMillis(), modifiers | pState1.buttonPressedMask, keyCode, keySym, keyChar) );
@@ -3027,12 +3027,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
// Always add currently pressed mouse buttons to modifier mask
enqueueEvent(wait, KeyEvent.create(eventType, this, System.currentTimeMillis(), modifiers | pState1.buttonPressedMask, keyCode, keySym, keyChar) );
}
-
+
@Override
public final void setKeyboardVisible(boolean visible) {
if(isNativeValid()) {
// We don't skip the impl. if it seems that there is no state change,
- // since we cannot assume the impl. reliably gives us it's current state.
+ // since we cannot assume the impl. reliably gives us it's current state.
final boolean ok = setKeyboardVisibleImpl(visible);
if(DEBUG_IMPLEMENTATION || DEBUG_KEY_EVENT) {
System.err.println("setKeyboardVisible(native): visible "+keyboardVisible+" -- op[visible:"+visible +", ok "+ok+"] -> "+(visible && ok));
@@ -3046,13 +3046,13 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
public final boolean isKeyboardVisible() {
return keyboardVisible;
}
- /**
+ /**
* Returns true if operation was successful, otherwise false.
*
* We assume that a failed invisible operation is due to an already invisible keyboard,
- * hence even if an invisible operation failed, the keyboard is considered invisible!
- *
- */
+ * hence even if an invisible operation failed, the keyboard is considered invisible!
+ *
+ */
protected boolean setKeyboardVisibleImpl(boolean visible) {
return false; // nop
}
@@ -3066,7 +3066,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
}
protected boolean keyboardVisible = false;
-
+
@Override
public void addKeyListener(KeyListener l) {
addKeyListener(-1, l);
@@ -3079,7 +3079,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
@SuppressWarnings("unchecked")
ArrayList clonedListeners = (ArrayList) keyListeners.clone();
- if(0>index) {
+ if(0>index) {
index = clonedListeners.size();
}
clonedListeners.add(index, l);
@@ -3101,7 +3101,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
public KeyListener getKeyListener(int index) {
@SuppressWarnings("unchecked")
ArrayList clonedListeners = (ArrayList) keyListeners.clone();
- if(0>index) {
+ if(0>index) {
index = clonedListeners.size()-1;
}
return clonedListeners.get(index);
@@ -3125,7 +3125,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
return e.isConsumed();
}
-
+
protected void consumeKeyEvent(KeyEvent e) {
boolean consumedE = false;
if( null != keyboardFocusHandler && !e.isAutoRepeat() ) {
@@ -3164,7 +3164,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
@Override
- public void addWindowListener(int index, WindowListener l)
+ public void addWindowListener(int index, WindowListener l)
throws IndexOutOfBoundsException
{
if(l == null) {
@@ -3172,8 +3172,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
@SuppressWarnings("unchecked")
ArrayList clonedListeners = (ArrayList) windowListeners.clone();
- if(0>index) {
- index = clonedListeners.size();
+ if(0>index) {
+ index = clonedListeners.size();
}
clonedListeners.add(index, l);
windowListeners = clonedListeners;
@@ -3194,8 +3194,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
public WindowListener getWindowListener(int index) {
@SuppressWarnings("unchecked")
ArrayList clonedListeners = (ArrayList) windowListeners.clone();
- if(0>index) {
- index = clonedListeners.size()-1;
+ if(0>index) {
+ index = clonedListeners.size()-1;
}
return clonedListeners.get(index);
}
@@ -3234,7 +3234,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
l.windowRepaint((WindowUpdateEvent)e);
break;
default:
- throw
+ throw
new NativeWindowException("Unexpected window event type "
+ e.getEventType());
}
@@ -3248,7 +3248,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
System.err.println("Window.focusChanged: ("+getThreadName()+"): (defer: "+defer+") "+this.hasFocus+" -> "+focusGained+" - windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle));
}
hasFocus = focusGained;
- final int evt = focusGained ? WindowEvent.EVENT_WINDOW_GAINED_FOCUS : WindowEvent.EVENT_WINDOW_LOST_FOCUS ;
+ final int evt = focusGained ? WindowEvent.EVENT_WINDOW_GAINED_FOCUS : WindowEvent.EVENT_WINDOW_LOST_FOCUS ;
if(!defer) {
sendWindowEvent(evt);
} else {
@@ -3256,7 +3256,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
}
}
-
+
/** Triggered by implementation's WM events to update the visibility state. */
protected void visibleChanged(boolean defer, boolean visible) {
if(this.visible != visible) {
@@ -3282,7 +3282,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
display.dispatchMessagesNative(); // status up2date
}
if(this.visible != visible) {
- final String msg = "Visibility not reached as requested within "+timeOut+"ms : requested "+visible+", is "+this.visible;
+ final String msg = "Visibility not reached as requested within "+timeOut+"ms : requested "+visible+", is "+this.visible;
if(failFast) {
throw new NativeWindowException(msg);
} else if (DEBUG_IMPLEMENTATION) {
@@ -3297,7 +3297,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
}
- /** Triggered by implementation's WM events to update the client-area size w/o insets/decorations. */
+ /** Triggered by implementation's WM events to update the client-area size w/o insets/decorations. */
protected void sizeChanged(boolean defer, int newWidth, int newHeight, boolean force) {
if(force || getWidth() != newWidth || getHeight() != newHeight) {
if(DEBUG_IMPLEMENTATION) {
@@ -3316,7 +3316,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
}
}
-
+
private boolean waitForSize(int w, int h, boolean failFast, long timeOut) {
final DisplayImpl display = (DisplayImpl) screen.getDisplay();
display.dispatchMessagesNative(); // status up2date
@@ -3338,8 +3338,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
return true;
}
}
-
- /** Triggered by implementation's WM events to update the position. */
+
+ /** Triggered by implementation's WM events to update the position. */
protected void positionChanged(boolean defer, int newX, int newY) {
if ( getX() != newX || getY() != newY ) {
if(DEBUG_IMPLEMENTATION) {
@@ -3352,7 +3352,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
enqueueWindowEvent(false, WindowEvent.EVENT_WINDOW_MOVED);
}
} else {
- autoPosition = false; // ensure it's off even w/ same position
+ autoPosition = false; // ensure it's off even w/ same position
}
}
@@ -3396,10 +3396,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
return ok;
}
-
+
/**
- * Triggered by implementation's WM events to update the insets.
- *
+ * Triggered by implementation's WM events to update the insets.
+ *
* @see #getInsets()
* @see #updateInsetsImpl(Insets)
*/
@@ -3409,7 +3409,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window.insetsChanged: skip insets change for undecoration mode");
}
- } else if ( (left != insets.getLeftWidth() || right != insets.getRightWidth() ||
+ } else if ( (left != insets.getLeftWidth() || right != insets.getRightWidth() ||
top != insets.getTopHeight() || bottom != insets.getBottomHeight() )
) {
insets.set(left, right, top, bottom);
@@ -3419,10 +3419,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
}
}
-
+
/**
* Triggered by implementation's WM events or programmatic while respecting {@link #getDefaultCloseOperation()}.
- *
+ *
* @param force if true, overrides {@link #setDefaultCloseOperation(WindowClosingMode)} with {@link WindowClosingProtocol#DISPOSE_ON_CLOSE}
* and hence force destruction. Otherwise is follows the user settings.
* @return true if this window is no more valid and hence has been destroyed, otherwise false.
@@ -3434,9 +3434,9 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
System.err.println("Window.windowDestroyNotify(isNativeValid: "+isNativeValid()+", force: "+force+", mode "+defMode+" -> "+mode+") "+getThreadName()+": "+this);
// Thread.dumpStack();
}
-
+
final boolean destroyed;
-
+
if( isNativeValid() ) {
if( WindowClosingMode.DISPOSE_ON_CLOSE == mode ) {
if(force) {
@@ -3457,7 +3457,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
// send synced destroy notifications
sendWindowEvent(WindowEvent.EVENT_WINDOW_DESTROY_NOTIFY);
}
-
+
destroyed = !isNativeValid();
} else {
destroyed = true;
@@ -3465,19 +3465,19 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window.windowDestroyNotify(isNativeValid: "+isNativeValid()+", force: "+force+", mode "+mode+") END "+getThreadName()+": destroyed "+destroyed+", "+this);
- }
-
+ }
+
return destroyed;
}
@Override
public void windowRepaint(int x, int y, int width, int height) {
- windowRepaint(false, x, y, width, height);
+ windowRepaint(false, x, y, width, height);
}
-
+
/**
* Triggered by implementation's WM events to update the content
- */
+ */
protected void windowRepaint(boolean defer, int x, int y, int width, int height) {
width = ( 0 >= width ) ? getWidth() : width;
height = ( 0 >= height ) ? getHeight() : height;
@@ -3542,7 +3542,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
protected final void shouldNotCallThis() {
throw new NativeWindowException("Should not call this");
}
-
+
public static String getThreadName() {
return Display.getThreadName();
}
diff --git a/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java b/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java
index 861a6d6be..2ba5b3460 100644
--- a/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java
+++ b/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package jogamp.newt.awt;
import javax.media.nativewindow.AbstractGraphicsConfiguration;
@@ -76,12 +76,12 @@ public class NewtFactoryAWT extends NewtFactory {
}
return (JAWTWindow)nw;
}
-
+
public static void destroyNativeWindow(JAWTWindow jawtWindow) {
final AbstractGraphicsConfiguration config = jawtWindow.getGraphicsConfiguration();
jawtWindow.destroy();
- config.getScreen().getDevice().close();
+ config.getScreen().getDevice().close();
}
-
+
}
diff --git a/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java b/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java
index d71ad175b..0ee3cc0cd 100644
--- a/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java
+++ b/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,26 +20,26 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package jogamp.newt.awt.event;
import com.jogamp.newt.event.MouseEvent;
/**
*
- *
- *
+ *
* @param awtMods
* The AWT event modifiers.
- *
+ *
* @param awtModsEx
* The AWT extended event modifiers.
* AWT passes mouse button specific bits here and are the preferred way check the mouse button state.
*/
public static final int awtModifiers2Newt(final int awtMods, final int awtModsEx) {
int newtMods = 0;
-
+
/** Redundant old modifiers ..
if ((awtMods & java.awt.event.InputEvent.SHIFT_MASK) != 0) newtMods |= com.jogamp.newt.event.InputEvent.SHIFT_MASK;
if ((awtMods & java.awt.event.InputEvent.CTRL_MASK) != 0) newtMods |= com.jogamp.newt.event.InputEvent.CTRL_MASK;
if ((awtMods & java.awt.event.InputEvent.META_MASK) != 0) newtMods |= com.jogamp.newt.event.InputEvent.META_MASK;
if ((awtMods & java.awt.event.InputEvent.ALT_MASK) != 0) newtMods |= com.jogamp.newt.event.InputEvent.ALT_MASK;
if ((awtMods & java.awt.event.InputEvent.ALT_GRAPH_MASK) != 0) newtMods |= com.jogamp.newt.event.InputEvent.ALT_GRAPH_MASK; */
-
+
if ((awtModsEx & java.awt.event.InputEvent.SHIFT_DOWN_MASK) != 0) newtMods |= com.jogamp.newt.event.InputEvent.SHIFT_MASK;
if ((awtModsEx & java.awt.event.InputEvent.CTRL_DOWN_MASK) != 0) newtMods |= com.jogamp.newt.event.InputEvent.CTRL_MASK;
if ((awtModsEx & java.awt.event.InputEvent.META_DOWN_MASK) != 0) newtMods |= com.jogamp.newt.event.InputEvent.META_MASK;
@@ -221,7 +221,7 @@ public class AWTNewtEventFactory {
// being ignored intentionally. The AWT docs say that the
// BUTTON1_DOWN_MASK etc bits in the extended modifiers are
// the preferred place to check current button state.
-
+
if( 0 != awtModsEx ) {
for (int n = 0 ; n < awtButtonDownMasks.length ; ++n) {
if ( (awtModsEx & awtButtonDownMasks[n]) != 0 ) {
@@ -232,7 +232,7 @@ public class AWTNewtEventFactory {
return newtMods;
}
-
+
public static short awtKeyCode2NewtKeyCode(final int awtKeyCode) {
final short defNEWTKeyCode = (short)awtKeyCode;
switch (awtKeyCode) {
@@ -371,7 +371,7 @@ public class AWTNewtEventFactory {
case java.awt.event.KeyEvent.VK_MULTIPLY : return com.jogamp.newt.event.KeyEvent.VK_MULTIPLY;
case java.awt.event.KeyEvent.VK_DIVIDE : return com.jogamp.newt.event.KeyEvent.VK_DIVIDE;
case java.awt.event.KeyEvent.VK_NUM_LOCK : return com.jogamp.newt.event.KeyEvent.VK_NUM_LOCK;
- case java.awt.event.KeyEvent.VK_KP_LEFT : /** Fall through intended .. */
+ case java.awt.event.KeyEvent.VK_KP_LEFT : /** Fall through intended .. */
case java.awt.event.KeyEvent.VK_LEFT : return com.jogamp.newt.event.KeyEvent.VK_LEFT;
case java.awt.event.KeyEvent.VK_KP_UP : /** Fall through intended .. */
case java.awt.event.KeyEvent.VK_UP : return com.jogamp.newt.event.KeyEvent.VK_UP;
@@ -381,7 +381,7 @@ public class AWTNewtEventFactory {
case java.awt.event.KeyEvent.VK_DOWN : return com.jogamp.newt.event.KeyEvent.VK_DOWN;
case java.awt.event.KeyEvent.VK_CONTEXT_MENU : return com.jogamp.newt.event.KeyEvent.VK_CONTEXT_MENU;
case java.awt.event.KeyEvent.VK_WINDOWS : return com.jogamp.newt.event.KeyEvent.VK_WINDOWS;
- case java.awt.event.KeyEvent.VK_META : return com.jogamp.newt.event.KeyEvent.VK_META;
+ case java.awt.event.KeyEvent.VK_META : return com.jogamp.newt.event.KeyEvent.VK_META;
case java.awt.event.KeyEvent.VK_HELP : return com.jogamp.newt.event.KeyEvent.VK_HELP;
case java.awt.event.KeyEvent.VK_COMPOSE : return com.jogamp.newt.event.KeyEvent.VK_COMPOSE;
case java.awt.event.KeyEvent.VK_BEGIN : return com.jogamp.newt.event.KeyEvent.VK_BEGIN;
@@ -558,7 +558,7 @@ public class AWTNewtEventFactory {
case com.jogamp.newt.event.KeyEvent.VK_DOWN : return java.awt.event.KeyEvent.VK_DOWN;
case com.jogamp.newt.event.KeyEvent.VK_CONTEXT_MENU : return java.awt.event.KeyEvent.VK_CONTEXT_MENU;
case com.jogamp.newt.event.KeyEvent.VK_WINDOWS : return java.awt.event.KeyEvent.VK_WINDOWS;
- case com.jogamp.newt.event.KeyEvent.VK_META : return java.awt.event.KeyEvent.VK_META;
+ case com.jogamp.newt.event.KeyEvent.VK_META : return java.awt.event.KeyEvent.VK_META;
case com.jogamp.newt.event.KeyEvent.VK_HELP : return java.awt.event.KeyEvent.VK_HELP;
case com.jogamp.newt.event.KeyEvent.VK_COMPOSE : return java.awt.event.KeyEvent.VK_COMPOSE;
case com.jogamp.newt.event.KeyEvent.VK_BEGIN : return java.awt.event.KeyEvent.VK_BEGIN;
@@ -636,7 +636,7 @@ public class AWTNewtEventFactory {
}
return new com.jogamp.newt.event.MouseEvent(
newtType, (null==newtSource)?(Object)event.getComponent():(Object)newtSource, event.getWhen(),
- mods, event.getX(), event.getY(), (short)event.getClickCount(),
+ mods, event.getX(), event.getY(), (short)event.getClickCount(),
newtButton, MouseEvent.getRotationXYZ(rotation, mods), 1f);
}
return null; // no mapping ..
@@ -650,11 +650,11 @@ public class AWTNewtEventFactory {
if( (short)0 != newtType ) {
final short newtKeyCode = awtKeyCode2NewtKeyCode( event.getKeyCode() );
return com.jogamp.newt.event.KeyEvent.create(
- newtType, (null==newtSource)?(Object)event.getComponent():(Object)newtSource, event.getWhen(),
- awtModifiers2Newt(event.getModifiers(), event.getModifiersEx()),
+ newtType, (null==newtSource)?(Object)event.getComponent():(Object)newtSource, event.getWhen(),
+ awtModifiers2Newt(event.getModifiers(), event.getModifiersEx()),
newtKeyCode, newtKeyCode, event.getKeyChar());
}
return null; // no mapping ..
}
-
+
}
diff --git a/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java b/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java
index fa494adca..325f17278 100644
--- a/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java
+++ b/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package jogamp.newt.awt.event;
import java.awt.KeyboardFocusManager;
@@ -45,7 +45,7 @@ import com.jogamp.newt.event.awt.AWTWindowAdapter;
public class AWTParentWindowAdapter extends AWTWindowAdapter implements java.awt.event.HierarchyListener
{
NativeWindow downstreamParent;
-
+
public AWTParentWindowAdapter(NativeWindow downstreamParent, com.jogamp.newt.Window downstream) {
super(downstream);
this.downstreamParent = downstreamParent;
@@ -111,12 +111,12 @@ public class AWTParentWindowAdapter extends AWTWindowAdapter implements java.awt
public void componentMoved(java.awt.event.ComponentEvent e) {
if(DEBUG_IMPLEMENTATION) {
- System.err.println("AWT: componentMoved: "+e);
+ System.err.println("AWT: componentMoved: "+e);
}
final Window newtWindow = getNewtWindow();
if(newtWindow.getDelegatedWindow() instanceof DriverUpdatePosition) {
((DriverUpdatePosition)newtWindow.getDelegatedWindow()).updatePosition(0, 0);
- }
+ }
}
public void windowActivated(java.awt.event.WindowEvent e) {
@@ -130,7 +130,7 @@ public class AWTParentWindowAdapter extends AWTWindowAdapter implements java.awt
public void hierarchyChanged(java.awt.event.HierarchyEvent e) {
if( null == getNewtEventListener() ) {
long bits = e.getChangeFlags();
- final java.awt.Component changed = e.getChanged();
+ final java.awt.Component changed = e.getChanged();
if( 0 != ( java.awt.event.HierarchyEvent.SHOWING_CHANGED & bits ) ) {
final boolean showing = changed.isShowing();
if(DEBUG_IMPLEMENTATION) {
@@ -142,7 +142,7 @@ public class AWTParentWindowAdapter extends AWTWindowAdapter implements java.awt
getNewtWindow().setVisible(showing);
}
}});
- }
+ }
if(DEBUG_IMPLEMENTATION) {
if( 0 != ( java.awt.event.HierarchyEvent.DISPLAYABILITY_CHANGED & bits ) ) {
final boolean displayability = changed.isDisplayable();
diff --git a/src/newt/classes/jogamp/newt/driver/DriverClearFocus.java b/src/newt/classes/jogamp/newt/driver/DriverClearFocus.java
index 0a824e83b..0ff86fe93 100644
--- a/src/newt/classes/jogamp/newt/driver/DriverClearFocus.java
+++ b/src/newt/classes/jogamp/newt/driver/DriverClearFocus.java
@@ -1,10 +1,10 @@
package jogamp.newt.driver;
-/**
+/**
* Interface tagging driver requirement of clearing the focus.
*
- * Some drivers require a programmatic {@link #clearFocus()} when traversing the focus.
- *
+ * Some drivers require a programmatic {@link #clearFocus()} when traversing the focus.
+ *
*/
public interface DriverClearFocus {
/** Programmatic clear the focus */
diff --git a/src/newt/classes/jogamp/newt/driver/DriverUpdatePosition.java b/src/newt/classes/jogamp/newt/driver/DriverUpdatePosition.java
index 2ec327187..e5f9b6a68 100644
--- a/src/newt/classes/jogamp/newt/driver/DriverUpdatePosition.java
+++ b/src/newt/classes/jogamp/newt/driver/DriverUpdatePosition.java
@@ -1,14 +1,14 @@
package jogamp.newt.driver;
-/**
+/**
* Interface tagging driver requirement of absolute positioning, ie. depend on parent position.
*/
public interface DriverUpdatePosition {
- /**
+ /**
* Programmatic update the top-left corner
* of the client area relative to it's parent.
- *
- * @param x x-component
+ *
+ * @param x x-component
* @param y y-component
**/
void updatePosition(int x, int y);
diff --git a/src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.java b/src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.java
index 9a1632130..14cc9c69d 100644
--- a/src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.java
+++ b/src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt.driver.awt;
@@ -100,7 +100,7 @@ public class AWTCanvas extends Canvas {
@Override
public void paint(Graphics g) {
}
-
+
public boolean hasDeviceChanged() {
boolean res = displayConfigChanged;
displayConfigChanged=false;
@@ -154,12 +154,12 @@ public class AWTCanvas extends Canvas {
public NativeWindow getNativeWindow() {
final JAWTWindow _jawtWindow = jawtWindow;
return (null != _jawtWindow) ? _jawtWindow : null;
- }
-
+ }
+
public boolean isOffscreenLayerSurfaceEnabled() {
- return null != jawtWindow ? jawtWindow.isOffscreenLayerSurfaceEnabled() : false;
+ return null != jawtWindow ? jawtWindow.isOffscreenLayerSurfaceEnabled() : false;
}
-
+
public void removeNotify() {
try {
dispose();
@@ -188,7 +188,7 @@ public class AWTCanvas extends Canvas {
}
}
}
-
+
private String getThreadName() { return Thread.currentThread().getName(); }
/**
@@ -200,7 +200,7 @@ public class AWTCanvas extends Canvas {
* Workaround for problems with Xinerama and java.awt.Component.checkGD
* when adding to a container on a different graphics device than the
* one that this Canvas is associated with.
- *
+ *
* GC will be null unless:
* - A native peer has assigned it. This means we have a native
* peer, and are already comitted to a graphics configuration.
@@ -214,7 +214,7 @@ public class AWTCanvas extends Canvas {
* chosen is only non-null on platforms where the GLDrawableFactory
* returns a non-null GraphicsConfiguration (in the GLCanvas
* constructor).
- *
+ *
* if gc is from this Canvas' native peer then it should equal chosen,
* otherwise it is from an ancestor component that this Canvas is being
* added to, and we go into this block.
@@ -224,21 +224,21 @@ public class AWTCanvas extends Canvas {
* Check for compatibility with gc. If they differ by only the
* device then return a new GCconfig with the super-class' GDevice
* (and presumably the same visual ID in Xinerama).
- *
+ *
*/
if (!chosen.getDevice().getIDstring().equals(gc.getDevice().getIDstring())) {
/*
* Here we select a GraphicsConfiguration on the alternate
* device that is presumably identical to the chosen
* configuration, but on the other device.
- *
+ *
* Should really check to ensure that we select a configuration
* with the same X visual ID for Xinerama screens, otherwise the
* GLDrawable may have the wrong visual ID (I don't think this
* ever gets updated). May need to add a method to
* X11GLDrawableFactory to do this in a platform specific
* manner.
- *
+ *
* However, on platforms where we can actually get into this
* block, both devices should have the same visual list, and the
* same configuration should be selected here.
@@ -265,7 +265,7 @@ public class AWTCanvas extends Canvas {
chosen = compatible;
if( !config.getChosenCapabilities().equals(awtConfig.getChosenCapabilities())) {
displayConfigChanged=true;
- }
+ }
awtConfig = config;
}
}
@@ -275,7 +275,7 @@ public class AWTCanvas extends Canvas {
* return the GC that was selected in the constructor (and might
* cause an exception in Component.checkGD when adding to a
* container, but in this case that would be the desired behavior).
- *
+ *
*/
return chosen;
} else if (gc == null) {
@@ -299,7 +299,7 @@ public class AWTCanvas extends Canvas {
CapabilitiesImmutable capsRequested,
CapabilitiesChooser chooser,
GraphicsDevice device) {
- final AbstractGraphicsScreen aScreen = null != device ?
+ final AbstractGraphicsScreen aScreen = null != device ?
AWTGraphicsScreen.createScreenDevice(device, AbstractGraphicsDevice.DEFAULT_UNIT):
AWTGraphicsScreen.createDefault();
AWTGraphicsConfiguration config = (AWTGraphicsConfiguration)
diff --git a/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java b/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java
index 02f4be0cd..bddb43b30 100644
--- a/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java
+++ b/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java
@@ -40,9 +40,9 @@ import jogamp.newt.Debug;
public class AWTEDTUtil implements EDTUtil {
public static final boolean DEBUG = Debug.debug("EDT");
-
+
private final Object edtLock = new Object(); // locking the EDT start/stop state
- private final ThreadGroup threadGroup;
+ private final ThreadGroup threadGroup;
private final String name;
private final Runnable dispatchMessages;
private NEDT nedt = null;
@@ -66,7 +66,7 @@ public class AWTEDTUtil implements EDTUtil {
final public void setPollPeriod(long ms) {
pollPeriod = ms;
}
-
+
@Override
public final boolean start() throws IllegalStateException {
synchronized(edtLock) {
@@ -107,12 +107,12 @@ public class AWTEDTUtil implements EDTUtil {
public final boolean isCurrentThreadNEDT() {
return nedt == Thread.currentThread();
}
-
+
@Override
public final boolean isCurrentThreadEDTorNEDT() {
- return EventQueue.isDispatchThread() || nedt == Thread.currentThread();
+ return EventQueue.isDispatchThread() || nedt == Thread.currentThread();
}
-
+
@Override
final public boolean isRunning() {
return nedt.isRunning() ;
@@ -127,12 +127,12 @@ public class AWTEDTUtil implements EDTUtil {
public final boolean invoke(boolean wait, Runnable task) {
return invokeImpl(wait, task, false);
}
-
+
private static Runnable nullTask = new Runnable() {
@Override
- public void run() { }
+ public void run() { }
};
-
+
private final boolean invokeImpl(boolean wait, Runnable task, boolean stop) {
Throwable throwable = null;
RunnableTask rTask = null;
@@ -145,7 +145,7 @@ public class AWTEDTUtil implements EDTUtil {
if(DEBUG) {
Thread.dumpStack();
}
- return false;
+ return false;
}
if( isCurrentThreadEDT() ) {
if(null != task) {
@@ -181,7 +181,7 @@ public class AWTEDTUtil implements EDTUtil {
if(null != task) {
rTask = new RunnableTask(task,
wait ? rTaskLock : null,
- true /* always catch and report Exceptions, don't disturb EDT */,
+ true /* always catch and report Exceptions, don't disturb EDT */,
wait ? null : System.err);
AWTEDTExecutor.singleton.invoke(false, rTask);
}
@@ -205,7 +205,7 @@ public class AWTEDTUtil implements EDTUtil {
}
return true;
}
- }
+ }
@Override
final public boolean waitUntilIdle() {
@@ -241,7 +241,7 @@ public class AWTEDTUtil implements EDTUtil {
}
}
}
-
+
class NEDT extends Thread {
volatile boolean shouldStop = false;
volatile boolean isRunning = false;
@@ -261,7 +261,7 @@ public class AWTEDTUtil implements EDTUtil {
super.start();
}
- /**
+ /**
* Utilizing locking only on tasks and its execution,
* not for event dispatching.
*/
@@ -302,7 +302,7 @@ public class AWTEDTUtil implements EDTUtil {
}
} finally {
if(DEBUG) {
- System.err.println(getName()+": AWT-EDT run() END "+ getName()+", "+error);
+ System.err.println(getName()+": AWT-EDT run() END "+ getName()+", "+error);
}
synchronized(edtLock) {
isRunning = false;
@@ -317,7 +317,7 @@ public class AWTEDTUtil implements EDTUtil {
} // finally
} // run()
} // EventDispatchThread
-
+
}
diff --git a/src/newt/classes/jogamp/newt/driver/awt/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/awt/DisplayDriver.java
index 30449f9bc..9e716d544 100644
--- a/src/newt/classes/jogamp/newt/driver/awt/DisplayDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/awt/DisplayDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt.driver.awt;
@@ -57,7 +57,7 @@ public class DisplayDriver extends DisplayImpl {
protected EDTUtil createEDTUtil() {
final EDTUtil def;
if(NewtFactory.useEDT()) {
- def = new AWTEDTUtil(Thread.currentThread().getThreadGroup(), "AWTDisplay-"+getFQName(), dispatchMessagesRunnable);
+ def = new AWTEDTUtil(Thread.currentThread().getThreadGroup(), "AWTDisplay-"+getFQName(), dispatchMessagesRunnable);
if(DEBUG) {
System.err.println("Display.createNative("+getFQName()+") Create EDTUtil: "+def.getClass().getName());
}
@@ -67,7 +67,7 @@ public class DisplayDriver extends DisplayImpl {
return def;
}
- protected void closeNativeImpl(AbstractGraphicsDevice aDevice) {
+ protected void closeNativeImpl(AbstractGraphicsDevice aDevice) {
aDevice.close();
}
diff --git a/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java
index 126143e1e..a2430e2bb 100644
--- a/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,7 +28,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt.driver.awt;
@@ -66,10 +66,10 @@ public class ScreenDriver extends ScreenImpl {
}
protected void closeNativeImpl() { }
-
+
protected int validateScreenIndex(int idx) {
- return idx; // pass through ...
- }
+ return idx; // pass through ...
+ }
private static MonitorMode getModeProps(Cache cache, DisplayMode mode) {
int rate = mode.getRefreshRate();
@@ -90,16 +90,16 @@ public class ScreenDriver extends ScreenImpl {
props[i++] = 0; // flags
props[i++] = 0; // mode_idx
props[i++] = 0; // rotation
- return MonitorModeProps.streamInMonitorMode(null, cache, props, 0);
+ return MonitorModeProps.streamInMonitorMode(null, cache, props, 0);
}
-
+
@Override
protected void collectNativeMonitorModesAndDevicesImpl(Cache cache) {
final GraphicsDevice awtGD = ((AWTGraphicsDevice)getDisplay().getGraphicsDevice()).getGraphicsDevice();
final DisplayMode[] awtModes = awtGD.getDisplayModes();
for(int i=0; i=0 || y>=0) {
System.err.println("BCEGL Window.setPositionImpl n/a in BroadcomEGL");
}
-
+
if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) {
visibleChanged(false, 0 != ( FLAG_IS_VISIBLE & flags));
}
@@ -122,7 +122,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl {
}
protected void updateInsetsImpl(Insets insets) {
- // nop ..
+ // nop ..
}
@Override
diff --git a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java
index 4872a9071..52c92a5da 100644
--- a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -72,7 +72,7 @@ public class DisplayDriver extends DisplayImpl {
DispatchMessages();
}
- protected static native boolean initIDs();
+ protected static native boolean initIDs();
private native void DispatchMessages();
}
diff --git a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java
index be99052d7..5a1917419 100644
--- a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -53,9 +53,9 @@ public class ScreenDriver extends ScreenImpl {
protected void closeNativeImpl() { }
protected int validateScreenIndex(int idx) {
- return 0; // only one screen available
- }
-
+ return 0; // only one screen available
+ }
+
@Override
protected final void collectNativeMonitorModesAndDevicesImpl(MonitorModeProps.Cache cache) {
int[] props = new int[ MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL ];
@@ -92,20 +92,20 @@ public class ScreenDriver extends ScreenImpl {
protected boolean setCurrentMonitorModeImpl(final MonitorDevice monitor, final MonitorMode mode) {
return false;
}
-
+
@Override
protected void calcVirtualScreenOriginAndSize(Rectangle vOriginSize) {
vOriginSize.set(0, 0, cachedWidth, cachedHeight);
}
-
+
/** Called from {@link #initNative()}. */
protected void setScreenSize(int width, int height) {
cachedWidth = width;
cachedHeight = height;
}
-
+
private static int cachedWidth = 0;
- private static int cachedHeight = 0;
+ private static int cachedHeight = 0;
protected static native boolean initIDs();
protected native void initNative();
diff --git a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java
index e820439d0..560e49e96 100644
--- a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -65,7 +65,7 @@ public class WindowDriver extends WindowImpl {
final EGLGraphicsDevice aDevice = (EGLGraphicsDevice) aScreen.getDevice();
final EGLGraphicsDevice eglDevice = EGLDisplayUtil.eglCreateEGLGraphicsDevice(aDevice.getNativeDisplayID(), aDevice.getConnection(), aDevice.getUnitID());
final DefaultGraphicsScreen eglScreen = new DefaultGraphicsScreen(eglDevice, aScreen.getIndex());
-
+
final AbstractGraphicsConfiguration cfg = GraphicsConfigurationFactory.getFactory(getScreen().getDisplay().getGraphicsDevice(), capsRequested).chooseGraphicsConfiguration(
capsRequested, capsRequested, capabilitiesChooser, eglScreen, VisualIDHolder.VID_UNDEFINED);
if (null == cfg) {
@@ -89,24 +89,24 @@ public class WindowDriver extends WindowImpl {
windowHandleClose = nativeWindowHandle;
addWindowListener(LinuxMouseTracker.getSingleton());
addWindowListener(LinuxEventDeviceTracker.getSingleton());
- focusChanged(false, true);
+ focusChanged(false, true);
}
protected void closeNativeImpl() {
final EGLGraphicsDevice eglDevice = (EGLGraphicsDevice) getGraphicsConfiguration().getScreen().getDevice();
-
+
removeWindowListener(LinuxMouseTracker.getSingleton());
removeWindowListener(LinuxEventDeviceTracker.getSingleton());
-
+
if(0!=windowHandleClose) {
CloseWindow(windowHandleClose, windowUserData);
windowUserData=0;
}
-
+
eglDevice.close();
}
- protected void requestFocusImpl(boolean reparented) {
+ protected void requestFocusImpl(boolean reparented) {
focusChanged(false, true);
}
@@ -115,7 +115,7 @@ public class WindowDriver extends WindowImpl {
setVisible0(nativeWindowHandle, 0 != ( FLAG_IS_VISIBLE & flags));
visibleChanged(false, 0 != ( FLAG_IS_VISIBLE & flags));
}
-
+
if(0!=nativeWindowHandle) {
if(0 != ( FLAG_CHANGE_FULLSCREEN & flags)) {
final boolean fs = 0 != ( FLAG_IS_FULLSCREEN & flags) ;
@@ -135,11 +135,11 @@ public class WindowDriver extends WindowImpl {
System.err.println("setPosition n/a in KD");
}
}
-
+
if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) {
visibleChanged(false, 0 != ( FLAG_IS_VISIBLE & flags));
}
-
+
return true;
}
@@ -148,9 +148,9 @@ public class WindowDriver extends WindowImpl {
}
protected void updateInsetsImpl(Insets insets) {
- // nop ..
+ // nop ..
}
-
+
//----------------------------------------------------------------------
// Internals only
//
diff --git a/src/newt/classes/jogamp/newt/driver/intel/gdl/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/intel/gdl/DisplayDriver.java
index ee93eb932..4cb566bc2 100644
--- a/src/newt/classes/jogamp/newt/driver/intel/gdl/DisplayDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/intel/gdl/DisplayDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2012 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt.driver.intel.gdl;
diff --git a/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java
index 27b776562..b5202aaf9 100644
--- a/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2012 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt.driver.intel.gdl;
@@ -62,9 +62,9 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl {
protected void closeNativeImpl() { }
protected int validateScreenIndex(int idx) {
- return 0; // only one screen available
+ return 0; // only one screen available
}
-
+
@Override
protected final void collectNativeMonitorModesAndDevicesImpl(MonitorModeProps.Cache cache) {
int[] props = new int[ MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL ];
@@ -101,11 +101,11 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl {
protected boolean setCurrentMonitorModeImpl(final MonitorDevice monitor, final MonitorMode mode) {
return false;
}
-
+
protected void calcVirtualScreenOriginAndSize(Rectangle vOriginSize) {
vOriginSize.set(0, 0, cachedWidth, cachedHeight);
}
-
+
//----------------------------------------------------------------------
// Internals only
//
@@ -118,7 +118,7 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl {
cachedWidth = width;
cachedHeight = height;
}
-
+
private static int cachedWidth = 0;
private static int cachedHeight = 0;
}
diff --git a/src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java
index 98335f192..80821d4da 100644
--- a/src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2012 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt.driver.intel.gdl;
@@ -108,7 +108,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl {
}
visibleChanged(false, 0 != ( FLAG_IS_VISIBLE & flags));
}
-
+
return true;
}
@@ -126,9 +126,9 @@ public class WindowDriver extends jogamp.newt.WindowImpl {
}
protected void updateInsetsImpl(Insets insets) {
- // nop ..
+ // nop ..
}
-
+
//----------------------------------------------------------------------
// Internals only
//
diff --git a/src/newt/classes/jogamp/newt/driver/kd/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/kd/DisplayDriver.java
index 3cd72e971..1b92ca586 100644
--- a/src/newt/classes/jogamp/newt/driver/kd/DisplayDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/kd/DisplayDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2012 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt.driver.kd;
diff --git a/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java
index f893275ca..17cc5dd2f 100644
--- a/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2012 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt.driver.kd;
@@ -58,9 +58,9 @@ public class ScreenDriver extends ScreenImpl {
protected void closeNativeImpl() { }
protected int validateScreenIndex(int idx) {
- return 0; // only one screen available
- }
-
+ return 0; // only one screen available
+ }
+
@Override
protected final void collectNativeMonitorModesAndDevicesImpl(MonitorModeProps.Cache cache) {
int[] props = new int[ MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL ];
@@ -97,16 +97,16 @@ public class ScreenDriver extends ScreenImpl {
protected boolean setCurrentMonitorModeImpl(final MonitorDevice monitor, final MonitorMode mode) {
return false;
}
-
+
protected void calcVirtualScreenOriginAndSize(Rectangle vOriginSize) {
vOriginSize.set(0, 0, cachedWidth, cachedHeight);
}
-
+
protected void sizeChanged(int w, int h) {
cachedWidth = w;
cachedHeight = h;
}
-
+
private static int cachedWidth = 0;
- private static int cachedHeight = 0;
+ private static int cachedHeight = 0;
}
diff --git a/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java
index c733a3e94..d30d4f025 100644
--- a/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2012 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt.driver.kd;
@@ -97,7 +97,7 @@ public class WindowDriver extends WindowImpl {
setVisible0(eglWindowHandle, 0 != ( FLAG_IS_VISIBLE & flags));
visibleChanged(false, 0 != ( FLAG_IS_VISIBLE & flags));
}
-
+
if(0!=eglWindowHandle) {
if(0 != ( FLAG_CHANGE_FULLSCREEN & flags)) {
final boolean fs = 0 != ( FLAG_IS_FULLSCREEN & flags) ;
@@ -117,11 +117,11 @@ public class WindowDriver extends WindowImpl {
System.err.println("setPosition n/a in KD");
}
}
-
+
if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) {
visibleChanged(false, 0 != ( FLAG_IS_VISIBLE & flags));
}
-
+
return true;
}
@@ -130,9 +130,9 @@ public class WindowDriver extends WindowImpl {
}
protected void updateInsetsImpl(Insets insets) {
- // nop ..
+ // nop ..
}
-
+
//----------------------------------------------------------------------
// Internals only
//
diff --git a/src/newt/classes/jogamp/newt/driver/linux/LinuxEventDeviceTracker.java b/src/newt/classes/jogamp/newt/driver/linux/LinuxEventDeviceTracker.java
index e68b91d82..b7c86a26d 100644
--- a/src/newt/classes/jogamp/newt/driver/linux/LinuxEventDeviceTracker.java
+++ b/src/newt/classes/jogamp/newt/driver/linux/LinuxEventDeviceTracker.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -126,7 +126,7 @@ public class LinuxEventDeviceTracker implements WindowListener {
try {
while(true) {
Thread.sleep(1000);
- }
+ }
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -186,7 +186,7 @@ public class LinuxEventDeviceTracker implements WindowListener {
/**
* The Linux input event interface.
* http://www.kernel.org/doc/Documentation/input/input.txt
- *
+ *
* struct input_event {
* struct timeval time;
* unsigned short type;
@@ -262,7 +262,7 @@ public class LinuxEventDeviceTracker implements WindowListener {
break;
case 1: // EV_KEY
keyCode = LinuxEVKey2NewtVKey(code); // The device independent code.
- keyChar = NewtVKey2Unicode(keyCode, modifiers); // The printable character w/ key modifiers.
+ keyChar = NewtVKey2Unicode(keyCode, modifiers); // The printable character w/ key modifiers.
if(Window.DEBUG_KEY_EVENT) {
System.out.println("[EV_KEY: [time "+timeSeconds+":"+timeSecondFraction+"] type "+type+" / code "+code+" = value "+value);
}
@@ -946,7 +946,7 @@ public class LinuxEventDeviceTracker implements WindowListener {
case 248: // mic mute
break; // FIXME
- default:
+ default:
}
if(Window.DEBUG_KEY_EVENT) {
diff --git a/src/newt/classes/jogamp/newt/driver/linux/LinuxMouseTracker.java b/src/newt/classes/jogamp/newt/driver/linux/LinuxMouseTracker.java
index 0d6278bfb..1e314b7f4 100644
--- a/src/newt/classes/jogamp/newt/driver/linux/LinuxMouseTracker.java
+++ b/src/newt/classes/jogamp/newt/driver/linux/LinuxMouseTracker.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -48,16 +48,16 @@ import com.jogamp.newt.event.WindowUpdateEvent;
* within it's own polling thread.
*/
public class LinuxMouseTracker implements WindowListener {
-
+
private static final LinuxMouseTracker lmt;
-
+
static {
lmt = new LinuxMouseTracker();
final Thread t = new Thread(lmt.mouseDevicePoller, "NEWT-LinuxMouseTracker");
t.setDaemon(true);
t.start();
}
-
+
public static LinuxMouseTracker getSingleton() {
return lmt;
}
@@ -71,7 +71,7 @@ public class LinuxMouseTracker implements WindowListener {
private short old_buttonDown = 0;
private WindowImpl focusedWindow = null;
private MouseDevicePoller mouseDevicePoller = new MouseDevicePoller();
-
+
@Override
public void windowResized(WindowEvent e) { }
@@ -107,7 +107,7 @@ public class LinuxMouseTracker implements WindowListener {
@Override
public void windowRepaint(WindowUpdateEvent e) { }
-
+
class MouseDevicePoller implements Runnable {
@Override
public void run() {
@@ -150,17 +150,17 @@ public class LinuxMouseTracker implements WindowListener {
yo=(b[0]&128)>0;
xd=b[1];
yd=b[2];
-
+
x+=xd;
y-=yd;
-
+
if(x<0) {
x=0;
}
if(y<0) {
y=0;
}
-
+
buttonDown = 0;
if(lb) {
buttonDown = MouseEvent.BUTTON1;
@@ -171,7 +171,7 @@ public class LinuxMouseTracker implements WindowListener {
if(rb) {
buttonDown = MouseEvent.BUTTON3;
}
-
+
if(null != focusedWindow) {
if( x >= focusedWindow.getScreen().getWidth() ) {
x = focusedWindow.getScreen().getWidth() - 1;
@@ -179,31 +179,31 @@ public class LinuxMouseTracker implements WindowListener {
if( y >= focusedWindow.getScreen().getHeight() ) {
y = focusedWindow.getScreen().getHeight() - 1;
}
- int wx = x - focusedWindow.getX(), wy = y - focusedWindow.getY();
-
+ int wx = x - focusedWindow.getX(), wy = y - focusedWindow.getY();
+
if(old_x != x || old_y != y) {
// mouse moved
- focusedWindow.sendMouseEvent(MouseEvent.EVENT_MOUSE_MOVED, 0, wx, wy, (short)0, 0 );
+ focusedWindow.sendMouseEvent(MouseEvent.EVENT_MOUSE_MOVED, 0, wx, wy, (short)0, 0 );
}
-
+
if(old_buttonDown != buttonDown) {
// press/release
if( 0 != buttonDown ) {
- focusedWindow.sendMouseEvent(MouseEvent.EVENT_MOUSE_PRESSED, 0, wx, wy, buttonDown, 0 );
+ focusedWindow.sendMouseEvent(MouseEvent.EVENT_MOUSE_PRESSED, 0, wx, wy, buttonDown, 0 );
} else {
- focusedWindow.sendMouseEvent(MouseEvent.EVENT_MOUSE_RELEASED, 0, wx, wy, old_buttonDown, 0 );
+ focusedWindow.sendMouseEvent(MouseEvent.EVENT_MOUSE_RELEASED, 0, wx, wy, old_buttonDown, 0 );
}
- }
+ }
} else {
if(Window.DEBUG_MOUSE_EVENT) {
System.out.println(x+"/"+y+", hs="+hs+",vs="+vs+",lb="+lb+",rb="+rb+",mb="+mb+",xo="+xo+",yo="+yo+"xd="+xd+",yd="+yd);
}
}
-
+
old_x = x;
old_y = y;
old_buttonDown = buttonDown;
-
+
}
if(null != fis) {
try {
@@ -214,5 +214,5 @@ public class LinuxMouseTracker implements WindowListener {
}
}
}
- }
+ }
}
diff --git a/src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java
index a99bc4f23..2dbdfdce7 100644
--- a/src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2012 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt.driver.macosx;
@@ -60,19 +60,19 @@ public class DisplayDriver extends DisplayImpl {
public static void initSingleton() {
// just exist to ensure static init has been run
}
-
+
public DisplayDriver() {
}
protected void dispatchMessagesNative() {
// nop
}
-
+
protected void createNativeImpl() {
aDevice = new MacOSXGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT);
}
- protected void closeNativeImpl(AbstractGraphicsDevice aDevice) {
+ protected void closeNativeImpl(AbstractGraphicsDevice aDevice) {
aDevice.close();
}
diff --git a/src/newt/classes/jogamp/newt/driver/macosx/MacKeyUtil.java b/src/newt/classes/jogamp/newt/driver/macosx/MacKeyUtil.java
index baa94facd..a89150d7c 100644
--- a/src/newt/classes/jogamp/newt/driver/macosx/MacKeyUtil.java
+++ b/src/newt/classes/jogamp/newt/driver/macosx/MacKeyUtil.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -30,7 +30,7 @@ package jogamp.newt.driver.macosx;
import com.jogamp.newt.event.KeyEvent;
public class MacKeyUtil {
-
+
//
// KeyCodes (Layout Dependent)
//
@@ -64,17 +64,17 @@ public class MacKeyUtil {
private static final short kVK_ANSI_8 = 0x1C;
private static final short kVK_ANSI_0 = 0x1D;
private static final short kVK_ANSI_RightBracket = 0x1E;
- private static final short kVK_ANSI_O = 0x1F;
+ private static final short kVK_ANSI_O = 0x1F;
private static final short kVK_ANSI_U = 0x20;
private static final short kVK_ANSI_LeftBracket = 0x21;
private static final short kVK_ANSI_I = 0x22;
private static final short kVK_ANSI_P = 0x23;
private static final short kVK_ANSI_L = 0x25;
private static final short kVK_ANSI_J = 0x26;
- private static final short kVK_ANSI_Quote = 0x27;
+ private static final short kVK_ANSI_Quote = 0x27;
private static final short kVK_ANSI_K = 0x28;
private static final short kVK_ANSI_Semicolon = 0x29;
- private static final short kVK_ANSI_Backslash = 0x2A;
+ private static final short kVK_ANSI_Backslash = 0x2A;
private static final short kVK_ANSI_Comma = 0x2B;
private static final short kVK_ANSI_Slash = 0x2C;
private static final short kVK_ANSI_N = 0x2D;
@@ -99,7 +99,7 @@ public class MacKeyUtil {
private static final short kVK_ANSI_Keypad7 = 0x59;
private static final short kVK_ANSI_Keypad8 = 0x5B;
private static final short kVK_ANSI_Keypad9 = 0x5C;
-
+
//
// KeyCodes (Layout Independent)
//
@@ -150,7 +150,7 @@ public class MacKeyUtil {
private static final short kVK_RightArrow = 0x7C;
private static final short kVK_DownArrow = 0x7D;
private static final short kVK_UpArrow = 0x7E;
-
+
//
// Key constants handled differently on Mac OS X than other platforms
//
@@ -230,8 +230,8 @@ public class MacKeyUtil {
private static final char NSHelpFunctionKey = 0xF746;
private static final char NSModeSwitchFunctionKey = 0xF747;
*/
-
- static short validateKeyCode(short keyCode, char keyChar) {
+
+ static short validateKeyCode(short keyCode, char keyChar) {
// OS X Virtual Keycodes
switch(keyCode) {
//
@@ -267,17 +267,17 @@ public class MacKeyUtil {
case kVK_ANSI_8: return KeyEvent.VK_8;
case kVK_ANSI_0: return KeyEvent.VK_0;
case kVK_ANSI_RightBracket: return KeyEvent.VK_CLOSE_BRACKET;
- case kVK_ANSI_O: return KeyEvent.VK_O;
+ case kVK_ANSI_O: return KeyEvent.VK_O;
case kVK_ANSI_U: return KeyEvent.VK_U;
case kVK_ANSI_LeftBracket: return KeyEvent.VK_OPEN_BRACKET;
case kVK_ANSI_I: return KeyEvent.VK_I;
case kVK_ANSI_P: return KeyEvent.VK_P;
case kVK_ANSI_L: return KeyEvent.VK_L;
case kVK_ANSI_J: return KeyEvent.VK_J;
- case kVK_ANSI_Quote: return KeyEvent.VK_QUOTE;
+ case kVK_ANSI_Quote: return KeyEvent.VK_QUOTE;
case kVK_ANSI_K: return KeyEvent.VK_K;
case kVK_ANSI_Semicolon: return KeyEvent.VK_SEMICOLON;
- case kVK_ANSI_Backslash: return KeyEvent.VK_BACK_SLASH;
+ case kVK_ANSI_Backslash: return KeyEvent.VK_BACK_SLASH;
case kVK_ANSI_Comma: return KeyEvent.VK_COMMA;
case kVK_ANSI_Slash: return KeyEvent.VK_SLASH;
case kVK_ANSI_N: return KeyEvent.VK_N;
@@ -302,7 +302,7 @@ public class MacKeyUtil {
case kVK_ANSI_Keypad7: return KeyEvent.VK_7;
case kVK_ANSI_Keypad8: return KeyEvent.VK_8;
case kVK_ANSI_Keypad9: return KeyEvent.VK_9;
-
+
//
// KeyCodes (Layout Independent)
//
@@ -321,7 +321,7 @@ public class MacKeyUtil {
case kVK_RightControl: return KeyEvent.VK_CONTROL;
// case kVK_Function: return KeyEvent.VK_F;
case kVK_F17: return KeyEvent.VK_F17;
- // case kVK_VolumeUp:
+ // case kVK_VolumeUp:
// case kVK_VolumeDown:
// case kVK_Mute:
case kVK_F18: return KeyEvent.VK_F18;
@@ -354,7 +354,7 @@ public class MacKeyUtil {
case kVK_DownArrow: return KeyEvent.VK_DOWN;
case kVK_UpArrow: return KeyEvent.VK_UP;
}
-
+
switch (keyChar) {
case NSUpArrowFunctionKey: return KeyEvent.VK_UP;
case NSDownArrowFunctionKey: return KeyEvent.VK_DOWN;
@@ -422,5 +422,5 @@ public class MacKeyUtil {
}
return (short) keyChar; // let's hope for the best (compatibility of keyChar/keyCode's)
- }
+ }
}
diff --git a/src/newt/classes/jogamp/newt/driver/macosx/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/macosx/ScreenDriver.java
index a3bb26731..5d3b7287b 100644
--- a/src/newt/classes/jogamp/newt/driver/macosx/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/macosx/ScreenDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2011 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt.driver.macosx;
@@ -44,7 +44,7 @@ import com.jogamp.newt.MonitorDevice;
import com.jogamp.newt.MonitorMode;
public class ScreenDriver extends ScreenImpl {
-
+
static {
DisplayDriver.initSingleton();
}
@@ -68,7 +68,7 @@ public class ScreenDriver extends ScreenImpl {
}
return res;
}
-
+
@Override
protected final void collectNativeMonitorModesAndDevicesImpl(MonitorModeProps.Cache cache) {
int crtIdx = 0;
@@ -85,16 +85,16 @@ public class ScreenDriver extends ScreenImpl {
final MonitorMode currentMode = getMonitorModeImpl(cache, crtIdx, -1);
if ( null == currentMode ) {
throw new InternalError("Could not gather current mode of device "+crtIdx+", but gathered "+modeIdx+" modes");
- }
+ }
final int[] monitorProps = getMonitorProps0(crtIdx);
if ( null == monitorProps ) {
throw new InternalError("Could not gather device "+crtIdx+", but gathered "+modeIdx+" modes");
- }
+ }
// merge monitor-props + supported modes
MonitorModeProps.streamInMonitorDevice(null, cache, this, supportedModes, currentMode, monitorProps, 0);
-
+
// next monitor, 1st mode
- supportedModes= new ArrayHashSet();
+ supportedModes= new ArrayHashSet();
crtIdx++;
modeIdx=0;
} else {
@@ -108,16 +108,16 @@ public class ScreenDriver extends ScreenImpl {
protected MonitorMode queryCurrentMonitorModeImpl(MonitorDevice monitor) {
return getMonitorModeImpl(null, monitor.getId(), -1);
}
-
+
@Override
protected boolean setCurrentMonitorModeImpl(MonitorDevice monitor, MonitorMode mode) {
return setMonitorMode0(monitor.getId(), mode.getId(), mode.getRotation());
}
-
+
protected int validateScreenIndex(int idx) {
- return 0; // big-desktop w/ multiple monitor attached, only one screen available
+ return 0; // big-desktop w/ multiple monitor attached, only one screen available
}
-
+
private native int[] getMonitorProps0(int crt_idx);
private native int[] getMonitorMode0(int crt_index, int mode_idx);
private native boolean setMonitorMode0(int crt_index, int nativeId, int rot);
diff --git a/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java
index 08638d868..f36d32772 100644
--- a/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt.driver.macosx;
@@ -53,14 +53,14 @@ import com.jogamp.newt.event.InputEvent;
import com.jogamp.newt.event.KeyEvent;
public class WindowDriver extends WindowImpl implements MutableSurface, DriverClearFocus, DriverUpdatePosition {
-
+
static {
DisplayDriver.initSingleton();
}
public WindowDriver() {
}
-
+
@Override
protected void createNativeImpl() {
final AbstractGraphicsConfiguration cfg = GraphicsConfigurationFactory.getFactory(getScreen().getDisplay().getGraphicsDevice(), capsRequested).chooseGraphicsConfiguration(
@@ -69,7 +69,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
throw new NativeWindowException("Error choosing GraphicsConfiguration creating window: "+this);
}
setGraphicsConfiguration(cfg);
- reconfigureWindowImpl(getX(), getY(), getWidth(), getHeight(), getReconfigureFlags(FLAG_CHANGE_VISIBILITY, true));
+ reconfigureWindowImpl(getX(), getY(), getWidth(), getHeight(), getReconfigureFlags(FLAG_CHANGE_VISIBILITY, true));
if (0 == getWindowHandle()) {
throw new NativeWindowException("Error creating window");
}
@@ -79,7 +79,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
protected void closeNativeImpl() {
try {
if(DEBUG_IMPLEMENTATION) { System.err.println("MacWindow.CloseAction "+Thread.currentThread().getName()); }
- final long handle = getWindowHandle();
+ final long handle = getWindowHandle();
visibleChanged(true, false);
setWindowHandle(0);
surfaceHandle = 0;
@@ -92,16 +92,16 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
} } );
}
} catch (Throwable t) {
- if(DEBUG_IMPLEMENTATION) {
+ if(DEBUG_IMPLEMENTATION) {
Exception e = new Exception("Warning: closeNative failed - "+Thread.currentThread().getName(), t);
e.printStackTrace();
}
}
}
-
+
@Override
protected int lockSurfaceImpl() {
- /**
+ /**
* if( isOffscreenInstance ) {
* return LOCK_SUCCESS;
* }
@@ -116,7 +116,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
@Override
protected void unlockSurfaceImpl() {
- /**
+ /**
* if( isOffscreenInstance ) {
* return;
* }
@@ -129,7 +129,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
}
}
}
-
+
@Override
public final long getSurfaceHandle() {
return 0 != sscSurfaceHandle ? sscSurfaceHandle : surfaceHandle;
@@ -147,14 +147,14 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
public void run() {
orderOut0( 0 != getParentWindowHandle() ? getParentWindowHandle() : getWindowHandle() );
} } );
- } /** this is done by recreation!
+ } /** this is done by recreation!
else if (isVisible()){
OSXUtil.RunOnMainThread(false, new Runnable() {
public void run() {
orderFront0( 0!=getParentWindowHandle() ? getParentWindowHandle() : getWindowHandle() );
} } );
} */
- }
+ }
}
@Override
@@ -179,7 +179,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
focusChanged(false, true);
}
}
-
+
@Override
public final void clearFocus() {
if(DEBUG_IMPLEMENTATION) {
@@ -194,9 +194,9 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
focusChanged(false, false);
}
}
-
+
private boolean useParent(NativeWindow parent) { return null != parent && 0 != parent.getWindowHandle(); }
-
+
@Override
public void updatePosition(int x, int y) {
final long handle = getWindowHandle();
@@ -215,8 +215,8 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
// no native event (fullscreen, some reparenting)
positionChanged(true, x, y);
}
- }
-
+ }
+
@Override
protected void sizeChanged(boolean defer, int newWidth, int newHeight, boolean force) {
final long handle = getWindowHandle();
@@ -237,7 +237,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
}
super.sizeChanged(defer, newWidth, newHeight, force);
}
-
+
@Override
protected boolean reconfigureWindowImpl(final int x, final int y, final int width, final int height, int flags) {
final boolean _isOffscreenInstance = isOffscreenInstance(this, this.getParent());
@@ -250,11 +250,11 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
final boolean useParent = useParent(parent);
if( useParent ) {
pClientLevelOnSreen = getLocationOnScreenImpl(x, y, parent, useParent);
- } else {
+ } else {
pClientLevelOnSreen = new Point(x, y);
}
}
-
+
if(DEBUG_IMPLEMENTATION) {
final AbstractGraphicsConfiguration cWinCfg = this.getGraphicsConfiguration();
final NativeWindow pWin = getParent();
@@ -269,9 +269,9 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
"\n\t, "+getReconfigureFlagsAsString(null, flags));
// Thread.dumpStack();
}
-
+
final boolean setVisible = 0 != ( FLAG_IS_VISIBLE & flags);
-
+
if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) && !setVisible ) {
if ( !isOffscreenInstance ) {
OSXUtil.RunOnMainThread(false, new Runnable() {
@@ -290,11 +290,11 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
if(isOffscreenInstance) {
createWindow(true, 0 != getWindowHandle(), pClientLevelOnSreen, 64, 64, false, setVisible, false);
} else {
- createWindow(false, 0 != getWindowHandle(), pClientLevelOnSreen, width, height,
+ createWindow(false, 0 != getWindowHandle(), pClientLevelOnSreen, width, height,
0 != ( FLAG_IS_FULLSCREEN & flags), setVisible, 0 != ( FLAG_IS_ALWAYSONTOP & flags));
}
} else {
- if( width>0 && height>0 ) {
+ if( width>0 && height>0 ) {
if( !isOffscreenInstance ) {
OSXUtil.RunOnMainThread(false, new Runnable() {
public void run() {
@@ -306,7 +306,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
sizeChanged(true, width, height, false);
}
if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) && setVisible ) {
- if( !isOffscreenInstance ) {
+ if( !isOffscreenInstance ) {
OSXUtil.RunOnMainThread(false, new Runnable() {
public void run() {
orderFront0(getWindowHandle());
@@ -321,7 +321,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
}
}
if(DEBUG_IMPLEMENTATION) {
- System.err.println("MacWindow reconfig.X: clientPos "+pClientLevelOnSreen+", "+width+"x"+height+" -> clientPos "+getLocationOnScreenImpl(0, 0)+", insets: "+getInsets());
+ System.err.println("MacWindow reconfig.X: clientPos "+pClientLevelOnSreen+", "+width+"x"+height+" -> clientPos "+getLocationOnScreenImpl(0, 0)+", insets: "+getInsets());
}
return true;
}
@@ -332,28 +332,28 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
final boolean useParent = useParent(parent);
return getLocationOnScreenImpl(x, y, parent, useParent);
}
-
+
private Point getLocationOnScreenImpl(final int x, final int y, final NativeWindow parent, final boolean useParent) {
if( !useParent && !isOffscreenInstance && 0 != surfaceHandle) {
return OSXUtil.GetLocationOnScreen(surfaceHandle, true, x, y);
}
-
+
final Point p = new Point(x, y);
if( useParent ) {
p.translate( parent.getLocationOnScreen(null) );
}
return p;
}
-
+
@Override
protected void updateInsetsImpl(Insets insets) {
// nop - using event driven insetsChange(..)
}
-
+
/** Callback for native screen position change event of the client area. */
- protected void screenPositionChanged(boolean defer, int newX, int newY) {
+ protected void screenPositionChanged(boolean defer, int newX, int newY) {
// passed coordinates are in screen position of the client area
- if(getWindowHandle()!=0) {
+ if(getWindowHandle()!=0) {
final NativeWindow parent = getParent();
if( null == parent || isOffscreenInstance ) {
if(DEBUG_IMPLEMENTATION) {
@@ -362,7 +362,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
positionChanged(defer, newX, newY);
} else {
// screen position -> rel child window position
- Point absPos = new Point(newX, newY);
+ Point absPos = new Point(newX, newY);
Point parentOnScreen = parent.getLocationOnScreen(null);
absPos.translate( parentOnScreen.scale(-1, -1) );
if(DEBUG_IMPLEMENTATION) {
@@ -374,10 +374,10 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
System.err.println("MacWindow.positionChanged.2 (Screen Pos - IGN): ("+getThreadName()+"): (defer: "+defer+") "+getX()+"/"+getY()+" -> "+newX+"/"+newY);
}
}
-
+
@Override
protected boolean setPointerVisibleImpl(final boolean pointerVisible) {
- if( !isOffscreenInstance ) {
+ if( !isOffscreenInstance ) {
return setPointerVisible0(getWindowHandle(), hasFocus(), pointerVisible);
} // else may need offscreen solution ? FIXME
return false;
@@ -385,29 +385,29 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
@Override
protected boolean confinePointerImpl(final boolean confine) {
- if( !isOffscreenInstance ) {
+ if( !isOffscreenInstance ) {
return confinePointer0(getWindowHandle(), confine);
} // else may need offscreen solution ? FIXME
return false;
}
-
+
@Override
protected void warpPointerImpl(final int x, final int y) {
- if( !isOffscreenInstance ) {
+ if( !isOffscreenInstance ) {
warpPointer0(getWindowHandle(), x, y);
} // else may need offscreen solution ? FIXME
}
-
+
@Override
public final void sendKeyEvent(short eventType, int modifiers, short keyCode, short keySym, char keyChar) {
throw new InternalError("XXX: Adapt Java Code to Native Code Changes");
}
-
+
@Override
public final void enqueueKeyEvent(boolean wait, short eventType, int modifiers, short _keyCode, short _keySym, char keyChar) {
- throw new InternalError("XXX: Adapt Java Code to Native Code Changes");
+ throw new InternalError("XXX: Adapt Java Code to Native Code Changes");
}
-
+
protected final void enqueueKeyEvent(boolean wait, short eventType, int modifiers, short _keyCode, char keyChar, char keySymChar) {
// Note that we send the key char for the key code on this
// platform -- we do not get any useful key codes out of the system
@@ -427,7 +427,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
", was: pressed "+isKeyPressed(keyCode)+", isModifierKeyCode "+isModifierKeyCode+
", nativeValid "+isNativeValid()+", isOffscreen "+isOffscreenInstance);
} */
-
+
// OSX delivery order is PRESSED (t0), RELEASED (t1) and TYPED (t2) -> NEWT order: PRESSED (t0) and RELEASED (t1)
// Auto-Repeat: OSX delivers only PRESSED, inject auto-repeat RELEASE key _before_ PRESSED
switch(eventType) {
@@ -451,15 +451,15 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
//----------------------------------------------------------------------
// Internals only
- //
-
- private void createWindow(final boolean offscreenInstance, final boolean recreate,
- final PointImmutable pS, final int width, final int height,
+ //
+
+ private void createWindow(final boolean offscreenInstance, final boolean recreate,
+ final PointImmutable pS, final int width, final int height,
final boolean fullscreen, final boolean visible, final boolean alwaysOnTop) {
final long parentWinHandle = getParentWindowHandle();
final long preWinHandle = getWindowHandle();
-
+
if(DEBUG_IMPLEMENTATION) {
System.err.println("MacWindow.createWindow on thread "+Thread.currentThread().getName()+
": offscreen "+offscreenInstance+", recreate "+recreate+
@@ -474,7 +474,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
setWindowHandle(0);
if( 0 == surfaceHandle ) {
throw new NativeWindowException("Internal Error - create w/ window, but no Newt NSView");
- }
+ }
OSXUtil.RunOnMainThread(false, new Runnable() {
public void run() {
changeContentView0(parentWinHandle, preWinHandle, 0);
@@ -483,14 +483,14 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
} else {
if( 0 != surfaceHandle ) {
throw new NativeWindowException("Internal Error - create w/o window, but has Newt NSView");
- }
+ }
surfaceHandle = createView0(pS.getX(), pS.getY(), width, height, fullscreen);
if( 0 == surfaceHandle ) {
throw new NativeWindowException("Could not create native view "+Thread.currentThread().getName()+" "+this);
}
}
-
- final long newWin = createWindow0( pS.getX(), pS.getY(), width, height, fullscreen,
+
+ final long newWin = createWindow0( pS.getX(), pS.getY(), width, height, fullscreen,
( isUndecorated() || offscreenInstance ) ? NSBorderlessWindowMask :
NSTitledWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask|NSResizableWindowMask,
NSBackingStoreBuffered, surfaceHandle);
@@ -498,9 +498,9 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
throw new NativeWindowException("Could not create native window "+Thread.currentThread().getName()+" "+this);
}
setWindowHandle( newWin );
-
+
final boolean isOpaque = getGraphicsConfiguration().getChosenCapabilities().isBackgroundOpaque() && !offscreenInstance;
- // Blocking initialization on main-thread!
+ // Blocking initialization on main-thread!
OSXUtil.RunOnMainThread(true, new Runnable() {
public void run() {
initWindow0( parentWinHandle, newWin, pS.getX(), pS.getY(), width, height,
@@ -517,7 +517,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
ie.printStackTrace();
}
}
-
+
protected static native boolean initIDs0();
private native long createView0(int x, int y, int w, int h, boolean fullscreen);
private native long createWindow0(int x, int y, int w, int h, boolean fullscreen, int windowStyle, int backingStoreType, long view);
@@ -543,7 +543,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
private native void changeContentView0(long parentWindowOrView, long window, long view);
/** Must be called on Main-Thread */
private native void setWindowClientTopLeftPointAndSize0(long window, int x, int y, int w, int h, boolean display);
- /** Must be called on Main-Thread */
+ /** Must be called on Main-Thread */
private native void setWindowClientTopLeftPoint0(long window, int x, int y, boolean display);
/** Must be called on Main-Thread */
private native void setAlwaysOnTop0(long window, boolean atop);
@@ -551,7 +551,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
private static native boolean setPointerVisible0(long windowHandle, boolean hasFocus, boolean visible);
private static native boolean confinePointer0(long windowHandle, boolean confine);
private static native void warpPointer0(long windowHandle, int x, int y);
-
+
// Window styles
private static final int NSBorderlessWindowMask = 0;
private static final int NSTitledWindowMask = 1 << 0;
@@ -567,5 +567,5 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
private volatile long surfaceHandle = 0;
private long sscSurfaceHandle = 0;
private boolean isOffscreenInstance = false;
-
+
}
diff --git a/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java
index 595d5e952..d3c7416cc 100644
--- a/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt.driver.windows;
@@ -52,10 +52,10 @@ public class DisplayDriver extends DisplayImpl {
NEWTJNILibLoader.loadNEWT();
sharedClassFactory = new RegisteredClassFactory(newtClassBaseName, WindowDriver.getNewtWndProc0());
-
+
if (!WindowDriver.initIDs0(RegisteredClassFactory.getHInstance())) {
throw new NativeWindowException("Failed to initialize WindowsWindow jmethodIDs");
- }
+ }
}
public static void initSingleton() {
@@ -76,7 +76,7 @@ public class DisplayDriver extends DisplayImpl {
aDevice = new WindowsGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT);
}
- protected void closeNativeImpl(AbstractGraphicsDevice aDevice) {
+ protected void closeNativeImpl(AbstractGraphicsDevice aDevice) {
sharedClassFactory.releaseSharedClass();
aDevice.close();
}
diff --git a/src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.java
index 621091320..e789b995f 100644
--- a/src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt.driver.windows;
@@ -60,7 +60,7 @@ public class ScreenDriver extends ScreenImpl {
protected void createNativeImpl() {
aScreen = new DefaultGraphicsScreen(getDisplay().getGraphicsDevice(), screen_idx);
}
-
+
@Override
protected void closeNativeImpl() {
}
@@ -71,7 +71,7 @@ public class ScreenDriver extends ScreenImpl {
private final String getActiveMonitorName(String adapterName, int monitor_idx) {
return getActiveMonitorName0(adapterName, monitor_idx);
}
-
+
private final MonitorMode getMonitorModeImpl(MonitorModeProps.Cache cache, String adapterName, int crtModeIdx) {
if( null == adapterName ) {
return null;
@@ -107,7 +107,7 @@ public class ScreenDriver extends ScreenImpl {
final int[] monitorProps = getMonitorDevice0(adapterName, crtIdx);
// merge monitor-props + supported modes
MonitorModeProps.streamInMonitorDevice(null, cache, this, supportedModes, currentMode, monitorProps, 0);
-
+
// next monitor, 1st mode
supportedModes= new ArrayHashSet();
}
@@ -116,7 +116,7 @@ public class ScreenDriver extends ScreenImpl {
adapterName = getAdapterName(crtIdx);
}
}
-
+
@Override
protected Rectangle getNativeMonitorDeviceViewportImpl(MonitorDevice monitor) {
final String adapterName = getAdapterName(monitor.getId());
@@ -135,7 +135,7 @@ public class ScreenDriver extends ScreenImpl {
protected MonitorMode queryCurrentMonitorModeImpl(MonitorDevice monitor) {
return getMonitorModeImpl(null, getAdapterName(monitor.getId()), -1);
}
-
+
@Override
protected boolean setCurrentMonitorModeImpl(MonitorDevice monitor, MonitorMode mode) {
return setMonitorMode0(monitor.getId(),
@@ -150,14 +150,14 @@ public class ScreenDriver extends ScreenImpl {
@Override
protected int validateScreenIndex(int idx) {
- return 0; // big-desktop w/ multiple monitor attached, only one screen available
+ return 0; // big-desktop w/ multiple monitor attached, only one screen available
}
-
+
@Override
protected void calcVirtualScreenOriginAndSize(Rectangle vOriginSize) {
vOriginSize.set(getVirtualOriginX0(), getVirtualOriginY0(), getVirtualWidthImpl0(), getVirtualHeightImpl0());
}
-
+
// Native calls
private native int getVirtualOriginX0();
private native int getVirtualOriginY0();
diff --git a/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java
index b2e175415..30405aa05 100644
--- a/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt.driver.windows;
@@ -74,26 +74,26 @@ public class WindowDriver extends WindowImpl {
}
final long hWnd = getWindowHandle();
hdc = GDI.GetDC(hWnd);
-
+
// return ( 0 == hdc ) ? LOCK_SURFACE_NOT_READY : ( hdc_old != hdc ) ? LOCK_SURFACE_CHANGED : LOCK_SUCCESS ;
- if( 0 == hdc ) {
+ if( 0 == hdc ) {
return LOCK_SURFACE_NOT_READY;
- }
+ }
hmon = MonitorFromWindow0(hWnd);
-
+
// Let's not trigger on HDC change, GLDrawableImpl.'s destroy/create is a nop here anyways.
// FIXME: Validate against EGL surface creation: ANGLE uses HWND -> fine!
- return LOCK_SUCCESS;
-
+ return LOCK_SUCCESS;
+
/**
if( hdc_old == hdc ) {
return LOCK_SUCCESS;
}
- if(DEBUG_IMPLEMENTATION) {
+ if(DEBUG_IMPLEMENTATION) {
System.err.println("WindowsWindow: surface change "+toHexString(hdc_old)+" -> "+toHexString(hdc));
// Thread.dumpStack();
}
- return LOCK_SURFACE_CHANGED; */
+ return LOCK_SURFACE_CHANGED; */
}
@Override
@@ -137,24 +137,24 @@ public class WindowDriver extends WindowImpl {
}
setGraphicsConfiguration(cfg);
final VersionNumber winVer = Platform.getOSVersionNumber();
- final int flags = getReconfigureFlags(0, true) &
+ final int flags = getReconfigureFlags(0, true) &
( FLAG_IS_ALWAYSONTOP | FLAG_IS_UNDECORATED ) ;
final long _windowHandle = CreateWindow0(DisplayDriver.getHInstance(), display.getWindowClassName(), display.getWindowClassName(),
winVer.getMajor(), winVer.getMinor(),
- getParentWindowHandle(), getX(), getY(), getWidth(), getHeight(), autoPosition(), flags);
+ getParentWindowHandle(), getX(), getY(), getWidth(), getHeight(), autoPosition(), flags);
if ( 0 == _windowHandle ) {
throw new NativeWindowException("Error creating window");
}
setWindowHandle(_windowHandle);
windowHandleClose = _windowHandle;
-
+
if(DEBUG_IMPLEMENTATION) {
Exception e = new Exception("Info: Window new window handle "+Thread.currentThread().getName()+
" (Parent HWND "+toHexString(getParentWindowHandle())+
") : HWND "+toHexString(_windowHandle)+", "+Thread.currentThread());
e.printStackTrace();
}
- }
+ }
protected void closeNativeImpl() {
if(windowHandleClose != 0) {
@@ -162,7 +162,7 @@ public class WindowDriver extends WindowImpl {
try {
GDI.ReleaseDC(windowHandleClose, hdc);
} catch (Throwable t) {
- if(DEBUG_IMPLEMENTATION) {
+ if(DEBUG_IMPLEMENTATION) {
Exception e = new Exception("Warning: closeNativeImpl failed - "+Thread.currentThread().getName(), t);
e.printStackTrace();
}
@@ -188,14 +188,14 @@ public class WindowDriver extends WindowImpl {
System.err.println("WindowsWindow reconfig: "+x+"/"+y+" "+width+"x"+height+", "+
getReconfigureFlagsAsString(null, flags));
}
-
+
if(0 == ( FLAG_IS_UNDECORATED & flags)) {
final InsetsImmutable i = getInsets();
-
+
// client position -> top-level window position
x -= i.getLeftWidth() ;
y -= i.getTopHeight() ;
-
+
if(0 top-level window size
width += i.getTotalWidth();
@@ -203,9 +203,9 @@ public class WindowDriver extends WindowImpl {
}
}
reconfigureWindow0( getParentWindowHandle(), getWindowHandle(), x, y, width, height, flags);
-
+
if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) {
- visibleChanged(false, 0 != ( FLAG_IS_VISIBLE & flags));
+ visibleChanged(false, 0 != ( FLAG_IS_VISIBLE & flags));
}
return true;
}
@@ -222,7 +222,7 @@ public class WindowDriver extends WindowImpl {
@Override
protected boolean setPointerVisibleImpl(final boolean pointerVisible) {
final boolean[] res = new boolean[] { false };
-
+
this.runOnEDTIfAvail(true, new Runnable() {
public void run() {
res[0] = setPointerVisible0(getWindowHandle(), pointerVisible);
@@ -234,19 +234,19 @@ public class WindowDriver extends WindowImpl {
@Override
protected boolean confinePointerImpl(final boolean confine) {
final Boolean[] res = new Boolean[] { Boolean.FALSE };
-
+
this.runOnEDTIfAvail(true, new Runnable() {
public void run() {
final Point p0 = getLocationOnScreenImpl(0, 0);
- res[0] = Boolean.valueOf(confinePointer0(getWindowHandle(), confine,
+ res[0] = Boolean.valueOf(confinePointer0(getWindowHandle(), confine,
p0.getX(), p0.getY(), p0.getX()+getWidth(), p0.getY()+getHeight()));
}
});
return res[0].booleanValue();
}
-
+
@Override
- protected void warpPointerImpl(final int x, final int y) {
+ protected void warpPointerImpl(final int x, final int y) {
this.runOnEDTIfAvail(true, new Runnable() {
public void run() {
final Point sPos = getLocationOnScreenImpl(x, y);
@@ -255,44 +255,44 @@ public class WindowDriver extends WindowImpl {
});
return;
}
-
+
protected Point getLocationOnScreenImpl(int x, int y) {
return GDIUtil.GetRelativeLocation( getWindowHandle(), 0 /*root win*/, x, y);
}
protected void updateInsetsImpl(Insets insets) {
- // nop - using event driven insetsChange(..)
+ // nop - using event driven insetsChange(..)
}
-
+
//
// PointerEvent Handling
//
/**
* Send multiple-pointer {@link MouseEvent.PointerType#TouchScreen} event to be directly consumed
*
- * Assumes non normal pointer names and rotation/scroll will be determined by a gesture handler.
+ * Assumes non normal pointer names and rotation/scroll will be determined by a gesture handler.
*
*/
- public final void sendTouchScreenEvent(short eventType, int modifiers,
+ public final void sendTouchScreenEvent(short eventType, int modifiers,
int pActionIdx, int[] pNames,
int[] pX, int[] pY, float[] pPressure, float maxPressure) {
final int pCount = pNames.length;
final MouseEvent.PointerType[] pTypes = new MouseEvent.PointerType[pCount];
for(int i=pCount-1; i>=0; i--) { pTypes[i] = PointerType.TouchScreen; }
- doPointerEvent(false /*enqueue*/, false /*wait*/,
- pTypes, eventType, modifiers, pActionIdx, false /*normalPNames*/, pNames,
+ doPointerEvent(false /*enqueue*/, false /*wait*/,
+ pTypes, eventType, modifiers, pActionIdx, false /*normalPNames*/, pNames,
pX, pY, pPressure, maxPressure, new float[] { 0f, 0f, 0f} /*rotationXYZ*/, 1f/*rotationScale*/);
}
-
+
//
// KeyEvent Handling
//
private short repeatedKey = KeyEvent.VK_UNDEFINED;
-
+
private final boolean handlePressTypedAutoRepeat(boolean isModifierKey, int modifiers, short keyCode, short keySym, char keyChar) {
if( setKeyPressed(keyCode, true) ) {
// AR: Key was already pressed: Either [enter | within] AR mode
@@ -308,18 +308,18 @@ public class WindowDriver extends WindowImpl {
super.sendKeyEvent(KeyEvent.EVENT_KEY_RELEASED, modifiers, keyCode, keySym, keyChar);
}
return true;
- }
+ }
return false;
}
-
+
@Override
public final void sendKeyEvent(short eventType, int modifiers, short keyCode, short keySym, char keyChar) {
final boolean isModifierKey = KeyEvent.isModifierKey(keySym);
// System.err.println("*** sendKeyEvent: event "+KeyEvent.getEventTypeString(eventType)+", keyCode "+toHexString(keyCode)+", keyChar <"+keyChar+">, mods "+toHexString(modifiers)+
// ", isKeyCodeTracked "+isKeyCodeTracked(keyCode)+", was: pressed "+isKeyPressed(keyCode)+", printableKey "+KeyEvent.isPrintableKey(keyCode, false)+" [modifierKey "+isModifierKey+"] - "+System.currentTimeMillis());
-
+
// Reorder: WINDOWS delivery order is PRESSED (t0), TYPED (t0) and RELEASED (t1) -> NEWT order: PRESSED (t0) and RELEASED (t1)
- // Auto-Repeat: WINDOWS delivers only PRESSED (t0) and TYPED (t0).
+ // Auto-Repeat: WINDOWS delivers only PRESSED (t0) and TYPED (t0).
switch(eventType) {
case KeyEvent.EVENT_KEY_RELEASED:
if( isKeyCodeTracked(keyCode) ) {
@@ -339,12 +339,12 @@ public class WindowDriver extends WindowImpl {
break;
}
}
-
+
@Override
public final void enqueueKeyEvent(boolean wait, short eventType, int modifiers, short keyCode, short keySym, char keyChar) {
throw new InternalError("XXX: Adapt Java Code to Native Code Changes");
}
-
+
//----------------------------------------------------------------------
// Internals only
//
@@ -361,5 +361,5 @@ public class WindowDriver extends WindowImpl {
private static native boolean setPointerVisible0(long windowHandle, boolean visible);
private static native boolean confinePointer0(long windowHandle, boolean grab, int l, int t, int r, int b);
- private static native void warpPointer0(long windowHandle, int x, int y);
+ private static native void warpPointer0(long windowHandle, int x, int y);
}
diff --git a/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java
index d911483b0..aa8067520 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt.driver.x11;
@@ -83,7 +83,7 @@ public class DisplayDriver extends DisplayImpl {
CompleteDisplay0(aDevice.getHandle());
} catch(RuntimeException e) {
closeNativeImpl(aDevice);
- throw e;
+ throw e;
}
}
@@ -114,14 +114,14 @@ public class DisplayDriver extends DisplayImpl {
protected long getJavaObjectAtom() { return javaObjectAtom; }
protected long getWindowDeleteAtom() { return windowDeleteAtom; }
// protected long getKbdHandle() { return kbdHandle; } // XKB disabled for now
-
- /** Returns null if !{@link #isNativeValid()}, otherwise the Boolean value of {@link X11GraphicsDevice#isXineramaEnabled()}. */
+
+ /** Returns null if !{@link #isNativeValid()}, otherwise the Boolean value of {@link X11GraphicsDevice#isXineramaEnabled()}. */
protected Boolean isXineramaEnabled() { return isNativeValid() ? Boolean.valueOf(((X11GraphicsDevice)aDevice).isXineramaEnabled()) : null; }
-
+
//----------------------------------------------------------------------
// Internals only
//
-
+
private static native boolean initIDs0(boolean debug);
private native void CompleteDisplay0(long handle);
@@ -137,10 +137,10 @@ public class DisplayDriver extends DisplayImpl {
/** X11 Window delete atom marker used on EDT */
private long windowDeleteAtom;
-
+
/** X11 Window java object property used on EDT */
- private long javaObjectAtom;
-
+ private long javaObjectAtom;
+
/** X11 Keyboard handle used on EDT */
// private long kbdHandle; // XKB disabled for now
}
diff --git a/src/newt/classes/jogamp/newt/driver/x11/RandR.java b/src/newt/classes/jogamp/newt/driver/x11/RandR.java
index e39a6c63a..8b065d1f0 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/RandR.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/RandR.java
@@ -38,18 +38,18 @@ import com.jogamp.newt.MonitorDevice;
import com.jogamp.newt.MonitorMode;
public interface RandR {
- public static final VersionNumber version110 = new VersionNumber(1, 1, 0);
+ public static final VersionNumber version110 = new VersionNumber(1, 1, 0);
public static final VersionNumber version130 = new VersionNumber(1, 3, 0);
public static final VersionNumber version140 = new VersionNumber(1, 4, 0);
VersionNumber getVersion();
-
+
void dumpInfo(final long dpy, final int screen_idx);
-
+
/**
- * Encapsulate initial device query allowing caching of internal data structures.
+ * Encapsulate initial device query allowing caching of internal data structures.
* Methods covered:
- *
- * Above methods may be called w/o begin/end, in which case no
+ * Above methods may be called w/o begin/end, in which case no
* internal data structures can be cached:
*
* @param dpy TODO
@@ -66,11 +66,11 @@ public interface RandR {
*/
boolean beginInitialQuery(long dpy, ScreenDriver screen);
void endInitialQuery(long dpy, ScreenDriver screen);
-
+
int getMonitorDeviceCount(final long dpy, final ScreenDriver screen);
int[] getAvailableRotations(final long dpy, final ScreenDriver screen, final int crt_idx);
/**
- *
+ *
* @param dpy
* @param screen
* @param mode_idx w/o indexing rotation
@@ -80,7 +80,7 @@ public interface RandR {
int[] getMonitorDeviceProps(final long dpy, final ScreenDriver screen, MonitorModeProps.Cache cache, final int crt_idx);
int[] getMonitorDeviceViewport(final long dpy, final ScreenDriver screen, final int crt_idx);
int[] getCurrentMonitorModeProps(final long dpy, final ScreenDriver screen, final int crt_idx);
- boolean setCurrentMonitorMode(final long dpy, final ScreenDriver screen, MonitorDevice monitor, final MonitorMode mode);
-
- public void updateScreenViewport(final long dpy, final ScreenDriver screen, RectangleImmutable viewport);
+ boolean setCurrentMonitorMode(final long dpy, final ScreenDriver screen, MonitorDevice monitor, final MonitorMode mode);
+
+ public void updateScreenViewport(final long dpy, final ScreenDriver screen, RectangleImmutable viewport);
}
diff --git a/src/newt/classes/jogamp/newt/driver/x11/RandR11.java b/src/newt/classes/jogamp/newt/driver/x11/RandR11.java
index 877607f72..6c22a3fc6 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/RandR11.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/RandR11.java
@@ -38,8 +38,8 @@ import com.jogamp.newt.MonitorMode;
class RandR11 implements RandR {
private static final boolean DEBUG = ScreenDriver.DEBUG;
-
- RandR11() {
+
+ RandR11() {
}
@Override
@@ -51,13 +51,13 @@ class RandR11 implements RandR {
public void dumpInfo(final long dpy, final int screen_idx) {
// NOP
}
-
+
private int widthMM=0, heightMM=0;
private int modeCount = 0;
private int resolutionCount = 0;
private int[][] nrates = null; // [nres_number][nrate_number]
private int[] idx_rate = null, idx_res = null;
-
+
@Override
public boolean beginInitialQuery(long dpy, ScreenDriver screen) {
// initialize iterators and static data
@@ -76,11 +76,11 @@ class RandR11 implements RandR {
return false;
}
}
-
+
for(int nresIdx=0; nresIdx < resolutionCount; nresIdx++) {
modeCount += nrates[nresIdx].length;
}
-
+
idx_rate = new int[modeCount];
idx_res = new int[modeCount];
@@ -94,23 +94,23 @@ class RandR11 implements RandR {
}
return true;
}
-
+
@Override
public void endInitialQuery(long dpy, ScreenDriver screen) {
idx_rate=null;
- idx_res=null;
- nrates=null;
+ idx_res=null;
+ nrates=null;
}
-
+
@Override
public int getMonitorDeviceCount(final long dpy, final ScreenDriver screen) {
return 1;
}
-
+
@Override
public int[] getAvailableRotations(final long dpy, final ScreenDriver screen, final int crt_idx) {
if( 0 < crt_idx ) {
- // RandR11 only supports 1 CRT
+ // RandR11 only supports 1 CRT
return null;
}
final int screen_idx = screen.getIndex();
@@ -120,17 +120,17 @@ class RandR11 implements RandR {
}
return availRotations;
}
-
+
@Override
public int[] getMonitorModeProps(final long dpy, final ScreenDriver screen, final int mode_idx) {
if( mode_idx >= modeCount ) {
return null;
- }
+ }
final int screen_idx = screen.getIndex();
-
+
final int nres_index = idx_res[mode_idx];
final int nrate_index = idx_rate[mode_idx];
-
+
final int[] res = getScreenResolution0(dpy, screen_idx, nres_index);
if(null==res || 0==res.length) {
return null;
@@ -144,7 +144,7 @@ class RandR11 implements RandR {
if( res[3] > heightMM ) {
heightMM = res[3];
}
-
+
int rate = nrates[nres_index][nrate_index];
if(0>=rate) {
rate = ScreenImpl.default_sm_rate;
@@ -166,13 +166,13 @@ class RandR11 implements RandR {
if( MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL != i ) {
throw new InternalError("XX");
}
- return props;
+ return props;
}
-
+
@Override
public int[] getMonitorDeviceProps(final long dpy, final ScreenDriver screen, final MonitorModeProps.Cache cache, final int crt_idx) {
if( 0 < crt_idx ) {
- // RandR11 only supports 1 CRT
+ // RandR11 only supports 1 CRT
return null;
}
final int[] currentModeProps = getCurrentMonitorModeProps(dpy, screen, crt_idx);
@@ -194,15 +194,15 @@ class RandR11 implements RandR {
props[i++] = currentMode.getId(); // current mode id
props[i++] = currentMode.getRotation();
for(int j=0; jresId || resId>=resolutionCount) {
throw new RuntimeException("Invalid resolution index: ! 0 < "+resId+" < "+resolutionCount+", "+monitor+", "+mode);
- }
+ }
final int f = (int)mode.getRefreshRate(); // simply cut-off, orig is int
final int r = mode.getRotation();
@@ -335,11 +335,11 @@ class RandR11 implements RandR {
}
return done;
}
-
+
@Override
public final void updateScreenViewport(final long dpy, final ScreenDriver screen, RectangleImmutable viewport) {
// nop
- }
+ }
/** @return int[] { rot1, .. } */
private static native int[] getAvailableScreenRotations0(long display, int screen_index);
@@ -353,7 +353,7 @@ class RandR11 implements RandR {
private static native long getScreenConfiguration0(long display, int screen_index);
private static native void freeScreenConfiguration0(long screenConfiguration);
-
+
private static native int getCurrentScreenResolutionIndex0(long screenConfiguration);
private static native int getCurrentScreenRate0(long screenConfiguration);
private static native int getCurrentScreenRotation0(long screenConfiguration);
@@ -361,5 +361,5 @@ class RandR11 implements RandR {
/** needs own Display connection for XRANDR event handling */
private static native boolean setCurrentScreenModeStart0(long display, int screen_index, long screenConfiguration, int mode_index, int freq, int rot);
private static native boolean setCurrentScreenModePollEnd0(long display, int screen_index, int mode_index, int freq, int rot);
-
+
}
diff --git a/src/newt/classes/jogamp/newt/driver/x11/RandR13.java b/src/newt/classes/jogamp/newt/driver/x11/RandR13.java
index ac83fc5f2..a08741d9e 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/RandR13.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/RandR13.java
@@ -43,19 +43,19 @@ import com.jogamp.newt.MonitorMode;
*
*/
class RandR13 implements RandR {
private static final boolean DEBUG = ScreenDriver.DEBUG;
-
- RandR13() {
+
+ RandR13() {
}
-
+
@Override
public final VersionNumber getVersion() {
return version130;
}
-
+
@Override
public void dumpInfo(final long dpy, final int screen_idx) {
long screenResources = getScreenResources0(dpy, screen_idx);
@@ -66,12 +66,12 @@ class RandR13 implements RandR {
dumpInfo0(dpy, screen_idx, screenResources);
} finally {
freeScreenResources0(screenResources);
- }
+ }
}
-
+
long sessionScreenResources = 0;
IntLongHashMap crtInfoHandleMap = null;
-
+
@Override
public boolean beginInitialQuery(long dpy, ScreenDriver screen) {
final int screen_idx = screen.getIndex();
@@ -84,7 +84,7 @@ class RandR13 implements RandR {
return false;
}
}
-
+
@Override
public void endInitialQuery(long dpy, ScreenDriver screen) {
if( null != crtInfoHandleMap ) {
@@ -100,7 +100,7 @@ class RandR13 implements RandR {
sessionScreenResources = 0;
}
}
-
+
private final long getScreenResourceHandle(final long dpy, final int screen_idx) {
if( 0 != sessionScreenResources ) {
return sessionScreenResources;
@@ -112,7 +112,7 @@ class RandR13 implements RandR {
freeScreenResources0( screenResourceHandle );
}
}
-
+
private final long getMonitorInfoHandle(final long dpy, final int screen_idx, long screenResources, final int monitor_idx) {
if( null != crtInfoHandleMap ) {
long h = crtInfoHandleMap.get(monitor_idx);
@@ -129,8 +129,8 @@ class RandR13 implements RandR {
if( null == crtInfoHandleMap ) {
freeMonitorInfoHandle0(monitorInfoHandle);
}
- }
-
+ }
+
@Override
public int getMonitorDeviceCount(final long dpy, final ScreenDriver screen) {
final int screen_idx = screen.getIndex();
@@ -141,7 +141,7 @@ class RandR13 implements RandR {
releaseScreenResourceHandle(screenResources);
}
}
-
+
@Override
public int[] getAvailableRotations(final long dpy, final ScreenDriver screen, final int crt_idx) {
final int screen_idx = screen.getIndex();
@@ -152,7 +152,7 @@ class RandR13 implements RandR {
final int[] availRotations = getAvailableRotations0(monitorInfo);
if(null==availRotations || 0==availRotations.length) {
return null;
- }
+ }
return availRotations;
} finally {
releaseMonitorInfoHandle(monitorInfo);
@@ -161,7 +161,7 @@ class RandR13 implements RandR {
releaseScreenResourceHandle(screenResources);
}
}
-
+
@Override
public int[] getMonitorModeProps(final long dpy, final ScreenDriver screen, final int mode_idx) {
final int screen_idx = screen.getIndex();
@@ -172,7 +172,7 @@ class RandR13 implements RandR {
releaseScreenResourceHandle(screenResources);
}
}
-
+
@Override
public int[] getMonitorDeviceProps(final long dpy, final ScreenDriver screen, MonitorModeProps.Cache cache, final int crt_idx) {
final int screen_idx = screen.getIndex();
@@ -188,9 +188,9 @@ class RandR13 implements RandR {
releaseScreenResourceHandle(screenResources);
}
}
-
+
@Override
- public int[] getMonitorDeviceViewport(final long dpy, final ScreenDriver screen, final int crt_idx) {
+ public int[] getMonitorDeviceViewport(final long dpy, final ScreenDriver screen, final int crt_idx) {
final int screen_idx = screen.getIndex();
final long screenResources = getScreenResourceHandle(dpy, screen_idx);
try {
@@ -204,7 +204,7 @@ class RandR13 implements RandR {
releaseScreenResourceHandle(screenResources);
}
}
-
+
@Override
public int[] getCurrentMonitorModeProps(final long dpy, final ScreenDriver screen, final int crt_idx) {
final int screen_idx = screen.getIndex();
@@ -220,7 +220,7 @@ class RandR13 implements RandR {
releaseScreenResourceHandle(screenResources);
}
}
-
+
@Override
public boolean setCurrentMonitorMode(final long dpy, final ScreenDriver screen, MonitorDevice monitor, final MonitorMode mode) {
final int screen_idx = screen.getIndex();
@@ -229,7 +229,7 @@ class RandR13 implements RandR {
try {
final long monitorInfo = getMonitorInfoHandle(dpy, screen_idx, screenResources, monitor.getId());
try {
- res = setMonitorMode0(dpy, screenResources, monitorInfo, monitor.getId(), mode.getId(), mode.getRotation(),
+ res = setMonitorMode0(dpy, screenResources, monitorInfo, monitor.getId(), mode.getId(), mode.getRotation(),
-1, -1); // no fixed position!
} finally {
releaseMonitorInfoHandle(monitorInfo);
@@ -239,36 +239,36 @@ class RandR13 implements RandR {
}
return res;
}
-
+
@Override
public final void updateScreenViewport(final long dpy, final ScreenDriver screen, final RectangleImmutable viewport) {
final int screen_idx = screen.getIndex();
final long screenResources = getScreenResourceHandle(dpy, screen_idx);
try {
- setScreenViewport0(dpy, screen_idx, screenResources, viewport.getX(), viewport.getY(), viewport.getWidth(), viewport.getHeight());
+ setScreenViewport0(dpy, screen_idx, screenResources, viewport.getX(), viewport.getY(), viewport.getWidth(), viewport.getHeight());
} finally {
dumpInfo0(dpy, screen_idx, screenResources);
releaseScreenResourceHandle(screenResources);
}
}
-
+
private static native long getScreenResources0(long display, int screen_index);
private static native void freeScreenResources0(long screenResources);
private static native void dumpInfo0(long display, int screen_index, long screenResources);
-
+
private static native int getMonitorDeviceCount0(long screenResources);
-
+
private static native long getMonitorInfoHandle0(long display, int screen_index, long screenResources, int monitor_index);
private static native void freeMonitorInfoHandle0(long monitorInfoHandle);
-
+
private static native int[] getAvailableRotations0(long monitorInfo);
private static native int[] getMonitorViewport0(long monitorInfo);
private static native int[] getMonitorCurrentMode0(long monitorInfo);
-
+
private static native int[] getMonitorMode0(long screenResources, int mode_index);
private static native int[] getMonitorCurrentMode0(long screenResources, long monitorInfo);
private static native int[] getMonitorDevice0(long display, long screenResources, long monitorInfo, int monitor_idx);
-
+
private static native boolean setMonitorMode0(long display, long screenResources, long monitorInfo, int monitor_idx, int mode_id, int rotation, int x, int y);
private static native boolean setScreenViewport0(long display, int screen_index, long screenResources, int x, int y, int width, int height);
}
diff --git a/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java
index c01d899f8..7f75e03f0 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt.driver.x11;
@@ -54,19 +54,19 @@ import com.jogamp.nativewindow.x11.X11GraphicsScreen;
import com.jogamp.newt.MonitorDevice;
import com.jogamp.newt.MonitorMode;
-public class ScreenDriver extends ScreenImpl {
+public class ScreenDriver extends ScreenImpl {
protected static final boolean DEBUG_TEST_RANDR13_DISABLED;
-
+
static {
Debug.initSingleton();
DEBUG_TEST_RANDR13_DISABLED = Debug.isPropertyDefined("newt.test.Screen.disableRandR13", true);
-
+
DisplayDriver.initSingleton();
}
/** Ensure static init has been run. */
/* pp */static void initSingleton() { }
-
+
public ScreenDriver() {
}
@@ -74,14 +74,14 @@ public class ScreenDriver extends ScreenImpl {
protected void createNativeImpl() {
// validate screen index
Long handle = runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable() {
- public Long run(long dpy) {
+ public Long run(long dpy) {
return new Long(GetScreen0(dpy, screen_idx));
} } );
if (handle.longValue() == 0) {
throw new RuntimeException("Error creating screen: " + screen_idx);
}
- final X11GraphicsDevice x11dev = (X11GraphicsDevice) getDisplay().getGraphicsDevice();
- final long dpy = x11dev.getHandle();
+ final X11GraphicsDevice x11dev = (X11GraphicsDevice) getDisplay().getGraphicsDevice();
+ final long dpy = x11dev.getHandle();
aScreen = new X11GraphicsScreen(x11dev, screen_idx);
{
int v[] = getRandRVersion0(dpy);
@@ -118,7 +118,7 @@ public class ScreenDriver extends ScreenImpl {
if( rAndR.beginInitialQuery(device.getHandle(), this) ) {
try {
final int crtCount = rAndR.getMonitorDeviceCount(device.getHandle(), this);
-
+
// Gather all available rotations
final ArrayHashSet availableRotations = new ArrayHashSet();
for(int i = 0; i < crtCount; i++) {
@@ -129,7 +129,7 @@ public class ScreenDriver extends ScreenImpl {
availableRotations.addAll(rotationList);
}
}
-
+
// collect all modes, while injecting all available rotations
{
int modeIdx = 0;
@@ -147,8 +147,8 @@ public class ScreenDriver extends ScreenImpl {
if( cache.monitorModes.size() > 0 ) {
for(int i = 0; i < crtCount; i++) {
final int[] monitorProps = rAndR.getMonitorDeviceProps(device.getHandle(), this, cache, i);
- if( null != monitorProps &&
- MonitorModeProps.MIN_MONITOR_DEVICE_PROPERTIES <= monitorProps[0] && // Enabled ? I.e. contains active modes ?
+ if( null != monitorProps &&
+ MonitorModeProps.MIN_MONITOR_DEVICE_PROPERTIES <= monitorProps[0] && // Enabled ? I.e. contains active modes ?
MonitorModeProps.MIN_MONITOR_DEVICE_PROPERTIES <= monitorProps.length ) {
MonitorModeProps.streamInMonitorDevice(null, cache, this, monitorProps, 0);
}
@@ -174,11 +174,11 @@ public class ScreenDriver extends ScreenImpl {
device.unlock();
}
}
-
+
@Override
protected MonitorMode queryCurrentMonitorModeImpl(final MonitorDevice monitor) {
if( null == rAndR ) { return null; }
-
+
return runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable() {
public MonitorMode run(long dpy) {
final int[] currentModeProps = rAndR.getCurrentMonitorModeProps(dpy, ScreenDriver.this, monitor.getId());
@@ -189,14 +189,14 @@ public class ScreenDriver extends ScreenImpl {
@Override
protected boolean setCurrentMonitorModeImpl(final MonitorDevice monitor, final MonitorMode mode) {
if( null == rAndR ) { return false; }
-
+
final long t0 = System.currentTimeMillis();
boolean done = runWithOptTempDisplayHandle( new DisplayImpl.DisplayRunnable() {
public Boolean run(long dpy) {
return Boolean.valueOf( rAndR.setCurrentMonitorMode(dpy, ScreenDriver.this, monitor, mode) );
- }
+ }
}).booleanValue();
-
+
if(DEBUG || !done) {
System.err.println("X11Screen.setCurrentMonitorModeImpl: TO ("+SCREEN_MODE_CHANGE_TIMEOUT+") reached: "+
(System.currentTimeMillis()-t0)+"ms; "+monitor.getCurrentMode()+" -> "+mode);
@@ -205,10 +205,10 @@ public class ScreenDriver extends ScreenImpl {
}
private DisplayImpl.DisplayRunnable xineramaEnabledQueryWithTemp = new DisplayImpl.DisplayRunnable() {
- public Boolean run(long dpy) {
- return new Boolean(X11Util.XineramaIsEnabled(dpy));
+ public Boolean run(long dpy) {
+ return new Boolean(X11Util.XineramaIsEnabled(dpy));
} };
-
+
@Override
protected int validateScreenIndex(final int idx) {
final DisplayDriver x11Display = (DisplayDriver) getDisplay();
@@ -219,7 +219,7 @@ public class ScreenDriver extends ScreenImpl {
return runWithTempDisplayHandle( xineramaEnabledQueryWithTemp ).booleanValue() ? 0 : idx;
}
}
-
+
@Override
protected void calcVirtualScreenOriginAndSize(final Rectangle vOriginSize) {
final RectangleImmutable ov = (RectangleImmutable) getViewport().cloneMutable();
@@ -244,17 +244,17 @@ public class ScreenDriver extends ScreenImpl {
System.err.println("X11Screen.calcVirtualScreenOriginAndSize: Querying X11: "+ov+" -> "+vOriginSize);
}
}
- }
-
+ }
+
//----------------------------------------------------------------------
// Internals only
- //
+ //
private final T runWithLockedDisplayDevice(DisplayRunnable action) {
return display.runWithLockedDisplayDevice(action);
}
-
+
private final T runWithTempDisplayHandle(DisplayRunnable action) {
- final long displayHandle = X11Util.openDisplay(display.getName());
+ final long displayHandle = X11Util.openDisplay(display.getName());
if(0 == displayHandle) {
throw new RuntimeException("null device");
}
@@ -266,7 +266,7 @@ public class ScreenDriver extends ScreenImpl {
}
return res;
}
-
+
private final T runWithOptTempDisplayHandle(DisplayRunnable action) {
if( null != rAndR && rAndR.getVersion().compareTo(RandR.version130) >= 0 ) {
return display.runWithLockedDisplayDevice(action);
@@ -274,12 +274,12 @@ public class ScreenDriver extends ScreenImpl {
return runWithTempDisplayHandle(action);
}
}
-
+
private static native long GetScreen0(long dpy, int scrn_idx);
private static native int getWidth0(long display, int scrn_idx);
private static native int getHeight0(long display, int scrn_idx);
-
+
private static native int[] getRandRVersion0(long display);
}
diff --git a/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java
index 806dd270c..02f80c0c3 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package jogamp.newt.driver.x11;
@@ -57,7 +57,7 @@ public class WindowDriver extends WindowImpl {
private static final int X11_WHEEL_ONE_DOWN_BUTTON = 5;
private static final int X11_WHEEL_TWO_UP_BUTTON = 6;
private static final int X11_WHEEL_TWO_DOWN_BUTTON = 7;
-
+
static {
ScreenDriver.initSingleton();
}
@@ -70,21 +70,21 @@ public class WindowDriver extends WindowImpl {
final ScreenDriver screen = (ScreenDriver) getScreen();
final DisplayDriver display = (DisplayDriver) screen.getDisplay();
final AbstractGraphicsDevice edtDevice = display.getGraphicsDevice();
-
- // Decoupled X11 Device/Screen allowing X11 display lock-free off-thread rendering
+
+ // Decoupled X11 Device/Screen allowing X11 display lock-free off-thread rendering
final long renderDeviceHandle = X11Util.openDisplay(edtDevice.getConnection());
if( 0 == renderDeviceHandle ) {
throw new RuntimeException("Error creating display(GfxCfg/Render): "+edtDevice.getConnection());
}
renderDevice = new X11GraphicsDevice(renderDeviceHandle, AbstractGraphicsDevice.DEFAULT_UNIT, true /* owner */);
final AbstractGraphicsScreen renderScreen = new X11GraphicsScreen(renderDevice, screen.getIndex());
-
+
final GraphicsConfigurationFactory factory = GraphicsConfigurationFactory.getFactory(display.getGraphicsDevice(), capsRequested);
final AbstractGraphicsConfiguration cfg = factory.chooseGraphicsConfiguration(
capsRequested, capsRequested, capabilitiesChooser, renderScreen, VisualIDHolder.VID_UNDEFINED);
if(DEBUG_IMPLEMENTATION) {
System.err.println("X11Window.createNativeImpl() factory: "+factory+", chosen config: "+cfg);
- }
+ }
if (null == cfg) {
throw new NativeWindowException("Error choosing GraphicsConfiguration creating window: "+this);
}
@@ -93,13 +93,13 @@ public class WindowDriver extends WindowImpl {
throw new NativeWindowException("Chosen Configuration w/o native visual ID: "+cfg);
}
setGraphicsConfiguration(cfg);
- final int flags = getReconfigureFlags(0, true) &
+ final int flags = getReconfigureFlags(0, true) &
( FLAG_IS_ALWAYSONTOP | FLAG_IS_UNDECORATED ) ;
edtDevice.lock();
- try {
+ try {
setWindowHandle(CreateWindow0(getParentWindowHandle(),
- edtDevice.getHandle(), screen.getIndex(), visualID,
- display.getJavaObjectAtom(), display.getWindowDeleteAtom(),
+ edtDevice.getHandle(), screen.getIndex(), visualID,
+ display.getJavaObjectAtom(), display.getWindowDeleteAtom(),
getX(), getY(), getWidth(), getHeight(), autoPosition(), flags));
} finally {
edtDevice.unlock();
@@ -117,10 +117,10 @@ public class WindowDriver extends WindowImpl {
final AbstractGraphicsDevice edtDevice = display.getGraphicsDevice();
edtDevice.lock();
try {
- CloseWindow0(edtDevice.getHandle(), windowHandleClose,
+ CloseWindow0(edtDevice.getHandle(), windowHandleClose,
display.getJavaObjectAtom(), display.getWindowDeleteAtom() /* , display.getKbdHandle() */); // XKB disabled for now
} catch (Throwable t) {
- if(DEBUG_IMPLEMENTATION) {
+ if(DEBUG_IMPLEMENTATION) {
Exception e = new Exception("Warning: closeNativeImpl failed - "+Thread.currentThread().getName(), t);
e.printStackTrace();
}
@@ -135,7 +135,7 @@ public class WindowDriver extends WindowImpl {
}
}
- /**
+ /**
*
@@ -145,7 +145,7 @@ public class WindowDriver extends WindowImpl {
protected boolean isReconfigureFlagSupported(int changeFlags) {
return true; // all flags!
}
-
+
@Override
protected boolean reconfigureWindowImpl(final int x, final int y, final int width, final int height, int flags) {
if(DEBUG_IMPLEMENTATION) {
@@ -153,8 +153,8 @@ public class WindowDriver extends WindowImpl {
}
final int _x, _y;
if(0 == ( FLAG_IS_UNDECORATED & flags)) {
- final InsetsImmutable i = getInsets();
-
+ final InsetsImmutable i = getInsets();
+
// client position -> top-level window position
_x = x - i.getLeftWidth() ;
_y = y - i.getTopHeight() ;
@@ -177,7 +177,7 @@ public class WindowDriver extends WindowImpl {
final DisplayDriver display = (DisplayDriver) getScreen().getDisplay();
runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable() {
public Object run(long dpy) {
- reconfigureWindow0( dpy, getScreenIndex(),
+ reconfigureWindow0( dpy, getScreenIndex(),
getParentWindowHandle(), getWindowHandle(), display.getWindowDeleteAtom(),
_x, _y, width, height, fflags);
return null;
@@ -205,23 +205,23 @@ public class WindowDriver extends WindowImpl {
public Object run(long dpy) {
reconfigureWindow0( dpy, getScreenIndex(),
getParentWindowHandle(), getWindowHandle(), display.getWindowDeleteAtom(),
- getX(), getY(), getWidth(), getHeight(), flags);
+ getX(), getY(), getWidth(), getHeight(), flags);
return null;
}
});
}
super.focusChanged(defer, focusGained);
}
-
+
protected void reparentNotify(long newParentWindowHandle) {
if(DEBUG_IMPLEMENTATION) {
final long p0 = getParentWindowHandle();
System.err.println("Window.reparentNotify ("+getThreadName()+"): "+toHexString(p0)+" -> "+toHexString(newParentWindowHandle));
}
}
-
+
@Override
- protected void requestFocusImpl(final boolean force) {
+ protected void requestFocusImpl(final boolean force) {
runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable() {
public Object run(long dpy) {
requestFocus0(dpy, getWindowHandle(), force);
@@ -239,7 +239,7 @@ public class WindowDriver extends WindowImpl {
}
});
}
-
+
@Override
protected boolean setPointerVisibleImpl(final boolean pointerVisible) {
return runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable() {
@@ -257,7 +257,7 @@ public class WindowDriver extends WindowImpl {
}
}).booleanValue();
}
-
+
@Override
protected void warpPointerImpl(final int x, final int y) {
runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable() {
@@ -267,7 +267,7 @@ public class WindowDriver extends WindowImpl {
}
});
}
-
+
@Override
protected Point getLocationOnScreenImpl(final int x, final int y) {
return runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable() {
@@ -279,9 +279,9 @@ public class WindowDriver extends WindowImpl {
@Override
protected void updateInsetsImpl(Insets insets) {
- // nop - using event driven insetsChange(..)
+ // nop - using event driven insetsChange(..)
}
-
+
@Override
protected final void doMouseEvent(boolean enqueue, boolean wait, short eventType, int modifiers,
int x, int y, short button, float[] rotationXYZ, float rotationScale) {
@@ -321,34 +321,34 @@ public class WindowDriver extends WindowImpl {
rotationXYZ[0] = -1;
modifiers |= InputEvent.SHIFT_MASK;
break;
- }
+ }
break;
}
super.doMouseEvent(enqueue, wait, eventType, modifiers, x, y, button, rotationXYZ, rotationScale);
}
-
+
/** Called by native TK */
protected final void sendKeyEvent(short eventType, int modifiers, short keyCode, short keySym, char keyChar0, String keyString) {
// handleKeyEvent(true, false, eventType, modifiers, keyCode, keyChar);
final boolean isModifierKey = KeyEvent.isModifierKey(keyCode);
final boolean isAutoRepeat = 0 != ( KeyEvent.AUTOREPEAT_MASK & modifiers );
- final char keyChar = ( null != keyString ) ? keyString.charAt(0) : keyChar0;
+ final char keyChar = ( null != keyString ) ? keyString.charAt(0) : keyChar0;
// System.err.println("*** sendKeyEvent: event "+KeyEvent.getEventTypeString(eventType)+", keyCode "+toHexString(keyCode)+", keyChar <"+keyChar0+">/<"+keyChar+">, keyString "+keyString+", mods "+toHexString(modifiers)+
// ", isKeyCodeTracked "+isKeyCodeTracked(keyCode)+", was: pressed "+isKeyPressed(keyCode)+", repeat "+isAutoRepeat+", [modifierKey "+isModifierKey+"] - "+System.currentTimeMillis());
-
+
if( !isAutoRepeat || !isModifierKey ) { // ! ( isModifierKey && isAutoRepeat )
switch(eventType) {
case KeyEvent.EVENT_KEY_PRESSED:
super.sendKeyEvent(KeyEvent.EVENT_KEY_PRESSED, modifiers, keyCode, keySym, keyChar);
break;
-
+
case KeyEvent.EVENT_KEY_RELEASED:
super.sendKeyEvent(KeyEvent.EVENT_KEY_RELEASED, modifiers, keyCode, keySym, keyChar);
break;
}
}
}
-
+
@Override
public final void sendKeyEvent(short eventType, int modifiers, short keyCode, short keySym, char keyChar) {
throw new InternalError("XXX: Adapt Java Code to Native Code Changes");
@@ -357,33 +357,33 @@ public class WindowDriver extends WindowImpl {
public final void enqueueKeyEvent(boolean wait, short eventType, int modifiers, short keyCode, short keySym, char keyChar) {
throw new InternalError("XXX: Adapt Java Code to Native Code Changes");
}
-
+
//----------------------------------------------------------------------
// Internals only
//
private static final String getCurrentThreadName() { return Thread.currentThread().getName(); } // Callback for JNI
private static final void dumpStack() { Thread.dumpStack(); } // Callback for JNI
-
+
private final T runWithLockedDisplayDevice(DisplayRunnable action) {
return ((DisplayDriver) getScreen().getDisplay()).runWithLockedDisplayDevice(action);
}
protected static native boolean initIDs0();
-
- private native long CreateWindow0(long parentWindowHandle, long display, int screen_index,
- int visualID, long javaObjectAtom, long windowDeleteAtom,
- int x, int y, int width, int height, boolean autoPosition, int flags);
+
+ private native long CreateWindow0(long parentWindowHandle, long display, int screen_index,
+ int visualID, long javaObjectAtom, long windowDeleteAtom,
+ int x, int y, int width, int height, boolean autoPosition, int flags);
private native void CloseWindow0(long display, long windowHandle, long javaObjectAtom, long windowDeleteAtom /*, long kbdHandle*/ ); // XKB disabled for now
private native void reconfigureWindow0(long display, int screen_index, long parentWindowHandle, long windowHandle,
- long windowDeleteAtom, int x, int y, int width, int height, int flags);
+ long windowDeleteAtom, int x, int y, int width, int height, int flags);
private native void requestFocus0(long display, long windowHandle, boolean force);
-
+
private static native void setTitle0(long display, long windowHandle, String title);
private static native long getParentWindow0(long display, long windowHandle);
private static native boolean setPointerVisible0(long display, long windowHandle, boolean visible);
private static native boolean confinePointer0(long display, long windowHandle, boolean grab);
private static native void warpPointer0(long display, long windowHandle, int x, int y);
-
+
private long windowHandleClose;
private X11GraphicsDevice renderDevice;
}
diff --git a/src/newt/classes/jogamp/newt/event/NEWTEventTask.java b/src/newt/classes/jogamp/newt/event/NEWTEventTask.java
index 93d5e2fb9..38a434279 100644
--- a/src/newt/classes/jogamp/newt/event/NEWTEventTask.java
+++ b/src/newt/classes/jogamp/newt/event/NEWTEventTask.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package jogamp.newt.event;
import com.jogamp.newt.event.NEWTEvent;
diff --git a/src/newt/classes/jogamp/newt/swt/SWTEDTUtil.java b/src/newt/classes/jogamp/newt/swt/SWTEDTUtil.java
index 6024195e3..08eacdee5 100644
--- a/src/newt/classes/jogamp/newt/swt/SWTEDTUtil.java
+++ b/src/newt/classes/jogamp/newt/swt/SWTEDTUtil.java
@@ -40,16 +40,16 @@ import com.jogamp.newt.util.EDTUtil;
*/
public class SWTEDTUtil implements EDTUtil {
public static final boolean DEBUG = Debug.debug("EDT");
-
+
private final Object edtLock = new Object(); // locking the EDT start/stop state
- private final ThreadGroup threadGroup;
+ private final ThreadGroup threadGroup;
private final String name;
private final Runnable dispatchMessages;
private final org.eclipse.swt.widgets.Display swtDisplay;
private NEDT nedt = null;
private int start_iter=0;
private static long pollPeriod = EDTUtil.defaultEDTPollPeriod;
-
+
public SWTEDTUtil(final com.jogamp.newt.Display newtDisplay, org.eclipse.swt.widgets.Display swtDisplay) {
this.threadGroup = Thread.currentThread().getThreadGroup();
this.name=Thread.currentThread().getName()+"-SWTDisplay-"+newtDisplay.getFQName()+"-EDT-";
@@ -61,11 +61,11 @@ public class SWTEDTUtil implements EDTUtil {
this.nedt = new NEDT(threadGroup, name);
this.nedt.setDaemon(true); // don't stop JVM from shutdown ..
}
-
+
public final org.eclipse.swt.widgets.Display getDisplay() {
return swtDisplay;
}
-
+
@Override
public long getPollPeriod() {
return pollPeriod;
@@ -116,7 +116,7 @@ public class SWTEDTUtil implements EDTUtil {
}
nedt.start();
}
-
+
@Override
public boolean isCurrentThreadEDT() {
return !swtDisplay.isDisposed() && swtDisplay.getThread() == Thread.currentThread();
@@ -126,18 +126,18 @@ public class SWTEDTUtil implements EDTUtil {
public final boolean isCurrentThreadNEDT() {
return nedt == Thread.currentThread();
}
-
+
@Override
public final boolean isCurrentThreadEDTorNEDT() {
final Thread ct = Thread.currentThread();
return ( !swtDisplay.isDisposed() && ct == swtDisplay.getThread() ) || ct == nedt ;
}
-
+
@Override
public boolean isRunning() {
return nedt.isRunning();
}
-
+
@Override
public final boolean invokeStop(boolean wait, Runnable task) {
return invokeImpl(wait, task, true);
@@ -147,12 +147,12 @@ public class SWTEDTUtil implements EDTUtil {
public final boolean invoke(boolean wait, Runnable task) {
return invokeImpl(wait, task, false);
}
-
+
private static Runnable nullTask = new Runnable() {
@Override
- public void run() { }
+ public void run() { }
};
-
+
private final boolean invokeImpl(boolean wait, Runnable task, boolean stop) {
Throwable throwable = null;
RunnableTask rTask = null;
@@ -165,12 +165,12 @@ public class SWTEDTUtil implements EDTUtil {
System.err.println(Thread.currentThread()+": Warning: SWT-EDT about (1) to stop, won't enqueue new task: "+nedt+", isRunning "+nedt.isRunning+", shouldStop "+nedt.shouldStop);
Thread.dumpStack();
}
- return false;
+ return false;
}
if( swtDisplay.isDisposed() ) {
stop = true;
}
-
+
if( isCurrentThreadEDT() ) {
if(null != task) {
task.run();
@@ -179,7 +179,7 @@ public class SWTEDTUtil implements EDTUtil {
if( stop ) {
nedt.shouldStop = true;
}
- } else {
+ } else {
if( !nedt.isRunning && !swtDisplay.isDisposed() ) {
if( null != task ) {
if( stop ) {
@@ -210,11 +210,11 @@ public class SWTEDTUtil implements EDTUtil {
return false;
}
}
-
+
if( null != task ) {
rTask = new RunnableTask(task,
wait ? rTaskLock : null,
- true /* always catch and report Exceptions, don't disturb EDT */,
+ true /* always catch and report Exceptions, don't disturb EDT */,
wait ? null : System.err);
swtDisplay.asyncExec(rTask);
}
@@ -238,7 +238,7 @@ public class SWTEDTUtil implements EDTUtil {
}
return true;
}
- }
+ }
@Override
final public boolean waitUntilIdle() {
@@ -278,7 +278,7 @@ public class SWTEDTUtil implements EDTUtil {
}
}
}
-
+
class NEDT extends Thread {
volatile boolean shouldStop = false;
volatile boolean isRunning = false;
@@ -298,7 +298,7 @@ public class SWTEDTUtil implements EDTUtil {
super.start();
}
- /**
+ /**
* Utilizing locking only on tasks and its execution,
* not for event dispatching.
*/
@@ -315,7 +315,7 @@ public class SWTEDTUtil implements EDTUtil {
// EDT invoke thread is SWT-EDT,
// hence dispatching is required to run on SWT-EDT as well.
// Otherwise a deadlock may happen due to dispatched event's
- // triggering a locking action.
+ // triggering a locking action.
if ( !swtDisplay.isDisposed() ) {
swtDisplay.syncExec(dispatchMessages);
} else {
@@ -343,7 +343,7 @@ public class SWTEDTUtil implements EDTUtil {
}
} finally {
if(DEBUG) {
- System.err.println(getName()+": SWT-EDT run() END "+ getName()+", "+error);
+ System.err.println(getName()+": SWT-EDT run() END "+ getName()+", "+error);
}
synchronized(edtLock) {
isRunning = false;
@@ -358,5 +358,5 @@ public class SWTEDTUtil implements EDTUtil {
} // finally
} // run()
} // EventDispatchThread
-
+
}
diff --git a/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java b/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java
index 3782a1186..b5c45c1aa 100644
--- a/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java
+++ b/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package jogamp.newt.swt.event;
import org.eclipse.swt.SWT;
@@ -206,7 +206,7 @@ public class SWTNewtEventFactory {
}
return res;
}
-
+
public static final com.jogamp.newt.event.MouseEvent createMouseEvent(org.eclipse.swt.widgets.Event event, Object source) {
switch(event.type) {
case SWT.MouseDown:
@@ -229,7 +229,7 @@ public class SWTNewtEventFactory {
}
int mods = swtModifiers2Newt(event.stateMask, true);
-
+
if( source instanceof com.jogamp.newt.Window) {
final com.jogamp.newt.Window newtSource = (com.jogamp.newt.Window)source;
if(newtSource.isPointerConfined()) {
@@ -239,7 +239,7 @@ public class SWTNewtEventFactory {
mods |= InputEvent.INVISIBLE_MASK;
}
}
-
+
return new com.jogamp.newt.event.MouseEvent(
type, (null==source)?(Object)event.data:source, (0xFFFFFFFFL & (long)event.time),
mods, event.x, event.y, (short)event.count, (short)event.button, MouseEvent.getRotationXYZ(rotation, mods), 1f);
@@ -260,32 +260,32 @@ public class SWTNewtEventFactory {
final short newtKeyCode = swtKeyCode2NewtKeyCode( event.keyCode );
return com.jogamp.newt.event.KeyEvent.create(
type, (null==source)?(Object)event.data:source, (0xFFFFFFFFL & (long)event.time),
- swtModifiers2Newt(event.stateMask, false),
+ swtModifiers2Newt(event.stateMask, false),
newtKeyCode, newtKeyCode, event.character);
}
return null; // no mapping ..
}
-
+
//
//
//
-
+
short dragButtonDown = 0;
-
+
public SWTNewtEventFactory() {
resetButtonsDown();
}
-
+
final void resetButtonsDown() {
dragButtonDown = 0;
}
-
+
public final boolean dispatchMouseEvent(org.eclipse.swt.widgets.Event event, Object source, com.jogamp.newt.event.MouseListener l) {
com.jogamp.newt.event.MouseEvent res = createMouseEvent(event, source);
if(null != res) {
if(null != l) {
switch(event.type) {
- case SWT.MouseDown:
+ case SWT.MouseDown:
dragButtonDown = (short) event.button;
l.mousePressed(res); break;
case SWT.MouseUp:
@@ -293,7 +293,7 @@ public class SWTNewtEventFactory {
l.mouseReleased(res);
{
final com.jogamp.newt.event.MouseEvent res2 = new com.jogamp.newt.event.MouseEvent(
- com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_CLICKED,
+ com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_CLICKED,
res.getSource(),
res.getWhen(), res.getModifiers(),
res.getX(), res.getY(), res.getClickCount(),
@@ -304,7 +304,7 @@ public class SWTNewtEventFactory {
case SWT.MouseMove:
if( 0 < dragButtonDown ) {
final com.jogamp.newt.event.MouseEvent res2 = new com.jogamp.newt.event.MouseEvent(
- com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_DRAGGED,
+ com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_DRAGGED,
res.getSource(),
res.getWhen(), res.getModifiers(),
res.getX(), res.getY(), res.getClickCount(),
@@ -315,14 +315,14 @@ public class SWTNewtEventFactory {
}
break;
case SWT.MouseEnter:
- l.mouseEntered(res);
+ l.mouseEntered(res);
break;
case SWT.MouseExit:
resetButtonsDown();
- l.mouseExited(res);
+ l.mouseExited(res);
break;
case SWT.MouseVerticalWheel:
- l.mouseWheelMoved(res);
+ l.mouseWheelMoved(res);
break;
}
}
@@ -337,7 +337,7 @@ public class SWTNewtEventFactory {
if(null != l) {
switch(event.type) {
case SWT.KeyDown:
- l.keyPressed(res);
+ l.keyPressed(res);
break;
case SWT.KeyUp:
l.keyReleased(res);
@@ -347,9 +347,9 @@ public class SWTNewtEventFactory {
return true;
}
return false;
- }
-
- public final void attachDispatchListener(final org.eclipse.swt.widgets.Control ctrl, final Object source,
+ }
+
+ public final void attachDispatchListener(final org.eclipse.swt.widgets.Control ctrl, final Object source,
final com.jogamp.newt.event.MouseListener ml,
final com.jogamp.newt.event.KeyListener kl) {
final Listener listener = new Listener () {
--
cgit v1.2.3
From 7f7a23dd0ddf106e6f0c69fc2a05ff92ac56200e Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Sun, 27 Oct 2013 17:51:08 +0100
Subject: Bug 776 GLContext Sharing: Refine API for relaxed and lazy GLContext
sharing ; Fix GLContext memory contract (volatile)
(Unit test remarks see below)
- Add shared GLContext queries
- Refined GLContextShareSet:
- Use IdentityHashMap since GLContext's can only be identical w/ same reference (footprint, performance)
- Add API doc for clarification
- Add methods:
- ArrayList getCreatedShares(final GLContext context)
- ArrayList getDestroyedShares(final GLContext context)
- Use 'final' where possible
- Add GLContext methods:
- boolean isShared()
- List getCreatedShares()
- List getDestroyedShares()
- Add GLSharedContextSetter interface defining setting a shared GLContext
directly (GLContext) or via a GLAutoDrawable:
- setSharedContext(GLContext)
- setSharedAutoDrawable(GLAutoDrawable)
Both cause initialization/creation of GLAutoDrawable's drawable/context to be postponed,
if the shared GLContext is not yet created natively or
the shared GLAutoDrawable's GLContext does not yet exist.
Most of impl. resides in GLDrawableHelper
Implemented in:
- GLAutoDrawableBase, GLOffscreenAutoDrawable
- GLWindow
- AWT GLCanvas
TODO:
- GLJPanel
- SWT GLCanvas
- GLDrawableFactory:
- Add 'GLOffscreenAutoDrawable createOffscreenAutoDrawable(..)' variant w/o passing the
optional shared GLContext _and_ specifying lazy GLContext
creation. This allows to benefit from GLSharedContextSetter contract.
Lazy GLContext creation is performed at 2st display() call at the latest.
All JOGL code and unit tests use this new method now.
- Mark 'createOffscreenAutoDrawable(..)' w/ shared GLContext argument
and immediate GLContext creation deprecated - shall be removed in 2.2.0
- Make reference to GLContext and it's native handle volatile
Since we rely on the query 'GLContext.isCreated()' to properly allow GLAutoDrawable's to query whether
a shared GLContext is natively created (already), the handle must be volatile
since such query and the actual creation may operate on different threads.
+++++
- Add/Refine shared GLContext unit tests demonstrating diff. sharing methods.
All variants of using shared GLContext:
com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBO*
Most convenient way to share via setSharedAutoDrawable(GLAutoDrawable):
com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2[NEWT|AWT]3
AWT use w/ JTabbedPane using setSharedAutoDrawable(GLAutoDrawable):
com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextWithJTabbedPaneAWT
---
make/scripts/tests.sh | 32 +-
.../com/jogamp/opengl/GLAutoDrawableDelegate.java | 9 +-
.../classes/com/jogamp/opengl/swt/GLCanvas.java | 4 +-
.../com/jogamp/opengl/util/awt/TextRenderer.java | 32 +-
src/jogl/classes/javax/media/opengl/GLContext.java | 21 +-
.../javax/media/opengl/GLDrawableFactory.java | 55 +++-
.../media/opengl/GLOffscreenAutoDrawable.java | 2 +-
.../javax/media/opengl/GLSharedContextSetter.java | 78 +++++
.../classes/javax/media/opengl/awt/GLCanvas.java | 122 +++++---
.../classes/javax/media/opengl/awt/GLJPanel.java | 46 +--
.../classes/jogamp/opengl/GLAutoDrawableBase.java | 72 +++--
src/jogl/classes/jogamp/opengl/GLContextImpl.java | 4 +-
.../classes/jogamp/opengl/GLContextShareSet.java | 150 ++++++----
.../jogamp/opengl/GLDrawableFactoryImpl.java | 13 +
.../classes/jogamp/opengl/GLDrawableHelper.java | 60 +++-
.../jogamp/opengl/GLOffscreenAutoDrawableImpl.java | 2 +-
.../classes/com/jogamp/newt/awt/NewtCanvasAWT.java | 7 +-
.../classes/com/jogamp/newt/opengl/GLWindow.java | 45 ++-
.../jogl/acore/TestFBOAutoDrawableDeadlockAWT.java | 28 +-
.../jogl/acore/TestFBOAutoDrawableFactoryNEWT.java | 130 ++++-----
...tFBOOffThreadSharedContextMix2DemosES2NEWT.java | 100 +++----
.../TestFBOOnThreadSharedContext1DemoES2NEWT.java | 89 +++---
.../jogl/acore/TestGLAutoDrawableDelegateNEWT.java | 46 +--
...estGLAutoDrawableFactoryES2OffscrnCapsNEWT.java | 106 +++----
...estGLAutoDrawableFactoryGL2OffscrnCapsNEWT.java | 118 ++++----
...TestGLAutoDrawableFactoryGLnBitmapCapsNEWT.java | 66 ++---
.../jogl/acore/TestGLExtensionQueryOffscreen.java | 22 +-
.../jogl/acore/TestNEWTCloseX11DisplayBug565.java | 24 +-
.../junit/jogl/acore/TestSharedContextListAWT.java | 43 +--
.../jogl/acore/TestSharedContextListNEWT.java | 20 +-
.../jogl/acore/TestSharedContextNewtAWTBug523.java | 94 +++---
.../jogl/acore/TestSharedContextVBOES1NEWT.java | 75 +++--
.../jogl/acore/TestSharedContextVBOES2AWT3.java | 321 +++++++++++++++++++++
.../jogl/acore/TestSharedContextVBOES2NEWT.java | 245 ----------------
.../jogl/acore/TestSharedContextVBOES2NEWT0.java | 270 +++++++++++++++++
.../jogl/acore/TestSharedContextVBOES2NEWT1.java | 295 +++++++++++++++++++
.../jogl/acore/TestSharedContextVBOES2NEWT2.java | 315 ++++++++++++++++++++
.../jogl/acore/TestSharedContextVBOES2NEWT3.java | 296 +++++++++++++++++++
.../acore/TestSharedContextWithJTabbedPaneAWT.java | 264 +++++++++++++++++
.../acore/glels/GLContextDrawableSwitchBase.java | 96 +++---
.../glels/TestGLContextDrawableSwitch02AWT.java | 52 ++--
.../awt/TestBug461FBOSupersamplingSwingAWT.java | 46 +--
.../junit/jogl/caps/TestBug605FlippedImageAWT.java | 2 +-
.../jogl/caps/TestBug605FlippedImageNEWT.java | 2 +-
.../junit/jogl/caps/TestMultisampleES1AWT.java | 18 +-
.../opengl/test/junit/jogl/demos/es1/GearsES1.java | 85 +++---
.../opengl/test/junit/jogl/demos/es2/GearsES2.java | 114 ++++++--
.../jogl/glu/TestBug365TextureGenerateMipMaps.java | 108 ++++---
.../tile/TestRandomTiledRendering2GL2NEWT.java | 26 +-
.../junit/jogl/tile/TestTiledRendering2NEWT.java | 36 +--
.../opengl/test/junit/util/AWTRobotUtil.java | 230 ++++++++-------
.../jogamp/opengl/test/junit/util/MiscUtils.java | 73 +++--
52 files changed, 3301 insertions(+), 1308 deletions(-)
create mode 100644 src/jogl/classes/javax/media/opengl/GLSharedContextSetter.java
create mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2AWT3.java
delete mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT.java
create mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT0.java
create mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT1.java
create mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT2.java
create mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT3.java
create mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextWithJTabbedPaneAWT.java
(limited to 'src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java')
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index 3f4fe9c19..23477b254 100644
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -353,9 +353,8 @@ function testawtswt() {
#testnoawt com.jogamp.opengl.test.junit.jogl.math.TestFloatUtil01MatrixMatrixMultNOUI $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLVersionParsing00NEWT $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestNEWTCloseX11DisplayBug565 $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestMainVersionGLWindowNEWT $*
-testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile00NEWT $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile00NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile01NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestShutdownCompleteNEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestInitConcurrent01NEWT $*
@@ -368,10 +367,25 @@ testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile00NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestBug669RecursiveGLContext01NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestBug669RecursiveGLContext02NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestBug692GL3VAO $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLExtensionQueryOffscreen $*
+
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextListNEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextListNEWT2 $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES1NEWT $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2NEWT $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2NEWT0 $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2NEWT1 $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2NEWT2 $*
+#testawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2AWT3 $*
+testawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextWithJTabbedPaneAWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextNewtAWTBug523 $*
+#testawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextListAWT $*
+
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOOffThreadSharedContextMix2DemosES2NEWT $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOOnThreadSharedContext1DemoES2NEWT $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOAutoDrawableFactoryNEWT $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOMix2DemosES2NEWT $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOMRTNEWT01 $*
+
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLPointsNEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLMesaBug651NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLMesaBug658NEWT $*
@@ -391,12 +405,6 @@ testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile00NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOAutoDrawableFactoryNEWT $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOOffThreadSharedContextMix2DemosES2NEWT $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOOnThreadSharedContext1DemoES2NEWT $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOMix2DemosES2NEWT $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOMRTNEWT01 $*
-
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.ect.TestExclusiveContext01VSyncAnimNEWT $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.ect.TestExclusiveContext01VSyncAnimAWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.ect.TestExclusiveContext02FPSAnimNEWT $*
@@ -418,6 +426,9 @@ testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile00NEWT $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOAutoDrawableDeadlockAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug461FBOSupersamplingSwingAWT
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestNEWTCloseX11DisplayBug565 $*
+#testawt com.jogamp.opengl.test.junit.jogl.acore.TestAWTCloseX11DisplayBug565 $*
+
#testnoawt com.jogamp.opengl.test.junit.newt.TestRemoteWindow01NEWT $*
#testnoawt com.jogamp.opengl.test.junit.newt.TestRemoteGLWindows01NEWT $*
@@ -447,9 +458,6 @@ testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile00NEWT $*
#testawt jogamp.newt.awt.opengl.VersionApplet $*
#testawt javax.media.opengl.awt.GLCanvas $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestMainVersionGLCanvasAWT $*
-#testawt com.jogamp.opengl.test.junit.jogl.acore.TestAWTCloseX11DisplayBug565 $*
-#testawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextListAWT $*
-#testawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextNewtAWTBug523 $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOAutoDrawableDeadlockAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestPBufferDeadlockAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestShutdownCompleteAWT $*
diff --git a/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java b/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java
index ce58d29c1..6b1bb0e5e 100644
--- a/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java
@@ -64,11 +64,18 @@ import jogamp.opengl.GLDrawableImpl;
*/
public class GLAutoDrawableDelegate extends GLAutoDrawableBase implements GLAutoDrawable {
/**
+ *
+ * The {@link GLContext} can be assigned later manually via {@link GLAutoDrawable#setContext(GLContext, boolean) setContext(ctx)}
+ * or it will be created lazily at the 1st {@link GLAutoDrawable#display() display()} method call.
+ * Lazy {@link GLContext} creation will take a shared {@link GLContext} into account
+ * which has been set {@link #setSharedContext(GLContext) directly}
+ * or {@link #setSharedAutoDrawable(GLAutoDrawable) via another GLAutoDrawable}.
+ *
* @param drawable a valid {@link GLDrawable}, may not be {@link GLDrawable#isRealized() realized} yet.
* @param context a valid {@link GLContext},
* may not have been made current (created) yet,
* may not be associated w/ drawable yet,
- * may be null for lazy initialization
+ * may be null for lazy initialization at 1st {@link #display()}.
* @param upstreamWidget optional UI element holding this instance, see {@link #getUpstreamWidget()}.
* @param ownDevice pass true if {@link AbstractGraphicsDevice#close()} shall be issued,
* otherwise pass false. Closing the device is required in case
diff --git a/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java b/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java
index 1a3e1e0c0..5e3731984 100644
--- a/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java
+++ b/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java
@@ -242,7 +242,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
private class DisposeGLEventListenerAction implements Runnable {
private GLEventListener listener;
- private boolean remove;
+ private final boolean remove;
private DisposeGLEventListenerAction(GLEventListener listener, boolean remove) {
this.listener = listener;
this.remove = remove;
@@ -677,7 +677,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
@Override
public GLContext getContext() {
- return null != drawable ? context : null;
+ return context;
}
@Override
diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java
index 3662223f4..46dc73003 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java
@@ -159,20 +159,20 @@ public class TextRenderer {
static final int kTotalBufferSizeBytesTex = kTotalBufferSizeCoordsTex * 4;
static final int kSizeInBytes_OneVertices_VertexData = kCoordsPerVertVerts * 4;
static final int kSizeInBytes_OneVertices_TexData = kCoordsPerVertTex * 4;
- private Font font;
- private boolean antialiased;
- private boolean useFractionalMetrics;
+ private final Font font;
+ private final boolean antialiased;
+ private final boolean useFractionalMetrics;
// Whether we're attempting to use automatic mipmap generation support
private boolean mipmap;
private RectanglePacker packer;
private boolean haveMaxSize;
- private RenderDelegate renderDelegate;
+ private final RenderDelegate renderDelegate;
private TextureRenderer cachedBackingStore;
private Graphics2D cachedGraphics;
private FontRenderContext cachedFontRenderContext;
- private Map stringLocations = new HashMap();
- private GlyphProducer mGlyphProducer;
+ private final Map stringLocations = new HashMap();
+ private final GlyphProducer mGlyphProducer;
private int numRenderCycles;
@@ -905,8 +905,8 @@ public class TextRenderer {
private void debug(GL gl) {
dbgFrame = new Frame("TextRenderer Debug Output");
- GLCanvas dbgCanvas = new GLCanvas(new GLCapabilities(gl.getGLProfile()), null,
- GLContext.getCurrent(), null);
+ GLCanvas dbgCanvas = new GLCanvas(new GLCapabilities(gl.getGLProfile()));
+ dbgCanvas.setSharedContext(GLContext.getCurrent());
dbgCanvas.addGLEventListener(new DebugListener(gl, dbgFrame));
dbgFrame.add(dbgCanvas);
@@ -1085,7 +1085,7 @@ public class TextRenderer {
static class TextData {
// Back-pointer to String this TextData describes, if it
// represents a String rather than a single glyph
- private String str;
+ private final String str;
// If this TextData represents a single glyph, this is its
// unicode ID
@@ -1096,7 +1096,7 @@ public class TextRenderer {
// 2D coordinate system) at which the string must be rasterized in
// order to fit within the rectangle -- the leftmost point of the
// baseline.
- private Point origin;
+ private final Point origin;
// This represents the pre-normalized rectangle, which fits
// within the rectangle on the backing store. We keep a
@@ -1104,7 +1104,7 @@ public class TextRenderer {
// prevent bleeding of adjacent letters when using GL_LINEAR
// filtering for rendering. The origin of this rectangle is
// equivalent to the origin above.
- private Rectangle2D origRect;
+ private final Rectangle2D origRect;
private boolean used; // Whether this text was used recently
@@ -1375,7 +1375,7 @@ public class TextRenderer {
//
// A temporary to prevent excessive garbage creation
- private char[] singleUnicode = new char[1];
+ private final char[] singleUnicode = new char[1];
/** A Glyph represents either a single unicode glyph or a
substring of characters to be drawn. The reason for the dual
@@ -1497,10 +1497,10 @@ public class TextRenderer {
int width = (int) origRect.getWidth();
int height = (int) origRect.getHeight();
- float tx1 = xScale * (float) texturex / (float) renderer.getWidth();
+ float tx1 = xScale * texturex / renderer.getWidth();
float ty1 = yScale * (1.0f -
((float) texturey / (float) renderer.getHeight()));
- float tx2 = xScale * (float) (texturex + width) / (float) renderer.getWidth();
+ float tx2 = xScale * (texturex + width) / renderer.getWidth();
float ty2 = yScale * (1.0f -
((float) (texturey + height) / (float) renderer.getHeight()));
@@ -1829,7 +1829,7 @@ public class TextRenderer {
GL2 gl = GLContext.getCurrentGL().getGL2();
TextureRenderer renderer = getBackingStore();
- Texture texture = renderer.getTexture(); // triggers texture uploads. Maybe this should be more obvious?
+ renderer.getTexture(); // triggers texture uploads. Maybe this should be more obvious?
mVertCoords.rewind();
mTexCoords.rewind();
@@ -1872,7 +1872,7 @@ public class TextRenderer {
private void drawIMMEDIATE() {
if (mOutstandingGlyphsVerticesPipeline > 0) {
TextureRenderer renderer = getBackingStore();
- Texture texture = renderer.getTexture(); // triggers texture uploads. Maybe this should be more obvious?
+ renderer.getTexture(); // triggers texture uploads. Maybe this should be more obvious?
GL2 gl = GLContext.getCurrentGL().getGL2();
gl.glBegin(GL2.GL_QUADS);
diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java
index e83d60b66..5c6c7073a 100644
--- a/src/jogl/classes/javax/media/opengl/GLContext.java
+++ b/src/jogl/classes/javax/media/opengl/GLContext.java
@@ -44,12 +44,14 @@ import java.nio.IntBuffer;
import java.util.HashMap;
import java.util.IdentityHashMap;
import java.util.Iterator;
+import java.util.List;
import java.util.Set;
import javax.media.nativewindow.AbstractGraphicsDevice;
import jogamp.opengl.Debug;
import jogamp.opengl.GLContextImpl;
+import jogamp.opengl.GLContextShareSet;
import com.jogamp.common.os.Platform;
import com.jogamp.common.util.VersionNumber;
@@ -205,7 +207,7 @@ public abstract class GLContext {
protected final RecursiveLock lock = LockFactory.createRecursiveLock();
/** The underlying native OpenGL context */
- protected long contextHandle;
+ protected volatile long contextHandle;
protected GLContext() {
resetStates(true);
@@ -242,6 +244,21 @@ public abstract class GLContext {
drawableRetargeted = false;
}
+ /** Returns true if this GLContext is shared, otherwise false. */
+ public final boolean isShared() {
+ return GLContextShareSet.isShared(this);
+ }
+
+ /** Returns a new list of created GLContext shared with this GLContext. */
+ public final List getCreatedShares() {
+ return GLContextShareSet.getCreatedShares(this);
+ }
+
+ /** Returns a new list of destroyed GLContext shared with this GLContext. */
+ public final List getDestroyedShares() {
+ return GLContextShareSet.getDestroyedShares(this);
+ }
+
/**
* Returns the instance of {@link GLRendererQuirks}, allowing one to determine workarounds.
* @return instance of {@link GLRendererQuirks} if context was made current once, otherwise null.
@@ -590,7 +607,7 @@ public abstract class GLContext {
sb.append(toHexString(hashCode()));
sb.append(", handle ");
sb.append(toHexString(contextHandle));
- sb.append(", ");
+ sb.append(", isShared "+isShared()+", ");
sb.append(getGL());
sb.append(",\n\t quirks: ");
if(null != glRendererQuirks) {
diff --git a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
index 26bafd961..817dff8ad 100644
--- a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
+++ b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
@@ -475,7 +475,8 @@ public abstract class GLDrawableFactory {
*
* In case the passed {@link GLCapabilitiesImmutable} contains default values, i.e.
* {@link GLCapabilitiesImmutable#isOnscreen() caps.isOnscreen()} == true,
- * it is auto-configured. The latter will set offscreen and also FBO or Pbuffer, whichever is available in that order.
+ * it is auto-configured. Auto configuration will set {@link GLCapabilitiesImmutable caps} to offscreen
+ * and FBO or Pbuffer, whichever is available in that order.
*
*
* A FBO based auto drawable, {@link GLOffscreenAutoDrawable.FBO}, is created if both {@link GLCapabilitiesImmutable#isFBO() caps.isFBO()}
@@ -501,12 +502,62 @@ public abstract class GLDrawableFactory {
* the creation of the Offscreen to fail.
*
* @see #createOffscreenDrawable(AbstractGraphicsDevice, GLCapabilitiesImmutable, GLCapabilitiesChooser, int, int)
+ * @deprecated Use {@link #createOffscreenAutoDrawable(AbstractGraphicsDevice, GLCapabilitiesImmutable, GLCapabilitiesChooser, int, int)
*/
public abstract GLOffscreenAutoDrawable createOffscreenAutoDrawable(AbstractGraphicsDevice device,
GLCapabilitiesImmutable caps,
GLCapabilitiesChooser chooser,
int width, int height,
GLContext shareWith) throws GLException;
+
+ /**
+ * Creates a {@link GLDrawable#isRealized() realized} {@link GLOffscreenAutoDrawable}
+ * incl it's offscreen {@link javax.media.nativewindow.NativeSurface} with the given capabilites and dimensions.
+ *
+ * The {@link GLOffscreenAutoDrawable}'s {@link GLDrawable} is {@link GLDrawable#isRealized() realized}
+ * without an assigned {@link GLContext}.
+ * The {@link GLContext} can be assigned later manually via {@link GLAutoDrawable#setContext(GLContext, boolean) setContext(ctx)}
+ * or it will be created lazily at the 1st {@link GLAutoDrawable#display() display()} method call.
+ * Lazy {@link GLContext} creation will take a shared {@link GLContext} into account
+ * which has been set {@link GLOffscreenAutoDrawable#setSharedContext(GLContext) directly}
+ * or {@link GLOffscreenAutoDrawable#setSharedAutoDrawable(GLAutoDrawable) via another GLAutoDrawable}.
+ *
+ *
+ * In case the passed {@link GLCapabilitiesImmutable} contains default values, i.e.
+ * {@link GLCapabilitiesImmutable#isOnscreen() caps.isOnscreen()} == true,
+ * it is auto-configured. Auto configuration will set {@link GLCapabilitiesImmutable caps} to offscreen
+ * and FBO or Pbuffer, whichever is available in that order.
+ *
+ *
+ * A FBO based auto drawable, {@link GLOffscreenAutoDrawable.FBO}, is created if both {@link GLCapabilitiesImmutable#isFBO() caps.isFBO()}
+ * and {@link GLContext#isFBOAvailable(AbstractGraphicsDevice, GLProfile) canCreateFBO(device, caps.getGLProfile())} is true.
+ *
+ *
+ * A Pbuffer based auto drawable is created if both {@link GLCapabilitiesImmutable#isPBuffer() caps.isPBuffer()}
+ * and {@link #canCreateGLPbuffer(AbstractGraphicsDevice, GLProfile) canCreateGLPbuffer(device)} is true.
+ *
+ *
+ * If neither FBO nor Pbuffer is available,
+ * a simple pixmap/bitmap auto drawable is created, which is unlikely to be hardware accelerated.
+ *
+ *
+ * @param device which {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared device to be used, may be null for the platform's default device.
+ * @param caps the requested GLCapabilties
+ * @param chooser the custom chooser, may be null for default
+ * @param width the requested offscreen width
+ * @param height the requested offscreen height
+ * @return the created and initialized offscreen {@link GLOffscreenAutoDrawable} instance
+ *
+ * @throws GLException if any window system-specific errors caused
+ * the creation of the Offscreen to fail.
+ *
+ * @see #createOffscreenDrawable(AbstractGraphicsDevice, GLCapabilitiesImmutable, GLCapabilitiesChooser, int, int)
+ */
+ public abstract GLOffscreenAutoDrawable createOffscreenAutoDrawable(AbstractGraphicsDevice device,
+ GLCapabilitiesImmutable caps,
+ GLCapabilitiesChooser chooser,
+ int width, int height) throws GLException;
+
/**
* Creates an {@link GLDrawable#isRealized() unrealized} offscreen {@link GLDrawable}
* incl it's offscreen {@link javax.media.nativewindow.NativeSurface} with the given capabilites and dimensions.
@@ -625,7 +676,7 @@ public abstract class GLDrawableFactory {
*
*
* See the note in the overview documentation on
- * context sharing.
+ * context sharing.
*
* @param device which {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be null for the platform's default device.
* @param capabilities the requested capabilities
diff --git a/src/jogl/classes/javax/media/opengl/GLOffscreenAutoDrawable.java b/src/jogl/classes/javax/media/opengl/GLOffscreenAutoDrawable.java
index be90d935f..d34edaf2e 100644
--- a/src/jogl/classes/javax/media/opengl/GLOffscreenAutoDrawable.java
+++ b/src/jogl/classes/javax/media/opengl/GLOffscreenAutoDrawable.java
@@ -40,7 +40,7 @@ import com.jogamp.opengl.FBObject;
* with it's {@link #setSize(int, int)} functionality.
*
*/
-public interface GLOffscreenAutoDrawable extends GLAutoDrawable {
+public interface GLOffscreenAutoDrawable extends GLAutoDrawable, GLSharedContextSetter {
/**
* Resize this auto drawable.
diff --git a/src/jogl/classes/javax/media/opengl/GLSharedContextSetter.java b/src/jogl/classes/javax/media/opengl/GLSharedContextSetter.java
new file mode 100644
index 000000000..d5a10931e
--- /dev/null
+++ b/src/jogl/classes/javax/media/opengl/GLSharedContextSetter.java
@@ -0,0 +1,78 @@
+/**
+ * Copyright 2013 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+
+package javax.media.opengl;
+
+/**
+ * Adds capabilities to set a shared {@link GLContext} directly or via an {@link GLAutoDrawable}.
+ *
+ * Warning: Don't reference this interface directly, since it may end up in {@link GLAutoDrawable}
+ *
+ */
+public interface GLSharedContextSetter extends GLAutoDrawable {
+ /**
+ * Specifies an {@link GLContext OpenGL context}, which shall be shared by this {@link GLAutoDrawable}'s {@link GLContext}.
+ *
+ * Since the {@link GLDrawable drawable} and {@link GLContext context} is created
+ * at {@link GLAutoDrawable#initialization GLAutoDrawable initialization}
+ * this method shall be called beforehand to have any effect.
+ *
+ *
+ * A set sharedContext will block context creation, i.e. {@link GLAutoDrawable#initialization GLAutoDrawable initialization},
+ * as long it is not {@link GLContext#isCreated() created natively}.
+ *
+ *
+ * @param sharedContext The OpenGL context to be shared by this {@link GLAutoDrawable}'s {@link GLContext}.
+ * @throws IllegalStateException if a {@link #setSharedContext(GLContext) shared GLContext}
+ * or {@link #setSharedAutoDrawable(GLAutoDrawable) shared GLAutoDrawable} is already set,
+ * the given sharedContext is null or equal to this {@link GLAutoDrawable}'s context.
+ * @see #setSharedAutoDrawable(GLAutoDrawable)
+ */
+ void setSharedContext(GLContext sharedContext) throws IllegalStateException;
+
+ /**
+ * Specifies an {@link GLAutoDrawable}, which {@link GLContext OpenGL context} shall be shared by this {@link GLAutoDrawable}'s {@link GLContext}.
+ *
+ * Since the {@link GLDrawable drawable} and {@link GLContext context} is created
+ * at {@link GLAutoDrawable#initialization GLAutoDrawable initialization}
+ * this method shall be called beforehand to have any effect.
+ *
+ *
+ * A set sharedAutoDrawable will block context creation, i.e. {@link GLAutoDrawable#initialization GLAutoDrawable initialization},
+ * as long it's {@link GLContext} is null
+ * or has not been {@link GLContext#isCreated() created natively}.
+ *
+ *
+ * @param sharedContext The GLAutoDrawable, which OpenGL context shall be shared by this {@link GLAutoDrawable}'s {@link GLContext}.
+ * @throws IllegalStateException if a {@link #setSharedContext(GLContext) shared GLContext}
+ * or {@link #setSharedAutoDrawable(GLAutoDrawable) shared GLAutoDrawable} is already set,
+ * the given sharedAutoDrawable is null or equal to this GLAutoDrawable.
+ * @see #setSharedContext(GLContext)
+ */
+ void setSharedAutoDrawable(GLAutoDrawable sharedAutoDrawable) throws IllegalStateException;
+}
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
index 8757c7a26..b070ddd7d 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
@@ -81,6 +81,7 @@ import javax.media.opengl.GLEventListener;
import javax.media.opengl.GLException;
import javax.media.opengl.GLProfile;
import javax.media.opengl.GLRunnable;
+import javax.media.opengl.GLSharedContextSetter;
import javax.media.opengl.Threading;
import com.jogamp.common.GlueGenVersion;
@@ -114,7 +115,7 @@ import jogamp.opengl.awt.AWTTilePainter;
interfaces when adding a heavyweight doesn't work either because
of Z-ordering or LayoutManager problems.
*
- *
*
* {@link OffscreenLayerOption#setShallUseOffscreenLayer(boolean) setShallUseOffscreenLayer(true)}
* maybe called to use an offscreen drawable (FBO or PBuffer) allowing
@@ -124,7 +125,7 @@ import jogamp.opengl.awt.AWTTilePainter;
* is being called if {@link GLCapabilitiesImmutable#isOnscreen()} is false.
*
*
- *
*
* To avoid any conflicts with a potential Java2D OpenGL context,
* you shall consider setting the following JVM properties:
@@ -141,7 +142,7 @@ import jogamp.opengl.awt.AWTTilePainter;
*
*
* GLCanvas tries to disable background erase for the AWT Canvas
* before native peer creation (X11) and after it (Windows),
@@ -153,7 +154,7 @@ import jogamp.opengl.awt.AWTTilePainter;
*/
@SuppressWarnings("serial")
-public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosingProtocol, OffscreenLayerOption, AWTPrintLifecycle {
+public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosingProtocol, OffscreenLayerOption, AWTPrintLifecycle, GLSharedContextSetter {
private static final boolean DEBUG = Debug.debug("GLCanvas");
@@ -162,18 +163,20 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
private AWTGraphicsConfiguration awtConfig;
private volatile GLDrawableImpl drawable; // volatile: avoid locking for read-only access
private volatile JAWTWindow jawtWindow; // the JAWTWindow presentation of this AWT Canvas, bound to the 'drawable' lifecycle
- private GLContextImpl context;
+ private volatile GLContextImpl context;
private volatile boolean sendReshape = false; // volatile: maybe written by EDT w/o locking
// copy of the cstr args, mainly for recreation
- private GLCapabilitiesImmutable capsReqUser;
- private GLCapabilitiesChooser chooser;
- private GLContext shareWith;
+ private final GLCapabilitiesImmutable capsReqUser;
+ private final GLCapabilitiesChooser chooser;
private int additionalCtxCreationFlags = 0;
- private GraphicsDevice device;
+ private final GraphicsDevice device;
private boolean shallUseOffscreenLayer = false;
- private AWTWindowClosingProtocol awtWindowClosingProtocol =
+ protected GLContext sharedContext = null;
+ protected GLAutoDrawable sharedAutoDrawable = null;
+
+ private final AWTWindowClosingProtocol awtWindowClosingProtocol =
new AWTWindowClosingProtocol(this, new Runnable() {
@Override
public void run() {
@@ -207,6 +210,8 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
*
* @throws GLException if no GLCapabilities are given and no default profile is available for the default desktop device.
* @see GLCanvas#GLCanvas(javax.media.opengl.GLCapabilitiesImmutable, javax.media.opengl.GLCapabilitiesChooser, javax.media.opengl.GLContext, java.awt.GraphicsDevice)
+ * @deprecated Use {@link #GLCanvas(GLCapabilitiesImmutable)}
+ * and set shared GLContext via {@link #setSharedContext(GLContext)} or {@link #setSharedAutoDrawable(GLAutoDrawable)}.
*/
public GLCanvas(GLCapabilitiesImmutable capsReqUser, GLContext shareWith)
throws GLException
@@ -214,6 +219,26 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
this(capsReqUser, null, shareWith, null);
}
+ /** Creates a new GLCanvas component. The passed GLCapabilities
+ specifies the OpenGL capabilities for the component; if null, a
+ default set of capabilities is used. The GLCapabilitiesChooser
+ specifies the algorithm for selecting one of the available
+ GLCapabilities for the component; a DefaultGLCapabilitesChooser
+ is used if null is passed for this argument.
+ The passed GraphicsDevice indicates the screen on
+ which to create the GLCanvas; the GLDrawableFactory uses the
+ default screen device of the local GraphicsEnvironment if null
+ is passed for this argument.
+ * @throws GLException if no GLCapabilities are given and no default profile is available for the default desktop device.
+ */
+ public GLCanvas(GLCapabilitiesImmutable capsReqUser,
+ GLCapabilitiesChooser chooser,
+ GraphicsDevice device)
+ throws GLException
+ {
+ this(capsReqUser, chooser, null, device);
+ }
+
/** Creates a new GLCanvas component. The passed GLCapabilities
specifies the OpenGL capabilities for the component; if null, a
default set of capabilities is used. The GLCapabilitiesChooser
@@ -224,12 +249,14 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
textures, display lists and other OpenGL state, and may be null
if sharing is not desired. See the note in the overview
documentation on context
+ href="../../../spec-summary.html#SHARING">context
sharing. The passed GraphicsDevice indicates the screen on
which to create the GLCanvas; the GLDrawableFactory uses the
default screen device of the local GraphicsEnvironment if null
is passed for this argument.
* @throws GLException if no GLCapabilities are given and no default profile is available for the default desktop device.
+ * @deprecated Use {@link #GLCanvas(GLCapabilitiesImmutable, GLCapabilitiesChooser, GraphicsDevice)}
+ * and set shared GLContext via {@link #setSharedContext(GLContext)} or {@link #setSharedAutoDrawable(GLAutoDrawable)}.
*/
public GLCanvas(GLCapabilitiesImmutable capsReqUser,
GLCapabilitiesChooser chooser,
@@ -266,10 +293,20 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
// instantiation will be issued in addNotify()
this.capsReqUser = capsReqUser;
this.chooser = chooser;
- this.shareWith = shareWith;
+ this.sharedContext = shareWith;
this.device = device;
}
+ @Override
+ public final void setSharedContext(GLContext sharedContext) throws IllegalStateException {
+ helper.setSharedContext(this.context, sharedContext);
+ }
+
+ @Override
+ public final void setSharedAutoDrawable(GLAutoDrawable sharedAutoDrawable) throws IllegalStateException {
+ helper.setSharedAutoDrawable(this, sharedAutoDrawable);
+ }
+
@Override
public final Object getUpstreamWidget() {
return this;
@@ -383,7 +420,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
destroyImpl( true );
// recreation!
awtConfig = config;
- createDrawableAndContext( true );
+ createJAWTDrawableAndContext();
validateGLDrawable();
} else {
awtConfig = config;
@@ -592,7 +629,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
// after native peer is valid: Windows
disableBackgroundErase();
- createDrawableAndContext( true );
+ createJAWTDrawableAndContext();
// init drawable by paint/display makes the init sequence more equal
// for all launch flavors (applet/javaws/..)
@@ -608,22 +645,35 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
}
}
- private void createDrawableAndContext(boolean createJAWTWindow) {
+ private void createJAWTDrawableAndContext() {
if ( !Beans.isDesignTime() ) {
- if( createJAWTWindow ) {
- jawtWindow = (JAWTWindow) NativeWindowFactory.getNativeWindow(this, awtConfig);
- jawtWindow.setShallUseOffscreenLayer(shallUseOffscreenLayer);
- }
+ jawtWindow = (JAWTWindow) NativeWindowFactory.getNativeWindow(this, awtConfig);
+ jawtWindow.setShallUseOffscreenLayer(shallUseOffscreenLayer);
jawtWindow.lockSurface();
try {
drawable = (GLDrawableImpl) GLDrawableFactory.getFactory(capsReqUser.getGLProfile()).createGLDrawable(jawtWindow);
- context = (GLContextImpl) drawable.createContext(shareWith);
- context.setContextCreationFlags(additionalCtxCreationFlags);
+ createContextImpl(drawable);
} finally {
jawtWindow.unlockSurface();
}
}
}
+ private boolean createContextImpl(final GLDrawable drawable) {
+ final GLContext[] shareWith = { null };
+ if( !helper.isSharedGLContextPending(shareWith) ) {
+ context = (GLContextImpl) drawable.createContext(shareWith[0]);
+ context.setContextCreationFlags(additionalCtxCreationFlags);
+ if(DEBUG) {
+ System.err.println(getThreadName()+": Context created: has shared "+(null != shareWith[0]));
+ }
+ return true;
+ } else {
+ if(DEBUG) {
+ System.err.println(getThreadName()+": Context !created: pending share");
+ }
+ return false;
+ }
+ }
private boolean validateGLDrawable() {
if( Beans.isDesignTime() || !isDisplayable() ) {
@@ -631,17 +681,22 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
}
final GLDrawable _drawable = drawable;
if ( null != _drawable ) {
- if( _drawable.isRealized() ) {
- return true;
- }
- if( 0 >= _drawable.getWidth() || 0 >= _drawable.getHeight() ) {
- return false; // early out!
+ boolean res = _drawable.isRealized();
+ if( !res ) {
+ // re-try drawable creation
+ if( 0 >= _drawable.getWidth() || 0 >= _drawable.getHeight() ) {
+ return false; // early out!
+ }
+ setRealized(true);
+ res = _drawable.isRealized();
+ if(DEBUG) {
+ System.err.println(getThreadName()+": Realized Drawable: isRealized "+res+", "+_drawable.toString());
+ // Thread.dumpStack();
+ }
}
- setRealized(true);
- final boolean res = _drawable.isRealized();
- if(DEBUG) {
- System.err.println(getThreadName()+": Realized Drawable: isRealized "+res+", "+_drawable.toString());
- // Thread.dumpStack();
+ if( res && null == context ) {
+ // re-try context creation
+ res = createContextImpl(_drawable); // pending creation.
}
return res;
}
@@ -791,8 +846,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile());
printGLAD = factory.createOffscreenAutoDrawable(null, caps, null,
printAWTTiles.customTileWidth != -1 ? printAWTTiles.customTileWidth : DEFAULT_PRINT_TILE_SIZE,
- printAWTTiles.customTileHeight != -1 ? printAWTTiles.customTileHeight : DEFAULT_PRINT_TILE_SIZE,
- null);
+ printAWTTiles.customTileHeight != -1 ? printAWTTiles.customTileHeight : DEFAULT_PRINT_TILE_SIZE);
GLDrawableUtil.swapGLContextAndAllGLEventListener(GLCanvas.this, printGLAD);
printDrawable = printGLAD.getDelegatedDrawable();
}
@@ -1251,7 +1305,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
private class DisposeGLEventListenerAction implements Runnable {
GLEventListener listener;
- private boolean remove;
+ private final boolean remove;
private DisposeGLEventListenerAction(GLEventListener listener, boolean remove) {
this.listener = listener;
this.remove = remove;
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
index 84db62515..93e8b2c0b 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
@@ -108,22 +108,23 @@ import com.jogamp.opengl.util.texture.TextureState;
support. Provided for compatibility with Swing user interfaces
when adding a heavyweight doesn't work either because of
Z-ordering or LayoutManager problems.
-
+
The GLJPanel can be made transparent by creating it with a
GLCapabilities object with alpha bits specified and calling {@link
#setOpaque}(false). Pixels with resulting OpenGL alpha values less
- than 1.0 will be overlaid on any underlying Swing rendering.
-
+ than 1.0 will be overlaid on any underlying Swing rendering.
+
+
This component attempts to use hardware-accelerated rendering via FBO or pbuffers and
falls back on to software rendering if none of the former are available
using {@link GLDrawableFactory#createOffscreenDrawable(AbstractGraphicsDevice, GLCapabilitiesImmutable, GLCapabilitiesChooser, int, int) GLDrawableFactory.createOffscreenDrawable(..)}.
-
-
+
+
In case FBO is used and GLSL is available, a fragment shader is utilized
to flip the FBO texture vertically. This hardware-accelerated step can be disabled via system property jogl.gljpanel.noglsl.
See details here.
-
-
+
+
The OpenGL path is concluded by copying the rendered pixels an {@link BufferedImage} via {@link GL#glReadPixels(int, int, int, int, int, int, java.nio.Buffer) glReadPixels(..)}
for later Java2D composition.
@@ -210,7 +211,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
return singleAWTGLPixelBufferProvider;
}
- private GLDrawableHelper helper = new GLDrawableHelper();
+ private final GLDrawableHelper helper = new GLDrawableHelper();
private volatile boolean isInitialized;
//
@@ -219,10 +220,10 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
private AWTGLPixelBufferProvider customPixelBufferProvider = null;
/** Single buffered offscreen caps */
private GLCapabilitiesImmutable offscreenCaps;
- private GLProfile glProfile;
- private GLDrawableFactoryImpl factory;
- private GLCapabilitiesChooser chooser;
- private GLContext shareWith;
+ private final GLProfile glProfile;
+ private final GLDrawableFactoryImpl factory;
+ private final GLCapabilitiesChooser chooser;
+ private final GLContext shareWith;
private int additionalCtxCreationFlags = 0;
// Lazy reshape notification: reshapeWidth -> panelWidth -> backend.width
@@ -248,13 +249,13 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
private volatile Backend backend;
// Used by all backends either directly or indirectly to hook up callbacks
- private Updater updater = new Updater();
+ private final Updater updater = new Updater();
private boolean oglPipelineUsable() {
return null == customPixelBufferProvider && useJava2DGLPipeline && java2DGLPipelineOK;
}
- private AWTWindowClosingProtocol awtWindowClosingProtocol =
+ private final AWTWindowClosingProtocol awtWindowClosingProtocol =
new AWTWindowClosingProtocol(this, new Runnable() {
@Override
public void run() {
@@ -289,7 +290,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
GLContext specifies an OpenGL context with which to share
textures, display lists and other OpenGL state, and may be null
if sharing is not desired. See the note in the overview documentation on
- context sharing.
+ context sharing.
Note: Sharing cannot be enabled using J2D OpenGL FBO sharing,
since J2D GL Context must be shared and we can only share one context.
@@ -572,8 +573,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile());
printGLAD = factory.createOffscreenAutoDrawable(null, caps, null,
printAWTTiles.customTileWidth != -1 ? printAWTTiles.customTileWidth : DEFAULT_PRINT_TILE_SIZE,
- printAWTTiles.customTileHeight != -1 ? printAWTTiles.customTileHeight : DEFAULT_PRINT_TILE_SIZE,
- null);
+ printAWTTiles.customTileHeight != -1 ? printAWTTiles.customTileHeight : DEFAULT_PRINT_TILE_SIZE);
GLDrawableUtil.swapGLContextAndAllGLEventListener(GLJPanel.this, printGLAD);
printDrawable = printGLAD.getDelegatedDrawable();
}
@@ -1158,7 +1158,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
private class DisposeGLEventListenerAction implements Runnable {
GLEventListener listener;
- private boolean remove;
+ private final boolean remove;
private DisposeGLEventListenerAction(GLEventListener listener, boolean remove) {
this.listener = listener;
this.remove = remove;
@@ -1268,12 +1268,12 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
protected IntBuffer readBackIntsForCPUVFlip;
// Implementation using software rendering
- private GLDrawableImpl offscreenDrawable;
+ private volatile GLDrawableImpl offscreenDrawable;
private boolean offscreenIsFBO;
private FBObject fboFlipped;
private GLSLTextureRaster glslTextureRaster;
- private GLContextImpl offscreenContext;
+ private volatile GLContextImpl offscreenContext;
private boolean flipVertical;
// For saving/restoring of OpenGL state during ReadPixels
@@ -1694,11 +1694,11 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
private GLContext joglContext;
// State captured from Java2D OpenGL context necessary in order to
// properly render into Java2D back buffer
- private int[] drawBuffer = new int[1];
- private int[] readBuffer = new int[1];
+ private final int[] drawBuffer = new int[1];
+ private final int[] readBuffer = new int[1];
// This is required when the FBO option of the Java2D / OpenGL
// pipeline is active
- private int[] frameBuffer = new int[1];
+ private final int[] frameBuffer = new int[1];
// Current (as of this writing) NVidia drivers have a couple of bugs
// relating to the sharing of framebuffer and renderbuffer objects
// between contexts. It appears we have to (a) reattach the color
diff --git a/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java b/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java
index bb2983399..42d0a2ec4 100644
--- a/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java
+++ b/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java
@@ -45,8 +45,10 @@ import javax.media.opengl.GLContext;
import javax.media.opengl.GLDrawable;
import javax.media.opengl.GLEventListener;
import javax.media.opengl.GLException;
+import javax.media.opengl.GLOffscreenAutoDrawable;
import javax.media.opengl.GLProfile;
import javax.media.opengl.GLRunnable;
+import javax.media.opengl.GLSharedContextSetter;
import com.jogamp.common.util.locks.RecursiveLock;
import com.jogamp.opengl.GLAutoDrawableDelegate;
@@ -59,17 +61,18 @@ import com.jogamp.opengl.GLStateKeeper;
*
* @see GLAutoDrawable
* @see GLAutoDrawableDelegate
+ * @see GLOffscreenAutoDrawable
+ * @see GLOffscreenAutoDrawableImpl
* @see GLPBufferImpl
- * @see GLWindow
+ * @see com.jogamp.newt.opengl.GLWindow
*/
-public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeeper, FPSCounter {
+public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeeper, FPSCounter, GLSharedContextSetter {
public static final boolean DEBUG = GLDrawableImpl.DEBUG;
-
protected final GLDrawableHelper helper = new GLDrawableHelper();
protected final FPSCounterImpl fpsCounter = new FPSCounterImpl();
protected volatile GLDrawableImpl drawable; // volatile: avoid locking for read-only access
- protected GLContextImpl context;
+ protected volatile GLContextImpl context;
protected boolean preserveGLELSAtDestroy;
protected GLEventListenerState glels;
protected GLStateKeeper.Listener glStateKeeperListener;
@@ -79,12 +82,19 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe
protected volatile boolean sendDestroy = false; // volatile: maybe written by WindowManager thread w/o locking
/**
+ *
+ * The {@link GLContext} can be assigned later manually via {@link GLAutoDrawable#setContext(GLContext, boolean) setContext(ctx)}
+ * or it will be created lazily at the 1st {@link GLAutoDrawable#display() display()} method call.
+ * Lazy {@link GLContext} creation will take a shared {@link GLContext} into account
+ * which has been set {@link #setSharedContext(GLContext) directly}
+ * or {@link #setSharedAutoDrawable(GLAutoDrawable) via another GLAutoDrawable}.
+ *
* @param drawable upstream {@link GLDrawableImpl} instance,
* may be null for lazy initialization
* @param context upstream {@link GLContextImpl} instance,
* may not have been made current (created) yet,
* may not be associated w/ drawable yet,
- * may be null for lazy initialization
+ * may be null for lazy initialization at 1st {@link #display()}.
* @param ownsDevice pass true if {@link AbstractGraphicsDevice#close()} shall be issued,
* otherwise pass false. Closing the device is required in case
* the drawable is created w/ it's own new instance, e.g. offscreen drawables,
@@ -103,6 +113,16 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe
resetFPSCounter();
}
+ @Override
+ public final void setSharedContext(GLContext sharedContext) throws IllegalStateException {
+ helper.setSharedContext(this.context, sharedContext);
+ }
+
+ @Override
+ public final void setSharedAutoDrawable(GLAutoDrawable sharedAutoDrawable) throws IllegalStateException {
+ helper.setSharedAutoDrawable(this, sharedAutoDrawable);
+ }
+
/** Returns the recursive lock object of the upstream implementation, which synchronizes multithreaded access on top of {@link NativeSurface#lockSurface()}. */
protected abstract RecursiveLock getLock();
@@ -142,16 +162,16 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe
}
/**
- * Pulls the {@link GLEventListenerState} from this {@link GLAutoDrawable}.
+ * Preserves the {@link GLEventListenerState} from this {@link GLAutoDrawable}.
*
- * @return true if the {@link GLEventListenerState} is pulled successfully from this {@link GLAutoDrawable},
+ * @return true if the {@link GLEventListenerState} is preserved successfully from this {@link GLAutoDrawable},
* otherwise false.
*
- * @throws IllegalStateException if the {@link GLEventListenerState} is already pulled
+ * @throws IllegalStateException if the {@link GLEventListenerState} is already preserved
*
- * @see #pushGLEventListenerState()
+ * @see #restoreGLEventListenerState()
*/
- protected final boolean pullGLEventListenerState() throws IllegalStateException {
+ protected final boolean preserveGLEventListenerState() throws IllegalStateException {
if( null != glels ) {
throw new IllegalStateException("GLEventListenerState already pulled");
}
@@ -166,15 +186,15 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe
}
/**
- * Pushes a previously {@link #pullGLEventListenerState() pulled} {@link GLEventListenerState} to this {@link GLAutoDrawable}.
+ * Restores a previously {@link #preserveGLEventListenerState() preserved} {@link GLEventListenerState} to this {@link GLAutoDrawable}.
*
- * @return true if the {@link GLEventListenerState} was previously {@link #pullGLEventListenerState() pulled}
- * and is pushed successfully to this {@link GLAutoDrawable},
+ * @return true if the {@link GLEventListenerState} was previously {@link #preserveGLEventListenerState() preserved}
+ * and is moved successfully to this {@link GLAutoDrawable},
* otherwise false.
*
- * @see #pullGLEventListenerState()
+ * @see #preserveGLEventListenerState()
*/
- protected final boolean pushGLEventListenerState() {
+ protected final boolean restoreGLEventListenerState() {
if( null != glels ) {
glels.moveTo(this);
glels = null;
@@ -320,7 +340,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe
protected void destroyImplInLock() {
if( preserveGLELSAtDestroy ) {
preserveGLStateAtDestroy(false);
- pullGLEventListenerState();
+ preserveGLEventListenerState();
}
if( null != context ) {
if( context.isCreated() ) {
@@ -389,7 +409,25 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe
final RecursiveLock _lock = getLock();
_lock.lock();
try {
- if( null != context ) {
+ if( null == context ) {
+ boolean contextCreated = false;
+ final GLDrawableImpl _drawable = drawable;
+ if ( null != _drawable && _drawable.isRealized() && 0<_drawable.getWidth()*_drawable.getHeight() ) {
+ final GLContext[] shareWith = { null };
+ if( !helper.isSharedGLContextPending(shareWith) ) {
+ if( !restoreGLEventListenerState() ) {
+ context = (GLContextImpl) _drawable.createContext(shareWith[0]);
+ context.setContextCreationFlags(additionalCtxCreationFlags);
+ contextCreated = true;
+ // surface is locked/unlocked implicit by context's makeCurrent/release
+ helper.invokeGL(_drawable, context, defaultDisplayAction, defaultInitAction);
+ }
+ }
+ }
+ if(DEBUG) {
+ System.err.println("GLAutoDrawableBase.defaultDisplay: contextCreated "+contextCreated);
+ }
+ } else {
// surface is locked/unlocked implicit by context's makeCurrent/release
helper.invokeGL(drawable, context, defaultDisplayAction, defaultInitAction);
}
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index dff55488d..377ebd9f5 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -429,7 +429,7 @@ public abstract class GLContextImpl extends GLContext {
contextHandle = 0;
glDebugHandler = null;
// this maybe impl. in a platform specific way to release remaining shared ctx.
- if(GLContextShareSet.contextDestroyed(this) && !GLContextShareSet.hasCreatedSharedLeft(this)) {
+ if( GLContextShareSet.contextDestroyed(this) && !GLContextShareSet.hasCreatedSharedLeft(this) ) {
GLContextShareSet.unregisterSharing(this);
}
resetStates(false);
@@ -647,7 +647,7 @@ public abstract class GLContextImpl extends GLContext {
additionalCtxCreationFlags |= GLContext.CTX_OPTION_DEBUG ;
}
- final GLContextImpl shareWith = (GLContextImpl) GLContextShareSet.getShareContext(this);
+ final GLContextImpl shareWith = (GLContextImpl) GLContextShareSet.getCreatedShare(this);
if (null != shareWith) {
shareWith.getDrawableImpl().lockSurface();
}
diff --git a/src/jogl/classes/jogamp/opengl/GLContextShareSet.java b/src/jogl/classes/jogamp/opengl/GLContextShareSet.java
index 70ade34b7..483767b44 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextShareSet.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextShareSet.java
@@ -40,7 +40,8 @@
package jogamp.opengl;
-import java.util.HashMap;
+import java.util.ArrayList;
+import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
@@ -59,15 +60,15 @@ public class GLContextShareSet {
// This class is implemented using a HashMap which maps from all shared contexts
// to a share set, containing all shared contexts itself.
- private static final Map shareMap = new HashMap();
+ private static final Map shareMap = new IdentityHashMap();
private static final Object dummyValue = new Object();
private static class ShareSet {
- private Map allShares = new HashMap();
- private Map createdShares = new HashMap();
- private Map destroyedShares = new HashMap();
+ private final Map allShares = new IdentityHashMap();
+ private final Map createdShares = new IdentityHashMap();
+ private final Map destroyedShares = new IdentityHashMap();
- public void add(GLContext ctx) {
+ public void add(final GLContext ctx) {
if (allShares.put(ctx, dummyValue) == null) {
if (ctx.isCreated()) {
createdShares.put(ctx, dummyValue);
@@ -85,9 +86,9 @@ public class GLContextShareSet {
return destroyedShares.keySet();
}
- public GLContext getCreatedShare(GLContext ignore) {
- for (Iterator iter = createdShares.keySet().iterator(); iter.hasNext(); ) {
- GLContext ctx = iter.next();
+ public GLContext getCreatedShare(final GLContext ignore) {
+ for (final Iterator iter = createdShares.keySet().iterator(); iter.hasNext(); ) {
+ final GLContext ctx = iter.next();
if (ctx != ignore) {
return ctx;
}
@@ -95,21 +96,21 @@ public class GLContextShareSet {
return null;
}
- public void contextCreated(GLContext ctx) {
- Object res = destroyedShares.remove(ctx);
+ public void contextCreated(final GLContext ctx) {
+ final Object res = destroyedShares.remove(ctx);
assert res != null : "State of ShareSet corrupted; thought context " +
ctx + " should have been in destroyed set but wasn't";
- res = createdShares.put(ctx, dummyValue);
- assert res == null : "State of ShareSet corrupted; thought context " +
+ final Object res2 = createdShares.put(ctx, dummyValue);
+ assert res2 == null : "State of ShareSet corrupted; thought context " +
ctx + " shouldn't have been in created set but was";
}
- public void contextDestroyed(GLContext ctx) {
- Object res = createdShares.remove(ctx);
+ public void contextDestroyed(final GLContext ctx) {
+ final Object res = createdShares.remove(ctx);
assert res != null : "State of ShareSet corrupted; thought context " +
ctx + " should have been in created set but wasn't";
- res = destroyedShares.put(ctx, dummyValue);
- assert res == null : "State of ShareSet corrupted; thought context " +
+ final Object res2 = destroyedShares.put(ctx, dummyValue);
+ assert res2 == null : "State of ShareSet corrupted; thought context " +
ctx + " shouldn't have been in destroyed set but was";
}
}
@@ -117,7 +118,7 @@ public class GLContextShareSet {
/** Indicate that contexts share1 and
share2 will share textures and display lists. Both
must be non-null. */
- public static synchronized void registerSharing(GLContext share1, GLContext share2) {
+ public static synchronized void registerSharing(final GLContext share1, final GLContext share2) {
if (share1 == null || share2 == null) {
throw new IllegalArgumentException("Both share1 and share2 must be non-null");
}
@@ -138,7 +139,7 @@ public class GLContextShareSet {
}
}
- public static synchronized void unregisterSharing(GLContext lastContext) {
+ public static synchronized void unregisterSharing(final GLContext lastContext) {
if (lastContext == null) {
throw new IllegalArgumentException("Last context is null");
}
@@ -166,7 +167,25 @@ public class GLContextShareSet {
}
}
- private static synchronized Set getCreatedSharedImpl(GLContext context) {
+ /** Returns true if the given GLContext is shared, otherwise false. */
+ public static synchronized boolean isShared(final GLContext context) {
+ if (context == null) {
+ throw new IllegalArgumentException("context is null");
+ }
+ final ShareSet share = entryFor(context);
+ return share != null;
+ }
+
+ /** Returns one created GLContext shared with the given context, otherwise return null. */
+ public static synchronized GLContext getCreatedShare(final GLContext context) {
+ final ShareSet share = entryFor(context);
+ if (share == null) {
+ return null;
+ }
+ return share.getCreatedShare(context);
+ }
+
+ private static synchronized Set getCreatedSharesImpl(final GLContext context) {
if (context == null) {
throw new IllegalArgumentException("context is null");
}
@@ -176,50 +195,56 @@ public class GLContextShareSet {
}
return null;
}
-
- public static synchronized boolean isShared(GLContext context) {
+ private static synchronized Set getDestroyedSharesImpl(final GLContext context) {
if (context == null) {
throw new IllegalArgumentException("context is null");
}
final ShareSet share = entryFor(context);
- return share != null;
+ if (share != null) {
+ return share.getDestroyedShares();
+ }
+ return null;
}
+ /** Returns true if the given GLContext has shared and created GLContext left including itself, otherwise false. */
public static synchronized boolean hasCreatedSharedLeft(GLContext context) {
- final Set s = getCreatedSharedImpl(context);
- return null != s && s.size()>0 ;
+ final Set s = getCreatedSharesImpl(context);
+ return null != s && s.size() > 0;
}
- /** currently not used ..
- public static synchronized Set getCreatedShared(GLContext context) {
- final Set s = getCreatedSharedImpl(context);
- if (s == null) {
- throw new GLException("context is unknown: "+context);
- }
- return s;
+ /** Returns a new array-list of created GLContext shared with the given GLContext. */
+ public static synchronized ArrayList getCreatedShares(final GLContext context) {
+ final ArrayList otherShares = new ArrayList();
+ final Set createdShares = getCreatedSharesImpl(context);
+ if( null != createdShares ) {
+ for (final Iterator iter = createdShares.iterator(); iter.hasNext(); ) {
+ final GLContext ctx = iter.next();
+ if (ctx != context) {
+ otherShares.add(ctx);
+ }
+ }
+ }
+ return otherShares;
}
- public static synchronized Set getDestroyedShared(GLContext context) {
- if (context == null) {
- throw new IllegalArgumentException("context is null");
- }
- ShareSet share = entryFor(context);
- if (share == null) {
- throw new GLException("context is unknown: "+context);
- }
- return share.getDestroyedShares();
- } */
-
- public static synchronized GLContext getShareContext(GLContext contextToCreate) {
- ShareSet share = entryFor(contextToCreate);
- if (share == null) {
- return null;
- }
- return share.getCreatedShare(contextToCreate);
+ /** Returns a new array-list of destroyed GLContext shared with the given GLContext. */
+ public static synchronized ArrayList getDestroyedShares(final GLContext context) {
+ final ArrayList otherShares = new ArrayList();
+ final Set destroyedShares = getDestroyedSharesImpl(context);
+ if( null != destroyedShares ) {
+ for (final Iterator iter = destroyedShares.iterator(); iter.hasNext(); ) {
+ final GLContext ctx = iter.next();
+ if (ctx != context) {
+ otherShares.add(ctx);
+ }
+ }
+ }
+ return otherShares;
}
- public static synchronized boolean contextCreated(GLContext context) {
- ShareSet share = entryFor(context);
+ /** Mark the given GLContext as being created. */
+ public static synchronized boolean contextCreated(final GLContext context) {
+ final ShareSet share = entryFor(context);
if (share != null) {
share.contextCreated(context);
return true;
@@ -227,8 +252,9 @@ public class GLContextShareSet {
return false;
}
- public static synchronized boolean contextDestroyed(GLContext context) {
- ShareSet share = entryFor(context);
+ /** Mark the given GLContext as being destroyed. */
+ public static synchronized boolean contextDestroyed(final GLContext context) {
+ final ShareSet share = entryFor(context);
if (share != null) {
share.contextDestroyed(context);
return true;
@@ -245,9 +271,9 @@ public class GLContextShareSet {
currently only needed in a fairly esoteric case, when the
Java2D/JOGL bridge is active, but the GLBufferSizeTracker
mechanism is now always required.) */
- public static void synchronizeBufferObjectSharing(GLContext olderContextOrNull, GLContext newContext) {
- GLContextImpl older = (GLContextImpl) olderContextOrNull;
- GLContextImpl newer = (GLContextImpl) newContext;
+ public static void synchronizeBufferObjectSharing(final GLContext olderContextOrNull, final GLContext newContext) {
+ final GLContextImpl older = (GLContextImpl) olderContextOrNull;
+ final GLContextImpl newer = (GLContextImpl) newContext;
GLBufferSizeTracker tracker = null;
if (older != null) {
tracker = older.getBufferSizeTracker();
@@ -264,20 +290,20 @@ public class GLContextShareSet {
// Internals only below this point
- private static ShareSet entryFor(GLContext context) {
- return (ShareSet) shareMap.get(context);
+ private static ShareSet entryFor(final GLContext context) {
+ return shareMap.get(context);
}
- private static void addEntry(GLContext context, ShareSet share) {
+ private static void addEntry(final GLContext context, final ShareSet share) {
if (shareMap.get(context) == null) {
shareMap.put(context, share);
}
}
- private static ShareSet removeEntry(GLContext context) {
- return (ShareSet) shareMap.remove(context);
+ private static ShareSet removeEntry(final GLContext context) {
+ return shareMap.remove(context);
}
- protected static String toHexString(long hex) {
+ private static String toHexString(long hex) {
return "0x" + Long.toHexString(hex);
}
}
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java
index 1e4cb38fa..ecb9f7dd1 100644
--- a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java
@@ -312,6 +312,19 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
return new GLOffscreenAutoDrawableImpl( drawable, context, null, null);
}
+ @Override
+ public final GLOffscreenAutoDrawable createOffscreenAutoDrawable(AbstractGraphicsDevice deviceReq,
+ GLCapabilitiesImmutable capsRequested,
+ GLCapabilitiesChooser chooser,
+ int width, int height) {
+ final GLDrawable drawable = createOffscreenDrawable( deviceReq, capsRequested, chooser, width, height );
+ drawable.setRealized(true);
+ if(drawable instanceof GLFBODrawableImpl) {
+ return new GLOffscreenAutoDrawableImpl.FBOImpl( (GLFBODrawableImpl)drawable, null, null, null );
+ }
+ return new GLOffscreenAutoDrawableImpl( drawable, null, null, null);
+ }
+
@Override
public final GLDrawable createOffscreenDrawable(AbstractGraphicsDevice deviceReq,
GLCapabilitiesImmutable capsRequested,
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
index 4ce6a7121..cf5d7a206 100644
--- a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
+++ b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
@@ -82,6 +82,10 @@ public class GLDrawableHelper {
private GLAnimatorControl animatorCtrl;
private static Runnable nop = new Runnable() { @Override public void run() {} };
+ private GLContext sharedContext;
+ private GLAutoDrawable sharedAutoDrawable;
+
+
public GLDrawableHelper() {
reset();
}
@@ -98,6 +102,60 @@ public class GLDrawableHelper {
glRunnables.clear();
}
animatorCtrl = null;
+ sharedContext = null;
+ sharedAutoDrawable = null;
+ }
+
+ public final void setSharedContext(GLContext thisContext, GLContext sharedContext) throws IllegalStateException {
+ if( null == sharedContext ) {
+ throw new IllegalStateException("Null shared GLContext");
+ }
+ if( thisContext == sharedContext ) {
+ throw new IllegalStateException("Shared GLContext same as local");
+ }
+ if( null != this.sharedContext ) {
+ throw new IllegalStateException("Shared GLContext already set");
+ }
+ if( null != this.sharedAutoDrawable ) {
+ throw new IllegalStateException("Shared GLAutoDrawable already set");
+ }
+ this.sharedContext = sharedContext;
+ }
+
+ public final void setSharedAutoDrawable(GLAutoDrawable thisAutoDrawable, GLAutoDrawable sharedAutoDrawable) throws IllegalStateException {
+ if( null == sharedAutoDrawable ) {
+ throw new IllegalStateException("Null shared GLAutoDrawable");
+ }
+ if( thisAutoDrawable == sharedAutoDrawable ) {
+ throw new IllegalStateException("Shared GLAutoDrawable same as this");
+ }
+ if( null != this.sharedContext ) {
+ throw new IllegalStateException("Shared GLContext already set");
+ }
+ if( null != this.sharedAutoDrawable ) {
+ throw new IllegalStateException("Shared GLAutoDrawable already set");
+ }
+ this.sharedAutoDrawable = sharedAutoDrawable;
+ }
+
+ /**
+ * @param shared returns the shared GLContext, based on set shared GLAutoDrawable
+ * or GLContext. Maybe null if none is set.
+ * @return true if initialization is pending due to a set shared GLAutoDrawable or GLContext
+ * which is not ready yet. Otherwise false.
+ */
+ public boolean isSharedGLContextPending(GLContext[] shared) {
+ final GLContext shareWith;
+ final boolean pending;
+ if ( null != sharedAutoDrawable ) {
+ shareWith = sharedAutoDrawable.getContext();
+ pending = null == shareWith || !shareWith.isCreated();
+ } else {
+ shareWith = sharedContext;
+ pending = null != shareWith && !shareWith.isCreated();
+ }
+ shared[0] = shareWith;
+ return pending;
}
@Override
@@ -612,7 +670,7 @@ public class GLDrawableHelper {
public final void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
synchronized(listenersLock) {
for (int i=0; i < listeners.size(); i++) {
- reshape((GLEventListener) listeners.get(i), drawable, x, y, width, height, 0==i /* setViewport */, true /* checkInit */);
+ reshape(listeners.get(i), drawable, x, y, width, height, 0==i /* setViewport */, true /* checkInit */);
}
}
}
diff --git a/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java
index f175acf28..345f08e4c 100644
--- a/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java
@@ -48,7 +48,7 @@ public class GLOffscreenAutoDrawableImpl extends GLAutoDrawableDelegate implemen
* @param context a valid {@link GLContext},
* may not have been made current (created) yet,
* may not be associated w/ drawable yet,
- * may be null for lazy initialization
+ * may be null for lazy initialization at 1st {@link #display()}.
* @param upstreamWidget optional UI element holding this instance, see {@link #getUpstreamWidget()}.
* @param lock optional upstream lock, may be null
*/
diff --git a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
index 1f5c26f27..70157fe4b 100644
--- a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
+++ b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
@@ -105,7 +105,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
private AWTAdapter awtMouseAdapter = null;
private AWTAdapter awtKeyAdapter = null;
- private AWTWindowClosingProtocol awtWindowClosingProtocol =
+ private final AWTWindowClosingProtocol awtWindowClosingProtocol =
new AWTWindowClosingProtocol(this, new Runnable() {
@Override
public void run() {
@@ -204,7 +204,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
return false; // NEWT shall proceed requesting the native focus
}
}
- private FocusAction focusAction = new FocusAction();
+ private final FocusAction focusAction = new FocusAction();
WindowListener clearAWTMenusOnNewtFocus = new WindowAdapter() {
@Override
@@ -559,8 +559,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile());
printGLAD = factory.createOffscreenAutoDrawable(null, caps, null,
printAWTTiles.customTileWidth != -1 ? printAWTTiles.customTileWidth : DEFAULT_PRINT_TILE_SIZE,
- printAWTTiles.customTileHeight != -1 ? printAWTTiles.customTileHeight : DEFAULT_PRINT_TILE_SIZE,
- null);
+ printAWTTiles.customTileHeight != -1 ? printAWTTiles.customTileHeight : DEFAULT_PRINT_TILE_SIZE);
GLDrawableUtil.swapGLContextAndAllGLEventListener(glad, printGLAD);
printDrawable = printGLAD.getDelegatedDrawable();
}
diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
index 8c1110ed3..4f259fe9a 100644
--- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
+++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
@@ -499,21 +499,24 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
if( ( null != context ) ) {
throw new InternalError("GLWindow.LifecycleHook.setVisiblePost: "+WindowImpl.getThreadName()+" - Null drawable, but valid context - "+GLWindow.this);
}
- final NativeSurface ns;
- {
- final NativeSurface wrapped_ns = window.getWrappedSurface();
- ns = null != wrapped_ns ? wrapped_ns : window;
- }
- final GLCapabilitiesImmutable glCaps = (GLCapabilitiesImmutable) ns.getGraphicsConfiguration().getChosenCapabilities();
- if(null==factory) {
- factory = GLDrawableFactory.getFactory(glCaps.getGLProfile());
- }
- drawable = (GLDrawableImpl) factory.createGLDrawable(ns);
- drawable.setRealized(true);
+ final GLContext[] shareWith = { null };
+ if( !helper.isSharedGLContextPending(shareWith) ) {
+ final NativeSurface ns;
+ {
+ final NativeSurface wrapped_ns = window.getWrappedSurface();
+ ns = null != wrapped_ns ? wrapped_ns : window;
+ }
+ final GLCapabilitiesImmutable glCaps = (GLCapabilitiesImmutable) ns.getGraphicsConfiguration().getChosenCapabilities();
+ if(null==factory) {
+ factory = GLDrawableFactory.getFactory(glCaps.getGLProfile());
+ }
+ drawable = (GLDrawableImpl) factory.createGLDrawable(ns);
+ drawable.setRealized(true);
- if( !GLWindow.this.pushGLEventListenerState() ) {
- context = (GLContextImpl) drawable.createContext(sharedContext);
- context.setContextCreationFlags(additionalCtxCreationFlags);
+ if( !GLWindow.this.restoreGLEventListenerState() ) {
+ context = (GLContextImpl) drawable.createContext(shareWith[0]);
+ context.setContextCreationFlags(additionalCtxCreationFlags);
+ }
}
}
if(Window.DEBUG_IMPLEMENTATION) {
@@ -573,25 +576,11 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
// OpenGL-related methods and state
//
- private GLContext sharedContext = null;
-
@Override
protected final RecursiveLock getLock() {
return window.getLock();
}
- /**
- * Specifies an {@link javax.media.opengl.GLContext OpenGL context} to share with.
- * At native creation, {@link #setVisible(boolean) setVisible(true)},
- * a {@link javax.media.opengl.GLDrawable drawable} and {@link javax.media.opengl.GLContext context} is created besides the native Window itself,
- * hence you shall set the shared context before.
- *
- * @param sharedContext The OpenGL context shared by this GLWindow's one
- */
- public void setSharedContext(GLContext sharedContext) {
- this.sharedContext = sharedContext;
- }
-
@Override
public void display() {
if( !isNativeValid() || !isVisible() ) { return; }
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableDeadlockAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableDeadlockAWT.java
index 2df14d151..1548c08b5 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableDeadlockAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableDeadlockAWT.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -61,12 +61,8 @@ public class TestFBOAutoDrawableDeadlockAWT extends UITestCase {
}
protected void runTestGL( GLCapabilities caps ) throws InterruptedException, InvocationTargetException {
- final GLOffscreenAutoDrawable fbod = GLDrawableFactory.getFactory(caps.getGLProfile()).createOffscreenAutoDrawable(
- null,
- caps, new DefaultGLCapabilitiesChooser(),
- 512, 512,
- null
- );
+ final GLOffscreenAutoDrawable fbod = GLDrawableFactory.getFactory(caps.getGLProfile()).createOffscreenAutoDrawable(
+ null, caps, new DefaultGLCapabilitiesChooser(), 512, 512);
final boolean[] done = {false};
final Runnable pbufferCreationAction = new Runnable() {
@@ -77,30 +73,30 @@ public class TestFBOAutoDrawableDeadlockAWT extends UITestCase {
System.err.println("AA.X");
}
};
-
+
EventQueue.invokeAndWait(new Runnable() {
public void run() {
Assert.assertTrue(EventQueue.isDispatchThread());
JAWTUtil.lockToolkit();
try {
- final RunnableTask rTask = new RunnableTask(pbufferCreationAction, new Object(), false, null);
+ final RunnableTask rTask = new RunnableTask(pbufferCreationAction, new Object(), false, null);
System.err.println("BB.0: "+rTask.getSyncObject());
synchronized (rTask.getSyncObject()) {
System.err.println("BB.1: "+rTask.getSyncObject());
- new Thread(rTask, Thread.currentThread().getName()+"-Pbuffer_Creation").start();
+ new Thread(rTask, Thread.currentThread().getName()+"-Pbuffer_Creation").start();
try {
System.err.println("BB.2");
rTask.getSyncObject().wait();
System.err.println("BB.3");
} catch (InterruptedException e) {
throw new RuntimeException(e);
- }
+ }
System.err.println("BB.X");
}
} finally {
JAWTUtil.unlockToolkit();
}
- }
+ }
});
Assert.assertTrue(done[0]);
fbod.destroy();
@@ -128,4 +124,4 @@ public class TestFBOAutoDrawableDeadlockAWT extends UITestCase {
}
org.junit.runner.JUnitCore.main( TestFBOAutoDrawableDeadlockAWT.class.getName() );
}
-}
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableFactoryNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableFactoryNEWT.java
index 9151a88a5..cc06136d6 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableFactoryNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableFactoryNEWT.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.opengl.test.junit.jogl.acore;
import java.io.IOException;
@@ -52,53 +52,53 @@ import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
/**
- * Toolkit agnostic {@link GLOffscreenAutoDrawable.FBO} tests using the
- * {@link GLDrawableFactory#createOffscreenAutoDrawable(javax.media.nativewindow.AbstractGraphicsDevice, GLCapabilitiesImmutable, javax.media.opengl.GLCapabilitiesChooser, int, int, GLContext) factory model}.
+ * Toolkit agnostic {@link GLOffscreenAutoDrawable.FBO} tests using the
+ * {@link GLDrawableFactory#createOffscreenAutoDrawable(javax.media.nativewindow.AbstractGraphicsDevice, GLCapabilitiesImmutable, javax.media.opengl.GLCapabilitiesChooser, int, int, GLContext) factory model}.
*
- * The created {@link GLOffscreenAutoDrawable.FBO} is being used to run the {@link GLEventListener}.
+ * The created {@link GLOffscreenAutoDrawable.FBO} is being used to run the {@link GLEventListener}.
*
*
* Extensive FBO reconfiguration (size and sample buffer count) and validation are performed.
- *
+ *
*/
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestFBOAutoDrawableFactoryNEWT extends UITestCase {
-
+
static final int widthStep = 800/4;
static final int heightStep = 600/4;
volatile int szStep = 2;
-
+
interface MyGLEventListener extends GLEventListener {
void setMakeSnapshot();
}
-
+
@Test
- public void testGL2ES2_Demo1_SingleBuffer_Normal() throws InterruptedException {
+ public void testGL2ES2_Demo1_SingleBuffer_Normal() throws InterruptedException {
final GLProfile glp = GLProfile.getGL2ES2();
final GLCapabilities caps = new GLCapabilities(glp);
caps.setDoubleBuffered(false);
testGLFBODrawableImpl(caps, new GearsES2(0));
}
-
+
@Test
- public void testGL2ES2_Demo1_DoubleBuffer_Normal() throws InterruptedException {
+ public void testGL2ES2_Demo1_DoubleBuffer_Normal() throws InterruptedException {
final GLProfile glp = GLProfile.getGL2ES2();
final GLCapabilities caps = new GLCapabilities(glp);
caps.setDoubleBuffered(true); // default
testGLFBODrawableImpl(caps, new GearsES2(0));
}
-
+
@Test
- public void testGL2ES2_Demo2MSAA4() throws InterruptedException {
+ public void testGL2ES2_Demo2MSAA4() throws InterruptedException {
final GLProfile glp = GLProfile.getGL2ES2();
final GLCapabilities caps = new GLCapabilities(glp);
caps.setSampleBuffers(true);
caps.setNumSamples(4);
testGLFBODrawableImpl(caps, new MultisampleDemoES2(true));
}
-
+
@Test
- public void testGL2ES2_FBODemoMSAA4() throws InterruptedException {
+ public void testGL2ES2_FBODemoMSAA4() throws InterruptedException {
final GLProfile glp = GLProfile.getGL2ES2();
final FBOMix2DemosES2 demo = new FBOMix2DemosES2(0);
demo.setDoRotation(false);
@@ -107,9 +107,9 @@ public class TestFBOAutoDrawableFactoryNEWT extends UITestCase {
caps.setNumSamples(4);
testGLFBODrawableImpl(caps, demo);
}
-
+
@Test
- public void testEGLES2_Demo0Normal() throws InterruptedException {
+ public void testEGLES2_Demo0Normal() throws InterruptedException {
if( GLProfile.isAvailable(GLProfile.GLES2) ) {
final GLProfile glp = GLProfile.get(GLProfile.GLES2);
final GLCapabilities caps = new GLCapabilities(glp);
@@ -118,9 +118,9 @@ public class TestFBOAutoDrawableFactoryNEWT extends UITestCase {
System.err.println("EGL ES2 n/a");
}
}
-
+
@Test
- public void testEGLES2_Demo0MSAA4() throws InterruptedException {
+ public void testEGLES2_Demo0MSAA4() throws InterruptedException {
if( GLProfile.isAvailable(GLProfile.GLES2) ) {
final GLProfile glp = GLProfile.get(GLProfile.GLES2);
final GLCapabilities caps = new GLCapabilities(glp);
@@ -136,71 +136,71 @@ public class TestFBOAutoDrawableFactoryNEWT extends UITestCase {
caps.setFBO(true);
final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile());
final GLOffscreenAutoDrawable.FBO glad = (GLOffscreenAutoDrawable.FBO)
- factory.createOffscreenAutoDrawable(null, caps, null, widthStep*szStep, heightStep*szStep, null);
+ factory.createOffscreenAutoDrawable(null, caps, null, widthStep*szStep, heightStep*szStep);
Assert.assertNotNull(glad);
-
+
System.out.println("Realized GLAD: "+glad);
System.out.println("Realized GLAD: "+glad.getChosenGLCapabilities());
Assert.assertTrue("FBO drawable is initialized before ctx creation", !glad.isInitialized());
-
+
glad.display(); // initial display incl. init!
{
final GLContext context = glad.getContext();
Assert.assertNotNull(context);
Assert.assertTrue(context.isCreated());
}
- Assert.assertTrue("FBO drawable is not initialized after ctx creation", glad.isInitialized());
-
+ Assert.assertTrue("FBO drawable is not initialized after ctx creation", glad.isInitialized());
+
//
// FBO incl. MSAA is fully initialized now
//
-
+
final GLCapabilitiesImmutable chosenCaps = glad.getChosenGLCapabilities();
System.out.println("Init GLAD: "+glad);
System.out.println("Init GLAD: "+chosenCaps);
-
+
final FBObject fboFront = glad.getFBObject(GL.GL_FRONT);
final FBObject fboBack = glad.getFBObject(GL.GL_BACK);
-
+
System.out.println("Init front FBO: "+fboFront);
System.out.println("Init back FBO: "+fboBack);
-
+
Assert.assertTrue("FBO drawable is not initialized before ctx creation", glad.isInitialized());
Assert.assertTrue("FBO Front is not initialized before ctx creation", fboFront.isInitialized());
Assert.assertTrue("FBO Back is not initialized before ctx creation", fboBack.isInitialized());
-
+
if( chosenCaps.getDoubleBuffered() ) {
Assert.assertTrue("FBO are equal: "+fboFront+" == "+fboBack, !fboFront.equals(fboBack));
Assert.assertNotSame(fboFront, fboBack);
} else {
Assert.assertTrue("FBO are not equal: "+fboFront+" != "+fboBack, fboFront.equals(fboBack));
- Assert.assertSame(fboFront, fboBack);
+ Assert.assertSame(fboFront, fboBack);
}
-
+
final FBObject.TextureAttachment texAttachA, texAttachB;
-
+
texAttachA = glad.getTextureBuffer(GL.GL_FRONT);
if(0==glad.getNumSamples()) {
texAttachB = glad.getTextureBuffer(GL.GL_BACK);
} else {
texAttachB = null;
}
-
+
final FBObject.Colorbuffer colorA, colorB;
final FBObject.RenderAttachment depthA, depthB;
-
+
colorA = fboFront.getColorbuffer(0);
Assert.assertNotNull(colorA);
colorB = fboBack.getColorbuffer(0);
Assert.assertNotNull(colorB);
-
+
depthA = fboFront.getDepthAttachment();
Assert.assertNotNull(depthA);
depthB = fboBack.getDepthAttachment();
Assert.assertNotNull(depthB);
glad.display(); // SWAP_ODD
-
+
if( chosenCaps.getDoubleBuffered() ) {
// double buffer or MSAA
Assert.assertTrue("Color attachments are equal: "+colorB+" == "+colorA, !colorB.equals(colorA));
@@ -214,16 +214,16 @@ public class TestFBOAutoDrawableFactoryNEWT extends UITestCase {
Assert.assertEquals(depthA, depthB);
Assert.assertSame(depthA, depthB);
}
-
+
Assert.assertEquals(texAttachA, colorA);
Assert.assertSame(texAttachA, colorA);
if(0==glad.getNumSamples()) {
Assert.assertEquals(texAttachB, colorB);
- Assert.assertSame(texAttachB, colorB);
+ Assert.assertSame(texAttachB, colorB);
}
if( chosenCaps.getNumSamples() > 0 ) {
- // MSAA
+ // MSAA
FBObject _fboFront = glad.getFBObject(GL.GL_FRONT);
FBObject _fboBack = glad.getFBObject(GL.GL_BACK);
Assert.assertTrue("FBO are not equal: "+fboFront+" != "+_fboFront, fboFront.equals(_fboFront));
@@ -251,22 +251,22 @@ public class TestFBOAutoDrawableFactoryNEWT extends UITestCase {
Assert.assertTrue("FBO are not equal: "+fboFront+" != "+_fboBack, fboFront.equals(_fboBack));
Assert.assertSame(fboFront, _fboBack);
}
-
+
glad.addGLEventListener(demo);
-
+
final SnapshotGLEventListener snapshotGLEventListener = new SnapshotGLEventListener();
glad.addGLEventListener(snapshotGLEventListener);
-
+
glad.display(); // - SWAP_EVEN
// 1 - szStep = 2
snapshotGLEventListener.setMakeSnapshot();
glad.display(); // - SWAP_ODD
-
+
// 2, 3 (resize + display)
szStep = 1;
glad.setSize(widthStep*szStep, heightStep*szStep); // SWAP_EVEN
- Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
+ Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep));
snapshotGLEventListener.setMakeSnapshot();
glad.display(); // - SWAP_ODD
@@ -283,34 +283,34 @@ public class TestFBOAutoDrawableFactoryNEWT extends UITestCase {
Assert.assertSame(fboFront, _fboFront);
Assert.assertEquals(fboBack, _fboBack);
Assert.assertSame(fboBack, _fboBack);
-
+
FBObject.Colorbuffer _color = _fboFront.getColorbuffer(0);
Assert.assertNotNull(_color);
Assert.assertEquals(colorA, _color);
Assert.assertSame(colorA, _color);
-
+
FBObject.RenderAttachment _depth = _fboFront.getDepthAttachment();
System.err.println("Resize1.oldDepth "+depthA);
System.err.println("Resize1.newDepth "+_depth);
Assert.assertNotNull(_depth);
-
+
Assert.assertEquals(depthA, _depth);
Assert.assertSame(depthA, _depth);
_depth = _fboBack.getDepthAttachment();
Assert.assertNotNull(_depth);
Assert.assertEquals(depthB, _depth);
Assert.assertSame(depthB, _depth);
-
+
_color = _fboFront.getColorbuffer(colorA);
Assert.assertNotNull(_color);
Assert.assertEquals(colorA, _color);
Assert.assertSame(colorA, _color);
}
-
+
// 4, 5 (resize + display)
szStep = 4;
glad.setSize(widthStep*szStep, heightStep*szStep); // SWAP_ODD
- Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
+ Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep));
snapshotGLEventListener.setMakeSnapshot();
glad.display(); // - SWAP_EVEN
@@ -330,47 +330,47 @@ public class TestFBOAutoDrawableFactoryNEWT extends UITestCase {
} else {
// single or MSAA
Assert.assertEquals(fboFront, _fboFront);
- Assert.assertEquals(fboBack, _fboBack);
+ Assert.assertEquals(fboBack, _fboBack);
}
-
+
FBObject.Colorbuffer _color = fboBack.getColorbuffer(0);
Assert.assertNotNull(_color);
Assert.assertEquals(colorB, _color);
Assert.assertSame(colorB, _color);
-
+
FBObject.RenderAttachment _depth = fboBack.getDepthAttachment();
- Assert.assertNotNull(_depth); // MSAA back w/ depth
+ Assert.assertNotNull(_depth); // MSAA back w/ depth
Assert.assertEquals(depthB, _depth);
Assert.assertSame(depthB, _depth);
-
+
_depth = fboFront.getDepthAttachment();
Assert.assertNotNull(_depth);
Assert.assertEquals(depthA, _depth);
Assert.assertSame(depthA, _depth);
-
+
_color = fboBack.getColorbuffer(colorB);
Assert.assertNotNull(_color);
Assert.assertEquals(colorB, _color);
Assert.assertSame(colorB, _color);
}
-
+
// 6 + 7 (samples + display)
glad.setNumSamples(glad.getGL(), chosenCaps.getNumSamples() > 0 ? 0 : 4); // triggers repaint
snapshotGLEventListener.setMakeSnapshot();
glad.display(); // actual screenshot
-
+
// 8, 9 (resize + samples + display)
szStep = 3;
glad.setSize(widthStep*szStep, heightStep*szStep);
- Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
+ Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep));
snapshotGLEventListener.setMakeSnapshot();
glad.display();
-
+
glad.destroy();
System.out.println("Fin: "+glad);
}
-
+
public static void main(String args[]) throws IOException {
org.junit.runner.JUnitCore.main(TestFBOAutoDrawableFactoryNEWT.class.getName());
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOffThreadSharedContextMix2DemosES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOffThreadSharedContextMix2DemosES2NEWT.java
index b3e5e95b0..51dd9df37 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOffThreadSharedContextMix2DemosES2NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOffThreadSharedContextMix2DemosES2NEWT.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.opengl.test.junit.jogl.acore;
import java.io.BufferedReader;
@@ -68,10 +68,10 @@ import org.junit.FixMethodOrder;
import org.junit.runners.MethodSorters;
/**
- * Toolkit agnostic {@link GLOffscreenAutoDrawable.FBO} tests using the
- * {@link GLDrawableFactory#createOffscreenAutoDrawable(javax.media.nativewindow.AbstractGraphicsDevice, GLCapabilitiesImmutable, javax.media.opengl.GLCapabilitiesChooser, int, int, GLContext) factory model}.
+ * Toolkit agnostic {@link GLOffscreenAutoDrawable.FBO} tests using the
+ * {@link GLDrawableFactory#createOffscreenAutoDrawable(javax.media.nativewindow.AbstractGraphicsDevice, GLCapabilitiesImmutable, javax.media.opengl.GLCapabilitiesChooser, int, int, GLContext) factory model}.
*
- * The created {@link GLOffscreenAutoDrawable.FBO} is being used to run the {@link GLEventListener}.
+ * The created {@link GLOffscreenAutoDrawable.FBO} is being used to run the {@link GLEventListener}.
*
*
* This test simulates shared off-thread GL context / texture usage,
@@ -81,7 +81,7 @@ import org.junit.runners.MethodSorters;
*
- *
+ *
+ *
+ *
*/
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
-public class TestFBOOnThreadSharedContext1DemoES2NEWT extends UITestCase {
+public class TestFBOOnThreadSharedContext1DemoES2NEWT extends UITestCase {
static long duration = 500; // ms
static int swapInterval = 1;
static boolean showFPS = false;
static boolean forceES2 = false;
static boolean mainRun = false;
-
+
@AfterClass
public static void releaseClass() {
}
@@ -108,30 +108,31 @@ public class TestFBOOnThreadSharedContext1DemoES2NEWT extends UITestCase {
protected void runTestGL(GLCapabilitiesImmutable caps) throws InterruptedException {
final GLReadBufferUtil screenshot = new GLReadBufferUtil(false, false);
System.err.println("requested: vsync "+swapInterval+", "+caps);
-
+
final GLWindow glWindow = GLWindow.create(caps);
Assert.assertNotNull(glWindow);
glWindow.setTitle("Gears NEWT Test (translucent "+!caps.isBackgroundOpaque()+"), swapInterval "+swapInterval);
if(mainRun) {
- glWindow.setSize(512, 512);
+ glWindow.setSize(512, 512);
} else {
glWindow.setSize(256, 256);
}
// eager initialization of context
glWindow.setVisible(true);
- glWindow.display();
+ glWindow.display();
final int fbod1_texUnit = 0;
-
+
final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile());
GLCapabilities fbodCaps = (GLCapabilities) caps.cloneMutable();
// fbodCaps.setDoubleBuffered(false);
-
+
final Mix2TexturesES2 mixerDemo = new Mix2TexturesES2(1, fbod1_texUnit, 0);
- // FBOD1
+ // FBOD1
final GLOffscreenAutoDrawable.FBO fbod1 = (GLOffscreenAutoDrawable.FBO)
- factory.createOffscreenAutoDrawable(null, fbodCaps, null, glWindow.getWidth(), glWindow.getHeight(), glWindow.getContext());
+ factory.createOffscreenAutoDrawable(null, fbodCaps, null, glWindow.getWidth(), glWindow.getHeight());
+ fbod1.setSharedAutoDrawable(glWindow);
fbod1.setUpstreamWidget(glWindow); // connect the real GLWindow (mouse/key) to offscreen!
fbod1.setTextureUnit(fbod1_texUnit);
{
@@ -148,10 +149,10 @@ public class TestFBOOnThreadSharedContext1DemoES2NEWT extends UITestCase {
fbod1.display(); // init
System.err.println("FBOD1 "+fbod1);
Assert.assertTrue(fbod1.isInitialized());
-
+
// preinit texIDs
mixerDemo.setTexID0(fbod1.getTextureBuffer(GL.GL_FRONT).getName());
-
+
glWindow.addWindowListener(new WindowAdapter() {
@Override
public void windowResized(WindowEvent e) {
@@ -165,33 +166,33 @@ public class TestFBOOnThreadSharedContext1DemoES2NEWT extends UITestCase {
public void dispose(GLAutoDrawable drawable) {}
public void display(GLAutoDrawable drawable) {
if(mainRun) return;
-
+
final int dw = drawable.getWidth();
final int dh = drawable.getHeight();
c++;
-
+
if(dw<800) {
System.err.println("XXX: "+dw+"x"+dh+", c "+c);
if(8 == c) {
- snapshot(i++, "msaa"+fbod1.getNumSamples(), drawable.getGL(), screenshot, TextureIO.PNG, null);
+ snapshot(i++, "msaa"+fbod1.getNumSamples(), drawable.getGL(), screenshot, TextureIO.PNG, null);
}
if(9 == c) {
c=0;
- new Thread() {
+ new Thread() {
@Override
public void run() {
glWindow.setSize(dw+256, dh+256);
- } }.start();
+ } }.start();
}
}
}
- public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { }
+ public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { }
});
-
+
final Animator animator1 = new Animator();
animator1.add(fbod1);
animator1.add(glWindow);
-
+
QuitAdapter quitAdapter = new QuitAdapter();
//glWindow.addKeyListener(new TraceKeyAdapter(quitAdapter));
@@ -205,20 +206,20 @@ public class TestFBOOnThreadSharedContext1DemoES2NEWT extends UITestCase {
}
public void windowMoved(WindowEvent e) {
System.err.println("window moved: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight());
- }
+ }
});
-
+
animator1.start();
// glWindow.setSkipContextReleaseThread(animator.getThread());
glWindow.setVisible(true);
-
+
System.err.println("NW chosen: "+glWindow.getDelegatedWindow().getChosenCapabilities());
System.err.println("GL chosen: "+glWindow.getChosenCapabilities());
System.err.println("window pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", "+glWindow.getInsets());
-
+
animator1.setUpdateFPSFrames(60, showFPS ? System.err : null);
-
+
while(!quitAdapter.shouldQuit() && animator1.isAnimating() && animator1.getTotalFPSDuration()
- * Creates a {@link GLDrawable} using the
+ * Creates a {@link GLDrawable} using the
* {@link GLDrawableFactory#createGLDrawable(javax.media.nativewindow.NativeSurface) factory model}.
* The {@link GLContext} is derived {@link GLDrawable#createContext(GLContext) from the drawable}.
*
*
* Finally a {@link GLAutoDrawableDelegate} is created with the just created {@link GLDrawable} and {@link GLContext}.
- * It is being used to run the {@link GLEventListener}.
- *
+ * It is being used to run the {@link GLEventListener}.
+ *
*/
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLAutoDrawableDelegateNEWT extends UITestCase {
static long duration = 500; // ms
-
+
void doTest(GLCapabilitiesImmutable reqGLCaps, GLEventListener demo) throws InterruptedException {
final GLDrawableFactory factory = GLDrawableFactory.getFactory(reqGLCaps.getGLProfile());
-
+
//
// Create native windowing resources .. X11/Win/OSX
- //
+ //
final Window window = NewtFactory.createWindow(reqGLCaps);
Assert.assertNotNull(window);
window.setSize(640, 400);
@@ -85,24 +85,24 @@ public class TestGLAutoDrawableDelegateNEWT extends UITestCase {
Assert.assertTrue(AWTRobotUtil.waitForVisible(window, true));
Assert.assertTrue(AWTRobotUtil.waitForRealized(window, true));
System.out.println("Window: "+window.getClass().getName());
-
+
final GLDrawable drawable = factory.createGLDrawable(window);
Assert.assertNotNull(drawable);
drawable.setRealized(true);
-
- final GLAutoDrawableDelegate glad = new GLAutoDrawableDelegate(drawable, drawable.createContext(null), window, false, null) {
+
+ final GLAutoDrawableDelegate glad = new GLAutoDrawableDelegate(drawable, null, window, false, null) {
@Override
protected void destroyImplInLock() {
super.destroyImplInLock(); // destroys drawable/context
window.destroy(); // destroys the actual window, incl. the device
}
};
-
+
window.setWindowDestroyNotifyAction( new Runnable() {
public void run() {
glad.windowDestroyNotifyOp();
} } );
-
+
window.addWindowListener(new WindowAdapter() {
@Override
public void windowRepaint(WindowUpdateEvent e) {
@@ -116,13 +116,13 @@ public class TestGLAutoDrawableDelegateNEWT extends UITestCase {
});
glad.addGLEventListener(demo);
-
+
QuitAdapter quitAdapter = new QuitAdapter();
//glWindow.addKeyListener(new TraceKeyAdapter(quitAdapter));
//glWindow.addWindowListener(new TraceWindowAdapter(quitAdapter));
window.addKeyListener(quitAdapter);
window.addWindowListener(quitAdapter);
-
+
Animator animator = new Animator();
animator.setUpdateFPSFrames(60, System.err);
animator.setModeBits(false, Animator.MODE_EXPECT_AWT_RENDERING_THREAD);
@@ -130,17 +130,17 @@ public class TestGLAutoDrawableDelegateNEWT extends UITestCase {
animator.start();
Assert.assertTrue(animator.isStarted());
Assert.assertTrue(animator.isAnimating());
-
+
while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getTotalFPSDuration()
- * The created {@link GLOffscreenAutoDrawable} is being used to run the {@link GLEventListener}.
- *
+ * The created {@link GLOffscreenAutoDrawable} is being used to run the {@link GLEventListener}.
+ *
*/
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
@@ -71,7 +71,7 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
}
return new GLCapabilities(GLProfile.get(profile));
}
-
+
void doTest(GLCapabilitiesImmutable reqGLCaps, GLEventListener demo) throws InterruptedException {
System.out.println("Requested GL Caps: "+reqGLCaps);
final GLDrawableFactory factory = GLDrawableFactory.getFactory(reqGLCaps.getGLProfile());
@@ -79,15 +79,15 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
System.out.println("Expected GL Caps: "+expGLCaps);
//
- // Create native OpenGL resources .. XGL/WGL/CGL ..
+ // Create native OpenGL resources .. XGL/WGL/CGL ..
// equivalent to GLAutoDrawable methods: setVisible(true)
//
- final GLOffscreenAutoDrawable glad = factory.createOffscreenAutoDrawable(null, reqGLCaps, null, widthStep*szStep, heightStep*szStep, null);
-
+ final GLOffscreenAutoDrawable glad = factory.createOffscreenAutoDrawable(null, reqGLCaps, null, widthStep*szStep, heightStep*szStep);
+
Assert.assertNotNull(glad);
- System.out.println("Drawable Pre-GL(0): "+glad.getClass().getName()+", "+glad.getNativeSurface().getClass().getName());
+ System.out.println("Drawable Pre-GL(0): "+glad.getClass().getName()+", "+glad.getNativeSurface().getClass().getName());
Assert.assertTrue(glad.isRealized());
-
+
// Check caps of NativeWindow config w/o GL
final CapabilitiesImmutable chosenCaps = glad.getChosenGLCapabilities();
System.out.println("Drawable Caps Pre_GL : "+chosenCaps);
@@ -95,7 +95,7 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
Assert.assertTrue(chosenCaps.getGreenBits()>4);
Assert.assertTrue(chosenCaps.getBlueBits()>4);
Assert.assertTrue(chosenCaps.getRedBits()>4);
-
+
glad.display(); // force native context creation
// Check caps of GLDrawable after realization
@@ -113,45 +113,45 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
Assert.assertEquals(expGLCaps.isFBO(), chosenGLCaps.isFBO());
Assert.assertEquals(expGLCaps.isPBuffer(), chosenGLCaps.isPBuffer());
Assert.assertEquals(expGLCaps.isBitmap(), chosenGLCaps.isBitmap());
- /** Single/Double buffer cannot be checked since result may vary ..
+ /** Single/Double buffer cannot be checked since result may vary ..
if(chosenGLCaps.isOnscreen() || chosenGLCaps.isFBO()) {
// dbl buffer may be disabled w/ offscreen pbuffer and bitmap
Assert.assertEquals(expGLCaps.getDoubleBuffered(), chosenGLCaps.getDoubleBuffered());
- } */
+ } */
glad.addGLEventListener(demo);
-
+
final SnapshotGLEventListener snapshotGLEventListener = new SnapshotGLEventListener();
glad.addGLEventListener(snapshotGLEventListener);
-
+
glad.display(); // initial resize/display
-
+
// 1 - szStep = 2
- Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
+ Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep));
snapshotGLEventListener.setMakeSnapshot();
glad.display();
-
+
// 2, 3 (resize + display)
szStep = 1;
glad.setSize(widthStep*szStep, heightStep*szStep);
- Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
+ Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep));
snapshotGLEventListener.setMakeSnapshot();
glad.display();
-
+
// 4, 5 (resize + display)
szStep = 4;
glad.setSize(widthStep*szStep, heightStep*szStep);
- Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
+ Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep));
snapshotGLEventListener.setMakeSnapshot();
glad.display();
-
+
Thread.sleep(50);
-
+
glad.destroy();
- System.out.println("Fin Drawable: "+glad);
+ System.out.println("Fin Drawable: "+glad);
}
@Test
@@ -164,8 +164,8 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
if(null != f) {
System.err.println(JoglVersion.getDefaultOpenGLInfo(f.getDefaultDevice(), null, true).toString());
}
- }
-
+ }
+
@Test
public void testES2OffScreenAutoDblBuf() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2);
@@ -182,7 +182,7 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setFBO(true);
doTest(reqGLCaps, new GearsES2(1));
}
-
+
@Test
public void testES2OffScreenFBOSglBuf() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2);
@@ -191,8 +191,8 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setFBO(true);
reqGLCaps.setDoubleBuffered(false);
doTest(reqGLCaps, new GearsES2(1));
- }
-
+ }
+
@Test
public void testES2OffScreenFBODblBufStencil() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2);
@@ -202,7 +202,7 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setStencilBits(1);
doTest(reqGLCaps, new GearsES2(1));
}
-
+
@Test
public void testES2OffScreenFBODblBufMSAA() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2);
@@ -212,8 +212,8 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setSampleBuffers(true);
reqGLCaps.setNumSamples(4);
doTest(reqGLCaps, new GearsES2(1));
- }
-
+ }
+
@Test
public void testES2OffScreenFBODblBufStencilMSAA() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2);
@@ -224,8 +224,8 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setSampleBuffers(true);
reqGLCaps.setNumSamples(4);
doTest(reqGLCaps, new GearsES2(1));
- }
-
+ }
+
@Test
public void testES2OffScreenPbufferDblBuf() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2);
@@ -233,8 +233,8 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setOnscreen(false);
reqGLCaps.setPBuffer(true);
doTest(reqGLCaps, new GearsES2(1));
- }
-
+ }
+
@Test
public void testES2OffScreenPbufferSglBuf() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2);
@@ -244,7 +244,7 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setDoubleBuffered(false);
doTest(reqGLCaps, new GearsES2(1));
}
-
+
// Might be reduced to !stencil
@Test
public void testES2OffScreenPbufferDblBufStencil() throws InterruptedException {
@@ -255,7 +255,7 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setStencilBits(1);
doTest(reqGLCaps, new GearsES2(1));
}
-
+
// Might be reduced to !MSAA
@Test
public void testES2OffScreenPbufferDblBufMSAA() throws InterruptedException {
@@ -266,8 +266,8 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setSampleBuffers(true);
reqGLCaps.setNumSamples(4);
doTest(reqGLCaps, new GearsES2(1));
- }
-
+ }
+
// Might be reduced to !stencil && !MSAA
@Test
public void testES2OffScreenPbufferDblBufStencilMSAA() throws InterruptedException {
@@ -279,9 +279,9 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setSampleBuffers(true);
reqGLCaps.setNumSamples(4);
doTest(reqGLCaps, new GearsES2(1));
- }
+ }
- /** NOT Implemented:
+ /** NOT Implemented:
// Might be reduced to !double-buff
@Test
public void testES2OffScreenBitmapDblBuf() throws InterruptedException {
@@ -291,7 +291,7 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setBitmap(true);
doTest(reqGLCaps, new Gears(1));
}
-
+
@Test
public void testES2OffScreenBitmapSglBuf() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2);
@@ -301,7 +301,7 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setDoubleBuffered(false);
doTest(reqGLCaps, new Gears(1));
}
-
+
// Might be reduced to !stencil
@Test
public void testES2OffScreenBitmapDblBufStencil() throws InterruptedException {
@@ -312,7 +312,7 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setStencilBits(1);
doTest(reqGLCaps, new GearsES2(1));
}
-
+
// Might be reduced to !MSAA
@Test
public void testES2OffScreenBitmapDblBufMSAA() throws InterruptedException {
@@ -323,8 +323,8 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setSampleBuffers(true);
reqGLCaps.setNumSamples(4);
doTest(reqGLCaps, new GearsES2(1));
- }
-
+ }
+
// Might be reduced to !stencil && !MSAA
@Test
public void testES2OffScreenBitmapDblBufStencilMSAA() throws InterruptedException {
@@ -337,7 +337,7 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setNumSamples(4);
doTest(reqGLCaps, new GearsES2(1));
} */
-
+
public static void main(String args[]) throws IOException {
org.junit.runner.JUnitCore.main(TestGLAutoDrawableFactoryES2OffscrnCapsNEWT.class.getName());
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT.java
index 06dc7c83e..09e211332 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.opengl.test.junit.jogl.acore;
import java.io.IOException;
@@ -52,11 +52,11 @@ import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
/**
- * Toolkit agnostic {@link GLOffscreenAutoDrawable} tests using the
- * {@link GLDrawableFactory#createOffscreenAutoDrawable(javax.media.nativewindow.AbstractGraphicsDevice, GLCapabilitiesImmutable, javax.media.opengl.GLCapabilitiesChooser, int, int, GLContext) factory model}.
+ * Toolkit agnostic {@link GLOffscreenAutoDrawable} tests using the
+ * {@link GLDrawableFactory#createOffscreenAutoDrawable(javax.media.nativewindow.AbstractGraphicsDevice, GLCapabilitiesImmutable, javax.media.opengl.GLCapabilitiesChooser, int, int, GLContext) factory model}.
*
- * The created {@link GLOffscreenAutoDrawable} is being used to run the {@link GLEventListener}.
- *
+ * The created {@link GLOffscreenAutoDrawable} is being used to run the {@link GLEventListener}.
+ *
*/
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
@@ -71,7 +71,7 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
}
return new GLCapabilities(GLProfile.get(profile));
}
-
+
void doTest(GLCapabilitiesImmutable reqGLCaps, GLEventListener demo) throws InterruptedException {
System.out.println("Requested GL Caps: "+reqGLCaps);
final GLDrawableFactory factory = GLDrawableFactory.getFactory(reqGLCaps.getGLProfile());
@@ -79,15 +79,15 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
System.out.println("Expected GL Caps: "+expGLCaps);
//
- // Create native OpenGL resources .. XGL/WGL/CGL ..
+ // Create native OpenGL resources .. XGL/WGL/CGL ..
// equivalent to GLAutoDrawable methods: setVisible(true)
//
- final GLOffscreenAutoDrawable glad = factory.createOffscreenAutoDrawable(null, reqGLCaps, null, widthStep*szStep, heightStep*szStep, null);
-
+ final GLOffscreenAutoDrawable glad = factory.createOffscreenAutoDrawable(null, reqGLCaps, null, widthStep*szStep, heightStep*szStep);
+
Assert.assertNotNull(glad);
- System.out.println("Drawable Pre-GL(0): "+glad.getClass().getName()+", "+glad.getNativeSurface().getClass().getName());
+ System.out.println("Drawable Pre-GL(0): "+glad.getClass().getName()+", "+glad.getNativeSurface().getClass().getName());
Assert.assertTrue(glad.isRealized());
-
+
// Check caps of NativeWindow config w/o GL
final CapabilitiesImmutable chosenCaps = glad.getChosenGLCapabilities();
System.out.println("Drawable Caps Pre_GL : "+chosenCaps);
@@ -95,7 +95,7 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
Assert.assertTrue(chosenCaps.getGreenBits()>4);
Assert.assertTrue(chosenCaps.getBlueBits()>4);
Assert.assertTrue(chosenCaps.getRedBits()>4);
-
+
glad.display(); // force native context creation
// Check caps of GLDrawable after realization
@@ -113,45 +113,45 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
Assert.assertEquals(expGLCaps.isFBO(), chosenGLCaps.isFBO());
Assert.assertEquals(expGLCaps.isPBuffer(), chosenGLCaps.isPBuffer());
Assert.assertEquals(expGLCaps.isBitmap(), chosenGLCaps.isBitmap());
- /** Single/Double buffer cannot be checked since result may vary ..
+ /** Single/Double buffer cannot be checked since result may vary ..
if(chosenGLCaps.isOnscreen() || chosenGLCaps.isFBO()) {
// dbl buffer may be disabled w/ offscreen pbuffer and bitmap
Assert.assertEquals(expGLCaps.getDoubleBuffered(), chosenGLCaps.getDoubleBuffered());
- } */
+ } */
glad.addGLEventListener(demo);
-
+
final SnapshotGLEventListener snapshotGLEventListener = new SnapshotGLEventListener();
glad.addGLEventListener(snapshotGLEventListener);
-
+
glad.display(); // initial resize/display
-
+
// 1 - szStep = 2
- Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
+ Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep));
snapshotGLEventListener.setMakeSnapshot();
glad.display();
-
+
// 2, 3 (resize + display)
szStep = 1;
glad.setSize(widthStep*szStep, heightStep*szStep);
- Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
+ Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep));
snapshotGLEventListener.setMakeSnapshot();
glad.display();
-
+
// 4, 5 (resize + display)
szStep = 4;
glad.setSize(widthStep*szStep, heightStep*szStep);
- Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
+ Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep));
snapshotGLEventListener.setMakeSnapshot();
glad.display();
-
+
Thread.sleep(50);
-
+
glad.destroy();
- System.out.println("Fin Drawable: "+glad);
+ System.out.println("Fin Drawable: "+glad);
}
@Test
@@ -164,8 +164,8 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
if(null != f) {
System.err.println(JoglVersion.getDefaultOpenGLInfo(f.getDefaultDevice(), null, true).toString());
}
- }
-
+ }
+
@Test
public void testGL2OffScreenAutoDblBuf() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
@@ -182,7 +182,7 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setFBO(true);
doTest(reqGLCaps, new Gears(1));
}
-
+
@Test
public void testGL2OffScreenFBOSglBuf() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
@@ -191,8 +191,8 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setFBO(true);
reqGLCaps.setDoubleBuffered(false);
doTest(reqGLCaps, new Gears(1));
- }
-
+ }
+
@Test
public void testGL2OffScreenFBODblBufStencil() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
@@ -202,7 +202,7 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setStencilBits(1);
doTest(reqGLCaps, new Gears(1));
}
-
+
@Test
public void testGL2OffScreenFBODblBufMSAA() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
@@ -212,8 +212,8 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setSampleBuffers(true);
reqGLCaps.setNumSamples(4);
doTest(reqGLCaps, new Gears(1));
- }
-
+ }
+
@Test
public void testGL2OffScreenFBODblBufStencilMSAA() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
@@ -224,8 +224,8 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setSampleBuffers(true);
reqGLCaps.setNumSamples(4);
doTest(reqGLCaps, new Gears(1));
- }
-
+ }
+
@Test
public void testGL2OffScreenPbufferDblBuf() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
@@ -233,8 +233,8 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setOnscreen(false);
reqGLCaps.setPBuffer(true);
doTest(reqGLCaps, new Gears(1));
- }
-
+ }
+
@Test
public void testGL2OffScreenPbufferSglBuf() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
@@ -244,8 +244,8 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setDoubleBuffered(false);
doTest(reqGLCaps, new Gears(1));
}
-
- // Might be reduced to !stencil
+
+ // Might be reduced to !stencil
@Test
public void testGL2OffScreenPbufferDblBufStencil() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
@@ -255,7 +255,7 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setStencilBits(1);
doTest(reqGLCaps, new Gears(1));
}
-
+
// Might be reduced to !MSAA
@Test
public void testGL2OffScreenPbufferDblBufMSAA() throws InterruptedException {
@@ -266,8 +266,8 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setSampleBuffers(true);
reqGLCaps.setNumSamples(4);
doTest(reqGLCaps, new Gears(1));
- }
-
+ }
+
// Might be reduced to !stencil && !MSAA
@Test
public void testGL2OffScreenPbufferDblBufStencilMSAA() throws InterruptedException {
@@ -279,9 +279,9 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setSampleBuffers(true);
reqGLCaps.setNumSamples(4);
doTest(reqGLCaps, new Gears(1));
- }
-
-
+ }
+
+
// Might be reduced to !double-buff
@Test
public void testGL2OffScreenBitmapDblBuf() throws InterruptedException {
@@ -291,7 +291,7 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setBitmap(true);
doTest(reqGLCaps, new Gears(1));
}
-
+
@Test
public void testGL2OffScreenBitmapDblBufRGBA8881() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
@@ -304,7 +304,7 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setBitmap(true);
doTest(reqGLCaps, new Gears(1));
}
-
+
@Test
public void testGL2OffScreenBitmapDblBufRGB555() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
@@ -317,7 +317,7 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setBitmap(true);
doTest(reqGLCaps, new Gears(1));
}
-
+
@Test
public void testGL2OffScreenBitmapDblBufRGBA5551() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
@@ -330,7 +330,7 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setBitmap(true);
doTest(reqGLCaps, new Gears(1));
}
-
+
@Test
public void testGL2OffScreenBitmapSglBuf() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
@@ -340,7 +340,7 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setDoubleBuffered(false);
doTest(reqGLCaps, new Gears(1));
}
-
+
// Might be reduced to !stencil
@Test
public void testGL2OffScreenBitmapDblBufStencil() throws InterruptedException {
@@ -351,7 +351,7 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setStencilBits(1);
doTest(reqGLCaps, new Gears(1));
}
-
+
// Might be reduced to !MSAA
@Test
public void testGL2OffScreenBitmapDblBufMSAA() throws InterruptedException {
@@ -362,8 +362,8 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setSampleBuffers(true);
reqGLCaps.setNumSamples(4);
doTest(reqGLCaps, new Gears(1));
- }
-
+ }
+
// Might be reduced to !stencil && !MSAA
@Test
public void testGL2OffScreenBitmapDblBufStencilMSAA() throws InterruptedException {
@@ -375,8 +375,8 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setSampleBuffers(true);
reqGLCaps.setNumSamples(4);
doTest(reqGLCaps, new Gears(1));
- }
-
+ }
+
public static void main(String args[]) throws IOException {
org.junit.runner.JUnitCore.main(TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT.class.getName());
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGLnBitmapCapsNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGLnBitmapCapsNEWT.java
index 75609224e..f35f8c8b0 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGLnBitmapCapsNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGLnBitmapCapsNEWT.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.opengl.test.junit.jogl.acore;
import java.io.IOException;
@@ -52,11 +52,11 @@ import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
/**
- * Toolkit agnostic {@link GLOffscreenAutoDrawable} tests using the
- * {@link GLDrawableFactory#createOffscreenAutoDrawable(javax.media.nativewindow.AbstractGraphicsDevice, GLCapabilitiesImmutable, javax.media.opengl.GLCapabilitiesChooser, int, int, GLContext) factory model}.
+ * Toolkit agnostic {@link GLOffscreenAutoDrawable} tests using the
+ * {@link GLDrawableFactory#createOffscreenAutoDrawable(javax.media.nativewindow.AbstractGraphicsDevice, GLCapabilitiesImmutable, javax.media.opengl.GLCapabilitiesChooser, int, int, GLContext) factory model}.
*
- * The created {@link GLOffscreenAutoDrawable} is being used to run the {@link GLEventListener}.
- *
+ * The created {@link GLOffscreenAutoDrawable} is being used to run the {@link GLEventListener}.
+ *
*/
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLAutoDrawableFactoryGLnBitmapCapsNEWT extends UITestCase {
@@ -71,15 +71,15 @@ public class TestGLAutoDrawableFactoryGLnBitmapCapsNEWT extends UITestCase {
System.out.println("Expected GL Caps: "+expGLCaps);
//
- // Create native OpenGL resources .. XGL/WGL/CGL ..
+ // Create native OpenGL resources .. XGL/WGL/CGL ..
// equivalent to GLAutoDrawable methods: setVisible(true)
//
- final GLOffscreenAutoDrawable glad = factory.createOffscreenAutoDrawable(null, reqGLCaps, null, widthStep*szStep, heightStep*szStep, null);
-
+ final GLOffscreenAutoDrawable glad = factory.createOffscreenAutoDrawable(null, reqGLCaps, null, widthStep*szStep, heightStep*szStep);
+
Assert.assertNotNull(glad);
- System.out.println("Drawable Pre-GL(0): "+glad.getClass().getName()+", "+glad.getNativeSurface().getClass().getName());
+ System.out.println("Drawable Pre-GL(0): "+glad.getClass().getName()+", "+glad.getNativeSurface().getClass().getName());
Assert.assertTrue(glad.isRealized());
-
+
// Check caps of NativeWindow config w/o GL
final CapabilitiesImmutable chosenCaps = glad.getChosenGLCapabilities();
System.out.println("Drawable Caps Pre_GL : "+chosenCaps);
@@ -87,7 +87,7 @@ public class TestGLAutoDrawableFactoryGLnBitmapCapsNEWT extends UITestCase {
Assert.assertTrue(chosenCaps.getGreenBits()>4);
Assert.assertTrue(chosenCaps.getBlueBits()>4);
Assert.assertTrue(chosenCaps.getRedBits()>4);
-
+
glad.display(); // force native context creation
// Check caps of GLDrawable after realization
@@ -105,45 +105,45 @@ public class TestGLAutoDrawableFactoryGLnBitmapCapsNEWT extends UITestCase {
Assert.assertEquals(expGLCaps.isFBO(), chosenGLCaps.isFBO());
Assert.assertEquals(expGLCaps.isPBuffer(), chosenGLCaps.isPBuffer());
Assert.assertEquals(expGLCaps.isBitmap(), chosenGLCaps.isBitmap());
- /** Single/Double buffer cannot be checked since result may vary ..
+ /** Single/Double buffer cannot be checked since result may vary ..
if(chosenGLCaps.isOnscreen() || chosenGLCaps.isFBO()) {
// dbl buffer may be disabled w/ offscreen pbuffer and bitmap
Assert.assertEquals(expGLCaps.getDoubleBuffered(), chosenGLCaps.getDoubleBuffered());
- } */
+ } */
glad.addGLEventListener(demo);
-
+
final SnapshotGLEventListener snapshotGLEventListener = new SnapshotGLEventListener();
glad.addGLEventListener(snapshotGLEventListener);
-
+
glad.display(); // initial resize/display
-
+
// 1 - szStep = 2
- Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
+ Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep));
snapshotGLEventListener.setMakeSnapshot();
glad.display();
-
+
// 2, 3 (resize + display)
szStep = 1;
glad.setSize(widthStep*szStep, heightStep*szStep);
- Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
+ Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep));
snapshotGLEventListener.setMakeSnapshot();
glad.display();
-
+
// 4, 5 (resize + display)
szStep = 4;
glad.setSize(widthStep*szStep, heightStep*szStep);
- Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
+ Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep));
snapshotGLEventListener.setMakeSnapshot();
glad.display();
-
+
Thread.sleep(50);
-
+
glad.destroy();
- System.out.println("Fin Drawable: "+glad);
+ System.out.println("Fin Drawable: "+glad);
}
@Test
@@ -156,8 +156,8 @@ public class TestGLAutoDrawableFactoryGLnBitmapCapsNEWT extends UITestCase {
if(null != f) {
System.err.println(JoglVersion.getDefaultOpenGLInfo(f.getDefaultDevice(), null, true).toString());
}
- }
-
+ }
+
// Might be reduced to !double-buff
@Test
public void testGL2OffScreenBitmapDblBuf() throws InterruptedException {
@@ -166,7 +166,7 @@ public class TestGLAutoDrawableFactoryGLnBitmapCapsNEWT extends UITestCase {
reqGLCaps.setBitmap(true);
doTest(reqGLCaps, new Gears(1));
}
-
+
// Might be reduced to !MSAA
@Test
public void testGL2OffScreenBitmapDblBufMSAA() throws InterruptedException {
@@ -176,8 +176,8 @@ public class TestGLAutoDrawableFactoryGLnBitmapCapsNEWT extends UITestCase {
reqGLCaps.setSampleBuffers(true);
reqGLCaps.setNumSamples(4);
doTest(reqGLCaps, new Gears(1));
- }
-
+ }
+
public static void main(String args[]) throws IOException {
org.junit.runner.JUnitCore.main(TestGLAutoDrawableFactoryGLnBitmapCapsNEWT.class.getName());
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLExtensionQueryOffscreen.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLExtensionQueryOffscreen.java
index f9ab6c4b3..4bc8e7ee3 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLExtensionQueryOffscreen.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLExtensionQueryOffscreen.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.opengl.test.junit.jogl.acore;
import java.util.Collections;
@@ -47,14 +47,14 @@ import org.junit.runners.MethodSorters;
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLExtensionQueryOffscreen {
-
+
public static void main(String[] args) {
TestGLExtensionQueryOffscreen instance = new TestGLExtensionQueryOffscreen();
instance.testJogl2ExtensionCheck1();
instance.testJogl2ExtensionCheck2();
}
- /**
+ /**
* @deprecated This test uses a non public API in jogamp.opengl.* and hence is not recommended
*/
@Test
@@ -74,13 +74,13 @@ public class TestGLExtensionQueryOffscreen {
System.out.println("SharedContext: "+sharedContext);
System.out.println("SharedContext: "+setExtensions);
}
-
+
@Test
public void testJogl2ExtensionCheck2() {
final GLCapabilities caps = new GLCapabilities(GLProfile.getDefault());
- final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile());
- final GLOffscreenAutoDrawable drawable = factory.createOffscreenAutoDrawable(null, caps, null, 256, 256, null);
-
+ final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile());
+ final GLOffscreenAutoDrawable drawable = factory.createOffscreenAutoDrawable(null, caps, null, 256, 256);
+ drawable.display(); // trigger context creation ..
final GLContext context = drawable.getContext();
context.makeCurrent();
String extensions;
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestNEWTCloseX11DisplayBug565.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestNEWTCloseX11DisplayBug565.java
index c8cc294a2..83e55b7e0 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestNEWTCloseX11DisplayBug565.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestNEWTCloseX11DisplayBug565.java
@@ -30,16 +30,16 @@ public class TestNEWTCloseX11DisplayBug565 {
try {
for ( int j = 0; j < 10; j++ ) {
final int open0;
- if(NativeWindowFactory.TYPE_X11 == NativeWindowFactory.getNativeWindowType(false)) {
+ if(NativeWindowFactory.TYPE_X11 == NativeWindowFactory.getNativeWindowType(false)) {
open0 = X11Util.getOpenDisplayConnectionNumber();
} else {
open0 = 0;
}
-
+
GLCapabilitiesImmutable caps = new GLCapabilities( GLProfile.getDefault( ) );
-
+
GLWindow window = GLWindow.create(caps);
- window.setTitle("NEWT Resource X11 Leak - #" + j );
+ window.setTitle("NEWT Resource X11 Leak - #" + j );
window.setSize( 128, 128 );
window.setVisible(true);
window.display();
@@ -69,7 +69,7 @@ public class TestNEWTCloseX11DisplayBug565 {
try {
for ( int j = 0; j < 10; j++ ) {
final int open0;
- if(NativeWindowFactory.TYPE_X11 == NativeWindowFactory.getNativeWindowType(false)) {
+ if(NativeWindowFactory.TYPE_X11 == NativeWindowFactory.getNativeWindowType(false)) {
open0 = X11Util.getOpenDisplayConnectionNumber();
} else {
open0 = 0;
@@ -111,7 +111,7 @@ public class TestNEWTCloseX11DisplayBug565 {
try {
for ( int j = 0; j < 10; j++ ) {
final int open0;
- if(NativeWindowFactory.TYPE_X11 == NativeWindowFactory.getNativeWindowType(false)) {
+ if(NativeWindowFactory.TYPE_X11 == NativeWindowFactory.getNativeWindowType(false)) {
open0 = X11Util.getOpenDisplayConnectionNumber();
} else {
open0 = 0;
@@ -121,13 +121,7 @@ public class TestNEWTCloseX11DisplayBug565 {
GLOffscreenAutoDrawable buffer = GLDrawableFactory.getFactory( glp ).createOffscreenAutoDrawable(
- null,
- caps,
- new DefaultGLCapabilitiesChooser(),
- 256,
- 256,
- null
- );
+ null, caps, new DefaultGLCapabilitiesChooser(), 256, 256);
buffer.display();
buffer.destroy();
@@ -146,10 +140,10 @@ public class TestNEWTCloseX11DisplayBug565 {
Assert.fail(e.getMessage());
}
}
-
+
public static void main(String args[]) {
org.junit.runner.JUnitCore.main(TestNEWTCloseX11DisplayBug565.class.getName());
}
-
+
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java
index a3eb6db84..77657f6f1 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.opengl.test.junit.jogl.acore;
import javax.media.opengl.GLCapabilities;
@@ -73,7 +73,7 @@ public class TestSharedContextListAWT extends UITestCase {
}
private void initShared() {
- sharedDrawable = GLDrawableFactory.getFactory(glp).createOffscreenAutoDrawable(null, caps, null, width, height, null);
+ sharedDrawable = GLDrawableFactory.getFactory(glp).createOffscreenAutoDrawable(null, caps, null, width, height);
Assert.assertNotNull(sharedDrawable);
sharedGears = new Gears();
Assert.assertNotNull(sharedGears);
@@ -86,8 +86,8 @@ public class TestSharedContextListAWT extends UITestCase {
Assert.assertNotNull(sharedDrawable);
sharedDrawable.destroy();
}
-
- protected void setFrameTitle(final Frame f, final boolean useShared)
+
+ protected void setFrameTitle(final Frame f, final boolean useShared)
throws InterruptedException, InvocationTargetException {
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
@@ -99,12 +99,13 @@ public class TestSharedContextListAWT extends UITestCase {
protected GLCanvas runTestGL(final Frame frame, final Animator animator, final int x, final int y, final boolean useShared, final boolean vsync)
throws InterruptedException, InvocationTargetException
{
- final GLCanvas glCanvas = new GLCanvas(caps, useShared ? sharedDrawable.getContext() : null);
+ final GLCanvas glCanvas = new GLCanvas(caps);
Assert.assertNotNull(glCanvas);
+ glCanvas.setSharedAutoDrawable(sharedDrawable);
frame.add(glCanvas);
frame.setLocation(x, y);
frame.setSize(width, height);
-
+
Gears gears = new Gears(vsync ? 1 : 0);
if(useShared) {
gears.setGears(sharedGears.getGear1(), sharedGears.getGear2(), sharedGears.getGear3());
@@ -133,22 +134,22 @@ public class TestSharedContextListAWT extends UITestCase {
final GLCanvas glc1 = runTestGL(f1, animator, 0, 0, true, false);
int x0 = f1.getX();
int y0 = f1.getY();
-
- final GLCanvas glc2 = runTestGL(f2, animator,
+
+ final GLCanvas glc2 = runTestGL(f2, animator,
x0+width,
- y0+0,
+ y0+0,
true, false);
-
- final GLCanvas glc3 = runTestGL(f3, animator,
- x0+0,
- y0+height,
+
+ final GLCanvas glc3 = runTestGL(f3, animator,
+ x0+0,
+ y0+height,
false, true);
setFrameTitle(f1, true);
setFrameTitle(f2, true);
setFrameTitle(f3, false);
-
- animator.setUpdateFPSFrames(1, null);
+
+ animator.setUpdateFPSFrames(1, null);
animator.start();
while(animator.isAnimating() && animator.getTotalFPSDuration()
+ * This is achieved by creating a master GLContext to an offscreen invisible GLAutoDrawable,
+ * which is then shared by the 3 GLContext of the three GLWindow instances.
+ *
+ *
+ * The original VBO is created by attaching a GearsES1 instance to
+ * the master GLAutoDrawable and initializing it.
+ *
+ *
+ * Above method allows random creation of all GLWindow instances.
+ *
+ *
+ * One animator is being used, hence the GLWindow, GLDrawable and GLContext
+ * creation of all 3 GLWindows is sequential.
+ *
+ */
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestSharedContextVBOES1NEWT extends UITestCase {
static GLProfile glp;
static GLCapabilities caps;
static int width, height;
- GLOffscreenAutoDrawable sharedDrawable;
+ GLAutoDrawable sharedDrawable;
GearsES1 sharedGears;
@BeforeClass
@@ -69,14 +91,22 @@ public class TestSharedContextVBOES1NEWT extends UITestCase {
}
}
- private void initShared() {
- sharedDrawable = GLDrawableFactory.getFactory(glp).createOffscreenAutoDrawable(null, caps, null, width, height, null);
+ private void initShared() throws InterruptedException {
+ GLDrawable dummyDrawable = GLDrawableFactory.getFactory(glp).createDummyDrawable(null, true /* createNewDevice */, caps.getGLProfile());
+ dummyDrawable.setRealized(true);
+ sharedDrawable = new GLAutoDrawableDelegate(dummyDrawable, null, null, true /*ownDevice*/, null) { };
Assert.assertNotNull(sharedDrawable);
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(sharedDrawable, true));
+
sharedGears = new GearsES1();
Assert.assertNotNull(sharedGears);
sharedDrawable.addGLEventListener(sharedGears);
// init and render one frame, which will setup the Gears display lists
sharedDrawable.display();
+ final GLContext ctxM = sharedDrawable.getContext();
+ Assert.assertTrue("Master ctx not created", AWTRobotUtil.waitForCreated(ctxM, true));
+ Assert.assertTrue("Master Ctx is shared before shared creation", !ctxM.isShared());
+ Assert.assertTrue("Master Gears is shared", !sharedGears.usesSharedGears());
}
private void releaseShared() {
@@ -87,6 +117,7 @@ public class TestSharedContextVBOES1NEWT extends UITestCase {
protected GLWindow runTestGL(Animator animator, int x, int y, boolean useShared, boolean vsync) throws InterruptedException {
GLWindow glWindow = GLWindow.create(caps);
Assert.assertNotNull(glWindow);
+ glWindow.setPosition(x, y);
glWindow.setTitle("Shared Gears NEWT Test: "+x+"/"+y+" shared "+useShared);
if(useShared) {
glWindow.setSharedContext(sharedDrawable.getContext());
@@ -96,7 +127,7 @@ public class TestSharedContextVBOES1NEWT extends UITestCase {
GearsES1 gears = new GearsES1(vsync ? 1 : 0);
if(useShared) {
- gears.setGears(sharedGears.getGear1(), sharedGears.getGear2(), sharedGears.getGear3());
+ gears.setSharedGearsObjects(sharedGears.getGear1(), sharedGears.getGear2(), sharedGears.getGear3());
}
glWindow.addGLEventListener(gears);
@@ -105,9 +136,17 @@ public class TestSharedContextVBOES1NEWT extends UITestCase {
glWindow.setVisible(true);
Assert.assertTrue(AWTRobotUtil.waitForRealized(glWindow, true));
Assert.assertTrue(AWTRobotUtil.waitForVisible(glWindow, true));
-
- glWindow.setPosition(x, y);
-
+ Assert.assertTrue(AWTRobotUtil.waitForCreated(glWindow.getContext(), true));
+
+ System.err.println("Master Context: ");
+ MiscUtils.dumpSharedGLContext(sharedDrawable.getContext());
+ System.err.println("New Context: ");
+ MiscUtils.dumpSharedGLContext(glWindow.getContext());
+ if( useShared ) {
+ Assert.assertEquals("Master Context not shared as expected", true, sharedDrawable.getContext().isShared());
+ }
+ Assert.assertEquals("New Context not shared as expected", useShared, glWindow.getContext().isShared());
+ Assert.assertEquals("Gears is not shared as expected", useShared, gears.usesSharedGears());
return glWindow;
}
@@ -117,11 +156,11 @@ public class TestSharedContextVBOES1NEWT extends UITestCase {
Animator animator = new Animator();
GLWindow f1 = runTestGL(animator, 0, 0, true, false);
InsetsImmutable insets = f1.getInsets();
- GLWindow f2 = runTestGL(animator, f1.getX()+width+insets.getTotalWidth(),
+ GLWindow f2 = runTestGL(animator, f1.getX()+width+insets.getTotalWidth(),
f1.getY()+0, true, false);
- GLWindow f3 = runTestGL(animator, f1.getX()+0,
- f1.getY()+height+insets.getTotalHeight(), false, true);
- animator.setUpdateFPSFrames(1, null);
+ GLWindow f3 = runTestGL(animator, f1.getX()+0,
+ f1.getY()+height+insets.getTotalHeight(), false, true);
+ animator.setUpdateFPSFrames(1, null);
animator.start();
while(animator.isAnimating() && animator.getTotalFPSDuration()
+ * This is achieved by using the 1st GLCanvas as the master
+ * and using the build-in blocking mechanism to postpone creation
+ * of the 2nd and 3rd GLCanvas until the 1st GLCanvas's GLContext becomes created.
+ *
+ *
+ * Above method allows random creation of the 1st GLCanvas, which triggers
+ * creation of the dependent other GLCanvas sharing it's GLContext.
+ *
+ */
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestSharedContextVBOES2AWT3 extends UITestCase {
+ static GLProfile glp;
+ static GLCapabilities caps;
+ static int width, height;
+
+ @BeforeClass
+ public static void initClass() {
+ if(GLProfile.isAvailable(GLProfile.GL2ES2)) {
+ glp = GLProfile.get(GLProfile.GL2ES2);
+ Assert.assertNotNull(glp);
+ caps = new GLCapabilities(glp);
+ Assert.assertNotNull(caps);
+ width = 256;
+ height = 256;
+ } else {
+ setTestSupported(false);
+ }
+ }
+
+ protected GLCanvas createGLCanvas(final Frame frame, int x, int y, GearsES2 gears) throws InterruptedException {
+ final GLCanvas glCanvas = new GLCanvas(caps);
+ Assert.assertNotNull(glCanvas);
+ glCanvas.addGLEventListener(gears);
+ frame.add(glCanvas);
+ frame.setLocation(x, y);
+ frame.setSize(width, height);
+ frame.setTitle("Shared Gears NEWT Test: "+x+"/"+y+" shared true");
+ return glCanvas;
+ }
+
+ @Test
+ public void test01SyncedCommonAnimatorSharedOffscreen() throws InterruptedException, InvocationTargetException {
+ final Frame f1 = new Frame();
+ final Animator animator = new Animator();
+ final GearsES2 g1 = new GearsES2(0);
+ final GLCanvas c1 = createGLCanvas(f1, 0, 0, g1);
+ animator.add(c1);
+
+ final Frame f2 = new Frame();
+ final GearsES2 g2 = new GearsES2(0);
+ g2.setSharedGears(g1);
+ final GLCanvas c2 = createGLCanvas(f2, f1.getX()+width,
+ f1.getY()+0, g2);
+ c2.setSharedAutoDrawable(c1);
+ animator.add(c2);
+
+ final Frame f3 = new Frame();
+ final GearsES2 g3 = new GearsES2(0);
+ g3.setSharedGears(g1);
+ final GLCanvas c3 = createGLCanvas(f3, f1.getX()+0,
+ f1.getY()+height, g3);
+ c3.setSharedAutoDrawable(c1);
+ animator.add(c3);
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ f2.setVisible(true); // shall wait until f1 is ready
+ f1.setVisible(true); // master ..
+ f3.setVisible(true); // shall wait until f1 is ready
+ } } );
+ animator.start(); // kicks off GLContext .. and hence gears of f2 + f3 completion
+
+ Thread.sleep(1000/60*10); // wait ~10 frames giving a chance to create (blocking until master share is valid)
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c1, true));
+ Assert.assertTrue(AWTRobotUtil.waitForCreated(c1.getContext(), true));
+ Assert.assertTrue("Gears1 not initialized", g1.waitForInit(true));
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c2, true));
+ Assert.assertTrue(AWTRobotUtil.waitForCreated(c2.getContext(), true));
+ Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true));
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c3, true));
+ Assert.assertTrue(AWTRobotUtil.waitForCreated(c3.getContext(), true));
+ Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true));
+
+ final GLContext ctx1 = c1.getContext();
+ final GLContext ctx2 = c2.getContext();
+ final GLContext ctx3 = c3.getContext();
+ {
+ final List ctx1Shares = ctx1.getCreatedShares();
+ final List ctx2Shares = ctx2.getCreatedShares();
+ final List ctx3Shares = ctx3.getCreatedShares();
+ System.err.println("XXX-C-3.1:");
+ MiscUtils.dumpSharedGLContext(ctx1);
+ System.err.println("XXX-C-3.2:");
+ MiscUtils.dumpSharedGLContext(ctx2);
+ System.err.println("XXX-C-3.3:");
+ MiscUtils.dumpSharedGLContext(ctx3);
+
+ Assert.assertTrue("Ctx1 is not shared", ctx1.isShared());
+ Assert.assertTrue("Ctx2 is not shared", ctx2.isShared());
+ Assert.assertTrue("Ctx3 is not shared", ctx3.isShared());
+ Assert.assertEquals("Ctx1 has unexpected number of created shares", 2, ctx1Shares.size());
+ Assert.assertEquals("Ctx2 has unexpected number of created shares", 2, ctx2Shares.size());
+ Assert.assertEquals("Ctx3 has unexpected number of created shares", 2, ctx3Shares.size());
+ }
+
+ Assert.assertTrue("Gears1 is shared", !g1.usesSharedGears());
+ Assert.assertTrue("Gears2 is not shared", g2.usesSharedGears());
+ Assert.assertTrue("Gears3 is not shared", g3.usesSharedGears());
+
+ try {
+ Thread.sleep(duration);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ animator.stop();
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ try {
+ f1.dispose();
+ f2.dispose();
+ f3.dispose();
+ } catch (Throwable t) {
+ throw new RuntimeException(t);
+ }
+ }});
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, false));
+ }
+
+ @Test
+ public void test02AsyncEachWithAnimatorSharedOffscreen() throws InterruptedException, InvocationTargetException {
+ final Frame f1 = new Frame();
+ final Animator a1 = new Animator();
+ final GearsES2 g1 = new GearsES2(0);
+ final GLCanvas c1 = createGLCanvas(f1, 0, 0, g1);
+ a1.add(c1);
+ a1.start();
+ // f1.setVisible(true); // we do this post f2 .. to test pending creation!
+
+ final Frame f2 = new Frame();
+ final Animator a2 = new Animator();
+ final GearsES2 g2 = new GearsES2(0);
+ g2.setSharedGears(g1);
+ final GLCanvas c2 = createGLCanvas(f2, f1.getX()+width, f1.getY()+0, g2);
+ c2.setSharedAutoDrawable(c1);
+ a2.add(c2);
+ a2.start();
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ f2.setVisible(true);
+ } } );
+
+ Thread.sleep(200); // wait a while ..
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ f1.setVisible(true); // test pending creation of f2
+ } } );
+
+ final Frame f3 = new Frame();
+ final Animator a3 = new Animator();
+ final GearsES2 g3 = new GearsES2(0);
+ g3.setSharedGears(g1);
+ final GLCanvas c3 = createGLCanvas(f3, f1.getX()+0, f1.getY()+height, g3);
+ c3.setSharedAutoDrawable(c1);
+ a3.add(c3);
+ a3.start();
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ f3.setVisible(true);
+ } } );
+
+ Thread.sleep(1000/60*10); // wait ~10 frames giving a chance to create (blocking until master share is valid)
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c1, true));
+ Assert.assertTrue(AWTRobotUtil.waitForCreated(c1.getContext(), true));
+ Assert.assertTrue("Gears1 not initialized", g1.waitForInit(true));
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c2, true));
+ Assert.assertTrue(AWTRobotUtil.waitForCreated(c2.getContext(), true));
+ Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true));
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c3, true));
+ Assert.assertTrue(AWTRobotUtil.waitForCreated(c3.getContext(), true));
+ Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true));
+
+ final GLContext ctx1 = c1.getContext();
+ final GLContext ctx2 = c2.getContext();
+ final GLContext ctx3 = c3.getContext();
+ {
+ final List ctx1Shares = ctx1.getCreatedShares();
+ final List ctx2Shares = ctx2.getCreatedShares();
+ final List ctx3Shares = ctx3.getCreatedShares();
+ System.err.println("XXX-C-3.1:");
+ MiscUtils.dumpSharedGLContext(ctx1);
+ System.err.println("XXX-C-3.2:");
+ MiscUtils.dumpSharedGLContext(ctx2);
+ System.err.println("XXX-C-3.3:");
+ MiscUtils.dumpSharedGLContext(ctx3);
+
+ Assert.assertTrue("Ctx1 is not shared", ctx1.isShared());
+ Assert.assertTrue("Ctx2 is not shared", ctx2.isShared());
+ Assert.assertTrue("Ctx3 is not shared", ctx3.isShared());
+ Assert.assertEquals("Ctx1 has unexpected number of created shares", 2, ctx1Shares.size());
+ Assert.assertEquals("Ctx2 has unexpected number of created shares", 2, ctx2Shares.size());
+ Assert.assertEquals("Ctx3 has unexpected number of created shares", 2, ctx3Shares.size());
+ }
+
+ Assert.assertTrue("Gears1 is shared", !g1.usesSharedGears());
+ Assert.assertTrue("Gears2 is not shared", g2.usesSharedGears());
+ Assert.assertTrue("Gears3 is not shared", g3.usesSharedGears());
+
+ try {
+ Thread.sleep(duration);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ a1.stop();
+ a2.stop();
+ a3.stop();
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ try {
+ f1.dispose();
+ f2.dispose();
+ f3.dispose();
+ } catch (Throwable t) {
+ throw new RuntimeException(t);
+ }
+ }});
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, false));
+ }
+
+ static long duration = 1000; // ms
+
+ public static void main(String args[]) {
+ for(int i=0; i 0 ) {
- // instable on OSX .. driver/OS bug when multi threading (3 animator)
- System.err.println("Shared context w/ 3 context each running in there own thread is instable here on OSX 10.7.4/NVidia,");
- System.err.println("SIGSEGV @ glDrawArrays / glBindBuffer .. any shared VBO.");
- System.err.println("Seems to run fine on 10.6.8/NVidia.");
- return;
- }
- initShared(false);
- Animator animator1 = new Animator();
- Animator animator2 = new Animator();
- Animator animator3 = new Animator();
- GLWindow f1 = runTestGL(animator1, 0, 0, true, false);
- InsetsImmutable insets = f1.getInsets();
- GLWindow f2 = runTestGL(animator2, f1.getX()+width+insets.getTotalWidth(),
- f1.getY()+0, true, false);
- GLWindow f3 = runTestGL(animator3, f1.getX()+0,
- f1.getY()+height+insets.getTotalHeight(), true, false);
-
- try {
- Thread.sleep(duration);
- } catch(Exception e) {
- e.printStackTrace();
- }
- animator1.stop();
- animator2.stop();
- animator3.stop();
-
- f1.destroy();
- f2.destroy();
- f3.destroy();
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, false));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, false));
-
- releaseShared();
- }
-
- static long duration = 2000; // ms
-
- public static void main(String args[]) {
- for(int i=0; i
+ * This is achieved by relying on the sequential creation
+ * of the 3 GLWindows with their GLDrawable and GLContext.
+ *
+ */
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestSharedContextVBOES2NEWT0 extends UITestCase {
+ static GLProfile glp;
+ static GLCapabilities caps;
+ static int width, height;
+
+ @BeforeClass
+ public static void initClass() {
+ if(GLProfile.isAvailable(GLProfile.GL2ES2)) {
+ glp = GLProfile.get(GLProfile.GL2ES2);
+ Assert.assertNotNull(glp);
+ caps = new GLCapabilities(glp);
+ Assert.assertNotNull(caps);
+ width = 256;
+ height = 256;
+ } else {
+ setTestSupported(false);
+ }
+ }
+
+ protected GLWindow runTestGL(Animator animator, int x, int y, GearsES2 gears, GLContext sharedContext) throws InterruptedException {
+ final boolean useShared = null != sharedContext;
+ GLWindow glWindow = GLWindow.create(caps);
+ Assert.assertNotNull(glWindow);
+ glWindow.setPosition(x, y);
+ glWindow.setTitle("Shared Gears NEWT Test: "+x+"/"+y+" shared "+useShared);
+ if(useShared) {
+ glWindow.setSharedContext(sharedContext);
+ }
+ glWindow.setSize(width, height);
+ glWindow.addGLEventListener(gears);
+
+ animator.add(glWindow);
+ glWindow.setVisible(true);
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(glWindow, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(glWindow, true));
+ glWindow.display();
+ Assert.assertTrue(AWTRobotUtil.waitForCreated(glWindow.getContext(), true));
+ Assert.assertTrue("Gears not initialized", gears.waitForInit(true));
+
+ return glWindow;
+ }
+
+ @Test
+ public void testCommonAnimatorShared() throws InterruptedException {
+ final Animator animator = new Animator();
+
+ //
+ // 1st
+ //
+ final GearsES2 g1 = new GearsES2(0);
+ final GLWindow f1 = runTestGL(animator, 0, 0, g1, null);
+ final GLContext ctx1 = f1.getContext();
+ Assert.assertTrue("Ctx is shared before shared creation", !ctx1.isShared());
+ final InsetsImmutable insets = f1.getInsets();
+
+ System.err.println("XXX-C-2.1:");
+ MiscUtils.dumpSharedGLContext(ctx1);
+
+ //
+ // 2nd
+ //
+ final GearsES2 g2 = new GearsES2(0);
+ g2.setSharedGearsObjects(g1.getGear1(), g1.getGear2(), g1.getGear3());
+ final GLWindow f2 = runTestGL(animator, f1.getX()+width+insets.getTotalWidth(),
+ f1.getY()+0, g2, f1.getContext());
+ final GLContext ctx2 = f2.getContext();
+ Assert.assertTrue("Ctx1 is not shared", ctx1.isShared());
+ Assert.assertTrue("Ctx2 is not shared", ctx2.isShared());
+
+ {
+ final List ctx1Shares = ctx1.getCreatedShares();
+ final List ctx2Shares = ctx2.getCreatedShares();
+ System.err.println("XXX-C-2.1:");
+ MiscUtils.dumpSharedGLContext(ctx1);
+ System.err.println("XXX-C-2.2:");
+ MiscUtils.dumpSharedGLContext(ctx2);
+
+ Assert.assertEquals("Ctx1 has unexpected number of created shares", 1, ctx1Shares.size());
+ Assert.assertEquals("Ctx2 has unexpected number of created shares", 1, ctx2Shares.size());
+ }
+
+ //
+ // 3rd
+ //
+ final GearsES2 g3 = new GearsES2(0);
+ g3.setSharedGearsObjects(g1.getGear1(), g1.getGear2(), g1.getGear3());
+ final GLWindow f3 = runTestGL(animator, f1.getX()+0,
+ f1.getY()+height+insets.getTotalHeight(), g3, f1.getContext());
+
+ final GLContext ctx3 = f3.getContext();
+ Assert.assertTrue("Ctx1 is not shared", ctx1.isShared());
+ Assert.assertTrue("Ctx2 is not shared", ctx2.isShared());
+ Assert.assertTrue("Ctx3 is not shared", ctx3.isShared());
+
+ {
+ final List ctx1Shares = ctx1.getCreatedShares();
+ final List ctx2Shares = ctx2.getCreatedShares();
+ final List ctx3Shares = ctx3.getCreatedShares();
+ System.err.println("XXX-C-3.1:");
+ MiscUtils.dumpSharedGLContext(ctx1);
+ System.err.println("XXX-C-3.2:");
+ MiscUtils.dumpSharedGLContext(ctx2);
+ System.err.println("XXX-C-3.3:");
+ MiscUtils.dumpSharedGLContext(ctx3);
+
+ Assert.assertEquals("Ctx1 has unexpected number of created shares", 2, ctx1Shares.size());
+ Assert.assertEquals("Ctx2 has unexpected number of created shares", 2, ctx2Shares.size());
+ Assert.assertEquals("Ctx3 has unexpected number of created shares", 2, ctx3Shares.size());
+ }
+
+ Assert.assertTrue("Gears1 is shared", !g1.usesSharedGears());
+ Assert.assertTrue("Gears2 is not shared", g2.usesSharedGears());
+ Assert.assertTrue("Gears3 is not shared", g3.usesSharedGears());
+
+ animator.start();
+
+ try {
+ Thread.sleep(duration);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ animator.stop();
+
+ f1.destroy();
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false));
+ Assert.assertTrue(AWTRobotUtil.waitForCreated(f1.getContext(), false));
+ {
+ final List ctx1Shares = ctx1.getCreatedShares();
+ final List ctx2Shares = ctx2.getCreatedShares();
+ final List ctx3Shares = ctx3.getCreatedShares();
+ System.err.println("XXX-D-2.1:");
+ MiscUtils.dumpSharedGLContext(ctx1);
+ System.err.println("XXX-D-2.2:");
+ MiscUtils.dumpSharedGLContext(ctx2);
+ System.err.println("XXX-D-2.3:");
+ MiscUtils.dumpSharedGLContext(ctx3);
+
+ Assert.assertTrue("Ctx1 is not shared", ctx1.isShared());
+ Assert.assertTrue("Ctx2 is not shared", ctx2.isShared());
+ Assert.assertTrue("Ctx3 is not shared", ctx3.isShared());
+ Assert.assertEquals("Ctx1 has unexpected number of created shares", 2, ctx1Shares.size());
+ Assert.assertEquals("Ctx2 has unexpected number of created shares", 1, ctx2Shares.size());
+ Assert.assertEquals("Ctx3 has unexpected number of created shares", 1, ctx3Shares.size());
+ }
+
+ f2.destroy();
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, false));
+ Assert.assertTrue(AWTRobotUtil.waitForCreated(f2.getContext(), false));
+ {
+ final List ctx1Shares = ctx1.getCreatedShares();
+ final List ctx2Shares = ctx2.getCreatedShares();
+ final List ctx3Shares = ctx3.getCreatedShares();
+ System.err.println("XXX-D-1.1:");
+ MiscUtils.dumpSharedGLContext(ctx1);
+ System.err.println("XXX-D-1.2:");
+ MiscUtils.dumpSharedGLContext(ctx2);
+ System.err.println("XXX-D-1.3:");
+ MiscUtils.dumpSharedGLContext(ctx3);
+
+ Assert.assertTrue("Ctx1 is not shared", ctx1.isShared());
+ Assert.assertTrue("Ctx2 is not shared", ctx2.isShared());
+ Assert.assertTrue("Ctx3 is not shared", ctx3.isShared());
+ Assert.assertEquals("Ctx1 has unexpected number of created shares", 1, ctx1Shares.size());
+ Assert.assertEquals("Ctx2 has unexpected number of created shares", 1, ctx2Shares.size());
+ Assert.assertEquals("Ctx3 has unexpected number of created shares", 0, ctx3Shares.size());
+ }
+
+ f3.destroy();
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, false));
+ Assert.assertTrue(AWTRobotUtil.waitForCreated(f3.getContext(), false));
+ {
+ final List ctx1Shares = ctx1.getCreatedShares();
+ final List ctx2Shares = ctx2.getCreatedShares();
+ final List ctx3Shares = ctx3.getCreatedShares();
+ System.err.println("XXX-D-0.1:");
+ MiscUtils.dumpSharedGLContext(ctx1);
+ System.err.println("XXX-D-0.2:");
+ MiscUtils.dumpSharedGLContext(ctx2);
+ System.err.println("XXX-D-0.3:");
+ MiscUtils.dumpSharedGLContext(ctx3);
+
+ Assert.assertTrue("Ctx1 is shared", !ctx1.isShared());
+ Assert.assertTrue("Ctx2 is shared", !ctx2.isShared());
+ Assert.assertTrue("Ctx3 is shared", !ctx3.isShared());
+ Assert.assertEquals("Ctx1 has unexpected number of created shares", 0, ctx1Shares.size());
+ Assert.assertEquals("Ctx2 has unexpected number of created shares", 0, ctx2Shares.size());
+ Assert.assertEquals("Ctx3 has unexpected number of created shares", 0, ctx3Shares.size());
+ }
+ }
+
+ static long duration = 1000; // ms
+
+ public static void main(String args[]) {
+ for(int i=0; i
+ * This is achieved by creating a master GLContext to an offscreen invisible GLAutoDrawable,
+ * which is then shared by the 3 GLContext of the three GLWindow instances.
+ *
+ *
+ * The original VBO is created by attaching a GearsES2 instance to
+ * the master GLAutoDrawable and initializing it.
+ *
+ *
+ * Above method allows random creation of all GLWindow instances.
+ *
+ *
+ * One tests uses only one animator, where the GLWindow, GLDrawable and GLContext
+ * creation of all 3 GLWindows is sequential.
+ *
+ *
+ * Another tests uses 3 animator, one for each GLWindow,
+ * where the GLWindow, GLDrawable and GLContext creation
+ * of all 3 GLWindows is random.
+ * This fact benefits from the master GLContext/GLAutoDrawable,
+ * since it is guaranteed it exist and is realized at the time of the shared
+ * GLWindow creation.
+ *
- *
+ *
* @author Michael Esemplare, et.al.
*
*/
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestBug365TextureGenerateMipMaps extends UITestCase {
static GLOffscreenAutoDrawable drawable;
-
+
@BeforeClass
public static void setup() throws Throwable {
// disableNPOT
@@ -61,23 +61,21 @@ public class TestBug365TextureGenerateMipMaps extends UITestCase {
throw t;
}
}
-
+
@AfterClass
public static void teardown() {
tearDownOffscreenAutoDrawable();
}
-
+
private static void setUpOffscreenAutoDrawable() throws Throwable {
GLProfile glp = GLProfile.getDefault();
GLCapabilities caps = new GLCapabilities(glp);
-
+
GLDrawableFactory factory = GLDrawableFactory.getFactory(glp);
-
- // Make a drawable to get an offscreen context
- drawable = factory.createOffscreenAutoDrawable(null, caps, null, 2, 2, null);
-
- drawable.setRealized(true);
+ // Make a drawable to get an offscreen context
+ drawable = factory.createOffscreenAutoDrawable(null, caps, null, 2, 2);
+ drawable.display(); // trigger context creation
GLContext glContext = drawable.getContext();
try {
Assert.assertTrue("Could not make context current", GLContext.CONTEXT_NOT_CURRENT < glContext.makeCurrent());
@@ -86,7 +84,7 @@ public class TestBug365TextureGenerateMipMaps extends UITestCase {
throw t;
}
}
-
+
private static void tearDownOffscreenAutoDrawable() {
if(drawable != null) {
drawable.getContext().release();
@@ -94,30 +92,30 @@ public class TestBug365TextureGenerateMipMaps extends UITestCase {
drawable = null;
}
}
-
+
private static void testTextureMipMapGeneration(int width, int height, int pixelFormat, int pixelType) {
int internalFormat = pixelFormat;
int border = 0;
boolean mipmap = true;
boolean dataIsCompressed = false;
boolean mustFlipVertically = false;
-
+
int memReq = Mipmap.image_size( width, height, pixelFormat, pixelType );
ByteBuffer buffer = Buffers.newDirectByteBuffer( memReq );
-
- TextureData data = new TextureData(drawable.getGLProfile(),
- internalFormat,
- width,
- height,
- border,
- pixelFormat,
- pixelType,
- mipmap,
- dataIsCompressed,
- mustFlipVertically,
- buffer,
+
+ TextureData data = new TextureData(drawable.getGLProfile(),
+ internalFormat,
+ width,
+ height,
+ border,
+ pixelFormat,
+ pixelType,
+ mipmap,
+ dataIsCompressed,
+ mustFlipVertically,
+ buffer,
null);
-
+
Texture texture = TextureIO.newTexture(drawable.getGL(), data);
// Cleanup
texture.destroy(drawable.getGL());
@@ -125,144 +123,144 @@ public class TestBug365TextureGenerateMipMaps extends UITestCase {
buffer.clear();
buffer = null;
}
-
+
@Test
public void test00_MipMap_ScaleInternal_RGB_UBYTE () {
int width = 1;
int height = 7;
int pixelFormat = GL2.GL_RGB;
int pixelType = GL2.GL_UNSIGNED_BYTE;
-
+
testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
}
-
+
@Test
public void test01_MipMap_ScaleInternal_RGBA_UBYTE () {
int width = 1;
int height = 7;
int pixelFormat = GL2.GL_RGBA;
int pixelType = GL2.GL_UNSIGNED_BYTE;
-
+
testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
}
-
+
@Test
public void test02_MipMap_ScaleInternal_RGB_BYTE () {
int width = 1;
int height = 7;
int pixelFormat = GL2.GL_RGB;
int pixelType = GL2.GL_BYTE;
-
+
testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
}
-
+
@Test
public void test03_MipMap_ScaleInternal_RGBA_BYTE () {
int width = 1;
int height = 7;
int pixelFormat = GL2.GL_RGBA;
int pixelType = GL2.GL_BYTE;
-
+
testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
}
-
+
@Test
public void test04_MipMap_ScaleInternal_RGB_USHORT () {
int width = 1;
int height = 7;
int pixelFormat = GL2.GL_RGB;
int pixelType = GL2.GL_UNSIGNED_SHORT;
-
+
testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
}
-
+
@Test
public void test05_MipMap_ScaleInternal_RGBA_USHORT () {
int width = 1;
int height = 7;
int pixelFormat = GL2.GL_RGBA;
int pixelType = GL2.GL_UNSIGNED_SHORT;
-
+
testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
}
-
+
@Test
public void test06_MipMap_ScaleInternal_RGB_SHORT () {
int width = 1;
int height = 7;
int pixelFormat = GL2.GL_RGB;
int pixelType = GL2.GL_SHORT;
-
+
testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
}
-
+
@Test
public void test07_MipMap_ScaleInternal_RGBA_SHORT () {
int width = 1;
int height = 7;
int pixelFormat = GL2.GL_RGBA;
int pixelType = GL2.GL_SHORT;
-
+
testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
}
-
+
@Test
public void test08_MipMap_ScaleInternal_RGB_UINT () {
int width = 1;
int height = 7;
int pixelFormat = GL2.GL_RGB;
int pixelType = GL2.GL_UNSIGNED_INT;
-
+
testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
}
-
+
@Test
public void test09_MipMap_ScaleInternal_RGBA_UINT () {
int width = 1;
int height = 7;
int pixelFormat = GL2.GL_RGBA;
int pixelType = GL2.GL_UNSIGNED_INT;
-
+
testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
}
-
+
@Test
public void test10_MipMap_ScaleInternal_RGB_INT () {
int width = 1;
int height = 7;
int pixelFormat = GL2.GL_RGB;
int pixelType = GL2.GL_INT;
-
+
testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
}
-
+
@Test
public void test11_MipMap_ScaleInternal_RGBA_INT () {
int width = 1;
int height = 7;
int pixelFormat = GL2.GL_RGBA;
int pixelType = GL2.GL_INT;
-
+
testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
}
-
+
@Test
public void test12_MipMap_ScaleInternal_RGB_FLOAT () {
int width = 1;
int height = 7;
int pixelFormat = GL2.GL_RGB;
int pixelType = GL2.GL_FLOAT;
-
+
testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
}
-
+
@Test
public void test13_MipMap_ScaleInternal_RGBA_FLOAT () {
int width = 1;
int height = 7;
int pixelFormat = GL2.GL_RGBA;
int pixelType = GL2.GL_FLOAT;
-
+
testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering2GL2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering2GL2NEWT.java
index d539b5e55..16c1b33f4 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering2GL2NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering2GL2NEWT.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -60,14 +60,14 @@ import org.junit.runners.MethodSorters;
*
*
* {@link RandomTileRenderer} buffer allocation is performed
- * within the pre {@link GLEventListener}
+ * within the pre {@link GLEventListener}
* set via {@link TileRendererBase#setGLEventListener(GLEventListener, GLEventListener)}
- * on the main thread.
+ * on the main thread.
*
*
* At tile rendering finish, the viewport and
* and the original {@link GLEventListener}'s PMV matrix as well.
- * The latter is done by calling it's {@link GLEventListener#reshape(GLAutoDrawable, int, int, int, int) reshape} method.
+ * The latter is done by calling it's {@link GLEventListener#reshape(GLAutoDrawable, int, int, int, int) reshape} method.
*
*/
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@@ -83,7 +83,7 @@ public class TestRandomTiledRendering2GL2NEWT extends UITestCase {
doTest(8);
}
- void doTest(int msaaCount) throws IOException, InterruptedException, InvocationTargetException {
+ void doTest(int msaaCount) throws IOException, InterruptedException, InvocationTargetException {
final GLCapabilities caps = new GLCapabilities(null);
caps.setDoubleBuffered(true);
if( msaaCount > 0 ) {
@@ -93,7 +93,7 @@ public class TestRandomTiledRendering2GL2NEWT extends UITestCase {
final int maxTileSize = 64;
final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile());
- final GLOffscreenAutoDrawable glad = factory.createOffscreenAutoDrawable(null, caps, null, maxTileSize, maxTileSize, null);
+ final GLOffscreenAutoDrawable glad = factory.createOffscreenAutoDrawable(null, caps, null, maxTileSize, maxTileSize);
final Gears gears = new Gears();
glad.addGLEventListener( gears );
@@ -156,7 +156,7 @@ public class TestRandomTiledRendering2GL2NEWT extends UITestCase {
drawable.getGL().glViewport(0, 0, drawable.getWidth(), drawable.getHeight());
gears.reshape(drawable, 0, 0, drawable.getWidth(), drawable.getHeight());
return false;
- }
+ }
});
glad.destroy();
@@ -168,9 +168,9 @@ public class TestRandomTiledRendering2GL2NEWT extends UITestCase {
caps.getGLProfile(),
0 /* internalFormat */,
imageWidth, imageHeight,
- 0,
+ 0,
imageBuffer.pixelAttributes,
- false, false,
+ false, false,
flipVertically[0],
imageBuffer.buffer,
null /* Flusher */);
@@ -189,5 +189,5 @@ public class TestRandomTiledRendering2GL2NEWT extends UITestCase {
}
}
org.junit.runner.JUnitCore.main(TestRandomTiledRendering2GL2NEWT.class.getName());
- }
+ }
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering2NEWT.java
index 74909dc8c..2220c1fb3 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering2NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering2NEWT.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -60,14 +60,14 @@ import org.junit.runners.MethodSorters;
*
*
* {@link TileRenderer} buffer allocation is performed
- * within the pre {@link GLEventListener}
+ * within the pre {@link GLEventListener}
* set via {@link TileRendererBase#setGLEventListener(GLEventListener, GLEventListener)}
- * on the main thread.
+ * on the main thread.
*
*
* At tile rendering finish, the viewport and
* and the original {@link GLEventListener}'s PMV matrix as well.
- * The latter is done by calling it's {@link GLEventListener#reshape(GLAutoDrawable, int, int, int, int) reshape} method.
+ * The latter is done by calling it's {@link GLEventListener#reshape(GLAutoDrawable, int, int, int, int) reshape} method.
*
*/
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@@ -88,8 +88,8 @@ public class TestTiledRendering2NEWT extends UITestCase {
return null;
}
return glp;
- }
-
+ }
+
@Test
public void test001_off_gl2___aa0() throws IOException {
GLProfile glp = getGLProfile(GLProfile.GL2);
@@ -155,8 +155,8 @@ public class TestTiledRendering2NEWT extends UITestCase {
doTest(true, new GearsES2(), glp, 8);
}
- void doTest(boolean onscreen, final GLEventListener demo, GLProfile glp, final int msaaCount) throws IOException {
- GLCapabilities caps = new GLCapabilities(glp);
+ void doTest(boolean onscreen, final GLEventListener demo, GLProfile glp, final int msaaCount) throws IOException {
+ GLCapabilities caps = new GLCapabilities(glp);
caps.setDoubleBuffered(onscreen);
if( msaaCount > 0 ) {
caps.setSampleBuffers(true);
@@ -172,7 +172,7 @@ public class TestTiledRendering2NEWT extends UITestCase {
glad = glWin;
} else {
final GLDrawableFactory factory = GLDrawableFactory.getFactory(glp);
- glad = factory.createOffscreenAutoDrawable(null, caps, null, maxTileSize, maxTileSize, null);
+ glad = factory.createOffscreenAutoDrawable(null, caps, null, maxTileSize, maxTileSize);
}
glad.addGLEventListener( demo );
@@ -220,7 +220,7 @@ public class TestTiledRendering2NEWT extends UITestCase {
}
renderer.detachAutoDrawable();
-
+
// Restore viewport and Gear's PMV matrix
// .. even though we close the demo, this is for documentation!
glad.invoke(true, new GLRunnable() {
@@ -229,7 +229,7 @@ public class TestTiledRendering2NEWT extends UITestCase {
drawable.getGL().glViewport(0, 0, drawable.getWidth(), drawable.getHeight());
demo.reshape(drawable, 0, 0, drawable.getWidth(), drawable.getHeight());
return false;
- }
+ }
});
final GLPixelBuffer imageBuffer = renderer.getImageBuffer();
@@ -237,15 +237,15 @@ public class TestTiledRendering2NEWT extends UITestCase {
caps.getGLProfile(),
0 /* internalFormat */,
imageWidth, imageHeight,
- 0,
+ 0,
imageBuffer.pixelAttributes,
- false, false,
+ false, false,
flipVertically[0],
imageBuffer.buffer,
null /* Flusher */);
TextureIO.write(textureData, file);
-
+
glad.destroy();
}
@@ -259,5 +259,5 @@ public class TestTiledRendering2NEWT extends UITestCase {
}
}
org.junit.runner.JUnitCore.main(TestTiledRendering2NEWT.class.getName());
- }
+ }
}
diff --git a/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java b/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java
index e85052d08..b1e9f477e 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.opengl.test.junit.util;
import jogamp.newt.WindowImplAccess;
@@ -40,6 +40,7 @@ import java.awt.Robot;
import javax.media.nativewindow.NativeWindow;
import javax.media.nativewindow.NativeWindowFactory;
import javax.media.opengl.GLAutoDrawable;
+import javax.media.opengl.GLContext;
import javax.media.opengl.GLDrawable;
import org.junit.Assert;
@@ -50,17 +51,17 @@ import com.jogamp.newt.event.WindowEvent;
public class AWTRobotUtil {
static final boolean DEBUG = false;
-
+
public static final int RETRY_NUMBER = 5;
public static final int ROBOT_DELAY = 100; // ms
public static final int TIME_OUT = 2000; // 2s
public static final int POLL_DIVIDER = 20; // TO/20
public static final int TIME_SLICE = TIME_OUT / POLL_DIVIDER ;
- public static Integer AWT_CLICK_TO = null;
-
+ public static Integer AWT_CLICK_TO = null;
+
static Object awtEDTAliveSync = new Object();
- static volatile boolean awtEDTAliveFlag = false;
-
+ static volatile boolean awtEDTAliveFlag = false;
+
static class OurUncaughtExceptionHandler implements UncaughtExceptionHandler {
@Override
public void uncaughtException(Thread t, Throwable e) {
@@ -68,16 +69,16 @@ public class AWTRobotUtil {
e.printStackTrace();
}
}
-
+
static {
Thread.setDefaultUncaughtExceptionHandler( new OurUncaughtExceptionHandler() );
// System.err.println("AWT EDT alive: "+isAWTEDTAlive());
}
-
+
/** Probes whether AWT's EDT is alive or not. */
public static boolean isAWTEDTAlive() {
if( EventQueue.isDispatchThread() ) {
- return true;
+ return true;
}
synchronized ( awtEDTAliveSync ) {
awtEDTAliveFlag = false;
@@ -85,7 +86,7 @@ public class AWTRobotUtil {
@Override
public void run() {
awtEDTAliveFlag = true;
- }
+ }
});
for (int wait=0; wait tc && j tc && j delta ) {
throw new AssertionError(msg+"; Expected @ ["+a0+"+"+i+"] has "+ai+", but actual @ ["+b0+"+"+i+"] has "+bi+", it's delta "+daibi+" > "+delta);
}
}
}
-
+
public static void assertFloatBufferNotEqual(String errmsg, FloatBuffer expected, FloatBuffer actual, float delta) {
if(null == expected || null == actual) {
return;
}
if(expected.remaining() != actual.remaining()) {
- return;
+ return;
}
String msg = null != errmsg ? errmsg + " " : "";
final int a0 = expected.position();
@@ -131,14 +135,14 @@ public class MiscUtils {
for(int i=0; i delta ) {
return;
}
}
throw new AssertionError(msg+"; Expected and actual are equal.");
}
-
+
public static boolean setFieldIfExists(Object instance, String fieldName, Object value) {
try {
Field f = instance.getClass().getField(fieldName);
@@ -155,14 +159,14 @@ public class MiscUtils {
}
return false;
}
-
+
public static class StreamDump extends Thread {
final InputStream is;
final StringBuilder outString;
final OutputStream outStream;
final String prefix;
final Object sync;
- volatile boolean eos = false;
+ volatile boolean eos = false;
public StreamDump(OutputStream out, String prefix, InputStream is, Object sync) {
this.is = is;
@@ -178,7 +182,7 @@ public class MiscUtils {
this.prefix = null;
this.sync = sync;
}
-
+
public final boolean eos() { return eos; }
@Override
@@ -208,7 +212,28 @@ public class MiscUtils {
}
}
}
- }
+ }
+
+ public static void dumpSharedGLContext(GLContext self) {
+ int i = 0, j = 0;
+ System.err.println("Myself: hash 0x"+Integer.toHexString(self.hashCode())+", \t(isShared "+self.isShared()+", created "+self.isCreated()+")");
+ {
+ final List set = self.getCreatedShares();
+ for (final Iterator iter = set.iterator(); iter.hasNext(); ) {
+ final GLContext c = iter.next();
+ System.err.println("Ctx #"+(i++)+": hash 0x"+Integer.toHexString(c.hashCode())+", \t(created "+c.isCreated()+")");
+ }
+ }
+ {
+ final List set = self.getDestroyedShares();
+ for (final Iterator iter = set.iterator(); iter.hasNext(); ) {
+ final GLContext c = iter.next();
+ System.err.println("Ctx #"+(j++)+": hash 0x"+Integer.toHexString(c.hashCode())+", \t(created "+c.isCreated()+")");
+ }
+ }
+ System.err.println("\t Total created "+i+" + destroyed "+j+" = "+(i+j));
+ System.err.println();
+ }
}
--
cgit v1.2.3