From 82a88278a0360e0e5896c5c0f009c47f9ff2a83c Mon Sep 17 00:00:00 2001
From: Michael Bien <mbien@fh-landshut.de>
Date: Thu, 9 Sep 2010 21:36:56 +0200
Subject: trivial code cleanup in glx package.  - locks are final  - debug
 prints use System.err exclusively (to prevent message corruption)  - removed
 unused imports, unused variables  - code cleanup in some places

---
 .../com/jogamp/opengl/impl/GLContextImpl.java      | 40 ++++++++++++----------
 1 file changed, 22 insertions(+), 18 deletions(-)

(limited to 'src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java')

diff --git a/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java b/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java
index 61705439e..e63f5a225 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java
@@ -119,8 +119,8 @@ public abstract class GLContextImpl extends GLContext {
 
   public GL setGL(GL gl) {
     if(DEBUG) {
-        String sgl1 = (null!=this.gl)?this.gl.getClass().toString()+", "+this.gl.toString():new String("<null>");
-        String sgl2 = (null!=gl)?gl.getClass().toString()+", "+gl.toString():new String("<null>");
+        String sgl1 = (null!=this.gl)?this.gl.getClass().toString()+", "+this.gl.toString():"<null>";
+        String sgl2 = (null!=gl)?gl.getClass().toString()+", "+gl.toString():"<null>";
         Exception e = new Exception("setGL (OpenGL "+getGLVersion()+"): "+Thread.currentThread()+", "+sgl1+" -> "+sgl2);
         e.printStackTrace();
     }
@@ -455,26 +455,12 @@ public abstract class GLContextImpl extends GLContext {
     AbstractGraphicsConfiguration config = drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration();
     GLCapabilities glCaps = (GLCapabilities) config.getChosenCapabilities();
     GLProfile glp = glCaps.getGLProfile();
-    long _context = 0;
 
     if (DEBUG) {
       System.err.println(getThreadName() + ": !!! createContextARB: mappedVersionsAvailableSet "+ mappedVersionsAvailableSet);
     }
-    if( !mappedVersionsAvailableSet ) {
-        synchronized(mappedVersionsAvailableLock) {
-            if( !mappedVersionsAvailableSet ) {
-                createContextARBMapVersionsAvailable(4, false /* compat */); // GL4
-                createContextARBMapVersionsAvailable(4, true /* compat */);  // GL4bc
-                createContextARBMapVersionsAvailable(3, false /* compat */); // GL3
-                createContextARBMapVersionsAvailable(3, true /* compat */);  // GL3bc
-                createContextARBMapVersionsAvailable(2, true /* compat */);  // GL2
-                mappedVersionsAvailableSet=true;
-                if (DEBUG) {
-                  System.err.println(getThreadName() + ": !!! createContextARB: SET mappedVersionsAvailableSet "+ mappedVersionsAvailableSet);
-                }
-            }
-        }
-    }
+
+    mapGLVersions();
 
     int reqMajor;
     if(glp.isGL4()) {
@@ -502,6 +488,24 @@ public abstract class GLContextImpl extends GLContext {
     return _ctx;
   }
 
+    private void mapGLVersions() {
+        if (!mappedVersionsAvailableSet) {
+            synchronized (mappedVersionsAvailableLock) {
+                if (!mappedVersionsAvailableSet) {
+                    createContextARBMapVersionsAvailable(4, false); // GL4
+                    createContextARBMapVersionsAvailable(4, true);  // GL4bc
+                    createContextARBMapVersionsAvailable(3, false); // GL3
+                    createContextARBMapVersionsAvailable(3, true);  // GL3bc
+                    createContextARBMapVersionsAvailable(2, true);  // GL2
+                    mappedVersionsAvailableSet = true;
+                    if (DEBUG) {
+                        System.err.println(getThreadName() + ": !!! createContextARB: SET mappedVersionsAvailableSet " + mappedVersionsAvailableSet);
+                    }
+                }
+            }
+        }
+    }
+
   private final void createContextARBMapVersionsAvailable(int reqMajor, boolean compat)
   {
     long _context;
-- 
cgit v1.2.3


From dc9191f1733960d8a035b5fb8c5f8314f54a0ca7 Mon Sep 17 00:00:00 2001
From: Sven Gothel <sgothel@jausoft.com>
Date: Wed, 15 Sep 2010 00:43:27 +0200
Subject: Misc Cleanups

- www/index.html: absolute local refs -> relative

- Platform GLContextImpl specialisations: remove local overriding drawable instance

- X11ExternalGLXDrawable: Remove dead code, left over.
---
 .../classes/com/jogamp/opengl/impl/GLContextImpl.java     | 10 +++++-----
 .../opengl/impl/macosx/cgl/MacOSXOnscreenCGLContext.java  |  2 --
 .../opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java   |  8 +++-----
 .../opengl/impl/windows/wgl/WindowsPbufferWGLContext.java |  8 +++-----
 .../opengl/impl/x11/glx/X11ExternalGLXDrawable.java       | 15 ++-------------
 .../impl/x11/glx/X11GLXGraphicsConfigurationFactory.java  |  5 ++---
 .../opengl/impl/x11/glx/X11OffscreenGLXContext.java       |  2 --
 .../jogamp/opengl/impl/x11/glx/X11PbufferGLXContext.java  |  4 +---
 www/index.html                                            | 10 +++++-----
 9 files changed, 21 insertions(+), 43 deletions(-)

(limited to 'src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java')

diff --git a/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java b/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java
index 258445ce2..c19871560 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java
@@ -492,11 +492,11 @@ public abstract class GLContextImpl extends GLContext {
         if (!mappedVersionsAvailableSet) {
             synchronized (mappedVersionsAvailableLock) {
                 if (!mappedVersionsAvailableSet) {
-                    createContextARBMapVersionsAvailable(4, false); // GL4
-                    createContextARBMapVersionsAvailable(4, true);  // GL4bc
-                    createContextARBMapVersionsAvailable(3, false); // GL3
-                    createContextARBMapVersionsAvailable(3, true);  // GL3bc
-                    createContextARBMapVersionsAvailable(2, true);  // GL2
+                    createContextARBMapVersionsAvailable(4, false /* core   */);  // GL4
+                    createContextARBMapVersionsAvailable(4, true  /* compat */);  // GL4bc
+                    createContextARBMapVersionsAvailable(3, false /* core   */);  // GL3
+                    createContextARBMapVersionsAvailable(3, true  /* compat */);  // GL3bc
+                    createContextARBMapVersionsAvailable(2, true  /* compat */);  // GL2
                     mappedVersionsAvailableSet = true;
                     if (DEBUG) {
                         System.err.println(getThreadName() + ": !!! createContextARB: SET mappedVersionsAvailableSet " + mappedVersionsAvailableSet);
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOnscreenCGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOnscreenCGLContext.java
index 568204384..e494fd121 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOnscreenCGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOnscreenCGLContext.java
@@ -46,12 +46,10 @@ import javax.media.opengl.*;
 import com.jogamp.opengl.impl.*;
 
 public class MacOSXOnscreenCGLContext extends MacOSXCGLContext {
-  protected MacOSXOnscreenCGLDrawable drawable;
 
   public MacOSXOnscreenCGLContext(MacOSXOnscreenCGLDrawable drawable,
                                  GLContext shareWith) {
     super(drawable, shareWith);
-    this.drawable = drawable;
   }
 
   protected void makeCurrentImpl(boolean newCreated) throws GLException {
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java
index 9c630d24b..3964c9771 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java
@@ -9,7 +9,6 @@ import javax.media.nativewindow.*;
 import com.jogamp.opengl.impl.*;
 
 public class MacOSXPbufferCGLContext extends MacOSXCGLContext {
-  protected MacOSXPbufferCGLDrawable drawable;
 
   // State for render-to-texture and render-to-texture-rectangle support
   private int textureTarget; // e.g. GL_TEXTURE_2D, GL_TEXTURE_RECTANGLE_NV
@@ -28,7 +27,6 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext {
   public MacOSXPbufferCGLContext(MacOSXPbufferCGLDrawable drawable,
                                 GLContext shareWith) {
     super(drawable, shareWith);
-    this.drawable = drawable;
     initOpenGLImpl();
   }
 
@@ -45,8 +43,8 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext {
   }
 
   protected void makeCurrentImpl(boolean newCreated) throws GLException {
-    if (getOpenGLMode() != drawable.getOpenGLMode()) {
-      setOpenGLMode(drawable.getOpenGLMode());
+    if (getOpenGLMode() != ((MacOSXPbufferCGLDrawable)drawable).getOpenGLMode()) {
+      setOpenGLMode(((MacOSXPbufferCGLDrawable)drawable).getOpenGLMode());
     }
 
     if (!impl.makeCurrent(contextHandle)) {
@@ -149,7 +147,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext {
       throw new GLException("Can't switch between using NSOpenGLPixelBuffer and CGLPBufferObj more than once");
     }
     destroyImpl();
-    drawable.setOpenGLMode(mode);
+    ((MacOSXPbufferCGLDrawable)drawable).setOpenGLMode(mode);
     openGLMode = mode;
     haveSetOpenGLMode = true;
     if (DEBUG) {
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLContext.java
index 1da5b80c9..66953289b 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLContext.java
@@ -46,7 +46,6 @@ public class WindowsPbufferWGLContext extends WindowsWGLContext {
   private static final boolean DEBUG = Debug.debug("WindowsPbufferWGLContext");
 
   // State for render-to-texture and render-to-texture-rectangle support
-  private WindowsPbufferWGLDrawable drawable;
   private boolean rtt;       // render-to-texture?
   private boolean hasRTT;    // render-to-texture extension available?
   private boolean rect;      // render-to-texture-rectangle?
@@ -56,7 +55,6 @@ public class WindowsPbufferWGLContext extends WindowsWGLContext {
   public WindowsPbufferWGLContext(WindowsPbufferWGLDrawable drawable,
                                  GLContext shareWith) {
     super(drawable, shareWith);
-    this.drawable = drawable;
   }
 
   public void bindPbufferToTexture() {
@@ -68,7 +66,7 @@ public class WindowsPbufferWGLContext extends WindowsWGLContext {
     WGLExt wglExt = getWGLExt();
     gl.glBindTexture(textureTarget, texture);
     if (rtt && hasRTT) {
-      if (!wglExt.wglBindTexImageARB(drawable.getPbufferHandle(), WGLExt.WGL_FRONT_LEFT_ARB)) {
+      if (!wglExt.wglBindTexImageARB(((WindowsPbufferWGLDrawable)drawable).getPbufferHandle(), WGLExt.WGL_FRONT_LEFT_ARB)) {
         throw new GLException("Binding of pbuffer to texture failed: " + wglGetLastError());
       }
     }
@@ -84,7 +82,7 @@ public class WindowsPbufferWGLContext extends WindowsWGLContext {
     }
     if (rtt && hasRTT) {
       WGLExt wglExt = getWGLExt();
-      if (!wglExt.wglReleaseTexImageARB(drawable.getPbufferHandle(), WGLExt.WGL_FRONT_LEFT_ARB)) {
+      if (!wglExt.wglReleaseTexImageARB(((WindowsPbufferWGLDrawable)drawable).getPbufferHandle(), WGLExt.WGL_FRONT_LEFT_ARB)) {
         throw new GLException("Releasing of pbuffer from texture failed: " + wglGetLastError());
       }
     }
@@ -142,7 +140,7 @@ public class WindowsPbufferWGLContext extends WindowsWGLContext {
   }
 
   public int getFloatingPointMode() {
-    return drawable.getFloatingPointMode();
+    return ((WindowsPbufferWGLDrawable)drawable).getFloatingPointMode();
   }
 
   private static String wglGetLastError() {
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11ExternalGLXDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11ExternalGLXDrawable.java
index 006a55e20..d930179df 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11ExternalGLXDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11ExternalGLXDrawable.java
@@ -47,19 +47,8 @@ import com.jogamp.nativewindow.impl.NullWindow;
 
 public class X11ExternalGLXDrawable extends X11GLXDrawable {
 
-    //TODO? those are not used
-//  private int fbConfigID;
-//  private int renderType;
-
-  private X11ExternalGLXDrawable(GLDrawableFactory factory, NativeWindow component, int renderType) {
+  private X11ExternalGLXDrawable(GLDrawableFactory factory, NativeWindow component) {
     super(factory, component, true);
-
-//    this.renderType = renderType;
-
-    // Need GLXFBConfig ID in order to properly create new contexts
-    // on this drawable
-//    X11GLXGraphicsConfiguration cfg = (X11GLXGraphicsConfiguration) component.getGraphicsConfiguration();
-//    fbConfigID = cfg.getFBConfigID();
   }
 
   protected static X11ExternalGLXDrawable create(GLDrawableFactory factory, GLProfile glp) {
@@ -97,7 +86,7 @@ public class X11ExternalGLXDrawable extends X11GLXDrawable {
     NullWindow nw = new NullWindow(cfg);
     nw.setSurfaceHandle(drawable);
     nw.setSize(w, h);
-    return new X11ExternalGLXDrawable(factory, nw, GLX.GLX_RGBA_TYPE);
+    return new X11ExternalGLXDrawable(factory, nw);
   }
 
   public GLContext createContext(GLContext shareWith) {
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java
index 8fcc7994b..9884db288 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java
@@ -132,7 +132,6 @@ public class X11GLXGraphicsConfigurationFactory extends GraphicsConfigurationFac
         }
 
         GLCapabilities caps2 = (GLCapabilities) capabilities.clone();
-        GLCapabilitiesChooser glChooser = chooser;
 
         boolean usePBuffer = caps2.isPBuffer();
 
@@ -141,12 +140,12 @@ public class X11GLXGraphicsConfigurationFactory extends GraphicsConfigurationFac
             caps2.setDoubleBuffered(false);
         }
     
-        X11GLXGraphicsConfiguration res = chooseGraphicsConfigurationFBConfig(caps2, glChooser, x11Screen);
+        X11GLXGraphicsConfiguration res = chooseGraphicsConfigurationFBConfig(caps2, chooser, x11Screen);
         if(null==res) {
             if(usePBuffer) {
                 throw new GLException("Error: Couldn't create X11GLXGraphicsConfiguration based on FBConfig for "+caps2);
             }
-            res = chooseGraphicsConfigurationXVisual(caps2, glChooser, x11Screen);
+            res = chooseGraphicsConfigurationXVisual(caps2, chooser, x11Screen);
         }
         if(null==res) {
             throw new GLException("Error: Couldn't create X11GLXGraphicsConfiguration based on FBConfig and XVisual for "+caps2);
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXContext.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXContext.java
index f3674c108..6f24d5a60 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXContext.java
@@ -42,12 +42,10 @@ package com.jogamp.opengl.impl.x11.glx;
 import javax.media.opengl.*;
 
 public class X11OffscreenGLXContext extends X11GLXContext {
-  private X11OffscreenGLXDrawable drawable;
 
   public X11OffscreenGLXContext(X11OffscreenGLXDrawable drawable,
                                GLContext shareWith) {
     super(drawable, shareWith);
-    this.drawable = drawable;
   }
 
   public int getOffscreenContextPixelDataType() {
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11PbufferGLXContext.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11PbufferGLXContext.java
index 8d118f2df..85bbade24 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11PbufferGLXContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11PbufferGLXContext.java
@@ -42,11 +42,9 @@ package com.jogamp.opengl.impl.x11.glx;
 import javax.media.opengl.*;
 
 public class X11PbufferGLXContext extends X11GLXContext {
-  private X11PbufferGLXDrawable drawable;
 
   public X11PbufferGLXContext(X11PbufferGLXDrawable drawable, GLContext shareWith) {
     super(drawable, shareWith);
-    this.drawable = drawable;
   }
 
   public void bindPbufferToTexture() {
@@ -61,7 +59,7 @@ public class X11PbufferGLXContext extends X11GLXContext {
 
 
   public int getFloatingPointMode() {
-    return drawable.getFloatingPointMode();
+    return ((X11PbufferGLXDrawable)drawable).getFloatingPointMode();
   }
 
   protected boolean createImpl() {
diff --git a/www/index.html b/www/index.html
index 41aa15010..90cd159ff 100644
--- a/www/index.html
+++ b/www/index.html
@@ -4,7 +4,7 @@
         <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
         <link href="../../style.css" rel="stylesheet" type="text/css"/>
         <title>JOGL - Java Binding for the OpenGL API</title>
-        <link href="http://jogamp.org/SocialCoding/logo_symbol_finals/website_final_blue_favicon_symbol_16x16pel.ico" rel="shortcut icon">
+        <link href="../../SocialCoding/logo_symbol_finals/website_final_blue_favicon_symbol_16x16pel.ico" rel="shortcut icon">
     </head>
     <body>
         <div id="container">
@@ -14,7 +14,7 @@
             </div>
             <div id="menu">
                 <ul>
-                    <li><a href="http://jogamp.org/">Home</a></li>
+                    <li><a href="../../">Home</a></li>
                     <li><a href="../../gluegen/www/">Gluegen</a></li>
                     <li><a href="../../joal/www/">JOAL</a></li>
                     <li><a href="../../jocl/www/">JOCL</a></li>
@@ -45,7 +45,7 @@
                     </ul>
                     <h3>Presentations</h3>
                     <ul>
-                        <li><a href="http://jogamp.org/doc/siggraph2010/jogamp-siggraph2010.pdf">Siggraph 2010</a></li>
+                        <li><a href="../../doc/siggraph2010/jogamp-siggraph2010.pdf">Siggraph 2010</a></li>
                     </ul>
                     <h3>Archive</h3>
                     <ul>
@@ -71,7 +71,7 @@
                         It is part of a suite of open-source technologies initiated by the Game Technology Group at Sun Microsystems.
                     </p>
                     <p>
-                        Please see the <a href="http://jogamp.org/jogl-demos/www">JOGL demos</a> for illustrations of
+                        Please see the <a href="../../jogl-demos/www">JOGL demos</a> for illustrations of
                         advanced OpenGL techniques now possible with the Java platform.
                     </p>
 
@@ -474,7 +474,7 @@
             <div id="footer">
                 <div id="footer_left">
                     <span>JogAmp.org</span>
-                    by <a href="http://jogamp.org">http://jogamp.org</a>
+                    by <a href="../../">http://jogamp.org</a>
                     is licensed under a <br/>
                     <a href="http://creativecommons.org/licenses/by/3.0/us/">Creative Commons Attribution 3.0 License</a>.
                 </div>
-- 
cgit v1.2.3