aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/macosx/cgl
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/macosx/cgl')
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java144
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java10
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java28
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDynamicLibraryBundleInfo.java18
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java44
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java18
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java12
8 files changed, 139 insertions, 139 deletions
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
index 0828d1dc3..5cc4003fe 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
@@ -80,7 +80,7 @@ import com.jogamp.opengl.util.glsl.ShaderCode;
import com.jogamp.opengl.util.glsl.ShaderProgram;
public class MacOSXCGLContext extends GLContextImpl
-{
+{
// Abstract interface for implementation of this context (either
// NSOpenGL-based or CGL-based)
protected interface GLBackendImpl {
@@ -140,13 +140,13 @@ public class MacOSXCGLContext extends GLContextImpl
}
private static final String shaderBasename = "texture01_xxx";
-
+
private static ShaderProgram createCALayerShader(GL3ES3 gl) {
// Create & Link the shader program
final ShaderProgram sp = new ShaderProgram();
- final ShaderCode vp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, MacOSXCGLContext.class,
+ final ShaderCode vp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, MacOSXCGLContext.class,
"../../shader", "../../shader/bin", shaderBasename, true);
- final ShaderCode fp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, MacOSXCGLContext.class,
+ final ShaderCode fp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, MacOSXCGLContext.class,
"../../shader", "../../shader/bin", shaderBasename, true);
vp.defaultShaderCustomization(gl, true, true);
fp.defaultShaderCustomization(gl, true, true);
@@ -162,7 +162,7 @@ public class MacOSXCGLContext extends GLContextImpl
pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION);
pmvMatrix.glLoadIdentity();
pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW);
- pmvMatrix.glLoadIdentity();
+ pmvMatrix.glLoadIdentity();
final GLUniformData pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); // P, Mv
pmvMatrixUniform.setLocation(gl, sp.program());
gl.glUniform(pmvMatrixUniform);
@@ -170,8 +170,8 @@ public class MacOSXCGLContext extends GLContextImpl
sp.useProgram(gl, false);
return sp;
}
-
-
+
+
private boolean haveSetOpenGLMode = false;
private GLBackendType openGLMode = GLBackendType.NSOPENGL;
@@ -185,7 +185,7 @@ public class MacOSXCGLContext extends GLContextImpl
private long updateHandle = 0;
private int lastWidth, lastHeight;
-
+
protected MacOSXCGLContext(GLDrawableImpl drawable,
GLContext shareWith) {
super(drawable, shareWith);
@@ -303,7 +303,7 @@ public class MacOSXCGLContext extends GLContextImpl
@Override
protected void makeCurrentImpl() throws GLException {
/** FIXME: won't work w/ special drawables (like FBO) - check for CGL mode regressions!
- *
+ *
if (getOpenGLMode() != ((MacOSXCGLDrawable)drawable).getOpenGLMode()) {
setOpenGLMode(((MacOSXCGLDrawable)drawable).getOpenGLMode());
} */
@@ -327,7 +327,7 @@ public class MacOSXCGLContext extends GLContextImpl
throw new GLException("Error destroying OpenGL Context: "+this);
}
}
-
+
private final long getUpdateHandle() {
if( 0 == updateHandle ) {
lastWidth = -1;
@@ -340,7 +340,7 @@ public class MacOSXCGLContext extends GLContextImpl
} else {
incompleteView = false;
}
- if(!incompleteView) {
+ if(!incompleteView) {
updateHandle = CGL.updateContextRegister(contextHandle, drawable.getHandle());
if(0 == updateHandle) {
throw new InternalError("XXX2");
@@ -350,14 +350,14 @@ public class MacOSXCGLContext extends GLContextImpl
}
return updateHandle;
}
-
+
private final void releaseUpdateHandle() {
if ( 0 != updateHandle ) {
CGL.updateContextUnregister(updateHandle);
updateHandle = 0;
- }
+ }
}
-
+
@Override
protected void drawableUpdatedNotify() throws GLException {
if( drawable.getChosenGLCapabilities().isOnscreen() ) {
@@ -376,7 +376,7 @@ public class MacOSXCGLContext extends GLContextImpl
}
}
}
-
+
@Override
protected void associateDrawable(boolean bound) {
// context stuff depends on drawable stuff
@@ -390,12 +390,12 @@ public class MacOSXCGLContext extends GLContextImpl
super.associateDrawable(false); // 2) free drawable stuff
}
}
-
+
/* pp */ void detachPBuffer() {
impl.detachPBuffer();
}
-
+
@Override
protected void copyImpl(GLContext source, int mask) throws GLException {
if( isNSContext() != ((MacOSXCGLContext)source).isNSContext() ) {
@@ -429,7 +429,7 @@ public class MacOSXCGLContext extends GLContextImpl
// FIXME: apparently the Apple extension doesn't require a custom memory allocator
throw new GLException("Not yet implemented");
}
-
+
@Override
protected final void updateGLXProcAddressTable() {
final AbstractGraphicsConfiguration aconfig = drawable.getNativeSurface().getGraphicsConfiguration();
@@ -520,11 +520,11 @@ public class MacOSXCGLContext extends GLContextImpl
private int lastWidth=0, lastHeight=0; // allowing to detect size change
private boolean needsSetContextPBuffer = false;
private ShaderProgram gl3ShaderProgram = null;
-
+
@Override
public boolean isNSContext() { return true; }
-
+
/** Only returns a valid NSView. If !NSView, return null and mark either pbuffer and FBO. */
private long getNSViewHandle(boolean[] isPBuffer, boolean[] isFBO) {
final long nsViewHandle;
@@ -558,11 +558,11 @@ public class MacOSXCGLContext extends GLContextImpl
needsSetContextPBuffer = isPBuffer[0];
return nsViewHandle;
}
-
+
@Override
public long create(long share, int ctp, int major, int minor) {
long ctx = 0;
- final NativeSurface surface = drawable.getNativeSurface();
+ final NativeSurface surface = drawable.getNativeSurface();
final MacOSXCGLGraphicsConfiguration config = (MacOSXCGLGraphicsConfiguration) surface.getGraphicsConfiguration();
final GLCapabilitiesImmutable chosenCaps = (GLCapabilitiesImmutable) config.getChosenCapabilities();
final long nsViewHandle;
@@ -606,7 +606,7 @@ public class MacOSXCGLContext extends GLContextImpl
if( !_fixedCaps.isPBuffer() && isPBuffer ) {
throw new InternalError("handle is PBuffer, fixedCaps not: "+drawable);
}
- // determine on-/offscreen caps, since pformat is ambiguous
+ // determine on-/offscreen caps, since pformat is ambiguous
_fixedCaps.setPBuffer( isPBuffer ); // exclusive
_fixedCaps.setBitmap( false ); // n/a in our OSX impl.
_fixedCaps.setOnscreen( !isFBO && !isPBuffer );
@@ -632,7 +632,7 @@ public class MacOSXCGLContext extends GLContextImpl
// Thread.dumpStack();
}
config.setChosenCapabilities(fixedCaps);
-
+
final IntBuffer viewNotReady = Buffers.newDirectIntBuffer(1);
// Try to allocate a context with this
ctx = CGL.createContext(share, nsViewHandle, incompleteView,
@@ -665,12 +665,12 @@ public class MacOSXCGLContext extends GLContextImpl
* <p>
* Since NSOpenGLLayer creation requires this context for it's shared context creation,
* this method attempts to acquire the surface and context lock with {@link #screenVSyncTimeout}/2 maximum wait time.
- * If the surface and context lock could not be acquired, this runnable is being re-queued for later execution.
+ * If the surface and context lock could not be acquired, this runnable is being re-queued for later execution.
* </p>
* <p>
* Hence this method blocks the main-thread only for a short period of time.
* </p>
- */
+ */
class AttachGLLayerCmd implements Runnable {
final OffscreenLayerSurface ols;
final long ctx;
@@ -685,7 +685,7 @@ public class MacOSXCGLContext extends GLContextImpl
long nsOpenGLLayer;
/** Synchronized by instance's monitor */
boolean valid;
-
+
AttachGLLayerCmd(OffscreenLayerSurface ols, long ctx, int shaderProgram, long pfmt, long pbuffer, int texID, boolean isOpaque, int width, int height) {
this.ols = ols;
this.ctx = ctx;
@@ -699,23 +699,23 @@ public class MacOSXCGLContext extends GLContextImpl
this.valid = false;
this.nsOpenGLLayer = 0;
}
-
+
public final String contentToString() {
return "valid "+valid+", size "+width+"x"+height+", ctx "+toHexString(ctx)+", opaque "+isOpaque+", texID "+texID+", pbuffer "+toHexString(pbuffer)+", nsOpenGLLayer "+toHexString(nsOpenGLLayer);
}
-
+
@Override
public final String toString() {
return "AttachGLLayerCmd["+contentToString()+"]";
}
-
+
@Override
public void run() {
synchronized(this) {
if( !valid ) {
try {
final int maxwait = screenVSyncTimeout/2000; // TO 1/2 of current screen-vsync in [ms]
- final RecursiveLock surfaceLock = ols.getLock();
+ final RecursiveLock surfaceLock = ols.getLock();
if( surfaceLock.tryLock( maxwait ) ) {
try {
if( MacOSXCGLContext.this.lock.tryLock( maxwait ) ) {
@@ -752,19 +752,19 @@ public class MacOSXCGLContext extends GLContextImpl
}
}
AttachGLLayerCmd attachGLLayerCmd = null;
-
+
class DetachGLLayerCmd implements Runnable {
final AttachGLLayerCmd cmd;
-
+
DetachGLLayerCmd(AttachGLLayerCmd cmd) {
this.cmd = cmd;
}
-
+
@Override
public final String toString() {
return "DetachGLLayerCmd["+cmd.contentToString()+"]";
}
-
+
@Override
public void run() {
synchronized( cmd ) {
@@ -777,7 +777,7 @@ public class MacOSXCGLContext extends GLContextImpl
ols.detachSurfaceLayer();
}
} catch(Throwable t) {
- System.err.println("Catched Exception on thread "+getThreadName());
+ System.err.println("Catched Exception on thread "+getThreadName());
t.printStackTrace();
}
CGL.releaseNSOpenGLLayer(cmd.nsOpenGLLayer);
@@ -790,27 +790,27 @@ public class MacOSXCGLContext extends GLContextImpl
System.err.println("NSOpenGLLayer.Detach: Skipped "+toHexString(cmd.nsOpenGLLayer)+" - "+getThreadName());
}
}
- }
+ }
}
-
+
@Override
public void associateDrawable(boolean bound) {
backingLayerHost = NativeWindowFactory.getOffscreenLayerSurface(drawable.getNativeSurface(), true);
-
+
if(DEBUG) {
System.err.println("MaxOSXCGLContext.NSOpenGLImpl.associateDrawable: "+bound+", ctx "+toHexString(contextHandle)+
", hasBackingLayerHost "+(null!=backingLayerHost)+", attachGLLayerCmd "+attachGLLayerCmd);
// Thread.dumpStack();
- }
-
- if( bound ) {
+ }
+
+ if( bound ) {
if( null != backingLayerHost ) {
final GLCapabilitiesImmutable chosenCaps;
final long ctx;
final int texID;
final long pbufferHandle;
final int gl3ShaderProgramName;
-
+
//
// handled layered surface
//
@@ -823,8 +823,8 @@ public class MacOSXCGLContext extends GLContextImpl
pbufferHandle = 0;
fbod.setSwapBufferContext(new GLFBODrawableImpl.SwapBufferContext() {
public void swapBuffers(boolean doubleBuffered) {
- MacOSXCGLContext.NSOpenGLImpl.this.swapBuffers();
- } } ) ;
+ MacOSXCGLContext.NSOpenGLImpl.this.swapBuffers();
+ } } ) ;
} else if( CGL.isNSOpenGLPixelBuffer(drawableHandle) ) {
texID = 0;
pbufferHandle = drawableHandle;
@@ -847,19 +847,19 @@ public class MacOSXCGLContext extends GLContextImpl
gl3ShaderProgramName = gl3ShaderProgram.program();
} else {
gl3ShaderProgramName = 0;
- }
-
+ }
+
// All CALayer lifecycle ops are deferred on main-thread
- attachGLLayerCmd = new AttachGLLayerCmd(
- backingLayerHost, ctx, gl3ShaderProgramName, pixelFormat, pbufferHandle, texID,
+ attachGLLayerCmd = new AttachGLLayerCmd(
+ backingLayerHost, ctx, gl3ShaderProgramName, pixelFormat, pbufferHandle, texID,
chosenCaps.isBackgroundOpaque(), lastWidth, lastHeight );
if(DEBUG) {
System.err.println("MaxOSXCGLContext.NSOpenGLImpl.associateDrawable(true): "+attachGLLayerCmd);
- }
+ }
OSXUtil.RunOnMainThread(false, attachGLLayerCmd);
- } else { // -> null == backingLayerHost
+ } else { // -> null == backingLayerHost
lastWidth = drawable.getWidth();
- lastHeight = drawable.getHeight();
+ lastHeight = drawable.getHeight();
boolean[] isPBuffer = { false };
boolean[] isFBO = { false };
CGL.setContextView(contextHandle, getNSViewHandle(isPBuffer, isFBO));
@@ -882,7 +882,7 @@ public class MacOSXCGLContext extends GLContextImpl
final DetachGLLayerCmd dCmd = new DetachGLLayerCmd(cmd);
if(DEBUG) {
System.err.println("MaxOSXCGLContext.NSOpenGLImpl.associateDrawable(false): "+dCmd);
- }
+ }
OSXUtil.RunOnMainThread(false, dCmd);
if( null != gl3ShaderProgram ) {
gl3ShaderProgram.destroy(MacOSXCGLContext.this.gl.getGL3());
@@ -903,11 +903,11 @@ public class MacOSXCGLContext extends GLContextImpl
needsSetContextPBuffer = false;
CGL.setContextPBuffer(ctx, drawableHandle);
if(DEBUG) {
- System.err.println("NS.validateDrawableConfig bind pbuffer "+toHexString(drawableHandle)+" -> ctx "+toHexString(ctx));
+ System.err.println("NS.validateDrawableConfig bind pbuffer "+toHexString(drawableHandle)+" -> ctx "+toHexString(ctx));
}
}
}
-
+
/** Returns true if size has been updated, otherwise false (same size). */
private final boolean validateDrawableSizeConfig(long ctx) {
final int width = drawable.getWidth();
@@ -916,13 +916,13 @@ public class MacOSXCGLContext extends GLContextImpl
lastWidth = drawable.getWidth();
lastHeight = drawable.getHeight();
if(DEBUG) {
- System.err.println("NS.validateDrawableConfig size changed");
+ System.err.println("NS.validateDrawableConfig size changed");
}
return true;
}
return false;
}
-
+
@Override
public boolean copyImpl(long src, int mask) {
CGL.copyContext(contextHandle, src, mask);
@@ -975,7 +975,7 @@ public class MacOSXCGLContext extends GLContextImpl
// CGL.setContextPBuffer(contextHandle, 0); // doesn't work, i.e. not taking nil
return true;
}
-
+
@Override
public boolean setSwapInterval(int interval) {
final AttachGLLayerCmd cmd = attachGLLayerCmd;
@@ -1004,7 +1004,7 @@ public class MacOSXCGLContext extends GLContextImpl
if(DEBUG) { System.err.println("CGL setSwapInterval: "+interval); }
CGL.setSwapInterval(contextHandle, interval);
}
-
+
private int skipSync=0;
/** TODO: Remove after discussion
private boolean perfIterReset = false;
@@ -1014,7 +1014,7 @@ public class MacOSXCGLContext extends GLContextImpl
private long frameXS = 0;
private long lastFrameStart = 0;
*/
-
+
@Override
public boolean swapBuffers() {
final AttachGLLayerCmd cmd = attachGLLayerCmd;
@@ -1026,7 +1026,7 @@ public class MacOSXCGLContext extends GLContextImpl
// allowing to update the texture IDs ASAP.
skipSync = 10;
}
-
+
final boolean res;
final int texID;
final boolean valid;
@@ -1054,19 +1054,19 @@ public class MacOSXCGLContext extends GLContextImpl
final long lastFramePeriod0 = TimeUnit.NANOSECONDS.toMicros(System.nanoTime()) - lastFrameStart;
gl.glFinish(); // Require to finish previous GL rendering to give CALayer proper result
final long lastFramePeriod1 = TimeUnit.NANOSECONDS.toMicros(System.nanoTime()) - lastFrameStart;
-
- // If v-sync is disabled, frames will be drawn as quickly as possible w/o delay,
+
+ // If v-sync is disabled, frames will be drawn as quickly as possible w/o delay,
// while still synchronizing w/ CALayer.
// If v-sync is enabled wait until next swap interval (v-sync).
CGL.waitUntilNSOpenGLLayerIsReady(cmd.nsOpenGLLayer, vsyncTimeout);
final long lastFramePeriodX = TimeUnit.NANOSECONDS.toMicros(System.nanoTime()) - lastFrameStart;
-
+
final long finishGL = lastFramePeriod1 - lastFramePeriod0;
final long waitGL = lastFramePeriodX - lastFramePeriod1;
finishGLS += finishGL;
waitGLS += waitGL;
frameXS += lastFramePeriodX;
-
+
System.err.println("XXX["+perfIter+"] TO "+vsyncTimeout/1000+" ms, "+
"lFrame0 "+lastFramePeriod0/1000+" ms, "+
"lFrameX "+lastFramePeriodX/1000+" / "+frameXS/1000+" ~"+(frameXS/perfIter)/1000.0+" ms, "+
@@ -1080,8 +1080,8 @@ public class MacOSXCGLContext extends GLContextImpl
// FIXME: IMHO this synchronization should be implicitly performed via 'CGL.flushBuffer(contextHandle)' above,
// in case this will be determined a driver bug - use a QUIRK entry in GLRendererQuirks!
gl.glFinish();
-
- // If v-sync is disabled, frames will be drawn as quickly as possible w/o delay,
+
+ // If v-sync is disabled, frames will be drawn as quickly as possible w/o delay,
// while still synchronizing w/ CALayer.
// If v-sync is enabled wait until next swap interval (v-sync).
CGL.waitUntilNSOpenGLLayerIsReady(cmd.nsOpenGLLayer, vsyncTimeout);
@@ -1093,7 +1093,7 @@ public class MacOSXCGLContext extends GLContextImpl
CGL.setNSOpenGLLayerNeedsDisplayFBO(cmd.nsOpenGLLayer, texID);
} else {
// trigger CALayer to update incl. possible surface change (new pbuffer handle)
- CGL.setNSOpenGLLayerNeedsDisplayPBuffer(cmd.nsOpenGLLayer, drawable.getHandle());
+ CGL.setNSOpenGLLayerNeedsDisplayPBuffer(cmd.nsOpenGLLayer, drawable.getHandle());
}
// lastFrameStart = TimeUnit.NANOSECONDS.toMicros(System.nanoTime());
}
@@ -1137,8 +1137,8 @@ public class MacOSXCGLContext extends GLContextImpl
if (0 != ctx) {
GLCapabilities fixedCaps = MacOSXCGLGraphicsConfiguration.CGLPixelFormat2GLCapabilities(pixelFormat);
fixedCaps = GLGraphicsConfigurationUtil.fixOpaqueGLCapabilities(fixedCaps, chosenCaps.isBackgroundOpaque());
- { // determine on-/offscreen caps, since pformat is ambiguous
- fixedCaps.setFBO( false ); // n/a for CGLImpl
+ { // determine on-/offscreen caps, since pformat is ambiguous
+ fixedCaps.setFBO( false ); // n/a for CGLImpl
fixedCaps.setPBuffer( fixedCaps.isPBuffer() && !chosenCaps.isOnscreen() );
fixedCaps.setBitmap( false ); // n/a in our OSX impl.
fixedCaps.setOnscreen( !fixedCaps.isPBuffer() );
@@ -1153,7 +1153,7 @@ public class MacOSXCGLContext extends GLContextImpl
if (res != CGL.kCGLNoError) {
throw new GLException("Error code " + res + " while attaching context to pbuffer");
}
- }
+ }
}
} finally {
CGL.CGLDestroyPixelFormat(pixelFormat);
@@ -1224,7 +1224,7 @@ public class MacOSXCGLContext extends GLContextImpl
} */
return true;
}
-
+
@Override
public boolean setSwapInterval(int interval) {
final IntBuffer lval = Buffers.newDirectIntBuffer(1);
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java
index 4bd7bc994..bb36a7219 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java
@@ -105,7 +105,7 @@ public abstract class MacOSXCGLDrawable extends GLDrawableImpl {
@Override
protected void setRealizedImpl() {
}
-
+
@Override
protected void associateContext(GLContext ctx, boolean bound) {
// NOTE: we need to keep track of the created contexts in order to
@@ -123,14 +123,14 @@ public abstract class MacOSXCGLDrawable extends GLDrawableImpl {
} else {
i++;
}
- }
+ }
}
- }
+ }
}
-
+
@Override
protected final void swapBuffersImpl(boolean doubleBuffered) {
- if(doubleBuffered) {
+ if(doubleBuffered) {
synchronized (createdContexts) {
for(int i=0; i<createdContexts.size(); ) {
final MacOSXCGLContext ctx = createdContexts.get(i).get();
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
index 83d656475..6f86e840b 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
@@ -124,7 +124,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
protected final boolean isComplete() {
return null != macOSXCGLDynamicLookupHelper;
}
-
+
@Override
protected final void destroy() {
if(null != sharedMap) {
@@ -194,7 +194,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
}
@Override
public GLRendererQuirks getRendererQuirks() {
- return glRendererQuirks;
+ return glRendererQuirks;
}
}
@@ -251,12 +251,12 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
final GLCapabilitiesImmutable caps = new GLCapabilities(glp);
final GLDrawableImpl sharedDrawable = createOnscreenDrawableImpl(createDummySurfaceImpl(sharedDevice, false, caps, caps, null, 64, 64));
sharedDrawable.setRealized(true);
-
+
final MacOSXCGLContext sharedContext = (MacOSXCGLContext) sharedDrawable.createContext(null);
if (null == sharedContext) {
throw new GLException("Couldn't create shared context for drawable: "+sharedDrawable);
}
-
+
try {
sharedContext.makeCurrent(); // could cause exception
isValid = sharedContext.isCurrent();
@@ -342,8 +342,8 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
}
@Override
- protected ProxySurface createMutableSurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice,
- GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested,
+ protected ProxySurface createMutableSurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice,
+ GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested,
GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstreamHook) {
final MacOSXGraphicsDevice device;
if( createNewDevice || !(deviceReq instanceof MacOSXGraphicsDevice) ) {
@@ -354,24 +354,24 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
final AbstractGraphicsScreen screen = new DefaultGraphicsScreen(device, 0);
final MacOSXCGLGraphicsConfiguration config = MacOSXCGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsChosen, capsRequested, chooser, screen, true);
if(null == config) {
- throw new GLException("Choosing GraphicsConfiguration failed w/ "+capsChosen+" on "+screen);
- }
+ throw new GLException("Choosing GraphicsConfiguration failed w/ "+capsChosen+" on "+screen);
+ }
return new WrappedSurface(config, 0, upstreamHook, createNewDevice);
}
@Override
- public final ProxySurface createDummySurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice,
+ public final ProxySurface createDummySurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice,
GLCapabilitiesImmutable chosenCaps, GLCapabilitiesImmutable requestedCaps, GLCapabilitiesChooser chooser, int width, int height) {
chosenCaps = GLGraphicsConfigurationUtil.fixOnscreenGLCapabilities(chosenCaps);
- return createMutableSurfaceImpl(deviceReq, createNewDevice, chosenCaps, requestedCaps, chooser,
- new OSXDummyUpstreamSurfaceHook(width, height));
- }
-
+ return createMutableSurfaceImpl(deviceReq, createNewDevice, chosenCaps, requestedCaps, chooser,
+ new OSXDummyUpstreamSurfaceHook(width, height));
+ }
+
@Override
protected ProxySurface createProxySurfaceImpl(AbstractGraphicsDevice deviceReq, int screenIdx, long windowHandle, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstream) {
final MacOSXGraphicsDevice device = new MacOSXGraphicsDevice(deviceReq.getUnitID());
final AbstractGraphicsScreen screen = new DefaultGraphicsScreen(device, screenIdx);
- final MacOSXCGLGraphicsConfiguration config = MacOSXCGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsRequested, capsRequested, chooser, screen, true);
+ final MacOSXCGLGraphicsConfiguration config = MacOSXCGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsRequested, capsRequested, chooser, screen, true);
return new WrappedSurface(config, windowHandle, upstream, true);
}
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDynamicLibraryBundleInfo.java
index f8c874a53..cda8307c7 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDynamicLibraryBundleInfo.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDynamicLibraryBundleInfo.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.opengl.macosx.cgl;
import jogamp.opengl.*;
@@ -42,13 +42,13 @@ public final class MacOSXCGLDynamicLibraryBundleInfo extends DesktopGLDynamicLib
final List<String> libsGL = new ArrayList<String>();
libsGL.add("/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib");
libsGL.add("GL");
- libsList.add(libsGL);
+ libsList.add(libsGL);
return libsList;
}
-
+
@Override
public final List<String> getToolGetProcAddressFuncNameList() {
- return null;
+ return null;
/** OSX manual says: NSImage use is discouraged
List res = new ArrayList();
res.add("GetProcAddress"); // dummy
@@ -59,7 +59,7 @@ public final class MacOSXCGLDynamicLibraryBundleInfo extends DesktopGLDynamicLib
public final long toolGetProcAddress(long toolGetProcAddressHandle, String funcName) {
return 0;
/** OSX manual says: NSImage use is discouraged
- return CGL.getProcAddress(glFuncName); // manual implementation
+ return CGL.getProcAddress(glFuncName); // manual implementation
*/
}
}
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java
index 5eb11c6a4..535c4d2d3 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.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.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -54,7 +54,7 @@ import com.jogamp.nativewindow.MutableGraphicsConfiguration;
public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration implements Cloneable {
- MacOSXCGLGraphicsConfiguration(AbstractGraphicsScreen screen,
+ MacOSXCGLGraphicsConfiguration(AbstractGraphicsScreen screen,
GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested) {
super(screen, capsChosen, capsRequested);
}
@@ -71,10 +71,10 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration
// MacOSXGraphicsDevice osxDevice = sharedResource.getDevice();
return new ArrayList<GLCapabilitiesImmutable>(0);
}
-
+
static final IntBuffer cglInternalAttributeToken = Buffers.newDirectIntBuffer(new int[] {
CGL.kCGLPFAOpenGLProfile, // >= lion
- CGL.NSOpenGLPFAAccelerated, // query only (prefer accelerated, but allow non accelerated), ignored for createPixelformat
+ CGL.NSOpenGLPFAAccelerated, // query only (prefer accelerated, but allow non accelerated), ignored for createPixelformat
CGL.NSOpenGLPFANoRecovery,
CGL.kCGLPFAColorFloat,
CGL.NSOpenGLPFAPixelBuffer,
@@ -96,13 +96,13 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration
for (int idx = 0; idx < len; idx++) {
final int attr = attrToken.get(idx+off);
switch (attr) {
- case CGL.kCGLPFAOpenGLProfile:
+ case CGL.kCGLPFAOpenGLProfile:
ivalues.put(idx, MacOSXCGLContext.GLProfile2CGLOGLProfileValue(ctp, major, minor));
break;
case CGL.NSOpenGLPFANoRecovery:
ivalues.put(idx, caps.getHardwareAccelerated() ? 1 : 0);
break;
-
+
case CGL.kCGLPFAColorFloat:
// ivalues.put(idx, ( !caps.isOnscreen() && caps.isPBuffer() && caps.getPbufferFloatingPointBuffers() ) ? 1 : 0);
ivalues.put(idx, 0);
@@ -160,7 +160,7 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration
if ( !MacOSXCGLContext.isLionOrLater ) {
// no OpenGLProfile
attrToken.position(1);
- }
+ }
final IntBuffer ivalues = GLCapabilities2NSAttribList(attrToken, caps, ctp, major, minor);
return CGL.createPixelFormat(attrToken, attrToken.remaining(), ivalues);
}
@@ -174,7 +174,7 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration
final IntBuffer attrs = Buffers.newDirectIntBuffer(256);
int i = 0;
if(MacOSXCGLContext.isLionOrLater) {
- attrs.put(i++, CGL.kCGLPFAOpenGLProfile);
+ attrs.put(i++, CGL.kCGLPFAOpenGLProfile);
attrs.put(i++, MacOSXCGLContext.GLProfile2CGLOGLProfileValue(ctp, major, minor));
}
/**
@@ -222,8 +222,8 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration
}
return fmt.get(0);
}
-
- static GLCapabilities CGLPixelFormat2GLCapabilities(long pixelFormat) {
+
+ static GLCapabilities CGLPixelFormat2GLCapabilities(long pixelFormat) {
return PixelFormat2GLCapabilities(null, pixelFormat, false);
}
@@ -235,7 +235,7 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration
off = 1;
} else {
off = 0;
- }
+ }
attrToken.position(off);
final int len = attrToken.remaining();
final IntBuffer ivalues = Buffers.newDirectIntBuffer(len);
@@ -243,7 +243,7 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration
// On this platform the pixel format is associated with the
// context and not the drawable. However it's a reasonable
// approximation to just store the chosen pixel format up in the
- // NativeSurface's AbstractGraphicsConfiguration,
+ // NativeSurface's AbstractGraphicsConfiguration,
// since the public API doesn't provide for a different GLCapabilities per context.
// Note: These restrictions of the platform's API might be considered as a bug anyways.
@@ -253,7 +253,7 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration
} else {
CGL.CGLQueryPixelFormat(pixelFormat, attrToken, len, ivalues);
}
-
+
if(null == glp && MacOSXCGLContext.isLionOrLater) {
// pre-scan for OpenGL Profile
for (int i = 0; i < len; i++) {
@@ -265,11 +265,11 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration
break;
case CGL.kCGLOGLPVersion_Legacy:
glp = GLProfile.get(GLProfile.GL2);
- break;
+ break;
default:
throw new RuntimeException("Unhandled OSX OpenGL Profile: 0x"+Integer.toHexString(ivalue));
}
- }
+ }
}
}
if(null == glp) {
@@ -284,7 +284,7 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration
case CGL.NSOpenGLPFAAccelerated:
caps.setHardwareAccelerated(ivalue != 0);
break;
-
+
case CGL.kCGLPFAColorFloat:
// caps.setPbufferFloatingPointBuffers(ivalue != 0);
break;
@@ -346,7 +346,7 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration
}
}
caps.setAlphaBits(alphaBits);
-
+
return caps;
}
}
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java
index 3bbba2c52..e761be7b7 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.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
@@ -56,13 +56,13 @@ public class MacOSXCGLGraphicsConfigurationFactory extends GLGraphicsConfigurati
static void registerFactory() {
GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.macosx.MacOSXGraphicsDevice.class, GLCapabilitiesImmutable.class, new MacOSXCGLGraphicsConfigurationFactory());
}
- private MacOSXCGLGraphicsConfigurationFactory() {
+ private MacOSXCGLGraphicsConfigurationFactory() {
}
protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl(
CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested,
CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen, int nativeVisualID) {
-
+
if (absScreen == null) {
throw new IllegalArgumentException("AbstractGraphicsScreen is null");
}
@@ -78,7 +78,7 @@ public class MacOSXCGLGraphicsConfigurationFactory extends GLGraphicsConfigurati
if (chooser != null && !(chooser instanceof GLCapabilitiesChooser)) {
throw new IllegalArgumentException("This NativeWindowFactory accepts only GLCapabilitiesChooser objects");
}
-
+
return chooseGraphicsConfigurationStatic((GLCapabilitiesImmutable)capsChosen, (GLCapabilitiesImmutable)capsRequested, (GLCapabilitiesChooser)chooser, absScreen, false);
}
@@ -91,7 +91,7 @@ public class MacOSXCGLGraphicsConfigurationFactory extends GLGraphicsConfigurati
}
final AbstractGraphicsDevice device = absScreen.getDevice();
capsChosen = GLGraphicsConfigurationUtil.fixGLCapabilities( capsChosen, GLDrawableFactory.getDesktopFactory(), device);
-
+
return new MacOSXCGLGraphicsConfiguration(absScreen, (GLCapabilitiesImmutable)capsChosen, (GLCapabilitiesImmutable)capsRequested);
}
}
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java
index 4e791cb5f..f6e8b8fa3 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java
@@ -90,7 +90,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
public GLContext createContext(GLContext shareWith) {
return new MacOSXCGLContext(this, shareWith);
}
-
+
protected int getTextureTarget() { return pBufferTexTarget; }
protected int getTextureWidth() { return pBufferTexWidth; }
protected int getTextureHeight() { return pBufferTexHeight; }
@@ -101,7 +101,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
if (0 != pBuffer) {
synchronized (createdContexts) {
for(int i=0; i<createdContexts.size(); ) {
- final WeakReference<MacOSXCGLContext> ref = createdContexts.get(i);
+ final WeakReference<MacOSXCGLContext> ref = createdContexts.get(i);
final MacOSXCGLContext ctx = ref.get();
if (ctx != null) {
ctx.detachPBuffer();
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java
index edf9b7c84..c08259665 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.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
@@ -59,7 +59,7 @@ import jogamp.opengl.macosx.cgl.MacOSXCGLGraphicsConfiguration;
public class MacOSXAWTCGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFactory {
public static void registerFactory() {
GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.awt.AWTGraphicsDevice.class, GLCapabilitiesImmutable.class, new MacOSXAWTCGLGraphicsConfigurationFactory());
- }
+ }
private MacOSXAWTCGLGraphicsConfigurationFactory() {
}