diff options
Diffstat (limited to 'make')
50 files changed, 476 insertions, 681 deletions
diff --git a/make/build-jogl.xml b/make/build-jogl.xml index 0dd04ccb8..74b9da089 100644 --- a/make/build-jogl.xml +++ b/make/build-jogl.xml @@ -38,11 +38,6 @@ - Optional properties: - -Djogl.cg=1 when combined with the build or javadoc targets will cause - the experimental binding to NVidia's Cg language to be built. - - Then you need to define the location of your CG libraries: - - -Dwindows.cg.lib32=<PATH> for Windows x32 and - - -Dwindows.cg.lib64=<PATH> for Windows x64 and - - -Dx11.cg.lib32=<PATH> for X11/Unix x32 - - -Dx11.cg.lib64=<PATH> for X11/Unix x64 - - Thanks to Rob Grzywinski and Artur Biesiadowski for the bulk of the - ANT build, including the GlueGen and StaticGLInfo tasks, the building of @@ -299,7 +294,6 @@ <target name="setup.javacdc"> <copy file="../src/jogl/classes/com/jogamp/opengl/impl/SystemUtil.java.javame_cdc_fp" tofile="${src.generated.java-cdc}/com/jogamp/opengl/impl/SystemUtil.java" /> - <copy file="../src/jogl/classes/com/jogamp/opengl/impl/InternalBufferUtil.java.javame_cdc_fp" tofile="${src.generated.java-cdc}/com/jogamp/opengl/impl/InternalBufferUtil.java" /> <copy file="../src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java.javame_cdc_fp" tofile="${src.generated.java-cdc}/com/jogamp/opengl/util/texture/TextureIO.java" /> <copy file="../src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java.javame_cdc_fp" tofile="${src.generated.java-cdc}/com/jogamp/opengl/util/texture/spi/DDSImage.java" /> <copy file="../src/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java.javame_cdc_fp" tofile="${src.generated.java-cdc}/com/jogamp/opengl/util/texture/spi/TGAImage.java" /> @@ -307,7 +301,6 @@ <target name="setup.javase"> <copy file="../src/jogl/classes/com/jogamp/opengl/impl/SystemUtil.java.javase" tofile="${src.generated.java}/com/jogamp/opengl/impl/SystemUtil.java" /> - <copy file="../src/jogl/classes/com/jogamp/opengl/impl/InternalBufferUtil.java.javase" tofile="${src.generated.java}/com/jogamp/opengl/impl/InternalBufferUtil.java" /> <copy file="../src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java.javase" tofile="${src.generated.java}/com/jogamp/opengl/util/texture/TextureIO.java" /> <copy file="../src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java.javase" tofile="${src.generated.java}/com/jogamp/opengl/util/texture/spi/DDSImage.java" /> <copy file="../src/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java.javase" tofile="${src.generated.java}/com/jogamp/opengl/util/texture/spi/TGAImage.java" /> @@ -622,7 +615,7 @@ <echo message="Generating EGL implementation class" /> <antcall target="java.generate.copy2temp" inheritRefs="true" /> <dirset id="stub.includes.fileset.platform" dir="." includes="${stub.includes}/${window.es.system}/** ${stub.includes}/common/**" /> - <gluegen src="${stub.includes}/${window.es.system}/window-system.c" + <gluegen src="${stub.includes}/${window.es.system}/window-system1.c" outputRootDir="${build.jogl}" config="${window.es.cfg}" includeRefid="stub.includes.fileset.platform" @@ -644,12 +637,24 @@ </gluegen> </target> - <target name="java.generate.window.system.os" if="window.os.cfg"> + <target name="java.generate.window.system.os0" if="window.os0.cfg"> <echo message="Generating window system glue impl: ${window.os.system}" /> <antcall target="java.generate.copy2temp" inheritRefs="true" /> - <gluegen src="${stub.includes}/${window.os.system}/window-system.c" + <gluegen src="${stub.includes}/${window.os.system}/window-system0.c" outputRootDir="${build.jogl}" - config="${window.os.cfg}" + config="${window.os0.cfg}" + includeRefid="stub.includes.fileset.platform" + emitter="com.sun.gluegen.opengl.GLEmitter"> + <classpath refid="gluegen.classpath" /> + </gluegen> + </target> + + <target name="java.generate.window.system.os1" if="window.os1.cfg"> + <echo message="Generating window system glue impl: ${window.os.system}" /> + <antcall target="java.generate.copy2temp" inheritRefs="true" /> + <gluegen src="${stub.includes}/${window.os.system}/window-system1.c" + outputRootDir="${build.jogl}" + config="${window.os1.cfg}" includeRefid="stub.includes.fileset.platform" emitter="com.sun.gluegen.opengl.GLEmitter"> <classpath refid="gluegen.classpath" /> @@ -659,7 +664,8 @@ <target name="java.generate.gl.platforms" > <dirset id="stub.includes.fileset.platform" dir="." includes="${stub.includes}/${window.os.system}/** ${stub.includes}/${window.es.system}/** ${stub.includes}/common/** ${stub.includes}/opengl/**" /> - <antcall target="java.generate.window.system.os" inheritRefs="true" /> + <antcall target="java.generate.window.system.os0" inheritRefs="true" /> + <antcall target="java.generate.window.system.os1" inheritRefs="true" /> <antcall target="java.generate.platform.glext" inheritRefs="true" /> </target> @@ -688,21 +694,22 @@ <antcall target="java.generate.gl.platforms" inheritRefs="true"> <param name="window.os.system" value="x11"/> - <param name="window.os.cfg" value="${config.jogl}/glx-x11.cfg" /> + <param name="window.os1.cfg" value="${config.jogl}/glx-x11.cfg" /> <param name="glext.platform.cfg" value="${config.jogl}/glxext.cfg" /> <param name="glext.platform.header" value="${stub.includes}/x11/glxext.c" /> </antcall> <antcall target="java.generate.gl.platforms" inheritRefs="true"> <param name="window.os.system" value="win32"/> - <param name="window.os.cfg" value="${config.jogl}/wgl-win32.cfg" /> + <param name="window.os0.cfg" value="${config.jogl}/gdi-win32.cfg" /> + <param name="window.os1.cfg" value="${config.jogl}/wgl-win32.cfg" /> <param name="glext.platform.cfg" value="${config.jogl}/wglext.cfg" /> <param name="glext.platform.header" value="${stub.includes}/win32/wglext.c" /> </antcall> <antcall target="java.generate.gl.platforms" inheritRefs="true"> <param name="window.os.system" value="macosx"/> - <param name="window.os.cfg" value="${config.jogl}/cgl-macosx.cfg" /> + <param name="window.os1.cfg" value="${config.jogl}/cgl-macosx.cfg" /> <param name="glext.platform.cfg" value="${config.jogl}/cglext.cfg" /> <param name="glext.platform.header" value="${stub.includes}/macosx/cglext.c" /> </antcall> @@ -754,7 +761,7 @@ outputRootDir="${build.jogl}" config="${config.jogl}/cg-common.cfg" includeRefid="stub.includes.cg.fileset.all" - emitter="com.sun.gluegen.JavaEmitter"> + emitter="com.sun.gluegen.procaddress.ProcAddressEmitter"> <classpath refid="gluegen.classpath" /> </gluegen> </target> @@ -1103,14 +1110,9 @@ <!-- linker configuration --> - <linker id="linker.cfg.linux.jogl.gl2" extends="linker.cfg.linux"> + <linker id="linker.cfg.linux.jogl.x11" extends="linker.cfg.linux"> <syslibset libs="X11"/> <syslibset libs="Xxf86vm" /> - <syslibset libs="GL"/> - </linker> - - <linker id="linker.cfg.linux.jogl.cg" extends="linker.cfg.linux.jogl.gl2"> - <syslibset dir="${x11.cg.lib32}" libs="Cg, CgGL"/> </linker> <linker id="linker.cfg.linux.amd64.jogl.x11" extends="linker.cfg.linux.amd64"> @@ -1118,77 +1120,47 @@ <syslibset libs="Xxf86vm" /> </linker> - <linker id="linker.cfg.linux.amd64.jogl.gl2" extends="linker.cfg.linux.amd64.jogl.x11"> - <syslibset libs="GL"/> - </linker> - - <linker id="linker.cfg.linux.amd64.jogl.cg" extends="linker.cfg.linux.amd64.jogl.gl2"> - <syslibset dir="${x11.cg.lib64}" libs="Cg, CgGL"/> - </linker> - <linker id="linker.cfg.solaris.jogl.x11" extends="linker.cfg.solaris"> <syslibset libs="X11"/> </linker> - <linker id="linker.cfg.solaris.jogl.gl2" extends="linker.cfg.solaris.jogl.x11"> - <syslibset libs="GL"/> - </linker> - - <linker id="linker.cfg.solaris.jogl.cg" extends="linker.cfg.solaris.jogl.gl2"> - <syslibset dir="${x11.cg.lib32}" libs="Cg, CgGL"/> - </linker> - - <linker id="linker.cfg.solaris.sparcv9.jogl.gl2" extends="linker.cfg.solaris.sparcv9"> + <linker id="linker.cfg.solaris.sparcv9.jogl.x11" extends="linker.cfg.solaris.sparcv9"> <linkerarg value="-xarch=v9a" /> - <syslibset dir="/usr/openwin/lib/sparcv9" libs="GL"/> <syslibset dir="/usr/lib/sparcv9" libs="X11"/> </linker> - <linker id="linker.cfg.solaris.amd64.jogl.gl2" extends="linker.cfg.solaris.amd64"> + <linker id="linker.cfg.solaris.amd64.jogl.x11" extends="linker.cfg.solaris.amd64"> <linkerarg value="-xarch=amd64" /> - <syslibset dir="/usr/lib/amd64" libs="GL"/> <syslibset dir="/usr/lib/amd64" libs="X11"/> </linker> <linker id="linker.cfg.win32.mingw.jogl" extends="linker.cfg.win32.mingw"> <linkerarg value="-Wl,--kill-at" /> <!-- remove @ from function names --> - <syslibset libs="opengl32, glu32, gdi32, kernel32"/> - </linker> - - <linker id="linker.cfg.win32.mingw.jogl.cg" extends="linker.cfg.win32.mingw.jogl"> - <syslibset dir="${windows.cg.lib32}" libs="cg, cgGL"/> + <syslibset libs="gdi32, kernel32"/> </linker> <linker id="linker.cfg.win64.mingw.jogl" extends="linker.cfg.win64.mingw"> <linkerarg value="-Wl,--kill-at" /> <!-- remove @ from function names --> - <syslibset libs="opengl32, glu32, gdi32, kernel32"/> - </linker> - - <linker id="linker.cfg.win64.mingw.jogl.cg" extends="linker.cfg.win64.mingw.jogl"> - <syslibset dir="${windows.cg.lib64}" libs="cg, cgGL"/> + <syslibset libs="gdi32, kernel32"/> </linker> <linker id="linker.cfg.win32.msvc.jogl" extends="linker.cfg.win32.msvc"> - <syslibset libs="opengl32, gdi32, user32, kernel32" /> + <syslibset libs="user32, kernel32" /> <!-- This is temporary --> <syslibset libs="winmm" /> </linker> - <linker id="linker.cfg.win32.msvc.jogl.cg" extends="linker.cfg.win32.msvc.jogl"> - <syslibset dir="${windows.cg.lib32}" libs="cg, cgGL"/> - </linker> - <linker id="linker.cfg.macosx.jogl" extends="linker.cfg.macosx"> <linkerarg value="-framework" /> <linkerarg value="Cocoa" /> - <linkerarg value="-framework" /> - <linkerarg value="OpenGL" /> + <!--linkerarg value="-framework" /> + <linkerarg value="OpenGL" /--> </linker> - <linker id="linker.cfg.macosx.jogl.cg" extends="linker.cfg.macosx.jogl"> + <!--linker id="linker.cfg.macosx.jogl.cg" extends="linker.cfg.macosx.jogl"> <linkerarg value="-framework"/> <linkerarg value="Cg"/> - </linker> + </linker--> <linker id="linker.cfg.hpux.jogl" extends="linker.cfg.hpux"> <syslibset dir="/opt/graphics/OpenGL/lib" libs="GL, GLU"/> @@ -1198,83 +1170,72 @@ <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.gl2" value="linker.cfg.win32.msvc.jogl" /> - <property name="linker.cfg.id.cg" value="linker.cfg.win32.msvc.jogl.cg" /> + <property name="compiler.cfg.id" value="compiler.cfg.win32.msvc" /> + <property name="linker.cfg.id.os" value="linker.cfg.win32.msvc.jogl" /> </target> <target name="c.configure.win32.mingw" if="isMingW32"> <echo message="Win32.MingW" /> - <property name="compiler.cfg.id" value="compiler.cfg.win32.mingw" /> - <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" /> + <property name="compiler.cfg.id" value="compiler.cfg.win32.mingw" /> + <property name="linker.cfg.id.os" value="linker.cfg.win32.mingw.jogl" /> </target> <target name="c.configure.win64.mingw" if="isMingW64"> <echo message="Win64.MingW" /> - <property name="compiler.cfg.id" value="compiler.cfg.win64.mingw" /> - <property name="linker.cfg.id.gl2" value="linker.cfg.win64.mingw.jogl" /> - <property name="linker.cfg.id.cg" value="linker.cfg.win64.mingw.jogl.cg" /> + <property name="compiler.cfg.id" value="compiler.cfg.win64.mingw" /> + <property name="linker.cfg.id.os" value="linker.cfg.win64.mingw.jogl" /> </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.gl2" value="linker.cfg.linux.jogl.gl2" /> - <property name="linker.cfg.id.cg" value="linker.cfg.linux.jogl.cg" /> + <property name="compiler.cfg.id" value="compiler.cfg.linux" /> + <property name="linker.cfg.id.os" value="linker.cfg.linux.jogl.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.gl2" value="linker.cfg.linux.amd64.jogl.gl2" /> - <property name="linker.cfg.id.cg" value="linker.cfg.linux.amd64.jogl.cg" /> + <property name="compiler.cfg.id" value="compiler.cfg.linux.amd64" /> + <property name="linker.cfg.id.os" value="linker.cfg.linux.amd64.jogl.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.gl2" value="linker.cfg.linux.jogl.gl2" /> - <property name="linker.cfg.id.cg" value="linker.cfg.linux.jogl.cg" /> + <property name="compiler.cfg.id" value="compiler.cfg.linux" /> + <property name="linker.cfg.id.os" value="linker.cfg.linux.jogl.x11" /> </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.gl2" value="linker.cfg.solaris.jogl.gl2" /> - <property name="linker.cfg.id.cg" value="linker.cfg.solaris.jogl.cg" /> + <property name="compiler.cfg.id" value="compiler.cfg.solaris" /> + <property name="linker.cfg.id.os" value="linker.cfg.solaris.jogl.x11" /> </target> <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.gl2" value="linker.cfg.solaris.sparcv9.jogl.gl2" /> - <property name="linker.cfg.id.cg" value="linker.cfg.solaris.sparcv9.jogl.cg" /> + <property name="compiler.cfg.id" value="compiler.cfg.solaris.sparcv9" /> + <property name="linker.cfg.id.os" value="linker.cfg.solaris.sparcv9.jogl.x11" /> </target> <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.gl2" value="linker.cfg.solaris.amd64.jogl.gl2" /> - <property name="linker.cfg.id.cg" value="linker.cfg.solaris.amd64.jogl.cg" /> + <property name="compiler.cfg.id" value="compiler.cfg.solaris.amd64" /> + <property name="linker.cfg.id.os" value="linker.cfg.solaris.amd64.jogl.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.jogl" /> - <property name="linker.cfg.id.gl2" value="linker.cfg.linux.jogl.gl2" /> - <property name="linker.cfg.id.cg" value="linker.cfg.linux.jogl.cg" /> + <property name="compiler.cfg.id" value="compiler.cfg.freebsd.jogl" /> + <property name="linker.cfg.id.os" value="linker.cfg.linux.jogl.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.gl2" value="linker.cfg.hpux.jogl.gl2" /> - <property name="linker.cfg.id.cg" value="linker.cfg.hpux.jogl.cg" /> + <property name="compiler.cfg.id" value="compiler.cfg.hpux" /> + <property name="linker.cfg.id.os" value="linker.cfg.hpux.jogl.x11" /> </target> <target name="c.configure.win32" depends="c.configure.win32.vc,c.configure.win32.mingw,c.configure.win64.mingw" if="isWindows" /> @@ -1282,9 +1243,8 @@ <target name="c.configure.x11" if="isX11" /> <target name="c.configure.macosx" if="isOSX"> - <property name="compiler.cfg.id" value="compiler.cfg.macosx" /> - <property name="linker.cfg.id.gl2" value="linker.cfg.macosx.jogl" /> - <property name="linker.cfg.id.cg" value="linker.cfg.macosx.jogl.cg" /> + <property name="compiler.cfg.id" value="compiler.cfg.macosx" /> + <property name="linker.cfg.id.os" value="linker.cfg.macosx.jogl" /> </target> <target name="c.configure.2" depends="c.configure.win32,c.configure.linux,c.configure.solaris32,c.configure.solaris.sparcv9,c.configure.solaris.amd64,c.configure.macosx,c.configure.freebsd,c.configure.hpux" /> @@ -1331,6 +1291,7 @@ <include name="${rootrel.generated.c.jogl}/gl2/GLUgl2_JNI.c"/> <include name="${rootrel.generated.c.jogl}/X11/GLX*.c" if="isX11"/> <include name="${rootrel.generated.c.jogl}/MacOSX/CGL*.c" if="isOSX"/> + <include name="${rootrel.generated.c.jogl}/Windows/GDI*.c" if="isWindows"/> <include name="${rootrel.generated.c.jogl}/Windows/WGL*.c" if="isWindows"/> </patternset> @@ -1453,14 +1414,14 @@ <c.build c.compiler.src.files="c.src.files.jogl.desktop" output.lib.name="jogl_desktop" compiler.cfg.id="${compiler.cfg.id}" - linker.cfg.id="${linker.cfg.id.gl2}"/> + linker.cfg.id="${linker.cfg.id.os}"/> </target> <target name="c.build.jogl.gl2es12" unless="setup.nodesktop"> <c.build c.compiler.src.files="c.src.files.jogl.gl2es12" output.lib.name="jogl_gl2es12" compiler.cfg.id="${compiler.cfg.id}" - linker.cfg.id="${linker.cfg.id.gl2}"/> + linker.cfg.id="${linker.cfg.id.os}"/> </target> <target name="c.build.jogl.es2"> @@ -1481,7 +1442,7 @@ <c.build c.compiler.src.files="c.src.files.cg" output.lib.name="jogl_cg" compiler.cfg.id="${compiler.cfg.id}" - linker.cfg.id="${linker.cfg.id.cg}"/> + linker.cfg.id="${linker.cfg.id.os}"/> </target> <target name="c.manifest.cg" if="jogl.cg"> diff --git a/make/build-junit.xml b/make/build-junit.xml index 6c4f42811..9b7f48987 100644 --- a/make/build-junit.xml +++ b/make/build-junit.xml @@ -53,7 +53,21 @@ <!-- - Build/run junit. --> - <target name="junit.compile" depends="init"> + <target name="junit.compile.check" depends="init"> + <property name="jogl.test.jar.path" location="${jogl.test.jar}"/> <!-- absolute path --> + <echo message="jogl.test.jar ${jogl.test.jar.path}"/> + <uptodate property="junit.compile.skip"> + <srcfiles dir= "." includes="*.xml"/> + <srcfiles dir= "${src.junit}" includes="**"/> + <srcfiles file="${nativewindow.all.jar}" /> + <srcfiles file="${jogl.all.jar}" /> + <srcfiles file="${newt.all.jar}" /> + <srcfiles file="${gluegen.jar}" /> + <mapper type="merge" to="${jogl.test.jar.path}"/> + </uptodate> + </target> + + <target name="junit.compile" depends="junit.compile.check" unless="junit.compile.skip"> <!-- Perform the junit pass Java compile --> <javac destdir="${classes}" source="${host.sourcelevel}" @@ -64,6 +78,9 @@ <classpath refid="junit_jogl_newt.compile.classpath"/> <src path="${src.junit}" /> </javac> + <delete includeEmptyDirs="true" quiet="true"> + <fileset file="${jogl.test.jar}" /> + </delete> <jar destfile="${jogl.test.jar}" filesonly="true"> <fileset dir="${classes}"> <include name="${java.part.test}"/> diff --git a/make/config/jogl/cg-common-CustomJavaCode.java b/make/config/jogl/cg-common-CustomJavaCode.java index d1e4f8bf5..cdaa6f2b2 100755 --- a/make/config/jogl/cg-common-CustomJavaCode.java +++ b/make/config/jogl/cg-common-CustomJavaCode.java @@ -1,7 +1,26 @@ +private static DynamicLookupHelper cgDynamicLookupHelper; +private static CgProcAddressTable cgProcAddressTable; + static { - com.jogamp.opengl.impl.GLJNILibLoader.loadCgImpl(); + cgProcAddressTable = new CgProcAddressTable(); + if(null==cgProcAddressTable) { + throw new RuntimeException("Couldn't instantiate CgProcAddressTable"); + } + DynamicLibraryBundle cgDynamicLookupHelper = new DynamicLibraryBundle(new CgDynamicLibraryBundleInfo()); + if(null==cgDynamicLookupHelper) { + throw new RuntimeException("Null CgDynamicLookupHelper"); + } + if(!cgDynamicLookupHelper.isToolLibLoaded()) { + throw new RuntimeException("Couln't load native Cg or CgGL library"); + } + if(!cgDynamicLookupHelper.isGlueLibLoaded(CgDynamicLibraryBundleInfo.getCgGlueLibIndex())) { + throw new RuntimeException("Couln't load native GLue/JNI library"); + } + cgProcAddressTable.reset(cgDynamicLookupHelper); } +public static CgProcAddressTable getCgProcAddressTable() { return cgProcAddressTable; } + /** A convenience method which reads all available data from the InputStream and then calls cgCreateProgram. */ public static CGprogram cgCreateProgramFromStream(CGcontext ctx, int program_type, java.io.InputStream stream, int profile, java.lang.String entry, java.lang.String[] args) throws java.io.IOException { if (stream == null) { diff --git a/make/config/jogl/cg-common.cfg b/make/config/jogl/cg-common.cfg index 927d233a8..ae29d3f80 100644 --- a/make/config/jogl/cg-common.cfg +++ b/make/config/jogl/cg-common.cfg @@ -7,6 +7,14 @@ JavaOutputDir gensrc/classes NativeOutputDir gensrc/native/jogl_cg HierarchicalNativeOutput false +ForceProcAddressGen __ALL__ +LocalProcAddressCallingConvention __ALL__ APIENTRY + +EmitProcAddressTable true +ProcAddressTableClassName CgProcAddressTable +GetProcAddressTableExpr cgProcAddressTable +ProcAddressNameExpr PFN $UPPERCASE({0}) PROC + # # Map const char* return values to Java strings for these functions # @@ -94,6 +102,9 @@ Ignore cgGetProgramOptions # And NativeLibLoader for help loading the native libraries Import com.jogamp.opengl.impl.* +Import com.jogamp.common.os.DynamicLookupHelper; +Import com.jogamp.common.os.DynamicLibraryBundle; +Import com.jogamp.opengl.cg.CgDynamicLibraryBundleInfo; # # NIODirectOnly directives for routines requiring them for semantic reasons diff --git a/make/config/jogl/cgl-macosx.cfg b/make/config/jogl/cgl-macosx.cfg index f2af29e00..2b28d3c68 100644 --- a/make/config/jogl/cgl-macosx.cfg +++ b/make/config/jogl/cgl-macosx.cfg @@ -5,7 +5,7 @@ NativeOutputDir gensrc/native/jogl/MacOSX Package com.jogamp.opengl.impl.macosx.cgl JavaClass CGL -Style allstatic +Style AllStatic Include gl-common.cfg Include gl-common-extensions.cfg Include gl-desktop.cfg diff --git a/make/config/jogl/egl.cfg b/make/config/jogl/egl.cfg index 94984a305..c194de2d0 100755 --- a/make/config/jogl/egl.cfg +++ b/make/config/jogl/egl.cfg @@ -5,7 +5,7 @@ NativeOutputDir gensrc/native/jogl/egl Package com.jogamp.opengl.impl.egl JavaClass EGL -Style allstatic +Style AllStatic # Shouldn't matter which one of these we pick up Include egl-common.cfg diff --git a/make/config/jogl/wgl-CustomCCode.c b/make/config/jogl/gdi-CustomCCode.c index 0fe9ee628..0fe9ee628 100755 --- a/make/config/jogl/wgl-CustomCCode.c +++ b/make/config/jogl/gdi-CustomCCode.c diff --git a/make/config/jogl/gdi-win32.cfg b/make/config/jogl/gdi-win32.cfg new file mode 100644 index 000000000..7d831c7b9 --- /dev/null +++ b/make/config/jogl/gdi-win32.cfg @@ -0,0 +1,26 @@ +# This .cfg file is used to generate the interface to the wgl routines +# used internally by the WindowsGLContext implementation. +JavaOutputDir gensrc/classes +NativeOutputDir gensrc/native/jogl/Windows + +Package com.jogamp.opengl.impl.windows.wgl +JavaClass GDI +Style AllStatic +Include gl-common.cfg +Include gl-common-extensions.cfg +Include gl-desktop.cfg + +GLHeader wingdi.h + +AllowNonGLExtensions true + +CustomCCode #define WIN32_LEAN_AND_MEAN +CustomCCode #include <windows.h> +CustomCCode #undef WIN32_LEAN_AND_MEAN + +CustomCCode #include <wingdi.h> +CustomCCode #include <stddef.h> + +Include ../intptr.cfg + +IncludeAs CustomCCode gdi-CustomCCode.c diff --git a/make/config/jogl/gl-common.cfg b/make/config/jogl/gl-common.cfg index 8d726c4bf..2c8e79e75 100644 --- a/make/config/jogl/gl-common.cfg +++ b/make/config/jogl/gl-common.cfg @@ -39,6 +39,7 @@ Ignore glTracePointerRangeMESA # Manually implement glMapBuffer as the size of the returned buffer # can only be computed by calling another routine ManuallyImplement glMapBuffer +ForceProcAddressGen glMapBuffer # Ignore the ATI_map_object_buffer extension for now unless someone # claims they need it, as it will undoubtedly require a similar @@ -347,6 +348,8 @@ NIODirectOnly glXFreeMemoryNV ReturnValueCapacity wglAllocateMemoryNV {0} ReturnValueCapacity glXAllocateMemoryNV {0} +ReturnValueCapacity glMapBufferRange {2} + # Pass arguments to ARB_vertex_program, ARB_fragment_program, # ARB_shader_objects, NV_vertex_program, NV_fragment_program, and # ARB_vertex_shader as Strings diff --git a/make/config/jogl/gl-desktop.cfg b/make/config/jogl/gl-desktop.cfg index f35ed254b..ce2fefe2f 100755 --- a/make/config/jogl/gl-desktop.cfg +++ b/make/config/jogl/gl-desktop.cfg @@ -51,19 +51,11 @@ Opaque long Visual * # traversed) Ignore Display Ignore Visual -# Implement the first argument to glXGetProcAddress as String instead -# of byte[] ArgumentIsString glXGetProcAddress 0 ArgumentIsString glXGetProcAddressARB 0 ReturnsString glXQueryExtensionsString ReturnsString glXQueryServerString ReturnsString glXGetClientString -TemporaryCVariableDeclaration glXChooseFBConfig int count; -TemporaryCVariableAssignment glXChooseFBConfig count = _ptr3[0]; -ReturnValueCapacity glXChooseFBConfig count * sizeof(GLXFBConfig) -TemporaryCVariableDeclaration glXChooseFBConfigSGIX int count; -TemporaryCVariableAssignment glXChooseFBConfigSGIX count = _ptr3[0]; -ReturnValueCapacity glXChooseFBConfigSGIX count * sizeof(GLXFBConfig) TemporaryCVariableDeclaration glXGetFBConfigs int count; TemporaryCVariableAssignment glXGetFBConfigs count = _nelements_ptr[0]; ReturnValueCapacity glXGetFBConfigs count * sizeof(GLXFBConfig) diff --git a/make/config/jogl/gl-es1.cfg b/make/config/jogl/gl-es1.cfg index da2267186..63905dfff 100755 --- a/make/config/jogl/gl-es1.cfg +++ b/make/config/jogl/gl-es1.cfg @@ -97,4 +97,4 @@ IncludeAs CustomCCode gl-impl-CustomCCode-gles1.c Import javax.media.opengl.GLES1 Import javax.media.opengl.GLES2 Import javax.media.opengl.GL2 -Import com.jogamp.opengl.impl.InternalBufferUtil +Import com.jogamp.common.nio.Buffers; diff --git a/make/config/jogl/gl-es2.cfg b/make/config/jogl/gl-es2.cfg index fd11ffcf0..cdfd7fef8 100755 --- a/make/config/jogl/gl-es2.cfg +++ b/make/config/jogl/gl-es2.cfg @@ -79,6 +79,6 @@ Import javax.media.opengl.GLES2 Import javax.media.opengl.GL2 Import javax.media.opengl.GLArrayData Import javax.media.opengl.GLUniformData -Import com.jogamp.opengl.impl.InternalBufferUtil +Import com.jogamp.common.nio.Buffers; Import java.io.PrintStream diff --git a/make/config/jogl/gl-gl2es12.cfg b/make/config/jogl/gl-gl2es12.cfg index 3942b1419..ec121d777 100644 --- a/make/config/jogl/gl-gl2es12.cfg +++ b/make/config/jogl/gl-gl2es12.cfg @@ -22,11 +22,6 @@ Include gl-common.cfg Include gl-common-extensions.cfg Include gl-desktop.cfg -# Because we're manually implementing glMapBuffer but only producing -# the implementing class, GlueGen doesn't notice that it has to emit a -# proc address table entry for it. Force it to here. -ForceProcAddressGen glMapBuffer - # Force all of the methods to be emitted using dynamic linking so we # don't need to link against any emulation library on the desktop or # depend on the presence of an import library for a particular device @@ -86,5 +81,5 @@ IncludeAs CustomCCode gl-impl-CustomCCode-gl2es12.c Import javax.media.opengl.GLES1 Import javax.media.opengl.GLES2 -Import com.jogamp.opengl.impl.InternalBufferUtil +Import com.jogamp.common.nio.Buffers; Import java.io.PrintStream diff --git a/make/config/jogl/gl-gl4bc.cfg b/make/config/jogl/gl-gl4bc.cfg index 3a3e02041..ccd9723e6 100644 --- a/make/config/jogl/gl-gl4bc.cfg +++ b/make/config/jogl/gl-gl4bc.cfg @@ -46,10 +46,11 @@ Include gl3-common.cfg Include gl4-common.cfg Include gl3-desktop.cfg -# Because we're manually implementing glMapBuffer but only producing -# the implementing class, GlueGen doesn't notice that it has to emit a -# proc address table entry for it. Force it to here. -ForceProcAddressGen glMapBuffer +# Manually implement glMapNamedBufferEXT as the size of the returned buffer +# can only be computed by calling another routine +ManuallyImplement glMapNamedBufferEXT +ForceProcAddressGen glMapNamedBufferEXT +JavaEpilogue glNamedBufferDataEXT bufferSizeTracker.setDirectStateBufferSize({0}, this, {1}); # Force all of the methods to be emitted using dynamic linking so we # don't need to link against any emulation library on the desktop or @@ -106,5 +107,5 @@ Import javax.media.opengl.GL2 Import javax.media.opengl.GL3 Import javax.media.opengl.GL3bc Import javax.media.opengl.GL4 -Import com.jogamp.opengl.impl.InternalBufferUtil +Import com.jogamp.common.nio.Buffers; Import java.io.PrintStream diff --git a/make/config/jogl/gl-impl-CustomCCode-gl4bc.c b/make/config/jogl/gl-impl-CustomCCode-gl4bc.c index bcda20fa4..0bd8b68da 100644 --- a/make/config/jogl/gl-impl-CustomCCode-gl4bc.c +++ b/make/config/jogl/gl-impl-CustomCCode-gl4bc.c @@ -15,6 +15,21 @@ Java_com_jogamp_opengl_impl_gl4_GL4bcImpl_dispatch_1glMapBuffer(JNIEnv *env, job /* Java->C glue code: * Java package: com.jogamp.opengl.impl.gl4.GL4bcImpl + * Java method: long dispatch_glMapNamedBufferEXT(int target, int access) + * C function: void * glMapNamedBufferEXT(GLenum target, GLenum access); + */ +JNIEXPORT jlong JNICALL +Java_com_jogamp_opengl_impl_gl4_GL4bcImpl_dispatch_1glMapNamedBufferEXT(JNIEnv *env, jobject _unused, jint target, jint access, jlong glProcAddress) { + PFNGLMAPNAMEDBUFFEREXTPROC ptr_glMapNamedBufferEXT; + void * _res; + ptr_glMapNamedBufferEXT = (PFNGLMAPNAMEDBUFFEREXTPROC) (intptr_t) glProcAddress; + assert(ptr_glMapNamedBufferEXT != NULL); + _res = (* ptr_glMapNamedBufferEXT) ((GLenum) target, (GLenum) access); + return (jlong) (intptr_t) _res; +} + +/* Java->C glue code: + * Java package: com.jogamp.opengl.impl.gl4.GL4bcImpl * Java method: ByteBuffer newDirectByteBuffer(long addr, int capacity); * C function: jobject newDirectByteBuffer(jlong addr, jint capacity); */ diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gl2es12.java b/make/config/jogl/gl-impl-CustomJavaCode-gl2es12.java index 4bc39b076..cb0d01312 100644 --- a/make/config/jogl/gl-impl-CustomJavaCode-gl2es12.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-gl2es12.java @@ -339,16 +339,19 @@ public java.nio.ByteBuffer glMapBuffer(int target, int access) { int sz = bufferSizeTracker.getBufferSize(bufferStateTracker, target, this); + if (0 == sz) { + return null; + } long addr; addr = dispatch_glMapBuffer(target, access, __addr_); - if (addr == 0 || sz == 0) { + if (0 == addr) { return null; } ARBVBOKey key = new ARBVBOKey(addr, sz); ByteBuffer _res = (ByteBuffer) arbVBOCache.get(key); if (_res == null) { _res = newDirectByteBuffer(addr, sz); - InternalBufferUtil.nativeOrder(_res); + Buffers.nativeOrder(_res); arbVBOCache.put(key, _res); } _res.position(0); diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gl4.java b/make/config/jogl/gl-impl-CustomJavaCode-gl4.java deleted file mode 100644 index a2c70eeee..000000000 --- a/make/config/jogl/gl-impl-CustomJavaCode-gl4.java +++ /dev/null @@ -1,339 +0,0 @@ -// Tracks glBegin/glEnd calls to determine whether it is legal to -// query Vertex Buffer Object state -private boolean inBeginEndPair; - -/* FIXME: refactor dependence on Java 2D / JOGL bridge - -// Tracks creation and destruction of server-side OpenGL objects when -// the Java2D/OpenGL pipeline is enabled and it is using frame buffer -// objects (FBOs) to do its rendering -private GLObjectTracker tracker; - -public void setObjectTracker(GLObjectTracker tracker) { - this.tracker = tracker; -} - -*/ - -public GL3Impl(GLProfile glp, GLContextImpl context) { - this._context = context; - this.bufferSizeTracker = context.getBufferSizeTracker(); - this.bufferStateTracker = context.getBufferStateTracker(); - this.glStateTracker = context.getGLStateTracker(); - this.glProfile = glp; -} - -/** - * Provides platform-independent access to the wglAllocateMemoryNV / - * glXAllocateMemoryNV extension. - */ -public java.nio.ByteBuffer glAllocateMemoryNV(int arg0, float arg1, float arg2, float arg3) { - return _context.glAllocateMemoryNV(arg0, arg1, arg2, arg3); -} - -// -// Helpers for ensuring the correct amount of texture data -// - -/** Returns the number of bytes required to fill in the appropriate - texture. This is computed as closely as possible based on the - pixel pack or unpack parameters. The logic in this routine is - based on code in the SGI OpenGL sample implementation. */ - -private int imageSizeInBytes(int format, int type, int w, int h, int d, - boolean pack) { - int elements = 0; - int esize = 0; - - if (w < 0) return 0; - if (h < 0) return 0; - if (d < 0) return 0; - switch (format) { - case GL_STENCIL_INDEX: - elements = 1; - break; - case GL_RED: - case GL_GREEN: - case GL_BLUE: - case GL_ALPHA: - case GL_LUMINANCE: - case GL_DEPTH_COMPONENT: - elements = 1; - break; - case GL_LUMINANCE_ALPHA: - elements = 2; - break; - case GL_RGB: - case GL_BGR: - elements = 3; - break; - case GL_RGBA: - case GL_BGRA: - elements = 4; - break; - /* FIXME ?? - case GL_HILO_NV: - elements = 2; - break; */ - default: - return 0; - } - switch (type) { - case GL_BYTE: - case GL_UNSIGNED_BYTE: - esize = 1; - break; - case GL_UNSIGNED_BYTE_3_3_2: - case GL_UNSIGNED_BYTE_2_3_3_REV: - esize = 1; - elements = 1; - break; - case GL_SHORT: - case GL_UNSIGNED_SHORT: - esize = 2; - break; - case GL_UNSIGNED_SHORT_5_6_5: - case GL_UNSIGNED_SHORT_5_6_5_REV: - case GL_UNSIGNED_SHORT_4_4_4_4: - case GL_UNSIGNED_SHORT_4_4_4_4_REV: - case GL_UNSIGNED_SHORT_5_5_5_1: - case GL_UNSIGNED_SHORT_1_5_5_5_REV: - esize = 2; - elements = 1; - break; - case GL_INT: - case GL_UNSIGNED_INT: - case GL_FLOAT: - esize = 4; - break; - case GL_UNSIGNED_INT_8_8_8_8: - case GL_UNSIGNED_INT_8_8_8_8_REV: - case GL_UNSIGNED_INT_10_10_10_2: - case GL_UNSIGNED_INT_2_10_10_10_REV: - esize = 4; - elements = 1; - break; - default: - return 0; - } - return imageSizeInBytes(elements * esize, w, h, d, pack); -} - -private GLBufferSizeTracker bufferSizeTracker; -private GLBufferStateTracker bufferStateTracker; -private GLStateTracker glStateTracker; - -private boolean bufferObjectExtensionsInitialized = false; -private boolean haveARBPixelBufferObject; -private boolean haveEXTPixelBufferObject; -private boolean haveGL15; -private boolean haveGL21; -private boolean haveARBVertexBufferObject; - -private void initBufferObjectExtensionChecks() { - if (bufferObjectExtensionsInitialized) - return; - bufferObjectExtensionsInitialized = true; - haveARBPixelBufferObject = isExtensionAvailable("GL_ARB_pixel_buffer_object"); - haveEXTPixelBufferObject = isExtensionAvailable("GL_EXT_pixel_buffer_object"); - haveGL15 = isExtensionAvailable("GL_VERSION_1_5"); - haveGL21 = isExtensionAvailable("GL_VERSION_2_1"); - haveARBVertexBufferObject = isExtensionAvailable("GL_ARB_vertex_buffer_object"); -} - -private boolean checkBufferObject(boolean extension1, - boolean extension2, - boolean extension3, - boolean enabled, - int state, - String kind, boolean throwException) { - if (inBeginEndPair) { - throw new GLException("May not call this between glBegin and glEnd"); - } - boolean avail = (extension1 || extension2 || extension3); - if (!avail) { - if (!enabled) - return true; - if(throwException) { - throw new GLException("Required extensions not available to call this function"); - } - return false; - } - int buffer = bufferStateTracker.getBoundBufferObject(state, this); - if (enabled) { - if (buffer == 0) { - if(throwException) { - throw new GLException(kind + " must be enabled to call this method"); - } - return false; - } - } else { - if (buffer != 0) { - if(throwException) { - throw new GLException(kind + " must be disabled to call this method"); - } - return false; - } - } - return true; -} - -private boolean checkArrayVBODisabled(boolean throwException) { - initBufferObjectExtensionChecks(); - return checkBufferObject(haveGL15, - haveARBVertexBufferObject, - false, - false, - GL.GL_ARRAY_BUFFER, - "array vertex_buffer_object", throwException); -} - -private boolean checkArrayVBOEnabled(boolean throwException) { - initBufferObjectExtensionChecks(); - return checkBufferObject(haveGL15, - haveARBVertexBufferObject, - false, - true, - GL.GL_ARRAY_BUFFER, - "array vertex_buffer_object", throwException); -} - -private boolean checkElementVBODisabled(boolean throwException) { - initBufferObjectExtensionChecks(); - return checkBufferObject(haveGL15, - haveARBVertexBufferObject, - false, - false, - GL.GL_ELEMENT_ARRAY_BUFFER, - "element vertex_buffer_object", throwException); -} - -private boolean checkElementVBOEnabled(boolean throwException) { - initBufferObjectExtensionChecks(); - return checkBufferObject(haveGL15, - haveARBVertexBufferObject, - false, - true, - GL.GL_ELEMENT_ARRAY_BUFFER, - "element vertex_buffer_object", throwException); -} - -private boolean checkUnpackPBODisabled(boolean throwException) { - initBufferObjectExtensionChecks(); - return checkBufferObject(haveARBPixelBufferObject, - haveEXTPixelBufferObject, - haveGL21, - false, - GL2.GL_PIXEL_UNPACK_BUFFER, - "unpack pixel_buffer_object", throwException); -} - -private boolean checkUnpackPBOEnabled(boolean throwException) { - initBufferObjectExtensionChecks(); - return checkBufferObject(haveARBPixelBufferObject, - haveEXTPixelBufferObject, - haveGL21, - true, - GL2.GL_PIXEL_UNPACK_BUFFER, - "unpack pixel_buffer_object", throwException); -} - -private boolean checkPackPBODisabled(boolean throwException) { - initBufferObjectExtensionChecks(); - return checkBufferObject(haveARBPixelBufferObject, - haveEXTPixelBufferObject, - haveGL21, - false, - GL2.GL_PIXEL_PACK_BUFFER, - "pack pixel_buffer_object", throwException); -} - -private boolean checkPackPBOEnabled(boolean throwException) { - initBufferObjectExtensionChecks(); - return checkBufferObject(haveARBPixelBufferObject, - haveEXTPixelBufferObject, - haveGL21, - true, - GL2.GL_PIXEL_PACK_BUFFER, - "pack pixel_buffer_object", throwException); -} - -public boolean glIsPBOPackEnabled() { - return checkPackPBOEnabled(false); -} - -public boolean glIsPBOUnpackEnabled() { - return checkUnpackPBOEnabled(false); -} - -// Attempt to return the same ByteBuffer object from glMapBuffer if -// the vertex buffer object's base address and size haven't changed -private static class ARBVBOKey { - private long addr; - private int capacity; - - ARBVBOKey(long addr, int capacity) { - this.addr = addr; - this.capacity = capacity; - } - - public int hashCode() { - return (int) addr; - } - - public boolean equals(Object o) { - if ((o == null) || (!(o instanceof ARBVBOKey))) { - return false; - } - - ARBVBOKey other = (ARBVBOKey) o; - return ((addr == other.addr) && (capacity == other.capacity)); - } -} - -private Map/*<ARBVBOKey, ByteBuffer>*/ arbVBOCache = new HashMap(); - -/** Entry point to C language function: <br> <code> LPVOID glMapBuffer(GLenum target, GLenum access); </code> */ -public java.nio.ByteBuffer glMapBuffer(int target, int access) { - final long __addr_ = ((GL3ProcAddressTable)_context.getGLProcAddressTable())._addressof_glMapBuffer; - if (__addr_ == 0) { - throw new GLException("Method \"glMapBuffer\" not available"); - } - int sz = bufferSizeTracker.getBufferSize(bufferStateTracker, - target, - this); - long addr; - addr = dispatch_glMapBuffer(target, access, __addr_); - if (addr == 0 || sz == 0) { - return null; - } - ARBVBOKey key = new ARBVBOKey(addr, sz); - ByteBuffer _res = (ByteBuffer) arbVBOCache.get(key); - if (_res == null) { - _res = newDirectByteBuffer(addr, sz); - InternalBufferUtil.nativeOrder(_res); - arbVBOCache.put(key, _res); - } - _res.position(0); - return _res; -} - -/** Encapsulates function pointer for OpenGL function <br>: <code> LPVOID glMapBuffer(GLenum target, GLenum access); </code> */ -native private long dispatch_glMapBuffer(int target, int access, long glProcAddress); - -native private ByteBuffer newDirectByteBuffer(long addr, int capacity); - - /** Dummy implementation for the ES 2.0 function: <br> <code> void {@native glShaderBinary}(GLint n, const GLuint * shaders, GLenum binaryformat, const void * binary, GLint length); </code> <br> Always throws a GLException! */ - public void glShaderBinary(int n, java.nio.IntBuffer shaders, int binaryformat, java.nio.Buffer binary, int length) { - throw new GLException("Method \"glShaderBinary\" not available"); - } - - /** Dummy implementation for the ES 2.0 function: <br> <code> void {@native glShaderBinary}(GLint n, const GLuint * shaders, GLenum binaryformat, const void * binary, GLint length); </code> <br> Always throws a GLException! */ - public void glShaderBinary(int n, int[] shaders, int shaders_offset, int binaryformat, java.nio.Buffer binary, int length) { - throw new GLException("Method \"glShaderBinary\" not available"); - } - - public void glReleaseShaderCompiler() { - // nothing to do - } - diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java b/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java index bceb12fe5..aa176738a 100644 --- a/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java @@ -308,19 +308,20 @@ public java.nio.ByteBuffer glMapBuffer(int target, int access) { if (__addr_ == 0) { throw new GLException("Method \"glMapBuffer\" not available"); } - int sz = bufferSizeTracker.getBufferSize(bufferStateTracker, - target, - this); + int sz = bufferSizeTracker.getBufferSize(bufferStateTracker, target, this); + if (0 == sz) { + return null; + } long addr; addr = dispatch_glMapBuffer(target, access, __addr_); - if (addr == 0 || sz == 0) { + if (0 == addr) { return null; } ARBVBOKey key = new ARBVBOKey(addr, sz); ByteBuffer _res = (ByteBuffer) arbVBOCache.get(key); if (_res == null) { _res = newDirectByteBuffer(addr, sz); - InternalBufferUtil.nativeOrder(_res); + Buffers.nativeOrder(_res); arbVBOCache.put(key, _res); } _res.position(0); @@ -330,6 +331,29 @@ public java.nio.ByteBuffer glMapBuffer(int target, int access) { /** Encapsulates function pointer for OpenGL function <br>: <code> LPVOID glMapBuffer(GLenum target, GLenum access); </code> */ native private long dispatch_glMapBuffer(int target, int access, long glProcAddress); +/** Entry point to C language function: <code> GLvoid * {@native glMapNamedBufferEXT}(GLuint buffer, GLenum access); </code> <br>Part of <code>GL_EXT_direct_state_access</code> */ +public java.nio.ByteBuffer glMapNamedBufferEXT(int buffer, int access) { + final long __addr_ = ((GL4bcProcAddressTable)_context.getGLProcAddressTable())._addressof_glMapNamedBufferEXT; + if (__addr_ == 0) { + throw new GLException("Method \"glMapNamedBufferEXT\" not available"); + } + int sz = bufferSizeTracker.getDirectStateBufferSize(buffer, this); + if (0 == sz) { + return null; + } + long addr; + addr = dispatch_glMapNamedBufferEXT(buffer, access, __addr_); + if (0 == addr) { + return null; + } + ByteBuffer _res = newDirectByteBuffer(addr, sz); + Buffers.nativeOrder(_res); + _res.position(0); + return _res; +} + +private native long dispatch_glMapNamedBufferEXT(int buffer, int access, long procAddress); + native private ByteBuffer newDirectByteBuffer(long addr, int capacity); /** Dummy implementation for the ES 2.0 function: <br> <code> void {@native glShaderBinary}(GLint n, const GLuint * shaders, GLenum binaryformat, const void * binary, GLint length); </code> <br> Always throws a GLException! */ diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gles1.java b/make/config/jogl/gl-impl-CustomJavaCode-gles1.java index b4efac8a1..d29fe1645 100755 --- a/make/config/jogl/gl-impl-CustomJavaCode-gles1.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-gles1.java @@ -285,16 +285,19 @@ public java.nio.ByteBuffer glMapBuffer(int target, int access) { int sz = bufferSizeTracker.getBufferSize(bufferStateTracker, target, this); + if (0 == sz) { + return null; + } long addr; addr = dispatch_glMapBuffer(target, access, __addr_); - if (addr == 0 || sz == 0) { + if (0 == addr) { return null; } ARBVBOKey key = new ARBVBOKey(addr, sz); java.nio.ByteBuffer _res = (java.nio.ByteBuffer) arbVBOCache.get(key); if (_res == null) { _res = newDirectByteBuffer(addr, sz); - InternalBufferUtil.nativeOrder(_res); + Buffers.nativeOrder(_res); arbVBOCache.put(key, _res); } _res.position(0); diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gles2.java b/make/config/jogl/gl-impl-CustomJavaCode-gles2.java index bb8ddb7ef..e65c491a2 100755 --- a/make/config/jogl/gl-impl-CustomJavaCode-gles2.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-gles2.java @@ -295,16 +295,19 @@ public java.nio.ByteBuffer glMapBuffer(int target, int access) { int sz = bufferSizeTracker.getBufferSize(bufferStateTracker, target, this); + if (0 == sz) { + return null; + } long addr; addr = dispatch_glMapBuffer(target, access, __addr_); - if (addr == 0 || sz == 0) { + if (0 == addr) { return null; } ARBVBOKey key = new ARBVBOKey(addr, sz); java.nio.ByteBuffer _res = (java.nio.ByteBuffer) arbVBOCache.get(key); if (_res == null) { _res = newDirectByteBuffer(addr, sz); - InternalBufferUtil.nativeOrder(_res); + Buffers.nativeOrder(_res); arbVBOCache.put(key, _res); } _res.position(0); diff --git a/make/config/jogl/gl3-desktop.cfg b/make/config/jogl/gl3-desktop.cfg index ee741089e..19eef4270 100755 --- a/make/config/jogl/gl3-desktop.cfg +++ b/make/config/jogl/gl3-desktop.cfg @@ -47,19 +47,11 @@ Opaque long Visual * # traversed) Ignore Display Ignore Visual -# Implement the first argument to glXGetProcAddress as String instead -# of byte[] ArgumentIsString glXGetProcAddress 0 ArgumentIsString glXGetProcAddressARB 0 ReturnsString glXQueryExtensionsString ReturnsString glXQueryServerString ReturnsString glXGetClientString -TemporaryCVariableDeclaration glXChooseFBConfig int count; -TemporaryCVariableAssignment glXChooseFBConfig count = _ptr3[0]; -ReturnValueCapacity glXChooseFBConfig count * sizeof(GLXFBConfig) -TemporaryCVariableDeclaration glXChooseFBConfigSGIX int count; -TemporaryCVariableAssignment glXChooseFBConfigSGIX count = _ptr3[0]; -ReturnValueCapacity glXChooseFBConfigSGIX count * sizeof(GLXFBConfig) TemporaryCVariableDeclaration glXGetFBConfigs int count; TemporaryCVariableAssignment glXGetFBConfigs count = _nelements_ptr[0]; ReturnValueCapacity glXGetFBConfigs count * sizeof(GLXFBConfig) diff --git a/make/config/jogl/glu-CustomJavaCode-base.java b/make/config/jogl/glu-CustomJavaCode-base.java index 480f5d117..7aee33ae1 100755 --- a/make/config/jogl/glu-CustomJavaCode-base.java +++ b/make/config/jogl/glu-CustomJavaCode-base.java @@ -1382,21 +1382,21 @@ public void gluLookAt(double eyeX, double eyeY, double eyeZ, double centerX, dou * <P> Accepts the outgoing window coordinates as a single array. */ public boolean gluProject(double objX, double objY, double objZ, double[] model, int model_offset, double[] proj, int proj_offset, int[] view, int view_offset, double[] winPos, int winPos_offset) { - return project.gluProject((float)objX, (float)objY, (float)objZ, InternalBufferUtil.getFloatArray(model), model_offset, InternalBufferUtil.getFloatArray(proj), proj_offset, view, view_offset, InternalBufferUtil.getFloatArray(winPos), winPos_offset); + return project.gluProject((float)objX, (float)objY, (float)objZ, Buffers.getFloatArray(model), model_offset, Buffers.getFloatArray(proj), proj_offset, view, view_offset, Buffers.getFloatArray(winPos), winPos_offset); } /** Interface to C language function: <br> <code> GLint gluUnProject(GLdouble winX, GLdouble winY, GLdouble winZ, const GLdouble * model, const GLdouble * proj, const GLint * view, GLdouble * objX, GLdouble * objY, GLdouble * objZ); </code> * <P> Accepts the outgoing object coordinates (a 3-vector) as a single array. */ public boolean gluUnProject(double winX, double winY, double winZ, double[] model, int model_offset, double[] proj, int proj_offset, int[] view, int view_offset, double[] objPos, int objPos_offset) { - return project.gluUnProject((float)winX, (float)winY, (float)winZ, InternalBufferUtil.getFloatArray(model), model_offset, InternalBufferUtil.getFloatArray(proj), proj_offset, view, view_offset, InternalBufferUtil.getFloatArray(objPos), objPos_offset); + return project.gluUnProject((float)winX, (float)winY, (float)winZ, Buffers.getFloatArray(model), model_offset, Buffers.getFloatArray(proj), proj_offset, view, view_offset, Buffers.getFloatArray(objPos), objPos_offset); } /** Interface to C language function: <br> <code> GLint gluUnProject4(GLdouble winX, GLdouble winY, GLdouble winZ, GLdouble clipW, const GLdouble * model, const GLdouble * proj, const GLint * view, GLdouble nearVal, GLdouble farVal, GLdouble * objX, GLdouble * objY, GLdouble * objZ, GLdouble * objW); </code> * <P> Accepts the outgoing object coordinates (a 4-vector) as a single array. */ public boolean gluUnProject4(double winX, double winY, double winZ, double clipW, double[] model, int model_offset, double[] proj, int proj_offset, int[] view, int view_offset, double nearVal, double farVal, double[] objPos, int objPos_offset) { - return project.gluUnProject4((float)winX, (float)winY, (float)winZ, (float)clipW, InternalBufferUtil.getFloatArray(model), model_offset, InternalBufferUtil.getFloatArray(proj), proj_offset, view, view_offset, (float)nearVal, (float)farVal, InternalBufferUtil.getFloatArray(objPos), objPos_offset); + return project.gluUnProject4((float)winX, (float)winY, (float)winZ, (float)clipW, Buffers.getFloatArray(model), model_offset, Buffers.getFloatArray(proj), proj_offset, view, view_offset, (float)nearVal, (float)farVal, Buffers.getFloatArray(objPos), objPos_offset); } public void gluPickMatrix(double x, double y, double delX, double delY, int[] viewport, int viewport_offset) { diff --git a/make/config/jogl/glu-CustomJavaCode-gl2.java b/make/config/jogl/glu-CustomJavaCode-gl2.java index 690e0acfa..4dcb5691e 100644 --- a/make/config/jogl/glu-CustomJavaCode-gl2.java +++ b/make/config/jogl/glu-CustomJavaCode-gl2.java @@ -218,13 +218,13 @@ private final ByteBuffer copyToByteBuffer(Buffer buf) { if (buf.position() == 0) { return (ByteBuffer) buf; } - return InternalBufferUtil.copyByteBuffer((ByteBuffer) buf); + return Buffers.copyByteBuffer((ByteBuffer) buf); } else if (buf instanceof ShortBuffer) { - return InternalBufferUtil.copyShortBufferAsByteBuffer((ShortBuffer) buf); + return Buffers.copyShortBufferAsByteBuffer((ShortBuffer) buf); } else if (buf instanceof IntBuffer) { - return InternalBufferUtil.copyIntBufferAsByteBuffer((IntBuffer) buf); + return Buffers.copyIntBufferAsByteBuffer((IntBuffer) buf); } else if (buf instanceof FloatBuffer) { - return InternalBufferUtil.copyFloatBufferAsByteBuffer((FloatBuffer) buf); + return Buffers.copyFloatBufferAsByteBuffer((FloatBuffer) buf); } else { throw new IllegalArgumentException("Unsupported buffer type (must be one of byte, short, int, or float)"); } @@ -239,11 +239,11 @@ private final int gluScaleImageJava( int format, int widthin, int heightin, if( dataout instanceof ByteBuffer ) { out = (ByteBuffer)dataout; } else if( dataout instanceof ShortBuffer ) { - out = InternalBufferUtil.newByteBuffer(dataout.remaining() * InternalBufferUtil.SIZEOF_SHORT); + out = Buffers.newDirectByteBuffer(dataout.remaining() * Buffers.SIZEOF_SHORT); } else if ( dataout instanceof IntBuffer ) { - out = InternalBufferUtil.newByteBuffer(dataout.remaining() * InternalBufferUtil.SIZEOF_INT); + out = Buffers.newDirectByteBuffer(dataout.remaining() * Buffers.SIZEOF_INT); } else if ( dataout instanceof FloatBuffer ) { - out = InternalBufferUtil.newByteBuffer(dataout.remaining() * InternalBufferUtil.SIZEOF_FLOAT); + out = Buffers.newDirectByteBuffer(dataout.remaining() * Buffers.SIZEOF_FLOAT); } else { throw new IllegalArgumentException("Unsupported destination buffer type (must be byte, short, int, or float)"); } @@ -536,27 +536,18 @@ public final void gluEndCurve(GLUnurbs r) { // private static GLUgl2ProcAddressTable gluProcAddressTable; -private static volatile boolean gluLibraryLoaded; private static final GLUgl2ProcAddressTable getGLUProcAddressTable() { - if (!gluLibraryLoaded) { - loadGLULibrary(); - } if (gluProcAddressTable == null) { GLContext curContext = GLContext.getCurrent(); if (curContext == null) { throw new GLException("No OpenGL context current on this thread"); } + GLDynamicLookupHelper glLookupHelper = ((GLDrawableImpl) curContext.getGLDrawable()).getGLDynamicLookupHelper(); + glLookupHelper.loadGLULibrary(); GLUgl2ProcAddressTable tmp = new GLUgl2ProcAddressTable(new GLProcAddressResolver()); - tmp.reset(((GLDrawableImpl)curContext.getGLDrawable()).getDynamicLookupHelper()); + tmp.reset(glLookupHelper); gluProcAddressTable = tmp; } return gluProcAddressTable; } - -private static final synchronized void loadGLULibrary() { - if (!gluLibraryLoaded) { - GLDrawableFactoryImpl.getFactoryImpl(null).loadGLULibrary(); - gluLibraryLoaded = true; - } -} diff --git a/make/config/jogl/glu-CustomJavaCode-gl2es1.java b/make/config/jogl/glu-CustomJavaCode-gl2es1.java index eb4bcc718..742f7c240 100755 --- a/make/config/jogl/glu-CustomJavaCode-gl2es1.java +++ b/make/config/jogl/glu-CustomJavaCode-gl2es1.java @@ -99,13 +99,13 @@ private final java.nio.ByteBuffer copyToByteBuffer(java.nio.Buffer buf) { if (buf.position() == 0) { return (java.nio.ByteBuffer) buf; } - return InternalBufferUtil.copyByteBuffer((java.nio.ByteBuffer) buf); + return Buffers.copyByteBuffer((java.nio.ByteBuffer) buf); } else if (buf instanceof java.nio.ShortBuffer) { - return InternalBufferUtil.copyShortBufferAsByteBuffer((java.nio.ShortBuffer) buf); + return Buffers.copyShortBufferAsByteBuffer((java.nio.ShortBuffer) buf); } else if (buf instanceof java.nio.IntBuffer) { - return InternalBufferUtil.copyIntBufferAsByteBuffer((java.nio.IntBuffer) buf); + return Buffers.copyIntBufferAsByteBuffer((java.nio.IntBuffer) buf); } else if (buf instanceof java.nio.FloatBuffer) { - return InternalBufferUtil.copyFloatBufferAsByteBuffer((java.nio.FloatBuffer) buf); + return Buffers.copyFloatBufferAsByteBuffer((java.nio.FloatBuffer) buf); } else { throw new IllegalArgumentException("Unsupported buffer type (must be one of byte, short, int, or float)"); } @@ -124,11 +124,11 @@ public final int gluScaleImage( int format, int widthin, int heightin, if( dataout instanceof java.nio.ByteBuffer ) { out = (java.nio.ByteBuffer)dataout; } else if( dataout instanceof java.nio.ShortBuffer ) { - out = InternalBufferUtil.newByteBuffer(dataout.remaining() * InternalBufferUtil.SIZEOF_SHORT); + out = Buffers.newDirectByteBuffer(dataout.remaining() * Buffers.SIZEOF_SHORT); } else if ( dataout instanceof java.nio.IntBuffer ) { - out = InternalBufferUtil.newByteBuffer(dataout.remaining() * InternalBufferUtil.SIZEOF_INT); + out = Buffers.newDirectByteBuffer(dataout.remaining() * Buffers.SIZEOF_INT); } else if ( dataout instanceof java.nio.FloatBuffer ) { - out = InternalBufferUtil.newByteBuffer(dataout.remaining() * InternalBufferUtil.SIZEOF_FLOAT); + out = Buffers.newDirectByteBuffer(dataout.remaining() * Buffers.SIZEOF_FLOAT); } else { throw new IllegalArgumentException("Unsupported destination buffer type (must be byte, short, int, or float)"); } @@ -225,30 +225,3 @@ public final int gluBuild3DMipmaps( int target, int internalFormat, int width, depth, format, type, buffer ) ); } -//---------------------------------------------------------------------- -// GLUProcAddressTable handling -// - -/* -private static GLUProcAddressTable gluProcAddressTable; -private static volatile boolean gluLibraryLoaded; - -private static GLUProcAddressTable getGLUProcAddressTable() { - if (!gluLibraryLoaded) { - loadGLULibrary(); - } - if (gluProcAddressTable == null) { - GLUProcAddressTable tmp = new GLUProcAddressTable(new GLProcAddressResolver()); - tmp.reset(GLDrawableFactoryImpl.getFactoryImpl()); - gluProcAddressTable = tmp; - } - return gluProcAddressTable; -} - -private static synchronized void loadGLULibrary() { - if (!gluLibraryLoaded) { - GLDrawableFactoryImpl.getFactoryImpl().loadGLULibrary(); - gluLibraryLoaded = true; - } -} -*/ diff --git a/make/config/jogl/glx-CustomCCode.c b/make/config/jogl/glx-CustomCCode.c index 1b30a7da6..dec3f4583 100755 --- a/make/config/jogl/glx-CustomCCode.c +++ b/make/config/jogl/glx-CustomCCode.c @@ -15,28 +15,28 @@ /* We expect glXGetProcAddressARB to be defined */ extern void (*glXGetProcAddressARB(const GLubyte *procname))(); -static const char * clazzNameInternalBufferUtil = "com/jogamp/opengl/impl/InternalBufferUtil"; -static const char * clazzNameInternalBufferUtilStaticCstrName = "copyByteBuffer"; -static const char * clazzNameInternalBufferUtilStaticCstrSignature = "(Ljava/nio/ByteBuffer;)Ljava/nio/ByteBuffer;"; +static const char * clazzNameBuffers = "com/jogamp/common/nio/Buffers"; +static const char * clazzNameBuffersStaticCstrName = "copyByteBuffer"; +static const char * clazzNameBuffersStaticCstrSignature = "(Ljava/nio/ByteBuffer;)Ljava/nio/ByteBuffer;"; static const char * clazzNameByteBuffer = "java/nio/ByteBuffer"; -static jclass clazzInternalBufferUtil = NULL; -static jmethodID cstrInternalBufferUtil = NULL; +static jclass clazzBuffers = NULL; +static jmethodID cstrBuffers = NULL; static jclass clazzByteBuffer = NULL; static void _initClazzAccess(JNIEnv *env) { jclass c; - if(NULL!=cstrInternalBufferUtil) return ; + if(NULL!=cstrBuffers) return ; - c = (*env)->FindClass(env, clazzNameInternalBufferUtil); + c = (*env)->FindClass(env, clazzNameBuffers); if(NULL==c) { - fprintf(stderr, "FatalError: Java_com_jogamp_opengl_impl_x11_glx_GLX: can't find %s\n", clazzNameInternalBufferUtil); - (*env)->FatalError(env, clazzNameInternalBufferUtil); + fprintf(stderr, "FatalError: Java_com_jogamp_opengl_impl_x11_glx_GLX: can't find %s\n", clazzNameBuffers); + (*env)->FatalError(env, clazzNameBuffers); } - clazzInternalBufferUtil = (jclass)(*env)->NewGlobalRef(env, c); - if(NULL==clazzInternalBufferUtil) { - fprintf(stderr, "FatalError: Java_com_jogamp_opengl_impl_x11_glx_GLX: can't use %s\n", clazzNameInternalBufferUtil); - (*env)->FatalError(env, clazzNameInternalBufferUtil); + clazzBuffers = (jclass)(*env)->NewGlobalRef(env, c); + if(NULL==clazzBuffers) { + fprintf(stderr, "FatalError: Java_com_jogamp_opengl_impl_x11_glx_GLX: can't use %s\n", clazzNameBuffers); + (*env)->FatalError(env, clazzNameBuffers); } c = (*env)->FindClass(env, clazzNameByteBuffer); if(NULL==c) { @@ -49,13 +49,13 @@ static void _initClazzAccess(JNIEnv *env) { (*env)->FatalError(env, clazzNameByteBuffer); } - cstrInternalBufferUtil = (*env)->GetStaticMethodID(env, clazzInternalBufferUtil, - clazzNameInternalBufferUtilStaticCstrName, clazzNameInternalBufferUtilStaticCstrSignature); - if(NULL==cstrInternalBufferUtil) { + cstrBuffers = (*env)->GetStaticMethodID(env, clazzBuffers, + clazzNameBuffersStaticCstrName, clazzNameBuffersStaticCstrSignature); + if(NULL==cstrBuffers) { fprintf(stderr, "FatalError: Java_com_jogamp_opengl_impl_x11_glx_GLX:: can't create %s.%s %s\n", - clazzNameInternalBufferUtil, - clazzNameInternalBufferUtilStaticCstrName, clazzNameInternalBufferUtilStaticCstrSignature); - (*env)->FatalError(env, clazzNameInternalBufferUtilStaticCstrName); + clazzNameBuffers, + clazzNameBuffersStaticCstrName, clazzNameBuffersStaticCstrSignature); + (*env)->FatalError(env, clazzNameBuffersStaticCstrName); } } @@ -65,18 +65,21 @@ static void _initClazzAccess(JNIEnv *env) { * C function: XVisualInfo * glXGetVisualFromFBConfig(Display * dpy, GLXFBConfig config); */ JNIEXPORT jobject JNICALL -Java_com_jogamp_opengl_impl_x11_glx_GLX_glXGetVisualFromFBConfigCopied0__JJ(JNIEnv *env, jclass _unused, jlong dpy, jlong config) { +Java_com_jogamp_opengl_impl_x11_glx_GLX_dispatch_1glXGetVisualFromFBConfig(JNIEnv *env, jclass _unused, jlong dpy, jlong config, jlong procAddress) { + typedef XVisualInfo* (APIENTRY*_local_PFNGLXGETVISUALFROMFBCONFIG)(Display * dpy, GLXFBConfig config); + _local_PFNGLXGETVISUALFROMFBCONFIG ptr_glXGetVisualFromFBConfig; XVisualInfo * _res; jobject jbyteSource; jobject jbyteCopy; - _res = glXGetVisualFromFBConfig((Display *) (intptr_t) dpy, (GLXFBConfig) (intptr_t) config); + ptr_glXGetVisualFromFBConfig = (_local_PFNGLXGETVISUALFROMFBCONFIG) (intptr_t) procAddress; + assert(ptr_glXGetVisualFromFBConfig != NULL); + _res = (* ptr_glXGetVisualFromFBConfig) ((Display *) (intptr_t) dpy, (GLXFBConfig) (intptr_t) config); if (_res == NULL) return NULL; _initClazzAccess(env); jbyteSource = (*env)->NewDirectByteBuffer(env, _res, sizeof(XVisualInfo)); - jbyteCopy = (*env)->CallStaticObjectMethod(env, - clazzInternalBufferUtil, cstrInternalBufferUtil, jbyteSource); + jbyteCopy = (*env)->CallStaticObjectMethod(env, clazzBuffers, cstrBuffers, jbyteSource); (*env)->DeleteLocalRef(env, jbyteSource); XFree(_res); @@ -90,20 +93,24 @@ Java_com_jogamp_opengl_impl_x11_glx_GLX_glXGetVisualFromFBConfigCopied0__JJ(JNIE * C function: GLXFBConfig * glXChooseFBConfig(Display * dpy, int screen, const int * attribList, int * nitems); */ JNIEXPORT jobject JNICALL -Java_com_jogamp_opengl_impl_x11_glx_GLX_glXChooseFBConfigCopied1__JILjava_lang_Object_2ILjava_lang_Object_2I(JNIEnv *env, jclass _unused, jlong dpy, jint screen, jobject attribList, jint attribList_byte_offset, jobject nitems, jint nitems_byte_offset) { +Java_com_jogamp_opengl_impl_x11_glx_GLX_dispatch_1glXChooseFBConfig(JNIEnv *env, jclass _unused, jlong dpy, jint screen, jobject attribList, jint attribList_byte_offset, jobject nitems, jint nitems_byte_offset, jlong procAddress) { + typedef GLXFBConfig* (APIENTRY*_local_PFNGLXCHOOSEFBCONFIG)(Display * dpy, int screen, const int * attribList, int * nitems); + _local_PFNGLXCHOOSEFBCONFIG ptr_glXChooseFBConfig; int * _ptr2 = NULL; int * _ptr3 = NULL; GLXFBConfig * _res; int count; jobject jbyteSource; jobject jbyteCopy; + ptr_glXChooseFBConfig = (_local_PFNGLXCHOOSEFBCONFIG) (intptr_t) procAddress; + assert(ptr_glXChooseFBConfig != NULL); if (attribList != NULL) { _ptr2 = (int *) (((char*) (*env)->GetPrimitiveArrayCritical(env, attribList, NULL)) + attribList_byte_offset); } if (nitems != NULL) { _ptr3 = (int *) (((char*) (*env)->GetPrimitiveArrayCritical(env, nitems, NULL)) + nitems_byte_offset); } - _res = glXChooseFBConfig((Display *) (intptr_t) dpy, (int) screen, (int *) _ptr2, (int *) _ptr3); + _res = (*ptr_glXChooseFBConfig)((Display *) (intptr_t) dpy, (int) screen, (int *) _ptr2, (int *) _ptr3); count = _ptr3[0]; if (attribList != NULL) { (*env)->ReleasePrimitiveArrayCritical(env, attribList, _ptr2, 0); @@ -116,8 +123,7 @@ Java_com_jogamp_opengl_impl_x11_glx_GLX_glXChooseFBConfigCopied1__JILjava_lang_O _initClazzAccess(env); jbyteSource = (*env)->NewDirectByteBuffer(env, _res, count * sizeof(GLXFBConfig)); - jbyteCopy = (*env)->CallStaticObjectMethod(env, - clazzInternalBufferUtil, cstrInternalBufferUtil, jbyteSource); + jbyteCopy = (*env)->CallStaticObjectMethod(env, clazzBuffers, cstrBuffers, jbyteSource); (*env)->DeleteLocalRef(env, jbyteSource); XFree(_res); @@ -130,15 +136,19 @@ Java_com_jogamp_opengl_impl_x11_glx_GLX_glXChooseFBConfigCopied1__JILjava_lang_O * C function: XVisualInfo * glXChooseVisual(Display * dpy, int screen, int * attribList); */ JNIEXPORT jobject JNICALL -Java_com_jogamp_opengl_impl_x11_glx_GLX_glXChooseVisualCopied1__JILjava_lang_Object_2I(JNIEnv *env, jclass _unused, jlong dpy, jint screen, jobject attribList, jint attribList_byte_offset) { +Java_com_jogamp_opengl_impl_x11_glx_GLX_dispatch_1glXChooseVisual(JNIEnv *env, jclass _unused, jlong dpy, jint screen, jobject attribList, jint attribList_byte_offset, jlong procAddress) { + typedef XVisualInfo* (APIENTRY*_local_PFNGLXCHOOSEVISUAL)(Display * dpy, int screen, int * attribList); + _local_PFNGLXCHOOSEVISUAL ptr_glXChooseVisual; int * _ptr2 = NULL; XVisualInfo * _res; jobject jbyteSource; jobject jbyteCopy; + ptr_glXChooseVisual = (_local_PFNGLXCHOOSEVISUAL) (intptr_t) procAddress; + assert(ptr_glXChooseVisual != NULL); if (attribList != NULL) { _ptr2 = (int *) (((char*) (*env)->GetPrimitiveArrayCritical(env, attribList, NULL)) + attribList_byte_offset); } - _res = glXChooseVisual((Display *) (intptr_t) dpy, (int) screen, (int *) _ptr2); + _res = (*ptr_glXChooseVisual)((Display *) (intptr_t) dpy, (int) screen, (int *) _ptr2); if (attribList != NULL) { (*env)->ReleasePrimitiveArrayCritical(env, attribList, _ptr2, 0); } @@ -147,8 +157,7 @@ Java_com_jogamp_opengl_impl_x11_glx_GLX_glXChooseVisualCopied1__JILjava_lang_Obj _initClazzAccess(env); jbyteSource = (*env)->NewDirectByteBuffer(env, _res, sizeof(XVisualInfo)); - jbyteCopy = (*env)->CallStaticObjectMethod(env, - clazzInternalBufferUtil, cstrInternalBufferUtil, jbyteSource); + jbyteCopy = (*env)->CallStaticObjectMethod(env, clazzBuffers, cstrBuffers, jbyteSource); (*env)->DeleteLocalRef(env, jbyteSource); XFree(_res); diff --git a/make/config/jogl/glx-CustomJavaCode.java b/make/config/jogl/glx-CustomJavaCode.java index fe81cd64a..0c3693b8b 100644 --- a/make/config/jogl/glx-CustomJavaCode.java +++ b/make/config/jogl/glx-CustomJavaCode.java @@ -1,46 +1,58 @@ /** Interface to C language function: <br> - Alias for: <br> <code> XVisualInfo * glXGetVisualFromFBConfigSGIX, glXGetVisualFromFBConfig(Display * dpy, GLXFBConfig config); </code> */ - public static XVisualInfo glXGetVisualFromFBConfigCopied(long dpy, long config) + public static XVisualInfo glXGetVisualFromFBConfig(long dpy, long config) { + final long __addr_ = glxProcAddressTable._addressof_glXGetVisualFromFBConfig; + if (__addr_ == 0) { + throw new GLException("Method \"glXGetVisualFromFBConfig\" not available"); + } java.nio.ByteBuffer _res; - _res = glXGetVisualFromFBConfigCopied0(dpy, config); + _res = dispatch_glXGetVisualFromFBConfig(dpy, config, __addr_); if (_res == null) return null; return XVisualInfo.create(_res); } /** Entry point to C language function: - Alias for: <br> <code> XVisualInfo * glXGetVisualFromFBConfigSGIX, glXGetVisualFromFBConfig(Display * dpy, GLXFBConfig config); </code> */ - private static native java.nio.ByteBuffer glXGetVisualFromFBConfigCopied0(long dpy, long config); + private static native java.nio.ByteBuffer dispatch_glXGetVisualFromFBConfig(long dpy, long config, long procAddr); /** Interface to C language function: <br> - Alias for: <br> <code> GLXFBConfig * glXChooseFBConfigSGIX, glXChooseFBConfig(Display * dpy, int screen, const int * attribList, int * nitems); </code> */ - public static com.jogamp.common.nio.PointerBuffer glXChooseFBConfigCopied(long dpy, int screen, int[] attribList, int attribList_offset, int[] nitems, int nitems_offset) + public static com.jogamp.common.nio.PointerBuffer glXChooseFBConfig(long dpy, int screen, int[] attribList, int attribList_offset, int[] nitems, int nitems_offset) { + final long __addr_ = glxProcAddressTable._addressof_glXChooseFBConfig; + if (__addr_ == 0) { + throw new GLException("Method \"glXGetVisualFromFBConfig\" not available"); + } if(attribList != null && attribList.length <= attribList_offset) throw new GLException("array offset argument \"attribList_offset\" (" + attribList_offset + ") equals or exceeds array length (" + attribList.length + ")"); if(nitems != null && nitems.length <= nitems_offset) throw new GLException("array offset argument \"nitems_offset\" (" + nitems_offset + ") equals or exceeds array length (" + nitems.length + ")"); java.nio.ByteBuffer _res; - _res = glXChooseFBConfigCopied1(dpy, screen, attribList, Buffers.SIZEOF_INT * attribList_offset, nitems, Buffers.SIZEOF_INT * nitems_offset); + _res = dispatch_glXChooseFBConfig(dpy, screen, attribList, Buffers.SIZEOF_INT * attribList_offset, nitems, Buffers.SIZEOF_INT * nitems_offset, __addr_); if (_res == null) return null; return PointerBuffer.wrap(_res); } /** Entry point to C language function: - Alias for: <br> <code> GLXFBConfig * glXChooseFBConfigSGIX, glXChooseFBConfig(Display * dpy, int screen, const int * attribList, int * nitems); </code> */ - private static native java.nio.ByteBuffer glXChooseFBConfigCopied1(long dpy, int screen, Object attribList, int attribList_byte_offset, Object nitems, int nitems_byte_offset); + private static native java.nio.ByteBuffer dispatch_glXChooseFBConfig(long dpy, int screen, Object attribList, int attribList_byte_offset, Object nitems, int nitems_byte_offset, long procAddr); /** Interface to C language function: <br> - Alias for: <br> <code> XVisualInfo * glXChooseVisual(Display * dpy, int screen, int * attribList); </code> */ - public static XVisualInfo glXChooseVisualCopied(long dpy, int screen, int[] attribList, int attribList_offset) + public static XVisualInfo glXChooseVisual(long dpy, int screen, int[] attribList, int attribList_offset) { + final long __addr_ = glxProcAddressTable._addressof_glXChooseVisual; + if (__addr_ == 0) { + throw new GLException("Method \"glXChooseVisual\" not available"); + } if(attribList != null && attribList.length <= attribList_offset) throw new GLException("array offset argument \"attribList_offset\" (" + attribList_offset + ") equals or exceeds array length (" + attribList.length + ")"); java.nio.ByteBuffer _res; - _res = glXChooseVisualCopied1(dpy, screen, attribList, Buffers.SIZEOF_INT * attribList_offset); + _res = dispatch_glXChooseVisual(dpy, screen, attribList, Buffers.SIZEOF_INT * attribList_offset, __addr_); if (_res == null) return null; return XVisualInfo.create(_res); } /** Entry point to C language function: - Alias for: <br> <code> XVisualInfo * glXChooseVisual(Display * dpy, int screen, int * attribList); </code> */ - private static native java.nio.ByteBuffer glXChooseVisualCopied1(long dpy, int screen, Object attribList, int attribList_byte_offset); + private static native java.nio.ByteBuffer dispatch_glXChooseVisual(long dpy, int screen, Object attribList, int attribList_byte_offset, long procAddr); diff --git a/make/config/jogl/glx-x11.cfg b/make/config/jogl/glx-x11.cfg index f451fa7f3..dee1d015f 100644 --- a/make/config/jogl/glx-x11.cfg +++ b/make/config/jogl/glx-x11.cfg @@ -5,7 +5,7 @@ NativeOutputDir gensrc/native/jogl/X11 Package com.jogamp.opengl.impl.x11.glx JavaClass GLX -Style allstatic +Style AllStatic Include gl-common.cfg Include gl-common-extensions.cfg Include gl-desktop.cfg @@ -13,16 +13,17 @@ Include gl-desktop.cfg GLHeader GL/glx.h GLHeader GL/glxext.h +ForceProcAddressGen __ALL__ +LocalProcAddressCallingConvention __ALL__ APIENTRY + +AllowNonGLExtensions true EmitProcAddressTable true ProcAddressTableClassName GLXProcAddressTable GetProcAddressTableExpr glxProcAddressTable -# This must be present for bootstrapping -SkipProcAddressGen glXGetProcAddressARB Import com.jogamp.nativewindow.impl.x11.* Import com.jogamp.gluegen.runtime.opengl.GLProcAddressResolver - CustomJavaCode GLX private static GLXProcAddressTable glxProcAddressTable = new GLXProcAddressTable(new GLProcAddressResolver()); CustomJavaCode GLX public static GLXProcAddressTable getGLXProcAddressTable() { return glxProcAddressTable; } @@ -36,13 +37,16 @@ Opaque long GLXFBConfig Ignore glXCreateContextAttribsARB # -# We have Custom code for the following -Ignore glXGetVisualFromFBConfig +# We have manual code for the following (copying the return values) Ignore glXGetVisualFromFBConfigSGIX -Ignore glXChooseFBConfig -Ignore glXChooseVisual - -# Ignore everything not in the GLX core (up through GLX 1.4) aside from glXGetProcAddress +ManuallyImplement glXGetVisualFromFBConfig +ManuallyImplement glXChooseFBConfig +ManuallyImplement glXChooseVisual +ForceProcAddressGen glXGetVisualFromFBConfig +ForceProcAddressGen glXChooseFBConfig +ForceProcAddressGen glXChooseVisual + +# Ignore everything not in the GLX core (up through GLX 1.4) # FIXME: this needs to be kept in sync with the stub headers more than usual Ignore glXFreeContextEXT Ignore glXGetContextIDEXT @@ -86,3 +90,11 @@ Ignore GLXHyperpipeConfigSGIX Ignore GLXPipeRect Ignore GLXPipeRectLimits +CustomJavaCode GLX protected static long glXGetProcAddress(long glXGetProcAddressHandle, java.lang.String procname) +CustomJavaCode GLX { +CustomJavaCode GLX if (glXGetProcAddressHandle == 0) { +CustomJavaCode GLX throw new GLException("Passed null pointer for method \"glXGetProcAddress\""); +CustomJavaCode GLX } +CustomJavaCode GLX return dispatch_glXGetProcAddress1(procname, glXGetProcAddressHandle); +CustomJavaCode GLX } + diff --git a/make/config/jogl/glxext.cfg b/make/config/jogl/glxext.cfg index 1dfc8fccd..aeed3af4e 100755 --- a/make/config/jogl/glxext.cfg +++ b/make/config/jogl/glxext.cfg @@ -95,7 +95,6 @@ Ignore glXGetCurrentReadDrawable Ignore glXQueryContext Ignore glXSelectEvent Ignore glXGetSelectedEvent -Ignore glXGetProcAddress # Ignore a few extensions that bring in data types we don't want to # expose in the public API (and that are useless anyway without diff --git a/make/config/jogl/wgl-win32.cfg b/make/config/jogl/wgl-win32.cfg index 2a69290a4..97938a853 100644 --- a/make/config/jogl/wgl-win32.cfg +++ b/make/config/jogl/wgl-win32.cfg @@ -5,21 +5,30 @@ NativeOutputDir gensrc/native/jogl/Windows Package com.jogamp.opengl.impl.windows.wgl JavaClass WGL -Style allstatic +Style AllStatic Include gl-common.cfg Include gl-common-extensions.cfg Include gl-desktop.cfg -AllowNonGLExtensions true - GLHeader wingdi.h GLHeader GL/wglext.h +ForceProcAddressGen __ALL__ +LocalProcAddressCallingConvention __ALL__ APIENTRY + +AllowNonGLExtensions true +EmitProcAddressTable true +ProcAddressTableClassName WGLProcAddressTable +GetProcAddressTableExpr wglProcAddressTable + +Import com.jogamp.gluegen.runtime.opengl.GLProcAddressResolver + +CustomJavaCode WGL private static WGLProcAddressTable wglProcAddressTable = new WGLProcAddressTable(new GLProcAddressResolver()); +CustomJavaCode WGL public static WGLProcAddressTable getWGLProcAddressTable() { return wglProcAddressTable; } + # Implement the first argument to wglGetProcAddress as String instead # of byte[] ArgumentIsString wglGetProcAddress 0 -ArgumentIsString LoadLibraryA 0 -ArgumentIsString GetProcAddress 1 CustomCCode #define WIN32_LEAN_AND_MEAN CustomCCode #include <windows.h> @@ -30,8 +39,6 @@ CustomCCode #include <stddef.h> Include ../intptr.cfg -IncludeAs CustomCCode wgl-CustomCCode.c - DropUniqVendorExtensions AMD # We need GL_APPLE_float_pixels for our pbuffer implementation # DropUniqVendorExtensions APPLE @@ -47,3 +54,11 @@ DropUniqVendorExtensions SGIX DropUniqVendorExtensions SUN DropUniqVendorExtensions WIN +CustomJavaCode WGL protected static long wglGetProcAddress(long wglGetProcAddressHandle, java.lang.String procname) +CustomJavaCode WGL { +CustomJavaCode WGL if (wglGetProcAddressHandle == 0) { +CustomJavaCode WGL throw new GLException("Passed null pointer for method \"wglGetProcAddress\""); +CustomJavaCode WGL } +CustomJavaCode WGL return dispatch_wglGetProcAddress1(procname, wglGetProcAddressHandle); +CustomJavaCode WGL } + diff --git a/make/config/jogl/wglext.cfg b/make/config/jogl/wglext.cfg index 35c43cb86..aca757b1c 100644 --- a/make/config/jogl/wglext.cfg +++ b/make/config/jogl/wglext.cfg @@ -36,6 +36,9 @@ GLHeader GL/wglext.h IgnoreExtension WGL_OML_sync_control IgnoreExtension WGL_NV_gpu_affinity +IgnoreExtension WGL_EXT_make_current_read +RenameExtensionIntoCore WGL_ARB_make_current_read + CustomJavaCode WGLExt public boolean isFunctionAvailable(String glFunctionName); CustomJavaCode WGLExt public boolean isExtensionAvailable(String glExtensionName); diff --git a/make/config/nativewindow/jawt-CustomJavaCode.java b/make/config/nativewindow/jawt-CustomJavaCode.java index 87d08241b..3223a74b1 100755 --- a/make/config/nativewindow/jawt-CustomJavaCode.java +++ b/make/config/nativewindow/jawt-CustomJavaCode.java @@ -5,7 +5,7 @@ public static JAWT getJAWT() { if (jawt == null) { synchronized (JAWT.class) { if (jawt == null) { - JAWTUtil.init(); + JAWTUtil.initSingleton(); // Workaround for 4845371. // Make sure the first reference to the JNI GetDirectBufferAddress is done // from a privileged context so the VM's internal class lookups will succeed. diff --git a/make/config/nativewindow/x11-CustomJavaCode.java b/make/config/nativewindow/x11-CustomJavaCode.java index 6b5831215..41f726916 100644 --- a/make/config/nativewindow/x11-CustomJavaCode.java +++ b/make/config/nativewindow/x11-CustomJavaCode.java @@ -3,12 +3,12 @@ } /** Interface to C language function: <br> <code> XVisualInfo * XGetVisualInfo(Display * , long, XVisualInfo * , int * ); </code> */ - public static XVisualInfo[] XGetVisualInfoCopied(long arg0, long arg1, XVisualInfo arg2, int[] arg3, int arg3_offset) + public static XVisualInfo[] XGetVisualInfo(long arg0, long arg1, XVisualInfo arg2, int[] arg3, int arg3_offset) { if(arg3 != null && arg3.length <= arg3_offset) throw new RuntimeException("array offset argument \"arg3_offset\" (" + arg3_offset + ") equals or exceeds array length (" + arg3.length + ")"); java.nio.ByteBuffer _res; - _res = XGetVisualInfoCopied1(arg0, arg1, ((arg2 == null) ? null : arg2.getBuffer()), arg3, Buffers.SIZEOF_INT * arg3_offset); + _res = XGetVisualInfo1(arg0, arg1, ((arg2 == null) ? null : arg2.getBuffer()), arg3, Buffers.SIZEOF_INT * arg3_offset); if (_res == null) return null; Buffers.nativeOrder(_res); @@ -25,16 +25,13 @@ } /** Entry point to C language function: <code> XVisualInfo * XGetVisualInfo(Display * , long, XVisualInfo * , int * ); </code> */ - private static native java.nio.ByteBuffer XGetVisualInfoCopied1(long arg0, long arg1, java.nio.ByteBuffer arg2, Object arg3, int arg3_byte_offset); + private static native java.nio.ByteBuffer XGetVisualInfo1(long arg0, long arg1, java.nio.ByteBuffer arg2, Object arg3, int arg3_byte_offset); public static native long DefaultVisualID(long display, int screen); public static native long CreateDummyWindow(long display, int screen_index, long visualID); public static native void DestroyDummyWindow(long display, long window); - public static native long dlopen(String name); - public static native long dlsym(String name); - public static native int XCloseDisplay(long display); public static native void XUnlockDisplay(long display); public static native void XLockDisplay(long display); diff --git a/make/jogl.compiler.xml b/make/jogl.compiler.xml index 1033a2851..413920e97 100644 --- a/make/jogl.compiler.xml +++ b/make/jogl.compiler.xml @@ -8,7 +8,6 @@ <linker id="linker.cfg.linux.jogl.gl2" extends="linker.cfg.linux.jogl.x11"> <syslibset dir="/devtools/i686-unknown-linux-gnu/xfree86-4.3.0-linux-ix86-glibc23/lib" libs="GL"/> - <syslibset dir="${x11.cg.lib}" libs="Cg, CgGL" if="c.compiler.use-cglib"/> </linker> </target> </project> diff --git a/make/jogl.properties b/make/jogl.properties index 1a123d7dc..7945cecc5 100644 --- a/make/jogl.properties +++ b/make/jogl.properties @@ -9,14 +9,3 @@ # home directory alongside this file and that copy also modified appropriately. # See that file for additional properties required by the build. # - -# -# If you are building the Cg binding (by specifying -Djogl.cg=1 to the -# Ant build) and have installed the Cg SDK in somewhere other than the -# default location, modify the appropriate variable to point to the -# absolute path of the lib directory -# -windows.cg.lib32=C:/Cg-2.2/bin -windows.cg.lib64=C:/Cg-2.2/bin.x64 -x11.cg.lib32=/usr/lib32 -x11.cg.lib64=/usr/lib64 diff --git a/make/nativewindow.compiler.xml b/make/nativewindow.compiler.xml index b60f9c707..21fd52eac 100644 --- a/make/nativewindow.compiler.xml +++ b/make/nativewindow.compiler.xml @@ -8,7 +8,6 @@ <linker id="linker.cfg.linux.nwi.gl2" extends="linker.cfg.linux.nwi.x11"> <syslibset dir="/devtools/i686-unknown-linux-gnu/xfree86-4.3.0-linux-ix86-glibc23/lib" libs="GL"/> - <syslibset dir="${x11.cg.lib}" libs="Cg, CgGL" if="c.compiler.use-cglib"/> </linker> </target> </project> diff --git a/make/newt.compiler.xml b/make/newt.compiler.xml index 973ef9654..ab405153b 100644 --- a/make/newt.compiler.xml +++ b/make/newt.compiler.xml @@ -8,7 +8,6 @@ <linker id="linker.cfg.linux.newt.gl2" extends="linker.cfg.linux.newt.x11"> <syslibset dir="/devtools/i686-unknown-linux-gnu/xfree86-4.3.0-linux-ix86-glibc23/lib" libs="GL"/> - <syslibset dir="${x11.cg.lib}" libs="Cg, CgGL" if="c.compiler.use-cglib"/> </linker> </target> </project> diff --git a/make/scripts/java-run-all.sh b/make/scripts/java-run-all.sh index 5f6cff28a..0188ae5d2 100755 --- a/make/scripts/java-run-all.sh +++ b/make/scripts/java-run-all.sh @@ -17,6 +17,11 @@ if [ "$1" = "-libdir" ] ; then shift LD_LIBRARY_PATH=$PRELIB:$LD_LIBRARY_PATH export LD_LIBRARY_PATH + # Mesa/Gallium EGL driver + EGL_DRIVER=$PRELIB/egl_glx.so + export EGL_DRIVER + # unset DRI/ATI .. + unset LIBGL_DRIVERS_PATH fi if [ -z "$1" ] ; then @@ -31,18 +36,27 @@ shift MOSX=0 uname -a | grep -i Darwin && MOSX=1 -# D_ARGS="-Dgluegen.debug.ProcAddressHelper=true -Dgluegen.debug.NativeLibrary=true -Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all" +# D_ARGS="-Djogamp.debug.ProcAddressHelper=true -Djogamp.debug.NativeLibrary=true -Djogl.debug=all" +# D_ARGS="-Djogamp.debug.ProcAddressHelper=true -Djogamp.debug.NativeLibrary=true -Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all" # D_ARGS="-Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all -Djogl.debug.GLSLState" # D_ARGS="-Dnativewindow.debug.X11Util=true -Djogl.debug.GLDrawableFactory=true" # D_ARGS="-Dnativewindow.debug.X11Util=true" # D_ARGS="-Dnewt.debug=all -Dnativewindow.debug=all" +# D_ARGS="-Djogl.debug=all -Dnewt.debug=all -Dnativewindow.debug=all" # D_ARGS="-Dnewt.debug=all" # D_ARGS="-Dnewt.debug.Window" # D_ARGS="-Dnewt.debug.Display" +# D_ARGS="-Djogl.debug=all -Djogl.debug.DynamicLookup=true -Djogamp.debug.NativeLibrary=true" # D_ARGS="-Djogl.debug=all" +# D_ARGS="-Djogamp.debug.JNILibLoader=true -Djogamp.debug.NativeLibrary=true -Djogamp.debug.NativeLibrary.Lookup=true -Djogl.debug.GLProfile=true" rm -f java-run.log +# export LIBGL_DRIVERS_PATH=/usr/lib/fglrx/dri:/usr/lib32/fglrx/dri +# export LIBGL_DEBUG=verbose echo LIBXCB_ALLOW_SLOPPY_LOCK: $LIBXCB_ALLOW_SLOPPY_LOCK 2>&1 | tee -a java-run.log +echo LIBGL_DRIVERS_PATH: $LIBGL_DRIVERS_PATH 2>&1 | tee -a java-run.log +echo LIBGL_DEBUG: $LIBGL_DEBUG 2>&1 | tee -a java-run.log echo java $X_ARGS $D_ARGS $* 2>&1 | tee -a java-run.log java $X_ARGS $D_ARGS $* 2>&1 | tee -a java-run.log + diff --git a/make/scripts/java-run-newt.sh b/make/scripts/java-run-newt.sh index 796e22da4..9fbe4e583 100755 --- a/make/scripts/java-run-newt.sh +++ b/make/scripts/java-run-newt.sh @@ -38,7 +38,8 @@ fi # D_ARGS="-Dgluegen.debug.ProcAddressHelper=true -Dgluegen.debug.NativeLibrary=true -Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all" # D_ARGS="-Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all -Djogl.debug.GLSLState" # D_ARGS="-Dnativewindow.debug.X11Util=true -Djogl.debug.GLDrawableFactory=true" -# D_ARGS="-Dnativewindow.debug.X11Util=true" +# D_ARGS="-Dnativewindow.debug.X11Util=true -Dnewt.debug.Display=true" # D_ARGS="-Dnewt.debug=all" +# D_ARGS="-Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all" java $X_ARGS -Djava.awt.headless=true $D_ARGS com.jogamp.newt.util.MainThread $* 2>&1 | tee java-run-newt.log diff --git a/make/scripts/make.jogl.all.linux-x86.sh b/make/scripts/make.jogl.all.linux-x86.sh index 5b443f5d3..76b46a03b 100644 --- a/make/scripts/make.jogl.all.linux-x86.sh +++ b/make/scripts/make.jogl.all.linux-x86.sh @@ -28,7 +28,7 @@ if [ "$1" = "-libdir" ] ; then fi -# -Djogl.cg=1 -Dx11.cg.lib=../../lib-linux-x86_64 +# -Djogl.cg=1 # -Dc.compiler.debug=true # -DuseOpenMAX=true \ # -Dbuild.noarchives=true @@ -37,16 +37,29 @@ fi # -DisLinux=true \ # -DisLinuxX86=true \ # -DisX11=true \ -# -Djogl.cg=1 -Dx11.cg.lib=../../lib-linux-x86 \ +# -Djogl.cg=1 \ + +#LD_LIBRARY_PATH=/opt-linux-x86_64/mesa-7.8.1/lib64 +#export LD_LIBRARY_PATH + +LOGF=make.jogl.all.linux-x86.log +rm -f $LOGF + +# export LIBGL_DRIVERS_PATH=/usr/lib/fglrx/dri:/usr/lib32/fglrx/dri +# export LIBGL_DEBUG=verbose +echo LIBXCB_ALLOW_SLOPPY_LOCK: $LIBXCB_ALLOW_SLOPPY_LOCK 2>&1 | tee -a $LOGF +echo LIBGL_DRIVERS_PATH: $LIBGL_DRIVERS_PATH 2>&1 | tee -a $LOGF +echo LIBGL_DEBUG: $LIBGL_DEBUG 2>&1 | tee -a $LOGF ant \ $CUSTOMLIBDIR \ -Dbuild.noarchives=true \ -Dgluegen-cpptasks.file=`pwd`/../../gluegen/make/lib/gluegen-cpptasks-linux-32bit.xml \ -Dbuild.noarchives=true \ - -Djogl.cg=1 -Dx11.cg.lib=../../lib-linux-x86 \ + -Djogl.cg=1 \ -Drootrel.build=build-x86 \ -Dos.arch=x86 \ -DuseKD=true \ -DuseOpenMAX=true \ - $* 2>&1 | tee make.jogl.all.linux-x86.log + $* 2>&1 | tee -a $LOGF + diff --git a/make/scripts/make.jogl.all.linux-x86_64.sh b/make/scripts/make.jogl.all.linux-x86_64.sh index b17cd2f15..220848693 100644 --- a/make/scripts/make.jogl.all.linux-x86_64.sh +++ b/make/scripts/make.jogl.all.linux-x86_64.sh @@ -27,7 +27,7 @@ if [ "$1" = "-libdir" ] ; then shift fi -# -Djogl.cg=1 -Dx11.cg.lib=../../lib-linux-x86_64 +# -Djogl.cg=1 # -Dc.compiler.debug=true \ # -Dbuild.noarchives=true \ @@ -41,11 +41,21 @@ fi #LD_LIBRARY_PATH=/opt-linux-x86_64/mesa-7.8.1/lib64 #export LD_LIBRARY_PATH +LOGF=make.jogl.all.linux-x86_64.log +rm -f $LOGF + +# export LIBGL_DRIVERS_PATH=/usr/lib/fglrx/dri:/usr/lib32/fglrx/dri +# export LIBGL_DEBUG=verbose +echo LIBXCB_ALLOW_SLOPPY_LOCK: $LIBXCB_ALLOW_SLOPPY_LOCK 2>&1 | tee -a $LOGF +echo LIBGL_DRIVERS_PATH: $LIBGL_DRIVERS_PATH 2>&1 | tee -a $LOGF +echo LIBGL_DEBUG: $LIBGL_DEBUG 2>&1 | tee -a $LOGF + ant \ $CUSTOMLIBDIR \ -Dbuild.noarchives=true \ - -Djogl.cg=1 -Dx11.cg.lib=../../lib-linux-x86_64 \ + -Djogl.cg=1 \ -Drootrel.build=build-x86_64 \ -DuseKD=true \ -DuseOpenMAX=true \ - $* 2>&1 | tee make.jogl.all.linux-x86_64.log + $* 2>&1 | tee -a $LOGF + diff --git a/make/scripts/make.jogl.all.win32.bat b/make/scripts/make.jogl.all.win32.bat index cea1317a5..528e153aa 100644 --- a/make/scripts/make.jogl.all.win32.bat +++ b/make/scripts/make.jogl.all.win32.bat @@ -11,7 +11,7 @@ set CLASSPATH=.;%THISDIR%\build-win32\classes REM -Dc.compiler.debug=true
REM -DuseOpenMAX=true
REM -DuseKD=true
-REM -Djogl.cg=1 -D-Dwindows.cg.lib=C:\Cg-2.2
+REM -Djogl.cg=1
REM -Dbuild.noarchives=true
-ant -Dbuild.noarchives=true -Drootrel.build=build-win32 -Djogl.cg=1 -Dwindows.cg.lib=C:\Cg-2.2\bin %1 %2 %3 %4 %5 %6 %7 %8 %9 > make.jogl.all.win32.log 2>&1
+ant -Dbuild.noarchives=true -Drootrel.build=build-win32 -Djogl.cg=1 %1 %2 %3 %4 %5 %6 %7 %8 %9 > make.jogl.all.win32.log 2>&1
diff --git a/make/scripts/make.jogl.all.win64.bat b/make/scripts/make.jogl.all.win64.bat index 5ce53e4a1..b8d8cc662 100644 --- a/make/scripts/make.jogl.all.win64.bat +++ b/make/scripts/make.jogl.all.win64.bat @@ -11,7 +11,7 @@ set CLASSPATH=.;%THISDIR%\build-win64\classes REM -Dc.compiler.debug=true
REM -DuseOpenMAX=true
REM -DuseKD=true
-REM -Djogl.cg=1 -D-Dwindows.cg.lib=C:\Cg-2.2
+REM -Djogl.cg=1
REM -Dbuild.noarchives=true
-ant -Dbuild.noarchives=true -Drootrel.build=build-win64 -Djogl.cg=1 -Dwindows.cg.lib=C:\Cg-2.2\bin.x64 %1 %2 %3 %4 %5 %6 %7 %8 %9 > make.jogl.all.win64.log 2>&1
+ant -Dbuild.noarchives=true -Drootrel.build=build-win64 -Djogl.cg=1 %1 %2 %3 %4 %5 %6 %7 %8 %9 > make.jogl.all.win64.log 2>&1
diff --git a/make/stub_includes/egl/window-system.c b/make/stub_includes/egl/window-system1.c index fbd0f0cde..fbd0f0cde 100755 --- a/make/stub_includes/egl/window-system.c +++ b/make/stub_includes/egl/window-system1.c diff --git a/make/stub_includes/macosx/window-system.c b/make/stub_includes/macosx/window-system1.c index 787d265ed..787d265ed 100644 --- a/make/stub_includes/macosx/window-system.c +++ b/make/stub_includes/macosx/window-system1.c diff --git a/make/stub_includes/win32/window-system.c b/make/stub_includes/win32/window-system0.c index c5c5d37b9..c5c5d37b9 100644 --- a/make/stub_includes/win32/window-system.c +++ b/make/stub_includes/win32/window-system0.c diff --git a/make/stub_includes/win32/window-system1.c b/make/stub_includes/win32/window-system1.c new file mode 100644 index 000000000..f74488c63 --- /dev/null +++ b/make/stub_includes/win32/window-system1.c @@ -0,0 +1,2 @@ +#include <windows.h> +#include <winwgl.h> diff --git a/make/stub_includes/win32/windows.h b/make/stub_includes/win32/windows.h index 647a5733d..20d424a79 100644 --- a/make/stub_includes/win32/windows.h +++ b/make/stub_includes/win32/windows.h @@ -34,14 +34,6 @@ typedef unsigned int UINT; typedef unsigned short USHORT; typedef unsigned short WORD; -typedef struct tagRECT - { - LONG left; - LONG top; - LONG right; - LONG bottom; - } RECT; - /* Necessary handle typedefs for parsing wglext.h */ typedef HANDLE HPBUFFERARB; diff --git a/make/stub_includes/win32/wingdi.h b/make/stub_includes/win32/wingdi.h index fbf2ec5ec..4a034e81c 100644 --- a/make/stub_includes/win32/wingdi.h +++ b/make/stub_includes/win32/wingdi.h @@ -8,6 +8,15 @@ #ifndef WGL_GDI_VERSION_1_X +/** +typedef struct tagRECT + { + LONG left; + LONG top; + LONG right; + LONG bottom; + } RECT; */ + typedef struct tagRGBQUAD { BYTE rgbBlue; BYTE rgbGreen; @@ -85,37 +94,6 @@ typedef struct tagPIXELFORMATDESCRIPTOR #define PFD_MAIN_PLANE 0 #define PFD_OVERLAY_PLANE 1 #define PFD_UNDERLAY_PLANE (-1) -#define WGL_SWAP_MAIN_PLANE 1 -#define WGL_SWAP_OVERLAY1 2 -#define WGL_SWAP_OVERLAY2 4 -#define WGL_SWAP_OVERLAY3 8 -#define WGL_SWAP_OVERLAY4 16 -#define WGL_SWAP_OVERLAY5 32 -#define WGL_SWAP_OVERLAY6 64 -#define WGL_SWAP_OVERLAY7 128 -#define WGL_SWAP_OVERLAY8 256 -#define WGL_SWAP_OVERLAY9 512 -#define WGL_SWAP_OVERLAY10 1024 -#define WGL_SWAP_OVERLAY11 2048 -#define WGL_SWAP_OVERLAY12 4096 -#define WGL_SWAP_OVERLAY13 8192 -#define WGL_SWAP_OVERLAY14 16384 -#define WGL_SWAP_OVERLAY15 32768 -#define WGL_SWAP_UNDERLAY1 65536 -#define WGL_SWAP_UNDERLAY2 0x20000 -#define WGL_SWAP_UNDERLAY3 0x40000 -#define WGL_SWAP_UNDERLAY4 0x80000 -#define WGL_SWAP_UNDERLAY5 0x100000 -#define WGL_SWAP_UNDERLAY6 0x200000 -#define WGL_SWAP_UNDERLAY7 0x400000 -#define WGL_SWAP_UNDERLAY8 0x800000 -#define WGL_SWAP_UNDERLAY9 0x1000000 -#define WGL_SWAP_UNDERLAY10 0x2000000 -#define WGL_SWAP_UNDERLAY11 0x4000000 -#define WGL_SWAP_UNDERLAY12 0x8000000 -#define WGL_SWAP_UNDERLAY13 0x10000000 -#define WGL_SWAP_UNDERLAY14 0x20000000 -#define WGL_SWAP_UNDERLAY15 0x40000000 /* PIXELFORMATDESCRIPTOR flags */ #define PFD_DOUBLEBUFFER 0x00000001 @@ -172,24 +150,13 @@ typedef struct tagPIXELFORMATDESCRIPTOR // Windows routines WINBASEAPI DWORD WINAPI GetLastError(VOID); -WINBASEAPI HMODULE WINAPI LoadLibraryA(LPCSTR lpLibFileName); -WINBASEAPI PROC WINAPI GetProcAddress(HMODULE hModule, LPCSTR lpProcName); // OpenGL-related routines WINGDIAPI int WINAPI ChoosePixelFormat(HDC, CONST PIXELFORMATDESCRIPTOR *); WINGDIAPI int WINAPI DescribePixelFormat(HDC, int, UINT, LPPIXELFORMATDESCRIPTOR); WINGDIAPI int WINAPI GetPixelFormat(HDC); WINGDIAPI BOOL WINAPI SetPixelFormat(HDC, int, CONST PIXELFORMATDESCRIPTOR *); -WINGDIAPI BOOL WINAPI wglCopyContext(HGLRC, HGLRC, UINT); -WINGDIAPI HGLRC WINAPI wglCreateContext(HDC); -WINGDIAPI BOOL WINAPI wglDeleteContext(HGLRC); -WINGDIAPI HGLRC WINAPI wglGetCurrentContext(VOID); -WINGDIAPI HDC WINAPI wglGetCurrentDC(VOID); -WINGDIAPI BOOL WINAPI wglMakeCurrent(HDC, HGLRC); -WINGDIAPI BOOL WINAPI wglShareLists(HGLRC, HGLRC); WINGDIAPI BOOL WINAPI SwapBuffers(HDC); -WINGDIAPI PROC WINAPI wglGetProcAddress(LPCSTR); -WINGDIAPI BOOL WINAPI wglSwapLayerBuffers(HDC,UINT); /* --- FIXME: need to handle these entry points! WINGDIAPI HGLRC WINAPI wglCreateLayerContext(HDC, int); @@ -223,3 +190,4 @@ WINGDIAPI BOOL WINAPI GetDeviceGammaRamp(HDC,LPVOID); WINGDIAPI BOOL WINAPI SetDeviceGammaRamp(HDC,LPVOID); #endif /* WGL_GDI_VERSION_1_X */ + diff --git a/make/stub_includes/win32/winwgl.h b/make/stub_includes/win32/winwgl.h new file mode 100644 index 000000000..27b43f915 --- /dev/null +++ b/make/stub_includes/win32/winwgl.h @@ -0,0 +1,72 @@ +/* + * Essential wgl and supporting routines and data structures extracted + * from WINGDI.H. + * + * Copyright (c) 1985-1997, Microsoft Corp. All rights reserved. + * + */ + +#ifndef WGL_GDI_VERSION_1_X + +/* layer types */ +#define WGL_SWAP_MAIN_PLANE 1 +#define WGL_SWAP_OVERLAY1 2 +#define WGL_SWAP_OVERLAY2 4 +#define WGL_SWAP_OVERLAY3 8 +#define WGL_SWAP_OVERLAY4 16 +#define WGL_SWAP_OVERLAY5 32 +#define WGL_SWAP_OVERLAY6 64 +#define WGL_SWAP_OVERLAY7 128 +#define WGL_SWAP_OVERLAY8 256 +#define WGL_SWAP_OVERLAY9 512 +#define WGL_SWAP_OVERLAY10 1024 +#define WGL_SWAP_OVERLAY11 2048 +#define WGL_SWAP_OVERLAY12 4096 +#define WGL_SWAP_OVERLAY13 8192 +#define WGL_SWAP_OVERLAY14 16384 +#define WGL_SWAP_OVERLAY15 32768 +#define WGL_SWAP_UNDERLAY1 65536 +#define WGL_SWAP_UNDERLAY2 0x20000 +#define WGL_SWAP_UNDERLAY3 0x40000 +#define WGL_SWAP_UNDERLAY4 0x80000 +#define WGL_SWAP_UNDERLAY5 0x100000 +#define WGL_SWAP_UNDERLAY6 0x200000 +#define WGL_SWAP_UNDERLAY7 0x400000 +#define WGL_SWAP_UNDERLAY8 0x800000 +#define WGL_SWAP_UNDERLAY9 0x1000000 +#define WGL_SWAP_UNDERLAY10 0x2000000 +#define WGL_SWAP_UNDERLAY11 0x4000000 +#define WGL_SWAP_UNDERLAY12 0x8000000 +#define WGL_SWAP_UNDERLAY13 0x10000000 +#define WGL_SWAP_UNDERLAY14 0x20000000 +#define WGL_SWAP_UNDERLAY15 0x40000000 + +#endif /* WGL_GDI_VERSION_1_X */ + +#ifndef WGL_GDI_VERSION_1_X +#define WGL_GDI_VERSION_1_X + +// OpenGL-related routines +WINGDIAPI BOOL WINAPI wglCopyContext(HGLRC, HGLRC, UINT); +WINGDIAPI HGLRC WINAPI wglCreateContext(HDC); +WINGDIAPI BOOL WINAPI wglDeleteContext(HGLRC); +WINGDIAPI HGLRC WINAPI wglGetCurrentContext(VOID); +WINGDIAPI HDC WINAPI wglGetCurrentDC(VOID); +WINGDIAPI BOOL WINAPI wglMakeCurrent(HDC, HGLRC); +WINGDIAPI BOOL WINAPI wglShareLists(HGLRC, HGLRC); +WINGDIAPI PROC WINAPI wglGetProcAddress(LPCSTR); +WINGDIAPI BOOL WINAPI wglSwapLayerBuffers(HDC,UINT); + +/* --- FIXME: need to handle these entry points! +WINGDIAPI HGLRC WINAPI wglCreateLayerContext(HDC, int); +WINGDIAPI BOOL WINAPI wglUseFontBitmapsA(HDC, DWORD, DWORD, DWORD); +WINGDIAPI BOOL WINAPI wglUseFontBitmapsW(HDC, DWORD, DWORD, DWORD); +#ifdef UNICODE +#define wglUseFontBitmaps wglUseFontBitmapsW +#else +#define wglUseFontBitmaps wglUseFontBitmapsA +#endif // !UNICODE +*/ + +#endif /* WGL_GDI_VERSION_1_X */ + diff --git a/make/stub_includes/x11/window-system.c b/make/stub_includes/x11/window-system1.c index e718aee97..e718aee97 100644 --- a/make/stub_includes/x11/window-system.c +++ b/make/stub_includes/x11/window-system1.c |