summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--make/build-jogl.xml39
-rw-r--r--make/build-nativewindow.xml15
-rw-r--r--make/build-newt.xml65
-rwxr-xr-xmake/config/jogl/eglext.cfg3
-rw-r--r--make/make.jogl.all.linux-x86.sh10
-rw-r--r--make/make.jogl.all.linux-x86_64.sh13
-rwxr-xr-xmake/stub_includes/egl/EGL/egl.h5
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java38
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java19
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java4
-rwxr-xr-xsrc/newt/classes/com/sun/javafx/newt/Display.java7
-rwxr-xr-xsrc/newt/classes/com/sun/javafx/newt/NewtFactory.java5
-rwxr-xr-xsrc/newt/classes/com/sun/javafx/newt/Screen.java2
-rwxr-xr-xsrc/newt/classes/com/sun/javafx/newt/Window.java2
-rw-r--r--src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLDisplay.java (renamed from src/newt/classes/com/sun/javafx/newt/opengl/egl/EGLDisplay.java)29
-rwxr-xr-xsrc/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLScreen.java64
-rwxr-xr-xsrc/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLWindow.java126
-rwxr-xr-xsrc/newt/native/BroadcomEGL.c170
-rwxr-xr-xsrc/newt/native/KDWindow.c18
19 files changed, 509 insertions, 125 deletions
diff --git a/make/build-jogl.xml b/make/build-jogl.xml
index 348dc0624..fda65c5b2 100644
--- a/make/build-jogl.xml
+++ b/make/build-jogl.xml
@@ -1199,16 +1199,9 @@
<!-- linker configuration -->
- <linker id="linker.cfg.linux.jogl.x11" extends="linker.cfg.linux">
+ <linker id="linker.cfg.linux.jogl.gl2" extends="linker.cfg.linux">
<syslibset dir="/usr/X11R6/lib" libs="X11"/>
<syslibset dir="/usr/X11R6/lib" libs="Xxf86vm" />
- </linker>
-
- <linker id="linker.cfg.linux.jogl.egl" extends="linker.cfg.linux">
- <syslibset dir="/nfsroot/lg/lib" libs="EglUtil"/>
- </linker>
-
- <linker id="linker.cfg.linux.jogl.gl2" extends="linker.cfg.linux.jogl.x11">
<syslibset dir="/usr/X11R6/lib" libs="GL"/>
</linker>
@@ -1293,8 +1286,6 @@
<target name="c.configure.win32.vc" if="isVCFamily">
<echo message="Win32.VC" />
<property name="compiler.cfg.id" value="compiler.cfg.win32.msvc" />
- <property name="linker.cfg.id.core" value="linker.cfg.win32.msvc" />
- <property name="linker.cfg.id.oswin" value="linker.cfg.win32.msvc.jogl" />
<property name="linker.cfg.id.gl2" value="linker.cfg.win32.msvc.jogl" />
<property name="linker.cfg.id.cg" value="linker.cfg.win32.msvc.jogl.cg" />
</target>
@@ -1302,8 +1293,6 @@
<target name="c.configure.win32.mingw" if="isMingW">
<echo message="Win32.MingW" />
<property name="compiler.cfg.id" value="compiler.cfg.win32.mingw" />
- <property name="linker.cfg.id.core" value="linker.cfg.win32.mingw" />
- <property name="linker.cfg.id.oswin" value="linker.cfg.win32.mingw.jogl" />
<property name="linker.cfg.id.gl2" value="linker.cfg.win32.mingw.jogl" />
<property name="linker.cfg.id.cg" value="linker.cfg.win32.mingw.jogl.cg" />
</target>
@@ -1311,8 +1300,6 @@
<target name="c.configure.linux.x86" if="isLinuxX86">
<echo message="Linux.x86" />
<property name="compiler.cfg.id" value="compiler.cfg.linux" />
- <property name="linker.cfg.id.core" value="linker.cfg.linux" />
- <property name="linker.cfg.id.oswin" value="linker.cfg.linux.jogl.x11" />
<property name="linker.cfg.id.gl2" value="linker.cfg.linux.jogl.gl2" />
<property name="linker.cfg.id.cg" value="linker.cfg.linux.jogl.cg" />
</target>
@@ -1320,8 +1307,6 @@
<target name="c.configure.linux.amd64" if="isLinuxAMD64">
<echo message="Linux.AMD64" />
<property name="compiler.cfg.id" value="compiler.cfg.linux.amd64" />
- <property name="linker.cfg.id.core" value="linker.cfg.linux.amd64" />
- <property name="linker.cfg.id.oswin" value="linker.cfg.linux.amd64.jogl.x11" />
<property name="linker.cfg.id.gl2" value="linker.cfg.linux.amd64.jogl.gl2" />
<property name="linker.cfg.id.cg" value="linker.cfg.linux.amd64.jogl.cg" />
</target>
@@ -1329,23 +1314,15 @@
<target name="c.configure.linux.ia64" if="isLinuxIA64">
<echo message="Linux.IA64" />
<property name="compiler.cfg.id" value="compiler.cfg.linux" />
- <property name="linker.cfg.id.core" value="linker.cfg.linux" />
- <property name="linker.cfg.id.oswin" value="linker.cfg.linux.jogl.x11" />
<property name="linker.cfg.id.gl2" value="linker.cfg.linux.jogl.gl2" />
<property name="linker.cfg.id.cg" value="linker.cfg.linux.jogl.cg" />
</target>
- <target name="c.configure.linux"
- depends="c.configure.linux.x86,c.configure.linux.amd64,c.configure.linux.ia64,c.configure.x11"
- if="isLinux">
- <property name="linker.cfg.id.egl" value="linker.cfg.linux.jogl.egl" />
- </target>
+ <target name="c.configure.linux" depends="c.configure.linux.x86,c.configure.linux.amd64,c.configure.linux.ia64,c.configure.x11" if="isLinux" />
<target name="c.configure.solaris32" depends="c.configure.x11" if="isSolaris32Bit">
<echo message="Solaris" />
<property name="compiler.cfg.id" value="compiler.cfg.solaris" />
- <property name="linker.cfg.id.core" value="linker.cfg.solaris" />
- <property name="linker.cfg.id.oswin" value="linker.cfg.solaris.jogl.x11" />
<property name="linker.cfg.id.gl2" value="linker.cfg.solaris.jogl.gl2" />
<property name="linker.cfg.id.cg" value="linker.cfg.solaris.jogl.cg" />
</target>
@@ -1354,8 +1331,6 @@
<target name="c.configure.solaris.sparcv9" depends="c.configure.x11" if="isSolarisSparcv9">
<echo message="SolarisSparcv9" />
<property name="compiler.cfg.id" value="compiler.cfg.solaris.sparcv9" />
- <property name="linker.cfg.id.core" value="linker.cfg.solaris.sparcv9" />
- <property name="linker.cfg.id.oswin" value="linker.cfg.solaris.sparcv9.jogl.x11" />
<property name="linker.cfg.id.gl2" value="linker.cfg.solaris.sparcv9.jogl.gl2" />
<property name="linker.cfg.id.cg" value="linker.cfg.solaris.sparcv9.jogl.cg" />
</target>
@@ -1364,8 +1339,6 @@
<target name="c.configure.solaris.amd64" depends="c.configure.x11" if="isSolarisAMD64">
<echo message="SolarisAMD64" />
<property name="compiler.cfg.id" value="compiler.cfg.solaris.amd64" />
- <property name="linker.cfg.id.core" value="linker.cfg.solaris.amd64" />
- <property name="linker.cfg.id.oswin" value="linker.cfg.solaris.amd64.jogl.x11" />
<property name="linker.cfg.id.gl2" value="linker.cfg.solaris.amd64.jogl.gl2" />
<property name="linker.cfg.id.cg" value="linker.cfg.solaris.amd64.jogl.cg" />
</target>
@@ -1373,8 +1346,6 @@
<target name="c.configure.freebsd" depends="c.configure.x11" if="isFreeBSD">
<echo message="FreeBSD" />
<property name="compiler.cfg.id" value="compiler.cfg.freebsd.jogl" />
- <property name="linker.cfg.id.core" value="linker.cfg.linux" />
- <property name="linker.cfg.id.oswin" value="linker.cfg.linux.jogl.x11" />
<property name="linker.cfg.id.gl2" value="linker.cfg.linux.jogl.gl2" />
<property name="linker.cfg.id.cg" value="linker.cfg.linux.jogl.cg" />
</target>
@@ -1382,8 +1353,6 @@
<target name="c.configure.hpux" depends="c.configure.x11" if="isHPUX">
<echo message="HP-UX" />
<property name="compiler.cfg.id" value="compiler.cfg.hpux" />
- <property name="linker.cfg.id.core" value="linker.cfg.hpux" />
- <property name="linker.cfg.id.oswin" value="linker.cfg.hpux.jogl.x11" />
<property name="linker.cfg.id.gl2" value="linker.cfg.hpux.jogl.gl2" />
<property name="linker.cfg.id.cg" value="linker.cfg.hpux.jogl.cg" />
</target>
@@ -1394,8 +1363,6 @@
<target name="c.configure.macosx" if="isOSX">
<property name="compiler.cfg.id" value="compiler.cfg.macosx" />
- <property name="linker.cfg.id.core" value="linker.cfg.macosx" />
- <property name="linker.cfg.id.oswin" value="linker.cfg.macosx.jogl" />
<property name="linker.cfg.id.gl2" value="linker.cfg.macosx.jogl" />
<property name="linker.cfg.id.cg" value="linker.cfg.macosx.jogl.cg" />
</target>
@@ -1554,7 +1521,7 @@
</macrodef>
<target name="c.build.jogl.prepare.openMAX" if="useOpenMAX">
- <javah destdir="${build}/gensrc/native/openmax" classpath="${classes-cdc}" class="com.sun.openmax.OMXInstance" />
+ <javah destdir="${src.generated.c.openmax}" classpath="${classes-cdc}" class="com.sun.openmax.OMXInstance" />
</target>
<target name="c.build.jogl.prepare" depends="c.build.jogl.prepare.openMAX">
diff --git a/make/build-nativewindow.xml b/make/build-nativewindow.xml
index e583d05a6..641e2a4f5 100644
--- a/make/build-nativewindow.xml
+++ b/make/build-nativewindow.xml
@@ -490,6 +490,8 @@
<!-- linker configuration -->
<linker id="linker.cfg.linux.nativewindow.x11" extends="linker.cfg.linux">
+ <syslibset dir="/usr/X11R6/lib" libs="X11"/>
+ <syslibset dir="/usr/X11R6/lib" libs="Xxf86vm" />
</linker>
<linker id="linker.cfg.linux.amd64.nativewindow.x11" extends="linker.cfg.linux.amd64">
@@ -531,35 +533,30 @@
<target name="c.configure.win32.vc" if="isVCFamily">
<echo message="Win32.VC" />
<property name="compiler.cfg.id" value="compiler.cfg.win32.msvc" />
- <property name="linker.cfg.id.core" value="linker.cfg.win32.msvc" />
<property name="linker.cfg.id.oswin" value="linker.cfg.win32.msvc.nativewindow" />
</target>
<target name="c.configure.win32.mingw" if="isMingW">
<echo message="Win32.MingW" />
<property name="compiler.cfg.id" value="compiler.cfg.win32.mingw" />
- <property name="linker.cfg.id.core" value="linker.cfg.win32.mingw" />
<property name="linker.cfg.id.oswin" value="linker.cfg.win32.mingw.nativewindow" />
</target>
<target name="c.configure.linux.x86" if="isLinuxX86">
<echo message="Linux.x86" />
<property name="compiler.cfg.id" value="compiler.cfg.linux" />
- <property name="linker.cfg.id.core" value="linker.cfg.linux" />
<property name="linker.cfg.id.oswin" value="linker.cfg.linux.nativewindow.x11" />
</target>
<target name="c.configure.linux.amd64" if="isLinuxAMD64">
<echo message="Linux.AMD64" />
<property name="compiler.cfg.id" value="compiler.cfg.linux.amd64" />
- <property name="linker.cfg.id.core" value="linker.cfg.linux.amd64" />
<property name="linker.cfg.id.oswin" value="linker.cfg.linux.amd64.nativewindow.x11" />
</target>
<target name="c.configure.linux.ia64" if="isLinuxIA64">
<echo message="Linux.IA64" />
<property name="compiler.cfg.id" value="compiler.cfg.linux" />
- <property name="linker.cfg.id.core" value="linker.cfg.linux" />
<property name="linker.cfg.id.oswin" value="linker.cfg.linux.nativewindow.x11" />
</target>
@@ -568,7 +565,6 @@
<target name="c.configure.solaris32" depends="c.configure.x11" if="isSolaris32Bit">
<echo message="Solaris" />
<property name="compiler.cfg.id" value="compiler.cfg.solaris" />
- <property name="linker.cfg.id.core" value="linker.cfg.solaris" />
<property name="linker.cfg.id.oswin" value="linker.cfg.solaris.nativewindow.x11" />
</target>
@@ -576,7 +572,6 @@
<target name="c.configure.solaris.sparcv9" depends="c.configure.x11" if="isSolarisSparcv9">
<echo message="SolarisSparcv9" />
<property name="compiler.cfg.id" value="compiler.cfg.solaris.sparcv9" />
- <property name="linker.cfg.id.core" value="linker.cfg.solaris.sparcv9" />
<property name="linker.cfg.id.oswin" value="linker.cfg.solaris.sparcv9.nativewindow.x11" />
</target>
@@ -584,21 +579,18 @@
<target name="c.configure.solaris.amd64" depends="c.configure.x11" if="isSolarisAMD64">
<echo message="SolarisAMD64" />
<property name="compiler.cfg.id" value="compiler.cfg.solaris.amd64" />
- <property name="linker.cfg.id.core" value="linker.cfg.solaris.amd64" />
<property name="linker.cfg.id.oswin" value="linker.cfg.solaris.amd64.nativewindow.x11" />
</target>
<target name="c.configure.freebsd" depends="c.configure.x11" if="isFreeBSD">
<echo message="FreeBSD" />
<property name="compiler.cfg.id" value="compiler.cfg.freebsd.nativewindow" />
- <property name="linker.cfg.id.core" value="linker.cfg.linux" />
<property name="linker.cfg.id.oswin" value="linker.cfg.linux.nativewindow.x11" />
</target>
<target name="c.configure.hpux" depends="c.configure.x11" if="isHPUX">
<echo message="HP-UX" />
<property name="compiler.cfg.id" value="compiler.cfg.hpux" />
- <property name="linker.cfg.id.core" value="linker.cfg.hpux" />
<property name="linker.cfg.id.oswin" value="linker.cfg.hpux.nativewindow.x11" />
</target>
@@ -608,7 +600,6 @@
<target name="c.configure.macosx" if="isOSX">
<property name="compiler.cfg.id" value="compiler.cfg.macosx" />
- <property name="linker.cfg.id.core" value="linker.cfg.macosx" />
<property name="linker.cfg.id.oswin" value="linker.cfg.macosx.nativewindow" />
</target>
@@ -749,7 +740,7 @@
<c.build c.compiler.src.files="c.src.files.jvm"
output.lib.name="nativewindow_jvm"
compiler.cfg.id="${compiler.cfg.id}"
- linker.cfg.id="${linker.cfg.id.oswin}"/>
+ linker.cfg.id="${linker.cfg.id.base}"/>
</target>
<target name="c.build.nativewindow.awt" unless="setup.noAWT">
diff --git a/make/build-newt.xml b/make/build-newt.xml
index 31a23172a..95869546f 100644
--- a/make/build-newt.xml
+++ b/make/build-newt.xml
@@ -97,16 +97,13 @@
</or>
</condition>
- <condition property="useKD">
- <isset property="${setup.useKD}" />
- </condition>
-
<condition property="setup.nonatives">
<and>
<isfalse value="${isWindows}" />
<isfalse value="${isOSX}" />
<isfalse value="${isX11}" />
<isfalse value="${useKD}" />
+ <isfalse value="${useBroadcomEGL}" />
</and>
</condition>
@@ -118,7 +115,9 @@
<echo message="setup.noAWT: ${setup.noAWT}" />
<echo message="setup.noOpenGL: ${setup.noOpenGL}" />
<echo message="javac.bootclasspath-cdc.jar: ${javac.bootclasspath-cdc.jar}" />
+ <echo message="isX11: ${isX11}" />
<echo message="useKD: ${useKD}" />
+ <echo message="useBroadcomEGL: ${useBroadcomEGL}" />
<!-- partitioning -->
@@ -135,7 +134,10 @@
value="com/sun/javafx/newt/macosx/*"/>
<property name="java.part.opengl"
- value="com/sun/javafx/newt/opengl/*, com/sun/javafx/newt/opengl/egl/*, com/sun/javafx/newt/opengl/kd/*"/>
+ value="com/sun/javafx/newt/opengl/*, com/sun/javafx/newt/opengl/kd/*"/>
+
+ <property name="java.part.broadcomegl"
+ value="com/sun/javafx/newt/opengl/broadcom/*"/>
<property name="java.part.awt"
value="com/sun/javafx/newt/awt/*"/>
@@ -148,7 +150,7 @@
</condition>
<condition property="java.excludes.opengl"
- value="${java.part.opengl}">
+ value="${java.part.opengl} ${java.part.broadcomegl}">
<isset property="setup.noOpenGL"/>
</condition>
@@ -271,6 +273,7 @@
<property name="newt.win.jar" value="${build}/newt.win.jar" />
<property name="newt.osx.jar" value="${build}/newt.osx.jar" />
<property name="newt.ogl.jar" value="${build}/newt.ogl.jar" />
+ <property name="newt.broadcomegl.jar" value="${build}/newt.broadcomegl.jar" />
<property name="newt.awt.jar" value="${build}/newt.awt.jar" />
<property name="newt.all.jar" value="${build}/newt.all.jar" />
@@ -279,6 +282,7 @@
<property name="newt.win.cdc.jar" value="${build}/newt.win.cdc.jar" />
<property name="newt.osx.cdc.jar" value="${build}/newt.osx.cdc.jar" />
<property name="newt.ogl.cdc.jar" value="${build}/newt.ogl.cdc.jar" />
+ <property name="newt.broadcomegl.cdc.jar" value="${build}/newt.broadcomegl.cdc.jar" />
<property name="newt.all.cdc.jar" value="${build}/newt.all.cdc.jar" />
<!-- The javadoc dirs. -->
@@ -308,6 +312,7 @@
<mkdir dir="${src.generated.c}" />
<mkdir dir="${src.generated.c}/X11" />
<mkdir dir="${src.generated.c}/KD" />
+ <mkdir dir="${src.generated.c}/BroadcomEGL" />
<mkdir dir="${src.generated.c}/MacOSX" />
<mkdir dir="${src.generated.c}/Windows" />
<mkdir dir="${classes}" />
@@ -364,7 +369,13 @@
<!-- linker configuration -->
+ <linker id="linker.cfg.linux.newt.broadcom_egl" extends="linker.cfg.linux">
+ <syslibset dir="/nfsroot/lg/lib" libs="EglUtil"/>
+ </linker>
+
<linker id="linker.cfg.linux.newt.x11" extends="linker.cfg.linux">
+ <syslibset dir="/usr/X11R6/lib" libs="X11"/>
+ <syslibset dir="/usr/X11R6/lib" libs="Xxf86vm" />
</linker>
<linker id="linker.cfg.linux.amd64.newt.x11" extends="linker.cfg.linux.amd64">
@@ -421,7 +432,19 @@
<echo message="Linux.x86" />
<property name="compiler.cfg.id" value="compiler.cfg.linux" />
<property name="linker.cfg.id.core" value="linker.cfg.linux" />
- <property name="linker.cfg.id.oswin" value="linker.cfg.linux.newt.x11" />
+
+ <echo message="isX11 ${isX11}" />
+ <echo message="useBroadcomEGL ${useBroadcomEGL}" />
+ <echo message="linker.cfg.linux.newt.x11 ${linker.cfg.linux.newt.x11}" />
+ <echo message="linker.cfg.linux.newt.broadcom_egl ${linker.cfg.linux.newt.broadcom_egl}" />
+
+ <condition property="linker.cfg.id.oswin" value="linker.cfg.linux.newt.x11" >
+ <isset property="isX11" />
+ </condition>
+ <condition property="linker.cfg.id.oswin" value="linker.cfg.linux.newt.broadcom_egl" >
+ <isset property="useBroadcomEGL" />
+ </condition>
+ <echo message="linker.cfg.id.oswin ${linker.cfg.id.oswin}" />
</target>
<target name="c.configure.linux.amd64" if="isLinuxAMD64">
@@ -521,6 +544,7 @@
<include name="${rootrel.src.c}/*.m" if="isOSX"/>
<include name="${rootrel.src.c}/X11Window.c" if="isX11"/>
<include name="${rootrel.src.c}/KDWindow.c" if="useKD"/>
+ <include name="${rootrel.src.c}/BroadcomEGL.c" if="useBroadcomEGL"/>
</patternset>
<echo message="Compiling @{output.lib.name}" />
@@ -553,7 +577,8 @@
<includepath path="${src.generated.c}/X11" if="isX11"/>
<includepath path="${src.generated.c}/MacOSX" if="isOSX"/>
<includepath path="${src.generated.c}/Windows" if="isWindows"/>
- <includepath path="${src.generated.c}/KD"/>
+ <includepath path="${src.generated.c}/KD" if="useKD" />
+ <includepath path="${src.generated.c}/BroadcomEGL" if="useBroadcomEGL" />
<!-- This must come last to not override real include paths -->
<!-- includepath path="stub_includes/macosx" if="isOSX" / -->
@@ -583,16 +608,20 @@
</macrodef>
<target name="c.build.newt.prepare.KD" if="useKD">
- <javah destdir="../${rootrel.build.newt}/gensrc/native/newt/KD" classpath="${classes}" class="com.sun.javafx.newt.opengl.kd.KDWindow" />
+ <javah destdir="${src.generated.c}/KD" classpath="${classes}" class="com.sun.javafx.newt.opengl.kd.KDWindow" />
+ </target>
+
+ <target name="c.build.newt.prepare.BroadcomEGL" if="useBroadcomEGL">
+ <javah destdir="${src.generated.c}/BroadcomEGL" classpath="${classes}" class="com.sun.javafx.newt.opengl.broadcom.BCEGLWindow" />
</target>
<target name="c.build.newt.prepare.desktop" unless="setup.nodesktop">
- <javah destdir="../${rootrel.build.newt}/gensrc/native/newt/Windows" classpath="${classes}" class="com.sun.javafx.newt.windows.WindowsWindow" />
- <javah destdir="../${rootrel.build.newt}/gensrc/native/newt/MacOSX" classpath="${classes}" class="com.sun.javafx.newt.macosx.MacWindow" />
- <javah destdir="../${rootrel.build.newt}/gensrc/native/newt/X11" classpath="${classes}" class="com.sun.javafx.newt.x11.X11Window" />
+ <javah destdir="${src.generated.c}/Windows" classpath="${classes}" class="com.sun.javafx.newt.windows.WindowsWindow" />
+ <javah destdir="${src.generated.c}/MacOSX" classpath="${classes}" class="com.sun.javafx.newt.macosx.MacWindow" />
+ <javah destdir="${src.generated.c}/X11" classpath="${classes}" class="com.sun.javafx.newt.x11.X11Window" />
</target>
- <target name="c.build.newt.prepare" depends="c.build.newt.prepare.KD,c.build.newt.prepare.desktop" />
+ <target name="c.build.newt.prepare" depends="c.build.newt.prepare.KD,c.build.newt.prepare.BroadcomEGL,c.build.newt.prepare.desktop" />
<target name="c.build.newt.windowlib" unless="setup.nonatives">
<c.build c.compiler.src.files="c.src.files.newt"
@@ -686,6 +715,10 @@
<fileset dir="${classes}"
includes="${java.part.opengl}"/>
</jar>
+ <jar manifest="tempversion" destfile="${newt.broadcomegl.jar}">
+ <fileset dir="${classes}"
+ includes="${java.part.broadcomegl}"/>
+ </jar>
</target>
<target name="build-jars-opengl-cdc" depends="setup-manifestfile-cdc" unless="setup.noOpenGL">
@@ -693,6 +726,10 @@
<fileset dir="${classes-cdc}"
includes="${java.part.opengl}"/>
</jar>
+ <jar manifest="tempversion-cdc" destfile="${newt.broadcomegl.cdc.jar}">
+ <fileset dir="${classes-cdc}"
+ includes="${java.part.broadcomegl}"/>
+ </jar>
</target>
<target name="build-jars-desktop" depends="setup-manifestfile" unless="setup.nodesktop">
@@ -735,7 +772,7 @@
<target name="build-jars-all-cdc" depends="setup-manifestfile-cdc" unless="setup.noall-cdc">
<jar manifest="tempversion-cdc" destfile="${newt.all.cdc.jar}">
<fileset dir="${classes-cdc}"
- includes="${java.part.core} ${java.part.opengl}"/>
+ includes="${java.part.core} ${java.part.opengl} ${java.part.broadcomegl}"/>
</jar>
</target>
diff --git a/make/config/jogl/eglext.cfg b/make/config/jogl/eglext.cfg
index 0447dd1e4..bdd9a3655 100755
--- a/make/config/jogl/eglext.cfg
+++ b/make/config/jogl/eglext.cfg
@@ -124,6 +124,3 @@ Ignore eglTerminate
Ignore eglWaitClient
Ignore eglWaitGL
Ignore eglWaitNative
-
-Ignore EGLUtil_CreateDisplayByNative
-Ignore EGLUtil_CreateWindowByNative
diff --git a/make/make.jogl.all.linux-x86.sh b/make/make.jogl.all.linux-x86.sh
index 915bacaf3..8842cbc0c 100644
--- a/make/make.jogl.all.linux-x86.sh
+++ b/make/make.jogl.all.linux-x86.sh
@@ -9,15 +9,17 @@ fi
# -Dc.compiler.debug=true
# -DuseOpenMAX=true \
# -Dbuild.noarchives=true
+# -Dgluegen.cpptasks.detected.os=true \
+# -DisUnix=true \
+# -DisLinux=true \
+# -DisLinuxX86=true \
ant \
-Dbuild.noarchives=true \
-Djogl.cg=1 -Dx11.cg.lib=../../lib-linux-x86 \
-Drootrel.build=build-x86 \
- -Dgluegen.cpptasks.detected.os=true \
- -DisUnix=true \
- -DisLinux=true \
- -DisLinuxX86=true \
+ -Dos.arch=x86 \
-DisX11=true \
+ -DuseKD=true \
-DuseOpenMAX=true \
$* 2>&1 | tee make.jogl.all.linux-x86.log
diff --git a/make/make.jogl.all.linux-x86_64.sh b/make/make.jogl.all.linux-x86_64.sh
index b9e1d1789..90883f97c 100644
--- a/make/make.jogl.all.linux-x86_64.sh
+++ b/make/make.jogl.all.linux-x86_64.sh
@@ -8,14 +8,17 @@ fi
# -Dc.compiler.debug=true
# -Dbuild.noarchives=true
+# -Dgluegen.cpptasks.detected.os=true \
+# -DisUnix=true \
+# -DisLinux=true \
+# -DisLinuxAMD64=true \
+# -DisX11=true \
+
ant \
-Dbuild.noarchives=true \
-Djogl.cg=1 -Dx11.cg.lib=../../lib-linux-x86_64 \
-Dc.compiler.debug=true \
-Drootrel.build=build-x86_64 \
- -Dgluegen.cpptasks.detected.os=true \
- -DisUnix=true \
- -DisLinux=true \
- -DisLinuxAMD64=true \
- -DisX11=true \
+ -DuseKD=true \
+ -DuseOpenMAX=true \
$* 2>&1 | tee make.jogl.all.linux-x86_64.log
diff --git a/make/stub_includes/egl/EGL/egl.h b/make/stub_includes/egl/EGL/egl.h
index 5b4c4215c..86ca4818f 100755
--- a/make/stub_includes/egl/EGL/egl.h
+++ b/make/stub_includes/egl/EGL/egl.h
@@ -297,11 +297,6 @@ EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface,
EGLNativePixmapType target);
-EGLAPI EGLDisplay EGLAPIENTRY EGLUtil_CreateDisplayByNative(EGLint w, EGLint h);
-
-EGLAPI EGLSurface EGLAPIENTRY EGLUtil_CreateWindowByNative(EGLDisplay dpy, EGLint xx,
- EGLint *wvalue, EGLint *hvalue);
-
typedef void (* EGLAPIENTRY __EGLFuncPtr)(void);
EGLAPI __EGLFuncPtr eglGetProcAddress(const char *procname);
diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java
index d2907c83d..aabc6f263 100755
--- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java
+++ b/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java
@@ -45,10 +45,10 @@ import javax.media.opengl.*;
public abstract class EGLDrawable extends GLDrawableImpl {
protected boolean ownEGLDisplay = false;
+ protected boolean ownEGLSurface = false;
private EGLGraphicsConfiguration eglConfig;
protected long eglDisplay;
protected long eglSurface;
- private int[] tmp = new int[1];
protected EGLDrawable(EGLDrawableFactory factory,
NativeWindow component) throws GLException {
@@ -78,13 +78,16 @@ public abstract class EGLDrawable extends GLDrawableImpl {
protected abstract long createSurface(long eglDpy, _EGLConfig eglNativeCfg);
private void recreateSurface() {
- if(EGL.EGL_NO_SURFACE!=eglSurface) {
- EGL.eglDestroySurface(eglDisplay, eglSurface);
- }
- eglSurface = createSurface(eglDisplay, eglConfig.getNativeConfig());
+ if(ownEGLSurface) {
+ // create a new EGLSurface ..
+ if(EGL.EGL_NO_SURFACE!=eglSurface) {
+ EGL.eglDestroySurface(eglDisplay, eglSurface);
+ }
+ eglSurface = createSurface(eglDisplay, eglConfig.getNativeConfig());
- if(DEBUG) {
- System.err.println("setSurface using component: handle 0x"+Long.toHexString(component.getWindowHandle())+" -> 0x"+Long.toHexString(eglSurface));
+ if(DEBUG) {
+ System.err.println("setSurface using component: handle 0x"+Long.toHexString(component.getWindowHandle())+" -> 0x"+Long.toHexString(eglSurface));
+ }
}
}
@@ -110,13 +113,28 @@ public abstract class EGLDrawable extends GLDrawableImpl {
if (null == eglConfig) {
throw new GLException("Null EGLGraphicsConfiguration from "+aConfig);
}
- eglConfig.updateGraphicsConfiguration();
+ int[] tmp = new int[1];
+ if (EGL.eglQuerySurface(eglDisplay, component.getWindowHandle(), EGL.EGL_CONFIG_ID, tmp, 0)) {
+ // component holds static EGLSurface
+ eglSurface = component.getWindowHandle();
+ if(DEBUG) {
+ System.err.println("setSurface re-using component's EGLSurface: handle 0x"+Long.toHexString(eglSurface));
+ }
+ } else {
+ // EGLSurface is ours ..
+ ownEGLSurface=true;
+
+ eglConfig.updateGraphicsConfiguration();
+ }
} else {
throw new GLException("EGLGraphicsConfiguration doesn't carry a EGLGraphicsDevice: "+aConfig);
}
} else {
// create a new EGL config ..
ownEGLDisplay=true;
+ // EGLSurface is ours ..
+ ownEGLSurface=true;
+
long nDisplay;
if( NativeWindowFactory.TYPE_WINDOWS.equals(NativeWindowFactory.getNativeWindowType(false)) ) {
nDisplay = component.getSurfaceHandle(); // don't even ask ..
@@ -153,7 +171,7 @@ public abstract class EGLDrawable extends GLDrawableImpl {
} finally {
unlockSurface();
}
- } else if (eglSurface != EGL.EGL_NO_SURFACE) {
+ } else if (ownEGLSurface && eglSurface != EGL.EGL_NO_SURFACE) {
// Destroy the window surface
if (!EGL.eglDestroySurface(eglDisplay, eglSurface)) {
throw new GLException("Error destroying window surface (eglDestroySurface)");
@@ -168,6 +186,7 @@ public abstract class EGLDrawable extends GLDrawableImpl {
}
public int getWidth() {
+ int[] tmp = new int[1];
if (!EGL.eglQuerySurface(eglDisplay, eglSurface, EGL.EGL_WIDTH, tmp, 0)) {
throw new GLException("Error querying surface width");
}
@@ -175,6 +194,7 @@ public abstract class EGLDrawable extends GLDrawableImpl {
}
public int getHeight() {
+ int[] tmp = new int[1];
if (!EGL.eglQuerySurface(eglDisplay, eglSurface, EGL.EGL_HEIGHT, tmp, 0)) {
throw new GLException("Error querying surface height");
}
diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java
index 4f04bb57a..08fbae5bc 100644
--- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java
+++ b/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java
@@ -37,6 +37,7 @@ package com.sun.opengl.impl.egl;
import java.util.*;
import javax.media.nativewindow.*;
+import javax.media.nativewindow.egl.*;
import javax.media.opengl.*;
import com.sun.opengl.impl.*;
import com.sun.gluegen.runtime.NativeLibrary;
@@ -52,15 +53,29 @@ public class EGLGraphicsConfiguration extends DefaultGraphicsConfiguration imple
return configID;
}
- public EGLGraphicsConfiguration(AbstractGraphicsScreen screen,
+ public EGLGraphicsConfiguration(AbstractGraphicsScreen absScreen,
GLCapabilities capsChosen, GLCapabilities capsRequested, GLCapabilitiesChooser chooser,
_EGLConfig cfg, int cfgID) {
- super(screen, capsChosen, capsRequested);
+ super(absScreen, capsChosen, capsRequested);
this.chooser = chooser;
_config = cfg;
configID = cfgID;
}
+ public static EGLGraphicsConfiguration create(GLProfile glp, AbstractGraphicsScreen absScreen, int cfgID) {
+ AbstractGraphicsDevice absDevice = absScreen.getDevice();
+ if(null==absDevice || !(absDevice instanceof EGLGraphicsDevice)) {
+ throw new GLException("GraphicsDevice must be a valid EGLGraphicsDevice");
+ }
+ long dpy = absDevice.getHandle();
+ if (dpy == EGL.EGL_NO_DISPLAY) {
+ throw new GLException("Invalid EGL display: "+absDevice);
+ }
+ _EGLConfig _cfg = EGLConfigId2EGLConfig(glp, dpy, cfgID);
+ GLCapabilities caps = EGLConfig2Capabilities(glp, dpy, _cfg);
+ return new EGLGraphicsConfiguration(absScreen, caps, caps, new DefaultGLCapabilitiesChooser(), _cfg, cfgID);
+ }
+
public Object clone() {
return super.clone();
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java
index fd6eb458e..cbd485649 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java
@@ -80,7 +80,7 @@ public abstract class NativeWindowFactory {
}
private static String _getNativeWindowingType(String osNameLowerCase) {
- if (osNameLowerCase.startsWith("kd") || osNameLowerCase.startsWith("linux")) {
+ if (osNameLowerCase.startsWith("kd")) {
return TYPE_EGL;
} else if (osNameLowerCase.startsWith("wind")) {
return TYPE_WINDOWS;
@@ -101,8 +101,6 @@ public abstract class NativeWindowFactory {
AccessControlContext acc = AccessController.getContext();
nativeOSNamePure = Debug.getProperty("os.name", false, acc);
nativeOSNameCustom = Debug.getProperty("nativewindow.ws.name", true, acc);
- System.out.println(nativeOSNamePure);
- System.out.println(nativeOSNameCustom);
if(null==nativeOSNameCustom||nativeOSNameCustom.length()==0) {
nativeOSNameCustom = nativeOSNamePure;
}
diff --git a/src/newt/classes/com/sun/javafx/newt/Display.java b/src/newt/classes/com/sun/javafx/newt/Display.java
index bdac08dab..04fdb0181 100755
--- a/src/newt/classes/com/sun/javafx/newt/Display.java
+++ b/src/newt/classes/com/sun/javafx/newt/Display.java
@@ -45,16 +45,15 @@ public abstract class Display implements Runnable {
{
Class displayClass = null;
if (NativeWindowFactory.TYPE_EGL.equals(type)) {
- // displayClass = Class.forName("com.sun.javafx.newt.opengl.kd.KDDisplay");
- displayClass = Class.forName("com.sun.javafx.newt.opengl.egl.EGLDisplay");
+ displayClass = Class.forName("com.sun.javafx.newt.opengl.kd.KDDisplay");
} else if (NativeWindowFactory.TYPE_WINDOWS.equals(type)) {
displayClass = Class.forName("com.sun.javafx.newt.windows.WindowsDisplay");
} else if (NativeWindowFactory.TYPE_MACOSX.equals(type)) {
displayClass = Class.forName("com.sun.javafx.newt.macosx.MacDisplay");
} else if (NativeWindowFactory.TYPE_X11.equals(type)) {
displayClass = Class.forName("com.sun.javafx.newt.x11.X11Display");
- } else if (NativeWindowFactory.TYPE_AWT.equals(type)) {
- displayClass = Class.forName("com.sun.javafx.newt.awt.AWTDisplay");
+ } else if (NewtFactory.TYPE_BROADCOM_EGL.equals(type)) {
+ displayClass = Class.forName("com.sun.javafx.newt.opengl.broadcom.BCEGLDisplay");
} else {
throw new RuntimeException("Unknown display type \"" + type + "\"");
}
diff --git a/src/newt/classes/com/sun/javafx/newt/NewtFactory.java b/src/newt/classes/com/sun/javafx/newt/NewtFactory.java
index b88e1e49e..dbae30a4b 100755
--- a/src/newt/classes/com/sun/javafx/newt/NewtFactory.java
+++ b/src/newt/classes/com/sun/javafx/newt/NewtFactory.java
@@ -39,6 +39,8 @@ import java.util.Iterator;
import com.sun.nativewindow.impl.jvm.JVMUtil;
public abstract class NewtFactory {
+ public static final String TYPE_BROADCOM_EGL = "BroadcomEGL";
+
// Work-around for initialization order problems on Mac OS X
// between native Newt and (apparently) Fmod
static {
@@ -50,7 +52,6 @@ public abstract class NewtFactory {
* Create a Display entity, incl native creation
*/
public static Display createDisplay(String name) {
- System.out.println("NewtFactory: NAME: " + name);
return Display.create(NativeWindowFactory.getNativeWindowType(true), name);
}
@@ -58,8 +59,6 @@ public abstract class NewtFactory {
* Create a Display entity using the given implementation type, incl native creation
*/
public static Display createDisplay(String type, String name) {
- System.out.println("NewtFactory: TYPE: " + type);
- System.out.println("NewtFactory: NAME: " + name);
return Display.create(type, name);
}
diff --git a/src/newt/classes/com/sun/javafx/newt/Screen.java b/src/newt/classes/com/sun/javafx/newt/Screen.java
index 2566041a8..57ed34211 100755
--- a/src/newt/classes/com/sun/javafx/newt/Screen.java
+++ b/src/newt/classes/com/sun/javafx/newt/Screen.java
@@ -54,6 +54,8 @@ public abstract class Screen {
screenClass = Class.forName("com.sun.javafx.newt.x11.X11Screen");
} else if (NativeWindowFactory.TYPE_AWT.equals(type)) {
screenClass = Class.forName("com.sun.javafx.newt.awt.AWTScreen");
+ } else if (NewtFactory.TYPE_BROADCOM_EGL.equals(type)) {
+ screenClass = Class.forName("com.sun.javafx.newt.opengl.broadcom.BCEGLScreen");
} else {
throw new RuntimeException("Unknown window type \"" + type + "\"");
}
diff --git a/src/newt/classes/com/sun/javafx/newt/Window.java b/src/newt/classes/com/sun/javafx/newt/Window.java
index 36eafd32d..a1168d12d 100755
--- a/src/newt/classes/com/sun/javafx/newt/Window.java
+++ b/src/newt/classes/com/sun/javafx/newt/Window.java
@@ -74,6 +74,8 @@ public abstract class Window implements NativeWindow
windowClass = Class.forName("com.sun.javafx.newt.x11.X11Window");
} else if (NativeWindowFactory.TYPE_AWT.equals(type)) {
windowClass = Class.forName("com.sun.javafx.newt.awt.AWTWindow");
+ } else if (NewtFactory.TYPE_BROADCOM_EGL.equals(type)) {
+ windowClass = Class.forName("com.sun.javafx.newt.opengl.broadcom.BCEGLWindow");
} else {
throw new NativeWindowException("Unknown window type \"" + type + "\"");
}
diff --git a/src/newt/classes/com/sun/javafx/newt/opengl/egl/EGLDisplay.java b/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLDisplay.java
index bebb7ccf2..abf9859c5 100644
--- a/src/newt/classes/com/sun/javafx/newt/opengl/egl/EGLDisplay.java
+++ b/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLDisplay.java
@@ -31,7 +31,7 @@
*
*/
-package com.sun.javafx.newt.opengl.egl;
+package com.sun.javafx.newt.opengl.broadcom;
import com.sun.javafx.newt.*;
import com.sun.javafx.newt.impl.*;
@@ -39,12 +39,14 @@ import com.sun.opengl.impl.egl.*;
import javax.media.nativewindow.*;
import javax.media.nativewindow.egl.*;
-public class EGLDisplay extends Display {
+public class BCEGLDisplay extends Display {
static {
NativeLibLoader.loadNEWT();
- System.loadLibrary("EglUtil");
+ if (!BCEGLWindow.initIDs()) {
+ throw new NativeWindowException("Failed to initialize BCEGLWindow jmethodIDs");
+ }
}
public static void initSingleton() {
@@ -52,27 +54,20 @@ public class EGLDisplay extends Display {
}
- public EGLDisplay() {
+ public BCEGLDisplay() {
}
protected void createNative() {
- try {
- int windowWidth = 1920, windowHeight = 1080;
- int width[] = { windowWidth };
- int height[] = { windowHeight };
- long eglDisplayHandle =
- EGL.EGLUtil_CreateDisplayByNative(windowWidth, windowHeight);
- long eglSurfaceHandle =
- EGL.EGLUtil_CreateWindowByNative(eglDisplayHandle, 1,
- width, 0, height, 0);
- } catch (Throwable th) {
- th.printStackTrace();
+ long handle = CreateDisplay(BCEGLScreen.fixedWidth, BCEGLScreen.fixedHeight);
+ if (handle == EGL.EGL_NO_DISPLAY) {
+ throw new NativeWindowException("BC EGL CreateDisplay failed");
}
+ aDevice = new EGLGraphicsDevice(handle);
}
protected void closeNative() {
if (aDevice.getHandle() != EGL.EGL_NO_DISPLAY) {
- EGL.eglTerminate(aDevice.getHandle());
+ DestroyDisplay(aDevice.getHandle());
}
}
@@ -80,6 +75,8 @@ public class EGLDisplay extends Display {
DispatchMessages();
}
+ private native long CreateDisplay(int width, int height);
+ private native void DestroyDisplay(long dpy);
private native void DispatchMessages();
}
diff --git a/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLScreen.java b/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLScreen.java
new file mode 100755
index 000000000..165081cde
--- /dev/null
+++ b/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLScreen.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2008 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
+ * MICROSYSTEMS, 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.
+ *
+ */
+
+package com.sun.javafx.newt.opengl.broadcom;
+
+import com.sun.javafx.newt.*;
+import com.sun.javafx.newt.impl.*;
+import javax.media.nativewindow.*;
+
+public class BCEGLScreen extends Screen {
+
+ static {
+ BCEGLDisplay.initSingleton();
+ }
+
+
+ public BCEGLScreen() {
+ }
+
+ protected void createNative(int index) {
+ aScreen = new DefaultGraphicsScreen(getDisplay().getGraphicsDevice(), index);
+ setScreenSize(fixedWidth, fixedHeight);
+ }
+
+ protected void closeNative() { }
+
+ //----------------------------------------------------------------------
+ // Internals only
+ //
+
+ static final int fixedWidth = 1920;
+ static final int fixedHeight = 1080;
+}
+
diff --git a/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLWindow.java b/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLWindow.java
new file mode 100755
index 000000000..a91a91598
--- /dev/null
+++ b/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLWindow.java
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2008 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
+ * MICROSYSTEMS, 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.
+ *
+ */
+
+package com.sun.javafx.newt.opengl.broadcom;
+
+import com.sun.javafx.newt.*;
+import com.sun.javafx.newt.impl.*;
+import com.sun.opengl.impl.egl.*;
+import javax.media.nativewindow.*;
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.GLProfile;
+import javax.media.nativewindow.NativeWindowException;
+
+public class BCEGLWindow extends Window {
+ static {
+ BCEGLDisplay.initSingleton();
+ }
+
+ public BCEGLWindow() {
+ }
+
+ protected void createNative(Capabilities caps) {
+ // just save the GLProfile here, create window later ..
+ glProfile = ((GLCapabilities)caps).getGLProfile();
+ }
+
+ protected void closeNative() {
+ if(0!=windowHandleClose) {
+ CloseWindow(getDisplayHandle(), windowHandleClose);
+ }
+ }
+
+ public void setVisible(boolean visible) {
+ if(this.visible!=visible) {
+ this.visible=visible;
+ if ( 0==windowHandle ) {
+ windowHandle = realizeWindow(true, width, height);
+ if (0 == windowHandle) {
+ throw new NativeWindowException("Error native Window Handle is null");
+ }
+ }
+ clearEventMask();
+ }
+ }
+
+ public void setSize(int width, int height) {
+ if(0!=windowHandle) {
+ // n/a in BroadcomEGL
+ System.err.println("setSize n/a in BroadcomEGL with realized window");
+ } else {
+ this.width = width;
+ this.height = height;
+ }
+ }
+
+ public void setPosition(int x, int y) {
+ // n/a in BroadcomEGL
+ System.err.println("setPosition n/a in BroadcomEGL");
+ }
+
+ public boolean setFullscreen(boolean fullscreen) {
+ // n/a in BroadcomEGL
+ System.err.println("setFullscreen n/a in BroadcomEGL");
+ return false;
+ }
+
+ //----------------------------------------------------------------------
+ // Internals only
+ //
+
+ protected static native boolean initIDs();
+ private native long CreateWindow(long eglDisplayHandle, boolean chromaKey, int width, int height);
+ private native void CloseWindow(long eglDisplayHandle, long eglWindowHandle);
+
+
+ private long realizeWindow(boolean chromaKey, int width, int height) {
+ long handle = CreateWindow(getDisplayHandle(), chromaKey, width, height);
+ if (0 == handle) {
+ throw new NativeWindowException("Error native Window Handle is null");
+ }
+ windowHandleClose = handle;
+ return handle;
+ }
+
+ private void windowCreated(int cfgID, int width, int height) {
+ this.width = width;
+ this.height = height;
+ config = EGLGraphicsConfiguration.create(glProfile, screen.getGraphicsScreen(), cfgID);
+ if (config == null) {
+ throw new NativeWindowException("Error creating EGLGraphicsConfiguration from id: "+cfgID+", "+this);
+ }
+ }
+
+ private long windowHandleClose;
+ private GLProfile glProfile;
+}
diff --git a/src/newt/native/BroadcomEGL.c b/src/newt/native/BroadcomEGL.c
new file mode 100755
index 000000000..8afa71a47
--- /dev/null
+++ b/src/newt/native/BroadcomEGL.c
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 2008 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
+ * MICROSYSTEMS, 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.
+ *
+ */
+
+#ifdef _WIN32
+ #include <windows.h>
+#else
+ #include <inttypes.h>
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "com_sun_javafx_newt_opengl_broadcom_BCEGLWindow.h"
+
+#include "EventListener.h"
+#include "MouseEvent.h"
+#include "KeyEvent.h"
+
+#include <EGL/egl.h>
+
+typedef unsigned int GLuint;
+
+EGLDisplay EGLUtil_CreateDisplay( GLuint uiWidth, GLuint uiHeight );
+void EGLUtil_DestroyDisplay( EGLDisplay eglDisplay );
+
+EGLSurface EGLUtil_CreateWindow( EGLDisplay eglDisplay, /* bool */ GLuint bChromakey, GLuint *puiWidth, GLuint *puiHeight );
+void EGLUtil_DestroyWindow( EGLDisplay eglDisplay, EGLSurface eglSurface );
+void EGLUtil_SwapWindow( EGLDisplay eglDisplay, EGLSurface eglSurface );
+
+#define VERBOSE_ON 1
+
+#ifdef VERBOSE_ON
+ #define DBG_PRINT(...) fprintf(stdout, __VA_ARGS__)
+#else
+ #define DBG_PRINT(...)
+#endif
+
+static jmethodID windowCreatedID = NULL;
+
+/**
+ * Display
+ */
+
+JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_broadcom_BCEGLDisplay_DispatchMessages
+ (JNIEnv *env, jobject obj)
+{
+ // FIXME: n/a
+ (void) env;
+ (void) obj;
+}
+
+JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_opengl_broadcom_BCEGLDisplay_CreateDisplay
+ (JNIEnv *env, jobject obj, jint width, jint height)
+{
+ (void) env;
+ (void) obj;
+ EGLDisplay dpy = EGLUtil_CreateDisplay( (GLuint) width, (GLuint) height );
+ if(NULL==dpy) {
+ fprintf(stderr, "[CreateDisplay] failed: NULL\n");
+ } else {
+ DBG_PRINT( "[CreateDisplay] ok: %p, %ux%u\n", dpy, width, height);
+ }
+ return (jlong) (intptr_t) dpy;
+}
+
+JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_broadcom_BCEGLDisplay_DestroyDisplay
+ (JNIEnv *env, jobject obj, jlong display)
+{
+ EGLDisplay dpy = (EGLDisplay)(intptr_t)display;
+ (void) env;
+ (void) obj;
+ EGLUtil_DestroyDisplay(dpy);
+}
+
+/**
+ * Window
+ */
+
+JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_opengl_broadcom_BCEGLWindow_initIDs
+ (JNIEnv *env, jclass clazz)
+{
+ windowCreatedID = (*env)->GetMethodID(env, clazz, "windowCreated", "(III)V");
+ if (windowCreatedID == NULL) {
+ DBG_PRINT( "initIDs failed\n" );
+ return JNI_FALSE;
+ }
+ DBG_PRINT( "initIDs ok\n" );
+ return JNI_TRUE;
+}
+
+JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_opengl_broadcom_BCEGLWindow_CreateWindow
+ (JNIEnv *env, jobject obj, jlong display, jboolean chromaKey, jint width, jint height)
+{
+ EGLDisplay dpy = (EGLDisplay)(intptr_t)display;
+ EGLSurface window = 0;
+ GLuint uiWidth=(GLuint)width, uiHeight=(GLuint)height;
+
+ if(dpy==NULL) {
+ fprintf(stderr, "[RealizeWindow] invalid display connection..\n");
+ return 0;
+ }
+
+ window = EGLUtil_CreateWindow( dpy, chromaKey, &uiWidth, &uiHeight );
+ // EGLUtil_DestroyWindow( dpy, window );
+
+ if(NULL==window) {
+ fprintf(stderr, "[RealizeWindow.Create] failed: NULL\n");
+ return 0;
+ }
+ EGLint cfgID=0;
+ if(EGL_FALSE==eglQuerySurface(dpy, window, EGL_CONFIG_ID, &cfgID)) {
+ fprintf(stderr, "[RealizeWindow.ConfigID] failed: window %p\n", window);
+ EGLUtil_DestroyWindow(dpy, window);
+ return 0;
+ }
+ (*env)->CallVoidMethod(env, obj, windowCreatedID, (jint) cfgID, (jint)uiWidth, (jint)uiHeight);
+ DBG_PRINT( "[RealizeWindow.Create] ok: %p, cfgid %d, %ux%u\n", window, cfgID, uiWidth, uiHeight);
+
+ // release and destroy already made context ..
+ EGLContext ctx = eglGetCurrentContext();
+ eglMakeCurrent(dpy,
+ EGL_NO_SURFACE,
+ EGL_NO_SURFACE,
+ EGL_NO_CONTEXT);
+ eglDestroyContext(dpy, ctx);
+
+ return (jlong) (intptr_t) window;
+}
+
+JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_broadcom_BCEGLWindow_CloseWindow
+ (JNIEnv *env, jobject obj, jlong display, jlong window)
+{
+ EGLDisplay dpy = (EGLDisplay)(intptr_t)display;
+ EGLSurface surf = (EGLSurface) (intptr_t) window;
+ EGLUtil_DestroyWindow(dpy, surf);
+
+ DBG_PRINT( "[CloseWindow]\n");
+}
+
diff --git a/src/newt/native/KDWindow.c b/src/newt/native/KDWindow.c
index 8e57237b3..6c7aa7731 100755
--- a/src/newt/native/KDWindow.c
+++ b/src/newt/native/KDWindow.c
@@ -103,7 +103,7 @@ static jmethodID sendKeyEventID = NULL;
* Display
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_kd_KDDisplay_DispatchMessages
+JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_kd_KDDisplay_DispatchMessages
(JNIEnv *env, jobject obj)
{
const KDEvent * evt;
@@ -200,7 +200,7 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_kd_KDDisplay_DispatchMessages
* Window
*/
-JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_kd_KDWindow_initIDs
+JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_opengl_kd_KDWindow_initIDs
(JNIEnv *env, jclass clazz)
{
#ifdef VERBOSE_ON
@@ -228,7 +228,7 @@ JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_kd_KDWindow_initIDs
return JNI_TRUE;
}
-JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_kd_KDWindow_CreateWindow
+JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_opengl_kd_KDWindow_CreateWindow
(JNIEnv *env, jobject obj, jlong display, jintArray jAttrs)
{
jint * attrs = NULL;
@@ -270,7 +270,7 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_kd_KDWindow_CreateWindow
return (jlong) (intptr_t) window;
}
-JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_kd_KDWindow_RealizeWindow
+JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_opengl_kd_KDWindow_RealizeWindow
(JNIEnv *env, jobject obj, jlong window)
{
KDWindow *w = (KDWindow*) (intptr_t) window;
@@ -285,7 +285,7 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_kd_KDWindow_RealizeWindow
return (jlong) (intptr_t) nativeWindow;
}
-JNIEXPORT jint JNICALL Java_com_sun_javafx_newt_kd_KDWindow_CloseWindow
+JNIEXPORT jint JNICALL Java_com_sun_javafx_newt_opengl_kd_KDWindow_CloseWindow
(JNIEnv *env, jobject obj, jlong window, jlong juserData)
{
KDWindow *w = (KDWindow*) (intptr_t) window;
@@ -299,11 +299,11 @@ JNIEXPORT jint JNICALL Java_com_sun_javafx_newt_kd_KDWindow_CloseWindow
}
/*
- * Class: com_sun_javafx_newt_kd_KDWindow
+ * Class: com_sun_javafx_newt_opengl_kd_KDWindow
* Method: setVisible0
* Signature: (JJZ)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_kd_KDWindow_setVisible0
+JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_kd_KDWindow_setVisible0
(JNIEnv *env, jobject obj, jlong window, jboolean visible)
{
KDWindow *w = (KDWindow*) (intptr_t) window;
@@ -312,7 +312,7 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_kd_KDWindow_setVisible0
DBG_PRINT( "[setVisible] v=%d\n", visible);
}
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_kd_KDWindow_setFullScreen0
+JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_kd_KDWindow_setFullScreen0
(JNIEnv *env, jobject obj, jlong window, jboolean fullscreen)
{
KDWindow *w = (KDWindow*) (intptr_t) window;
@@ -323,7 +323,7 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_kd_KDWindow_setFullScreen0
(void)res;
}
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_kd_KDWindow_setSize0
+JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_kd_KDWindow_setSize0
(JNIEnv *env, jobject obj, jlong window, jint width, jint height)
{
KDWindow *w = (KDWindow*) (intptr_t) window;