diff options
author | Kenneth Russel <[email protected]> | 2003-07-03 00:09:30 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2003-07-03 00:09:30 +0000 |
commit | 93d272a0525ec57aa3cd584f15cde6cf2a637e0c (patch) | |
tree | 3d6c9f2a305539d26c7449566bbb0d72bf74b12c /src/net/java/games/jogl/impl/macosx | |
parent | 37d90a0da397a1958fb101051170a60f871fb8cc (diff) |
Added pbuffer support to JOGL on X11; HWShadowmapsSimple and
ProceduralTexturePhysics demos are now working on Linux with the
appropriate hardware. Moved core GLX routines out of the public GLX
interface; this allowed XVisualInfo (and the new GLXFBConfig) to be
removed from the public API. Added support to GlueGen for returning
arrays of pointers as arrays of StructAccessors in Java and for
choosing the typedef name for a pointer-to-struct if the struct itself
does not have a typedef name. Added support to GLEmitter to emit
ProcAddressTables under arbitrary names and to support arbitrary
mechanisms for fetching those tables. Made GLU (on all platforms) and
GLX (on X11) be dynamically linked. Refactored ProcAddressTable
filling to be mostly shared code. Tested changes on Linux, Mac OS X
and Windows.
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@17 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/net/java/games/jogl/impl/macosx')
-rw-r--r-- | src/net/java/games/jogl/impl/macosx/MacOSXGLContext.java | 70 |
1 files changed, 10 insertions, 60 deletions
diff --git a/src/net/java/games/jogl/impl/macosx/MacOSXGLContext.java b/src/net/java/games/jogl/impl/macosx/MacOSXGLContext.java index 23367c045..d35392ac1 100644 --- a/src/net/java/games/jogl/impl/macosx/MacOSXGLContext.java +++ b/src/net/java/games/jogl/impl/macosx/MacOSXGLContext.java @@ -41,7 +41,7 @@ package net.java.games.jogl.impl.macosx; import java.awt.Component; import java.util.*; -import net.java.games.gluegen.opengl.*; // for PROCADDRESS_VAR_PREFIX +import net.java.games.gluegen.runtime.*; // for PROCADDRESS_VAR_PREFIX import net.java.games.jogl.*; import net.java.games.jogl.impl.*; @@ -49,6 +49,9 @@ public abstract class MacOSXGLContext extends GLContext { private static JAWT jawt; protected long nsContext; // NSOpenGLContext + // Table that holds the addresses of the native C-language entry points for + // OpenGL functions. + private GLProcAddressTable glProcAddressTable; public MacOSXGLContext(Component component, GLCapabilities capabilities, GLCapabilitiesChooser chooser) { @@ -90,74 +93,25 @@ public abstract class MacOSXGLContext extends GLContext protected abstract void swapBuffers() throws GLException; + protected long dynamicLookupFunction(String glFuncName) { + return CGL.getProcAddress(glFuncName); + } protected void resetGLFunctionAvailability() { super.resetGLFunctionAvailability(); - resetGLProcAddressTable(); - } - - protected void resetGLProcAddressTable() - { if (DEBUG) { System.err.println("!!! Initializing OpenGL extension address table"); } - - net.java.games.jogl.impl.ProcAddressTable table = getGLProcAddressTable(); - - // if GL is no longer an interface, we'll have to re-implement the code - // below so it only iterates through gl methods (a non-interface might - // have constructors, custom methods, etc). For now we assume all methods - // will be gl methods. - GL gl = getGL(); - - Class tableClass = table.getClass(); - - java.lang.reflect.Field[] fields = tableClass.getDeclaredFields(); - - for (int i = 0; i < fields.length; ++i) { - String addressFieldName = fields[i].getName(); - if (!addressFieldName.startsWith(GLEmitter.PROCADDRESS_VAR_PREFIX)) - { - // not a proc address variable - continue; - } - int startOfMethodName = GLEmitter.PROCADDRESS_VAR_PREFIX.length(); - String glFuncName = addressFieldName.substring(startOfMethodName); - try - { - java.lang.reflect.Field addressField = tableClass.getDeclaredField(addressFieldName); - assert(addressField.getType() == Long.TYPE); - // get the current value of the proc address variable in the table object - long oldProcAddress = addressField.getLong(table); - long newProcAddress = CGL.getProcAddress(glFuncName); - /* - System.err.println( - "!!! Address=" + (newProcAddress == 0 - ? "<NULL> " - : ("0x" + - Long.toHexString(newProcAddress))) + - "\tGL func: " + glFuncName); - */ - // set the current value of the proc address variable in the table object - addressField.setLong(gl, newProcAddress); - } catch (Exception e) { - throw new GLException( - "Cannot get GL proc address for method \"" + - glFuncName + "\": Couldn't get value of field \"" + addressFieldName + - "\" in class " + tableClass.getName(), e); - } - } - + resetProcAddressTable(getGLProcAddressTable()); } - public net.java.games.jogl.impl.ProcAddressTable getGLProcAddressTable() + public GLProcAddressTable getGLProcAddressTable() { if (glProcAddressTable == null) { // FIXME: cache ProcAddressTables by capability bits so we can // share them among contexts with the same capabilities - glProcAddressTable = - new net.java.games.jogl.impl.ProcAddressTable(); + glProcAddressTable = new GLProcAddressTable(); } return glProcAddressTable; } @@ -171,10 +125,6 @@ public abstract class MacOSXGLContext extends GLContext // Internals only below this point // - // Table that holds the addresses of the native C-language entry points for - // OpenGL functions. - private net.java.games.jogl.impl.ProcAddressTable glProcAddressTable; - protected JAWT getJAWT() { if (jawt == null) |