aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--make/build.xml36
-rw-r--r--make/gl-common-x11.cfg2
-rw-r--r--make/jawt-x11.cfg2
-rw-r--r--make/stub_includes/x11/X11/X.h2
-rw-r--r--src/net/java/games/gluegen/GlueGen.java9
-rw-r--r--src/net/java/games/gluegen/StructLayout.java1
-rw-r--r--src/net/java/games/gluegen/cgram/types/MachineDescription64Bit.java46
-rw-r--r--src/net/java/games/jogl/impl/x11/X11GLContext.java21
-rw-r--r--src/net/java/games/jogl/impl/x11/X11OffscreenGLContext.java2
-rw-r--r--src/net/java/games/jogl/impl/x11/X11PbufferGLContext.java7
10 files changed, 115 insertions, 13 deletions
diff --git a/make/build.xml b/make/build.xml
index 19e192018..29649d06d 100644
--- a/make/build.xml
+++ b/make/build.xml
@@ -200,6 +200,7 @@
<property name="java.includes.dir.macosx" value="/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Headers" />
<property name="java.lib.dir.win32" value="${java.home.dir}/lib" />
<property name="java.lib.dir.linux" value="${java.home.dir}/jre/lib/i386" />
+ <property name="java.lib.dir.linux.amd64" value="${java.home.dir}/jre/lib/amd64" />
<condition property="cpu" value="sparc">
<os name="SunOS" arch="sparc" />
</condition>
@@ -303,7 +304,6 @@
<property name="javadoc.dev.packagenames.platform" value="${javadoc.dev.packagenames.x11}" />
</target>
-
<target name="declare.linux" depends="declare.x11">
<property name="java.includes.dir.platform" value="${java.includes.dir.linux}" />
<property name="java.lib.dir.platform" value="${java.lib.dir.linux}" />
@@ -312,6 +312,13 @@
<property name="linker.cfg.id" value="linker.cfg.linux" />
</target>
+ <target name="declare.linux.amd64" depends="declare.x11">
+ <property name="java.includes.dir.platform" value="${java.includes.dir.linux}" />
+ <property name="java.lib.dir.platform" value="${java.lib.dir.linux.amd64}" />
+
+ <property name="compiler.cfg.id" value="compiler.cfg.linux.amd64" />
+ <property name="linker.cfg.id" value="linker.cfg.linux.amd64" />
+ </target>
<target name="declare.solaris" depends="declare.x11">
<property name="java.includes.dir.platform" value="${java.includes.dir.solaris}" />
@@ -653,6 +660,10 @@
<!-- compiler configuration -->
<compiler id="compiler.cfg.linux" name="gcc" />
+ <compiler id="compiler.cfg.linux.amd64" name="gcc">
+ <compilerarg value="-fPIC"/>
+ </compiler>
+
<compiler id="compiler.cfg.solaris" name="suncc">
</compiler>
@@ -706,6 +717,11 @@
<syslibset dir="${x11.cg.lib}" libs="Cg, CgGL" if="c.compiler.use-cglib"/>
</linker>
+ <linker id="linker.cfg.linux.amd64" name="gcc">
+ <syslibset dir="/usr/X11R6/lib64" libs="GL, GLU, X11"/>
+ <syslibset dir="${x11.cg.lib}" libs="Cg, CgGL" if="c.compiler.use-cglib"/>
+ </linker>
+
<linker id="linker.cfg.solaris" name="suncc">
<syslibset libs="GL, GLU, X11"/>
</linker>
@@ -845,6 +861,9 @@
<target name="c.compile.jogl.linux" depends="declare.linux, c.build.jogl, c.build.cg" >
</target>
+ <target name="c.compile.jogl.linux.amd64" depends="declare.linux.amd64, c.build.jogl, c.build.cg" >
+ </target>
+
<target name="c.compile.jogl.solaris" depends="declare.solaris, c.build.jogl">
</target>
@@ -1001,7 +1020,7 @@
<target name="all">
<fail>
-Use a platform specific target: linux, macosx, solaris, win32.vc6, win32.vc7, win32.mingw
+Use a platform specific target: linux, linux.amd64, macosx, solaris, win32.vc6, win32.vc7, win32.mingw
</fail>
</target>
@@ -1050,7 +1069,18 @@ Use a platform specific target: linux, macosx, solaris, win32.vc6, win32.vc7, w
</target>
<!--
- - Solaris (assuming Solaris CC)
+ - Linux on AMD64 (assuming GCC)
+ -->
+ <target name="linux.amd64" depends="setup.java.home.dir.nonmacosx, declare.linux.amd64">
+ <!-- Generate, compile, and build the jar for the Java sources. -->
+ <antcall target="jar" inheritRefs="true" />
+
+ <!-- Compile the native C sources and build the jogl lib. -->
+ <antcall target="c.compile.jogl.linux.amd64" />
+ </target>
+
+ <!--
+ - Solaris (assuming Solaris CC)
-->
<target name="solaris" depends="setup.java.home.dir, declare.solaris">
<!-- Generate, compile, and build the jar for the Java sources. -->
diff --git a/make/gl-common-x11.cfg b/make/gl-common-x11.cfg
index 15154e363..5bc2ee8b6 100644
--- a/make/gl-common-x11.cfg
+++ b/make/gl-common-x11.cfg
@@ -5,6 +5,8 @@ Include gl-common.cfg
JavaOutputDir ../build/gensrc/classes
NativeOutputDir ../build/gensrc/native/jogl
+Opaque long XID
+
# Get returned array's capacity from XGetVisualInfo to be correct
TemporaryCVariableDeclaration XGetVisualInfo int count;
TemporaryCVariableAssignment XGetVisualInfo count = _ptr3[0];
diff --git a/make/jawt-x11.cfg b/make/jawt-x11.cfg
index 4161d7d13..5794ed4e0 100644
--- a/make/jawt-x11.cfg
+++ b/make/jawt-x11.cfg
@@ -7,8 +7,10 @@ JavaOutputDir ../build/gensrc/classes
NativeOutputDir ../build/gensrc/native/jogl
HierarchicalNativeOutput false
Opaque boolean jboolean
+Opaque long Drawable
Opaque long Display *
IgnoreField JAWT GetComponent
+IgnoreField JAWT_DrawingSurfaceInfo platformInfo
IgnoreField JAWT_X11DrawingSurfaceInfo GetAWTColor
CustomCCode #include <inttypes.h>
CustomCCode #include <jawt.h>
diff --git a/make/stub_includes/x11/X11/X.h b/make/stub_includes/x11/X11/X.h
index 2cd64bbf0..239836ee4 100644
--- a/make/stub_includes/x11/X11/X.h
+++ b/make/stub_includes/x11/X11/X.h
@@ -1,7 +1,7 @@
#ifndef _X_H_
#define _X_H_
-typedef unsigned long XID;
+typedef struct {} * XID;
typedef int Bool;
typedef struct {} Display;
typedef int Status;
diff --git a/src/net/java/games/gluegen/GlueGen.java b/src/net/java/games/gluegen/GlueGen.java
index 2e5f3421a..6c343a5ee 100644
--- a/src/net/java/games/gluegen/GlueGen.java
+++ b/src/net/java/games/gluegen/GlueGen.java
@@ -141,7 +141,14 @@ public class GlueGen implements GlueEmitterControls {
}
HeaderParser headerParser = new HeaderParser();
- MachineDescription machDesc = new MachineDescription32Bit();
+ MachineDescription machDesc;
+ String os = System.getProperty("os.name").toLowerCase();
+ String cpu = System.getProperty("os.arch").toLowerCase();
+ if (os.startsWith("linux") && cpu.equals("amd64")) {
+ machDesc = new MachineDescription64Bit();
+ } else {
+ machDesc = new MachineDescription32Bit();
+ }
headerParser.setMachineDescription(machDesc);
TypeDictionary td = new TypeDictionary();
headerParser.setTypedefDictionary(td);
diff --git a/src/net/java/games/gluegen/StructLayout.java b/src/net/java/games/gluegen/StructLayout.java
index 4f5b76f1c..7e32df683 100644
--- a/src/net/java/games/gluegen/StructLayout.java
+++ b/src/net/java/games/gluegen/StructLayout.java
@@ -123,6 +123,7 @@ public class StructLayout {
String cpu = System.getProperty("os.arch").toLowerCase();
if ((os.startsWith("windows") && cpu.equals("x86")) ||
(os.startsWith("linux") && cpu.equals("i386")) ||
+ (os.startsWith("linux") && cpu.equals("amd64")) ||
(os.startsWith("sunos") && cpu.equals("sparc")) ||
(os.startsWith("sunos") && cpu.equals("x86"))||
(os.startsWith("mac os") && cpu.equals("ppc"))
diff --git a/src/net/java/games/gluegen/cgram/types/MachineDescription64Bit.java b/src/net/java/games/gluegen/cgram/types/MachineDescription64Bit.java
new file mode 100644
index 000000000..fbfcfdfb7
--- /dev/null
+++ b/src/net/java/games/gluegen/cgram/types/MachineDescription64Bit.java
@@ -0,0 +1,46 @@
+/*
+ * 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
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * 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.
+ */
+
+package net.java.games.gluegen.cgram.types;
+
+public class MachineDescription64Bit extends MachineDescription {
+ public MachineDescription64Bit() {
+ super(1, 2, 4, 8, 8, 4, 8, 8);
+ }
+}
diff --git a/src/net/java/games/jogl/impl/x11/X11GLContext.java b/src/net/java/games/jogl/impl/x11/X11GLContext.java
index 359d0c95c..efcd9a101 100644
--- a/src/net/java/games/jogl/impl/x11/X11GLContext.java
+++ b/src/net/java/games/jogl/impl/x11/X11GLContext.java
@@ -40,6 +40,7 @@
package net.java.games.jogl.impl.x11;
import java.awt.Component;
+import java.security.*;
import java.util.*;
import net.java.games.gluegen.runtime.*; // for PROCADDRESS_VAR_PREFIX
import net.java.games.jogl.*;
@@ -64,11 +65,24 @@ public abstract class X11GLContext extends GLContext {
// so that we can implement displayImpl() (which must be done when
// the context is not current)
protected long mostRecentDisplay;
+ // There is currently a bug on Linux/AMD64 distributions in glXGetProcAddressARB
+ protected static boolean isLinuxAMD64;
static {
functionNameMap = new HashMap();
functionNameMap.put("glAllocateMemoryNV", "glXAllocateMemoryNV");
functionNameMap.put("glFreeMemoryNV", "glXFreeMemoryNV");
+
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ String os = System.getProperty("os.name").toLowerCase();
+ String arch = System.getProperty("os.arch").toLowerCase();
+ if (os.startsWith("linux") && arch.equals("amd64")) {
+ isLinuxAMD64 = true;
+ }
+ return null;
+ }
+ });
}
public X11GLContext(Component component,
@@ -185,7 +199,10 @@ public abstract class X11GLContext extends GLContext {
public abstract void swapBuffers() throws GLException;
protected long dynamicLookupFunction(String glFuncName) {
- long res = GLX.glXGetProcAddressARB(glFuncName);
+ long res = 0;
+ if (!isLinuxAMD64) {
+ res = GLX.glXGetProcAddressARB(glFuncName);
+ }
if (res == 0) {
// GLU routines aren't known to the OpenGL function lookup
res = GLX.dlsym(glFuncName);
@@ -235,7 +252,7 @@ public abstract class X11GLContext extends GLContext {
throw new GLException("Context not current");
}
if (!glXQueryExtensionsStringInitialized) {
- glXQueryExtensionsStringAvailable = (GLX.glXGetProcAddressARB("glXQueryExtensionsString") != 0);
+ glXQueryExtensionsStringAvailable = (dynamicLookupFunction("glXQueryExtensionsString") != 0);
glXQueryExtensionsStringInitialized = true;
}
if (glXQueryExtensionsStringAvailable) {
diff --git a/src/net/java/games/jogl/impl/x11/X11OffscreenGLContext.java b/src/net/java/games/jogl/impl/x11/X11OffscreenGLContext.java
index 2aa85e9f8..a22367091 100644
--- a/src/net/java/games/jogl/impl/x11/X11OffscreenGLContext.java
+++ b/src/net/java/games/jogl/impl/x11/X11OffscreenGLContext.java
@@ -44,7 +44,7 @@ import net.java.games.jogl.*;
import net.java.games.jogl.impl.*;
public class X11OffscreenGLContext extends X11GLContext {
- private int pixmap;
+ private long pixmap;
private boolean isDoubleBuffered;
// Width and height of the underlying bitmap
private int width;
diff --git a/src/net/java/games/jogl/impl/x11/X11PbufferGLContext.java b/src/net/java/games/jogl/impl/x11/X11PbufferGLContext.java
index 5ab976870..a253b9615 100644
--- a/src/net/java/games/jogl/impl/x11/X11PbufferGLContext.java
+++ b/src/net/java/games/jogl/impl/x11/X11PbufferGLContext.java
@@ -209,7 +209,7 @@ public class X11PbufferGLContext extends X11GLContext {
iattributes[niattribs++] = 0;
- int tmpBuffer = GLX.glXCreatePbuffer(display, fbConfig, iattributes);
+ long tmpBuffer = GLX.glXCreatePbuffer(display, fbConfig, iattributes);
if (tmpBuffer == 0) {
// FIXME: query X error code for detail error message
throw new GLException("pbuffer creation error: glXCreatePbuffer() failed");
@@ -251,10 +251,7 @@ public class X11PbufferGLContext extends X11GLContext {
created = true;
}
- // FIXME: this cast to int would be wrong on 64-bit platforms
- // where the argument type to glXMakeCurrent would change (should
- // probably make GLXDrawable, and maybe XID, Opaque as long)
- if (!GLX.glXMakeContextCurrent(display, (int) buffer, (int) buffer, context)) {
+ if (!GLX.glXMakeContextCurrent(display, buffer, buffer, context)) {
throw new GLException("Error making context current");
}