diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/jogl/native/macosx/MacOSXWindowSystemInterface-pbuffer.m | 25 | ||||
-rw-r--r-- | src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java | 16 |
2 files changed, 24 insertions, 17 deletions
diff --git a/src/jogl/native/macosx/MacOSXWindowSystemInterface-pbuffer.m b/src/jogl/native/macosx/MacOSXWindowSystemInterface-pbuffer.m index 66bd10f89..3fc6ea0f6 100644 --- a/src/jogl/native/macosx/MacOSXWindowSystemInterface-pbuffer.m +++ b/src/jogl/native/macosx/MacOSXWindowSystemInterface-pbuffer.m @@ -32,8 +32,6 @@ int texWidth; int texHeight; GLuint textureID; - GLint swapInterval; - GLint swapIntervalCounter; struct timespec lastWaitTime; #ifdef HAS_CADisplayLink CADisplayLink* displayLink; @@ -43,6 +41,8 @@ int tc; struct timespec t0; @public + GLint swapInterval; + GLint swapIntervalCounter; pthread_mutex_t renderLock; pthread_cond_t renderSignal; BOOL shallDraw; @@ -280,23 +280,22 @@ static CVReturn renderMyNSOpenGLLayer(CVDisplayLinkRef displayLink, } } */ GLenum textureTarget = [pbuffer textureTarget]; - GLfloat tWidth, tHeight; + GLfloat texCoordWidth, texCoordHeight; { GLsizei pwidth = [pbuffer pixelsWide]; GLsizei pheight = [pbuffer pixelsHigh]; - tWidth = textureTarget == GL_TEXTURE_2D ? (GLfloat)pwidth /(GLfloat)texWidth : pwidth; - tHeight = textureTarget == GL_TEXTURE_2D ? (GLfloat)pheight/(GLfloat)texHeight : pheight; + texCoordWidth = textureTarget == GL_TEXTURE_2D ? (GLfloat)pwidth /(GLfloat)texWidth : pwidth; + texCoordHeight = textureTarget == GL_TEXTURE_2D ? (GLfloat)pheight/(GLfloat)texHeight : pheight; } Bool texCreated = 0 == textureID; if(texCreated) { glGenTextures(1, &textureID); - DBG_PRINT("MyNSOpenGLLayer::drawInOpenGLContext %p, ctx %p, pfmt %p tex %dx%d -> %fx%f 0x%X: creating texID 0x%X\n", - self, context, pixelFormat, texWidth, texHeight, tWidth, tHeight, textureTarget, textureID); CGRect lRect = [self frame]; - DBG_PRINT("MyNSOpenGLLayer::drawInOpenGLContext %p frame0: %lf/%lf %lfx%lf\n", - self, lRect.origin.x, lRect.origin.y, lRect.size.width, lRect.size.height); + DBG_PRINT("MyNSOpenGLLayer::drawInOpenGLContext %p, pbuffer %p %dx%d -> tex %dx%d [%fx%f] id 0x%X target 0x%X, frame: %lf/%lf %lfx%lf (refcnt %d)\n", + self, pbuffer, [pbuffer pixelsWide], [pbuffer pixelsHigh], texWidth, texHeight, texCoordWidth, texCoordHeight, textureID, textureTarget, + lRect.origin.x, lRect.origin.y, lRect.size.width, lRect.size.height, (int)[self retainCount]); } glBindTexture(textureTarget, textureID); @@ -324,10 +323,10 @@ static CVReturn renderMyNSOpenGLLayer(CVDisplayLinkRef displayLink, }; GLfloat tex[] = { - 0.0, 0.0, - 0.0, tHeight, - tWidth, tHeight, - tWidth, 0.0 + 0.0, 0.0, + 0.0, texCoordHeight, + texCoordWidth, texCoordHeight, + texCoordWidth, 0.0 }; glEnableClientState(GL_VERTEX_ARRAY); diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java index 8098bdb1b..36d7c3727 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java @@ -115,8 +115,8 @@ public class JAWTUtil { JAWT jawt = JAWT.create(); // default queries - boolean tryOffscreenLayer = false; - boolean tryOnscreenLayer = true; + boolean tryOffscreenLayer; + boolean tryOnscreen; int jawt_version_flags_offscreen = jawt_version_flags; if(isOffscreenLayerRequired()) { @@ -124,7 +124,7 @@ public class JAWTUtil { if(Platform.OS_VERSION_NUMBER.compareTo(JAWTUtil.JAWT_MacOSXCALayerMinVersion) >= 0) { jawt_version_flags_offscreen |= JAWTUtil.JAWT_MACOSX_USE_CALAYER; tryOffscreenLayer = true; - tryOnscreenLayer = false; + tryOnscreen = false; } else { throw new RuntimeException("OSX: Invalid version of Java ("+Platform.JAVA_VERSION_NUMBER+") / OS X ("+Platform.OS_VERSION_NUMBER+")"); } @@ -135,9 +135,16 @@ public class JAWTUtil { if(Platform.OS_TYPE == Platform.OSType.MACOS) { jawt_version_flags_offscreen |= JAWTUtil.JAWT_MACOSX_USE_CALAYER; tryOffscreenLayer = true; + tryOnscreen = true; } else { throw new InternalError("offscreen requested and supported, but n/a for: "+Platform.OS_TYPE); } + } else { + tryOffscreenLayer = false; + tryOnscreen = true; + } + if(DEBUG) { + System.err.println("JAWTUtil.getJAWT(tryOffscreenLayer "+tryOffscreenLayer+", tryOnscreen "+tryOnscreen+")"); } StringBuilder errsb = new StringBuilder(); @@ -147,7 +154,7 @@ public class JAWTUtil { return jawt; } } - if(tryOnscreenLayer) { + if(tryOnscreen) { if(tryOffscreenLayer) { errsb.append(", "); } @@ -260,6 +267,7 @@ public class JAWTUtil { System.err.println("JAWTUtil: Is headless " + headlessMode); int hints = ( null != desktophints ) ? desktophints.size() : 0 ; System.err.println("JAWTUtil: AWT Desktop hints " + hints); + System.err.println("JAWTUtil: OffscreenLayer Supported: "+isOffscreenLayerSupported()+" - Required "+isOffscreenLayerRequired()); } } |