diff options
15 files changed, 256 insertions, 491 deletions
diff --git a/make/build-jogl.xml b/make/build-jogl.xml index 1db63812e..760200398 100644 --- a/make/build-jogl.xml +++ b/make/build-jogl.xml @@ -104,6 +104,9 @@ <property name="java.part.cgl" value="com/jogamp/opengl/impl/macosx/cgl/*"/> + <property name="java.part.gl2es12" + value="com/jogamp/opengl/impl/gl2es12/**"/> + <property name="java.part.gldesktop" value="com/jogamp/opengl/impl/**/gl2/** com/jogamp/opengl/impl/**/gl3/** com/jogamp/opengl/impl/**/gl4/**"/> @@ -517,6 +520,18 @@ </gluegen> </target> + <target name="java.generate.gl2es12"> + <echo message="Generating GL2ES12 implementation" /> + <antcall target="java.generate.copy2temp" inheritRefs="true" /> + <gluegen src="${stub.includes.opengl}/gl2es12.c" + outputRootDir="${build.jogl}" + config="${config.jogl}/gl-gl2es12.cfg" + includeRefid="stub.includes.fileset.all.gldesktop" + emitter="com.sun.gluegen.opengl.GLEmitter"> + <classpath refid="gluegen.classpath" /> + </gluegen> + </target> + <target name="java.generate.gles1"> <echo message="Generating GLES1 interface and implementation" /> <antcall target="java.generate.copy2temp" inheritRefs="true" /> @@ -541,7 +556,7 @@ </gluegen> </target> - <target name="java.generate.gl.all" depends="java.generate.gl_if, java.generate.gl2_es1_if, java.generate.gl2_es2_if, java.generate.gl2_gl3_if, java.generate.gl2, java.generate.gl3, java.generate.gl3bc, java.generate.gl4, java.generate.gl4bc, java.generate.gles1, java.generate.gles2"/> + <target name="java.generate.gl.all" depends="java.generate.gl_if, java.generate.gl2_es1_if, java.generate.gl2_es2_if, java.generate.gl2_gl3_if, java.generate.gl2, java.generate.gl3, java.generate.gl3bc, java.generate.gl4, java.generate.gl4bc, java.generate.gl2es12, java.generate.gles1, java.generate.gles2"/> <!-- target name="java.generate.gl.nsig" if="gluegen.nsig"> <echo message="Generating GL interface and implementation" /> @@ -778,6 +793,21 @@ </target> + <target name="java.generate.composable.pipeline.check.gl2es12"> + <!-- Blow away the DebugGL*.java and TraceGL*.java sources if GL*.class has changed + (the uptodate element doesn't support arbitrary source and destination files) --> + <dependset> + <srcfilelist dir="${classes}/javax/media/opengl" files="GL2ES12.class" /> + <targetfileset dir="${src.generated.java}/javax/media/opengl" + includes="DebugGL2ES12.java,TraceGL2ES12.java" /> + </dependset> + + <!-- Now choose one of the two to test to see if we have to regenerate --> + <uptodate property="java.generate.composable.pipeline.skip.gl2es12" + srcfile="${classes}/javax/media/opengl/GL2ES12.class" + targetfile="${src.generated.java}/javax/media/opengl/DebugGL2ES12.java" /> + </target> + <target name="java.generate.composable.pipeline.check.gl2"> <!-- Blow away the DebugGL*.java and TraceGL*.java sources if GL*.class has changed (the uptodate element doesn't support arbitrary source and destination files) --> @@ -1286,6 +1316,22 @@ <include name="${rootrel.generated.c.jogl}/Windows/WGL*.c" if="isWindows"/> </patternset> + <patternset id="c.src.files.jogl.gl2es12"> + <include name="${rootrel.src.c}/macosx/MacOSXCustomCGLCode.c" if="isOSX"/> + <include name="${rootrel.src.c}/macosx/MacOSXWindowSystemInterface.m" if="isOSX"/> + <include name="${rootrel.src.c}/macosx/ContextUpdater.m" if="isOSX"/> + <include name="${rootrel.src.c}/GLXGetProcAddressARB.c" if="isX11"/> + <include name="${rootrel.src.c.openmax}/omx_tool.c" if="useOpenMAX"/> + <include name="${rootrel.src.c.openmax}/com_jogamp_openmax_OMXInstance.c" if="useOpenMAX"/> + + <include name="${rootrel.generated.c.jogl}/gl2es12/GL2ES12Impl_JNI.c"/> + <!--include name="${rootrel.generated.c.jogl}/GLU_JNI.c"/ EMPTY --> + <!--include name="${rootrel.generated.c.jogl}/gl2es12/GLUgl2es12_JNI.c"/ SKIPPED --> + <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/WGL*.c" if="isWindows"/> + </patternset> + <patternset id="c.src.files.jogl.es2"> <include name="${rootrel.src.c}/GLXGetProcAddressARB.c" if="isX11"/> <include name="${rootrel.src.c.openmax}/omx_tool.c" if="useOpenMAX"/> @@ -1392,6 +1438,13 @@ linker.cfg.id="${linker.cfg.id.gl2}"/> </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}"/> + </target> + <target name="c.build.jogl.es2"> <c.build c.compiler.src.files="c.src.files.jogl.es2" output.lib.name="jogl_es2" @@ -1421,11 +1474,12 @@ <!-- exec mt, the Microsoft Manifest Tool, to include DLL manifests in order to resolve the location of msvcr80.dll --> <msvc.manifest objdir="${obj.jogl}" dllname="jogl_es1" /> <msvc.manifest objdir="${obj.jogl}" dllname="jogl_es2" /> + <msvc.manifest objdir="${obj.jogl}" dllname="jogl_gl2es12" /> <msvc.manifest objdir="${obj.jogl}" dllname="jogl_desktop" /> <antcall target="c.manifest.cg" inheritRefs="true" /> </target> - <target name="c.build.jogl" depends="c.configure,c.build.jogl.prepare,c.build.jogl.desktop,c.build.jogl.es2,c.build.jogl.es1,c.build.jogl.cg"> + <target name="c.build.jogl" depends="c.configure,c.build.jogl.prepare,c.build.jogl.gl2es12,c.build.jogl.desktop,c.build.jogl.es2,c.build.jogl.es1,c.build.jogl.cg"> <antcall target="gluegen.cpptasks.striplibs" inheritRefs="true"> <param name="libdir" value="${obj.jogl}"/> </antcall> @@ -1441,6 +1495,7 @@ <fileset dir="${obj.jogl}"> <include name="*_es1.${native.library.suffix-cdc}" /> <include name="*_es2.${native.library.suffix-cdc}" /> + <include name="*_gl2es12.${native.library.suffix-cdc}" /> </fileset> </jar> </target> @@ -1556,7 +1611,15 @@ </jar> </target> - <target name="build-jars-es-cdc" depends="setup-manifestfile-cdc" unless="setup.noCDC"> + <target name="build-jars-es-desktop-cdc" depends="setup-manifestfile-cdc,build-jars-os-desktop-cdc" unless="setup.nodesktop"> + <jar manifest="${build.jogl}/tempversion-cdc" destfile="${jogl.gl2es12.cdc.jar}" filesonly="true"> + <fileset dir="${classes-cdc}" + includes="${java.part.gl2es12}, ${java.part.openmax}" + excludes="${java.part.glugldesktop}"/> + </jar> + </target> + + <target name="build-jars-es-cdc" depends="setup-manifestfile-cdc, build-jars-es-desktop-cdc" unless="setup.noCDC"> <jar manifest="${build.jogl}/tempversion-cdc" destfile="${jogl.egl.cdc.jar}" filesonly="true"> <fileset dir="${classes-cdc}" includes="${java.part.egl}" @@ -1602,6 +1665,7 @@ <include name="${java.part.openmax}" /> <!-- FIXME: this is temporary until we move these classes to another workspace --> <include name="com/jogamp/**" /> + <exclude name="${java.part.gl2es12}"/> </fileset> <fileset dir="${src.java}" includes="${java.part.util.fixedfuncemu.shadercode}"/> @@ -1611,7 +1675,7 @@ <jar manifest="${build.jogl}/tempversion" destfile="${jogl.all-noawt.jar}" filesonly="true"> <fileset dir="${classes}" includes="javax/media/opengl/** com/jogamp/gluegen/runtime/** com/jogamp/opengl/** ${java.part.openmax} com/jogamp/**" - excludes="${java.part.awt} ${java.part.util.awt}"> + excludes="${java.part.awt} ${java.part.util.awt} ${java.part.gl2es12}"> </fileset> <fileset dir="${src.java}" includes="${java.part.util.fixedfuncemu.shadercode}"/> @@ -1620,7 +1684,7 @@ <target name="build-jars-all-cdc" depends="setup-manifestfile"> <jar manifest="${build.jogl}/tempversion-cdc" destfile="${jogl.all.cdc.jar}" filesonly="true"> <fileset dir="${classes-cdc}" - includes="${java.part.core} ${java.part.egl} ${java.part.glutess} ${java.part.glumipmap} ${java.part.openmax} ${java.part.sdk} ${java.part.glx} ${java.part.cgl} ${java.part.wgl} ${java.part.es1} ${java.part.es1.dbg} ${java.part.es2} ${java.part.es2.dbg} ${java.part.util} ${java.part.util.glsl} ${java.part.util.fixedfuncemu}" + includes="${java.part.core} ${java.part.egl} ${java.part.glutess} ${java.part.glumipmap} ${java.part.openmax} ${java.part.sdk} ${java.part.glx} ${java.part.cgl} ${java.part.wgl} ${java.part.es1} ${java.part.es1.dbg} ${java.part.es2} ${java.part.es2.dbg} ${java.part.gl2es12} ${java.part.util} ${java.part.util.glsl} ${java.part.util.fixedfuncemu}" excludes="${java.excludes.cdcfp}"/> <fileset dir="${src.java}" includes="${java.part.util.fixedfuncemu.shadercode}"/> @@ -1660,7 +1724,11 @@ <jar manifest="${build.jogl}/tempversion" destfile="${jogl.gldesktop.jar}" filesonly="true"> <fileset dir="${classes}" includes="${java.part.gldesktop}, ${java.part.openmax}" - excludes="${java.part.gldesktop.dbg}, ${java.part.glugldesktop}"/> + excludes="${java.part.gldesktop.dbg}, ${java.part.glugldesktop}, ${java.part.gl2es12}"/> + </jar> + <jar manifest="${build.jogl}/tempversion" destfile="${jogl.gl2es12.jar}" filesonly="true"> + <fileset dir="${classes}" includes="${java.part.gl2es12}, ${java.part.openmax}" + excludes="${java.part.glugldesktop}"/> </jar> <!-- misc --> diff --git a/make/config/jogl/obsolete/gl-gl2es12.cfg b/make/config/jogl/gl-gl2es12.cfg index 3942b1419..3942b1419 100644 --- a/make/config/jogl/obsolete/gl-gl2es12.cfg +++ b/make/config/jogl/gl-gl2es12.cfg diff --git a/make/config/jogl/obsolete/gl-impl-CustomCCode-gl2es12.c b/make/config/jogl/gl-impl-CustomCCode-gl2es12.c index 07b821802..07b821802 100644 --- a/make/config/jogl/obsolete/gl-impl-CustomCCode-gl2es12.c +++ b/make/config/jogl/gl-impl-CustomCCode-gl2es12.c diff --git a/make/config/jogl/obsolete/gl-impl-CustomJavaCode-gl2es12.java b/make/config/jogl/gl-impl-CustomJavaCode-gl2es12.java index aed442da3..4bc39b076 100644 --- a/make/config/jogl/obsolete/gl-impl-CustomJavaCode-gl2es12.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-gl2es12.java @@ -26,37 +26,98 @@ public GL2ES12Impl(GLProfile glp, GLContextImpl context) { private boolean isGL2ES2; -public boolean isFunctionAvailable(String glFunctionName) { - return _context.isFunctionAvailable(glFunctionName); +public final boolean isGL4bc() { + return false; +} + +public final boolean isGL4() { + return false; +} + +public final boolean isGL3bc() { + return false; +} + +public final boolean isGL3() { + return false; +} + +public final boolean isGL2() { + return false; +} + +public final boolean isGLES1() { + return false; +} + +public final boolean isGLES2() { + return false; +} + +public final boolean isGLES() { + return false; +} + +public final boolean isGL2ES1() { + return !isGL2ES2; +} + +public final boolean isGL2ES2() { + return isGL2ES2; +} + +public final boolean isGL2GL3() { + return false; +} + +public final boolean hasGLSL() { + return isGL2ES2; +} + +public final GL4bc getGL4bc() throws GLException { + throw new GLException("Not a GL4bc implementation"); +} + +public final GL4 getGL4() throws GLException { + throw new GLException("Not a GL4 implementation"); } -public boolean isExtensionAvailable(String glExtensionName) { - return _context.isExtensionAvailable(glExtensionName); +public final GL3bc getGL3bc() throws GLException { + throw new GLException("Not a GL3bc implementation"); } -public Object getExtension(String extensionName) { - // At this point we don't expose any extensions using this mechanism - return null; +public final GL3 getGL3() throws GLException { + throw new GLException("Not a GL3 implementation"); } -/** Returns the context this GL object is associated with for better - error checking by DebugGL. */ -public GLContext getContext() { - return _context; +public final GL2 getGL2() throws GLException { + throw new GLException("Not a GL2 implementation"); } -private GLContextImpl _context; +public final GLES1 getGLES1() throws GLException { + throw new GLException("Not a GLES1 implementation"); +} -public void setSwapInterval(int interval) { - _context.setSwapInterval(interval); +public final GLES2 getGLES2() throws GLException { + throw new GLException("Not a GLES2 implementation"); } -public int getSwapInterval() { - return _context.getSwapInterval(); +public final GL2ES1 getGL2ES1() throws GLException { + if (isGL2ES1()) { + return this; + } + throw new GLException("Not a GL2ES1 implementation"); +} + +public final GL2ES2 getGL2ES2() throws GLException { + if (isGL2ES2()) { + return this; + } + throw new GLException("Not a GL2ES2 implementation"); } -public Object getPlatformGLExtensions() { - return _context.getPlatformGLExtensions(); +public final GL2GL3 getGL2GL3() throws GLException { + throw new GLException("Not a GL2GL3 implementation"); } // diff --git a/make/config/jogl/obsolete/gl-impl-CustomCCode-gl2.c b/make/config/jogl/obsolete/gl-impl-CustomCCode-gl2.c deleted file mode 100644 index 91fd0078b..000000000 --- a/make/config/jogl/obsolete/gl-impl-CustomCCode-gl2.c +++ /dev/null @@ -1,24 +0,0 @@ -/* Java->C glue code: - * Java package: com.jogamp.opengl.impl.gl2.GL2Impl - * Java method: long dispatch_glMapBuffer(int target, int access) - * C function: void * glMapBuffer(GLenum target, GLenum access); - */ -JNIEXPORT jlong JNICALL -Java_com_jogamp_opengl_impl_gl2_GL2Impl_dispatch_1glMapBuffer(JNIEnv *env, jobject _unused, jint target, jint access, jlong glProcAddress) { - PFNGLMAPBUFFERPROC ptr_glMapBuffer; - void * _res; - ptr_glMapBuffer = (PFNGLMAPBUFFERPROC) (intptr_t) glProcAddress; - assert(ptr_glMapBuffer != NULL); - _res = (* ptr_glMapBuffer) ((GLenum) target, (GLenum) access); - return (jlong) (intptr_t) _res; -} - -/* Java->C glue code: - * Java package: com.jogamp.opengl.impl.gl2.GL2Impl - * Java method: ByteBuffer newDirectByteBuffer(long addr, int capacity); - * C function: jobject newDirectByteBuffer(jlong addr, jint capacity); - */ -JNIEXPORT jobject JNICALL -Java_com_jogamp_opengl_impl_gl2_GL2Impl_newDirectByteBuffer(JNIEnv *env, jobject _unused, jlong addr, jint capacity) { - return (*env)->NewDirectByteBuffer(env, (void*) (intptr_t) addr, capacity); -} diff --git a/make/config/jogl/obsolete/gl-impl-CustomCCode-gl3.c b/make/config/jogl/obsolete/gl-impl-CustomCCode-gl3.c deleted file mode 100644 index f540a7d4a..000000000 --- a/make/config/jogl/obsolete/gl-impl-CustomCCode-gl3.c +++ /dev/null @@ -1,24 +0,0 @@ -/* Java->C glue code: - * Java package: com.jogamp.opengl.impl.gl3.GL3Impl - * Java method: long dispatch_glMapBuffer(int target, int access) - * C function: void * glMapBuffer(GLenum target, GLenum access); - */ -JNIEXPORT jlong JNICALL -Java_com_jogamp_opengl_impl_gl3_GL3Impl_dispatch_1glMapBuffer(JNIEnv *env, jobject _unused, jint target, jint access, jlong glProcAddress) { - PFNGLMAPBUFFERPROC ptr_glMapBuffer; - void * _res; - ptr_glMapBuffer = (PFNGLMAPBUFFERPROC) (intptr_t) glProcAddress; - assert(ptr_glMapBuffer != NULL); - _res = (* ptr_glMapBuffer) ((GLenum) target, (GLenum) access); - return (jlong) (intptr_t) _res; -} - -/* Java->C glue code: - * Java package: com.jogamp.opengl.impl.gl3.GL3Impl - * Java method: ByteBuffer newDirectByteBuffer(long addr, int capacity); - * C function: jobject newDirectByteBuffer(jlong addr, jint capacity); - */ -JNIEXPORT jobject JNICALL -Java_com_jogamp_opengl_impl_gl3_GL3Impl_newDirectByteBuffer(JNIEnv *env, jobject _unused, jlong addr, jint capacity) { - return (*env)->NewDirectByteBuffer(env, (void*) (intptr_t) addr, capacity); -} diff --git a/make/config/jogl/obsolete/gl-impl-CustomJavaCode-gl2.java b/make/config/jogl/obsolete/gl-impl-CustomJavaCode-gl2.java deleted file mode 100644 index a1a6917df..000000000 --- a/make/config/jogl/obsolete/gl-impl-CustomJavaCode-gl2.java +++ /dev/null @@ -1,385 +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 GL2Impl(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_COLOR_INDEX: - 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: - case GL_ABGR_EXT: - elements = 4; - break; - /* FIXME ?? - case GL_HILO_NV: - elements = 2; - break; */ - default: - return 0; - } - switch (type) { - case GL_BITMAP: - if (format == GL_COLOR_INDEX) { - return (d * (h * ((w+7)/8))); - } else { - return 0; - } - 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_ = ((GL2ProcAddressTable)_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 - } - - public void glVertexPointer(GLArrayData array) { - if(array.getComponentNumber()==0) return; - if(array.isVBO()) { - glVertexPointer(array.getComponentNumber(), array.getComponentType(), array.getStride(), array.getOffset()); - } else { - glVertexPointer(array.getComponentNumber(), array.getComponentType(), array.getStride(), array.getBuffer()); - } - } - public void glColorPointer(GLArrayData array) { - if(array.getComponentNumber()==0) return; - if(array.isVBO()) { - glColorPointer(array.getComponentNumber(), array.getComponentType(), array.getStride(), array.getOffset()); - } else { - glColorPointer(array.getComponentNumber(), array.getComponentType(), array.getStride(), array.getBuffer()); - } - - } - public void glNormalPointer(GLArrayData array) { - if(array.getComponentNumber()==0) return; - if(array.getComponentNumber()!=3) { - throw new GLException("Only 3 components per normal allowed"); - } - if(array.isVBO()) { - glNormalPointer(array.getComponentType(), array.getStride(), array.getOffset()); - } else { - glNormalPointer(array.getComponentType(), array.getStride(), array.getBuffer()); - } - } - public void glTexCoordPointer(GLArrayData array) { - if(array.getComponentNumber()==0) return; - if(array.isVBO()) { - glTexCoordPointer(array.getComponentNumber(), array.getComponentType(), array.getStride(), array.getOffset()); - } else { - glTexCoordPointer(array.getComponentNumber(), array.getComponentType(), array.getStride(), array.getBuffer()); - } - } - diff --git a/make/lstjars.sh b/make/lstjars.sh index 7691bfa2d..3837be5e3 100644 --- a/make/lstjars.sh +++ b/make/lstjars.sh @@ -47,7 +47,7 @@ function listdeployment() { echo echo JOGL GL2ES12 NEWT - report gluegen-rt.$JAR_SUFFIX nativewindow.all-noawt.$JAR_SUFFIX jogl.core.$JAR_SUFFIX jogl.util.$JAR_SUFFIX jogl.os.$OSS.$JAR_SUFFIX newt.all-noawt.$JAR_SUFFIX libgluegen-rt.so.gz libnewt.so.gz libnativewindow_$OSS.so.gz + report gluegen-rt.$JAR_SUFFIX nativewindow.all-noawt.$JAR_SUFFIX jogl.core.$JAR_SUFFIX jogl.util.$JAR_SUFFIX jogl.os.$OSS.$JAR_SUFFIX jogl.gl2es12.$JAR_SUFFIX newt.all-noawt.$JAR_SUFFIX libgluegen-rt.so.gz libjogl_gl2es12.so.gz libnewt.so.gz libnativewindow_$OSS.so.gz echo echo JOGL GL2 NEWT @@ -125,8 +125,8 @@ mkdir -p nope mv *.cdc.lst *.all*.lst nope/ -mv jogl.gldesktop.*.lst nope/ -echo duplicates - w/o gldesktop.* +mv jogl.gl2es12.*.lst jogl.gldesktop.*.lst nope/ +echo duplicates - w/o gl2es12.* gldesktop.* echo sort jogl*.lst | uniq -d mv nope/* . diff --git a/make/make.jogl.all.linux-x86_64.sh b/make/make.jogl.all.linux-x86_64.sh index 8ebcc8744..b6c5e9d63 100644 --- a/make/make.jogl.all.linux-x86_64.sh +++ b/make/make.jogl.all.linux-x86_64.sh @@ -16,6 +16,7 @@ fi # -Dbuild.noarchives=true \ ant \ + -Dbuild.noarchives=true \ -Djogl.cg=1 -Dx11.cg.lib=../../lib-linux-x86_64 \ -Drootrel.build=build-x86_64 \ -DuseKD=true \ diff --git a/make/make.jogl.all.win64.bat b/make/make.jogl.all.win64.bat new file mode 100644 index 000000000..508067d57 --- /dev/null +++ b/make/make.jogl.all.win64.bat @@ -0,0 +1,17 @@ +set THISDIR="C:\JOGL"
+
+set J2RE_HOME=c:\jre1.6.0_19
+set JAVA_HOME=c:\jdk1.6.0_19
+set ANT_PATH=C:\apache-ant-1.8.0
+
+set PATH=%JAVA_HOME%\bin;%ANT_PATH%\bin;c:\mingw-w64\bin;c:\mingw\bin;%PATH%
+
+set LIB_GEN=%THISDIR%\lib
+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 -Dbuild.noarchives=true
+
+ant -Drootrel.build=build-win64 -Djogl.cg=1 -Dwindows.cg.lib=C:\Cg-2.2\lib %1 %2 %3 %4 %5 %6 %7 %8 %9 > make.jogl.all.win64.log 2>&1
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/ExtensionAvailabilityCache.java b/src/jogl/classes/com/jogamp/opengl/impl/ExtensionAvailabilityCache.java index 1ed0396a9..9d1235e13 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/ExtensionAvailabilityCache.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/ExtensionAvailabilityCache.java @@ -113,9 +113,7 @@ public final class ExtensionAvailabilityCache { boolean useGetStringi = false; - if ( context.getGLVersionMajor() > 3 || - ( context.getGLVersionMajor() == 3 && context.getGLVersionMinor() >= 0 ) || - gl.isGL3() ) { + if ( gl.isGL2GL3() ) { if ( ! gl.isFunctionAvailable("glGetStringi") ) { if(DEBUG) { System.err.println("GLContext: GL >= 3.1 usage, but no glGetStringi"); diff --git a/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java b/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java index 3abb69a7f..7143344bf 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java @@ -602,10 +602,7 @@ public abstract class GLContextImpl extends GLContext { // private Object createInstance(GLProfile glp, String suffix, Class[] cstrArgTypes, Object[] cstrArgs) { - try { - return ReflectionUtil.createInstance(glp.getGLImplBaseClassName()+suffix, cstrArgTypes, cstrArgs); - } catch (JogampRuntimeException jre) { /* n/a .. */ } - return null; + return ReflectionUtil.createInstance(glp.getGLImplBaseClassName()+suffix, cstrArgTypes, cstrArgs); } /** Create the GL for this context. */ diff --git a/src/jogl/classes/com/jogamp/opengl/impl/GLJNILibLoader.java b/src/jogl/classes/com/jogamp/opengl/impl/GLJNILibLoader.java index 7747b014b..c3958eedf 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/GLJNILibLoader.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/GLJNILibLoader.java @@ -67,6 +67,15 @@ public class GLJNILibLoader extends JNILibLoaderBase { }); } + public static void loadGLDesktopES12() { + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + loadLibrary("jogl_gl2es12", nativeOSPreload, true); + return null; + } + }); + } + public static void loadES2() { AccessController.doPrivileged(new PrivilegedAction() { public Object run() { diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXContext.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXContext.java index 7d907bf28..dce25978c 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXContext.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXContext.java @@ -308,7 +308,7 @@ public abstract class X11GLXContext extends GLContextImpl { } } } else { - if(!glp.isGL2()) { + if(glp.isGL3()) { glXMakeContextCurrent(display, 0, 0, 0); GLX.glXDestroyContext(display, temp_context); throw new GLException("X11GLXContext.createContext failed, but context > GL2 requested "+getGLVersion(null, major[0], minor[0], ctp[0], "@creation")+", "); diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java index 9e3a532e6..0e10b32b3 100644 --- a/src/jogl/classes/javax/media/opengl/GLProfile.java +++ b/src/jogl/classes/javax/media/opengl/GLProfile.java @@ -63,29 +63,36 @@ public class GLProfile implements Cloneable { // Query platform available OpenGL implementation // - public static final boolean isGL4bcAvailable() { return hasGL4bcImpl; } - public static final boolean isGL4Available() { return hasGL4Impl; } - public static final boolean isGL3bcAvailable() { return hasGL3bcImpl; } - public static final boolean isGL3Available() { return hasGL3Impl; } - public static final boolean isGL2Available() { return hasGL2Impl; } - public static final boolean isGLES2Available() { return hasGLES2Impl; } - public static final boolean isGLES1Available() { return hasGLES1Impl; } + public static final boolean isGL4bcAvailable() { return null != mappedProfiles.get(GL4bc); } + public static final boolean isGL4Available() { return null != mappedProfiles.get(GL4); } + public static final boolean isGL3bcAvailable() { return null != mappedProfiles.get(GL3bc); } + public static final boolean isGL3Available() { return null != mappedProfiles.get(GL3); } + public static final boolean isGL2Available() { return null != mappedProfiles.get(GL2); } + public static final boolean isGLES2Available() { return null != mappedProfiles.get(GLES2); } + public static final boolean isGLES1Available() { return null != mappedProfiles.get(GLES1); } + public static final boolean isGL2ES1Available() { return null != mappedProfiles.get(GL2ES1); } + public static final boolean isGL2ES2Available() { return null != mappedProfiles.get(GL2ES2); } + public static final String glAvailabilityToString() { StringBuffer sb = new StringBuffer(); sb.append("GLAvailability[Native[GL4bc "); - sb.append(hasGL4bcImpl); + sb.append(isGL4bcAvailable()); sb.append(", GL4 "); - sb.append(hasGL4Impl); + sb.append(isGL4Available()); sb.append(", GL3bc "); - sb.append(hasGL3bcImpl); + sb.append(isGL3bcAvailable()); sb.append(", GL3 "); - sb.append(hasGL3Impl); + sb.append(isGL3Available()); sb.append(", GL2 "); - sb.append(hasGL2Impl); + sb.append(isGL2Available()); + sb.append(", GL2ES1 "); + sb.append(isGL2ES1Available()); sb.append(", GLES1 "); - sb.append(hasGLES1Impl); + sb.append(isGLES1Available()); + sb.append(", GL2ES2 "); + sb.append(isGL2ES2Available()); sb.append(", GLES2 "); - sb.append(hasGLES2Impl); + sb.append(isGLES2Available()); sb.append("], Profiles["); for(Iterator i=mappedProfiles.values().iterator(); i.hasNext(); ) { sb.append(((GLProfile)i.next()).toString()); @@ -344,6 +351,8 @@ public class GLProfile implements Cloneable { GL3.equals(profileImpl) || GL2.equals(profileImpl) ) { return "com.jogamp.opengl.impl.gl4.GL4bc"; + } else if(GL2ES12.equals(profileImpl)) { + return "com.jogamp.opengl.impl.gl2es12.GL2ES12"; } else if(GLES1.equals(profileImpl) || GL2ES1.equals(profileImpl)) { return "com.jogamp.opengl.impl.es1.GLES1"; } else if(GLES2.equals(profileImpl) || GL2ES2.equals(profileImpl)) { @@ -767,6 +776,10 @@ public class GLProfile implements Cloneable { return "GLProfile[" + profile + "/" + profileImpl + "]"; } + // The intersection between desktop OpenGL and the union of the OpenGL ES profiles + // This is here only to avoid having separate GL2ES1Impl and GL2ES2Impl classes + private static final String GL2ES12 = "GL2ES12"; + private static final boolean isAWTAvailable; private static final boolean isAWTJOGLAvailable; @@ -776,6 +789,7 @@ public class GLProfile implements Cloneable { private static /*final*/ boolean hasGL3bcImpl; private static /*final*/ boolean hasGL3Impl; private static /*final*/ boolean hasGL2Impl; + private static /*final*/ boolean hasGL2ES12Impl; private static /*final*/ boolean hasGLES2Impl; private static /*final*/ boolean hasGLES1Impl; @@ -802,6 +816,7 @@ public class GLProfile implements Cloneable { ReflectionUtil.isClassAvailable("javax.media.opengl.awt.GLCanvas") ; // JOGL boolean hasDesktopGL = false; + boolean hasDesktopGLES12 = false; boolean hasNativeOSFactory = false; Throwable t; @@ -833,12 +848,37 @@ public class GLProfile implements Cloneable { } } + t=null; + try { + // See DRIHack.java for an explanation of why this is necessary + DRIHack.begin(); + GLJNILibLoader.loadGLDesktopES12(); + DRIHack.end(); + hasDesktopGLES12 = true; + } catch (UnsatisfiedLinkError ule) { + t=ule; + } catch (SecurityException se) { + t=se; + } catch (NullPointerException npe) { + t=npe; + } catch (RuntimeException re) { + t=re; + } + if(null!=t) { + if (DEBUG) { + System.err.println("GLProfile.static Desktop GLES12 Library not available"); + t.printStackTrace(); + } + } + + hasGL234Impl = hasDesktopGL && ReflectionUtil.isClassAvailable("com.jogamp.opengl.impl.gl4.GL4bcImpl"); hasGL4bcImpl = hasGL234Impl; hasGL4Impl = hasGL234Impl; hasGL3bcImpl = hasGL234Impl; hasGL3Impl = hasGL234Impl; hasGL2Impl = hasGL234Impl; + hasGL2ES12Impl = hasDesktopGLES12 && ReflectionUtil.isClassAvailable("com.jogamp.opengl.impl.gl2es12.GL2ES12Impl"); mappedProfiles = computeProfileMap(); // @@ -849,7 +889,7 @@ public class GLProfile implements Cloneable { // which will register at GLContext .. // - if(hasDesktopGL) { + if(hasDesktopGL||hasDesktopGLES12) { // if successfull it has a shared dummy drawable and context created try { hasNativeOSFactory = null != GLDrawableFactory.getFactoryImpl(GL2); @@ -872,13 +912,15 @@ public class GLProfile implements Cloneable { hasGL4Impl = false; hasGL3bcImpl = false; hasGL3Impl = false; + hasGL2ES12Impl = false; hasGL2Impl = false; } else { - hasGL4bcImpl = GLContext.isGL4bcAvailable(); - hasGL4Impl = GLContext.isGL4Available(); - hasGL3bcImpl = GLContext.isGL3bcAvailable(); - hasGL3Impl = GLContext.isGL3Available(); - hasGL2Impl = GLContext.isGL2Available(); + hasGL4bcImpl = hasGL4bcImpl && GLContext.isGL4bcAvailable(); + hasGL4Impl = hasGL4Impl && GLContext.isGL4Available(); + hasGL3bcImpl = hasGL3bcImpl && GLContext.isGL3bcAvailable(); + hasGL3Impl = hasGL3Impl && GLContext.isGL3Available(); + hasGL2Impl = hasGL2Impl && GLContext.isGL2Available(); + hasGL2ES12Impl = hasGL2ES12Impl && GLContext.isGL2Available(); } boolean btest = false; @@ -934,7 +976,7 @@ public class GLProfile implements Cloneable { mappedProfiles = computeProfileMap(); if(null==defaultGLProfile) { - throw new GLException("No profile available: "+list2String(GL_PROFILE_LIST_ALL)); + throw new GLException("No profile available: "+list2String(GL_PROFILE_LIST_ALL)+", "+glAvailabilityToString()); } if (DEBUG) { @@ -942,6 +984,7 @@ public class GLProfile implements Cloneable { System.err.println("GLProfile.static isAWTJOGLAvailable "+isAWTJOGLAvailable); System.err.println("GLProfile.static hasNativeOSFactory "+hasNativeOSFactory); System.err.println("GLProfile.static hasDesktopGL "+hasDesktopGL); + System.err.println("GLProfile.static hasDesktopGLES12 "+hasDesktopGLES12); System.err.println("GLProfile.static hasEGLDynLookup "+hasEGLDynLookup); System.err.println("GLProfile.static hasEGLDrawableFactory "+hasEGLDrawableFactory); System.err.println("GLProfile.static hasGL234Impl "+hasGL234Impl); @@ -993,7 +1036,9 @@ public class GLProfile implements Cloneable { */ private static String computeProfileImpl(String profile) { if (GL2ES1.equals(profile)) { - if(hasGL2Impl) { + if(hasGL2ES12Impl) { + return GL2ES12; + } else if(hasGL2Impl) { return GL2; } else if(hasGL3bcImpl) { return GL3bc; @@ -1003,7 +1048,9 @@ public class GLProfile implements Cloneable { return GLES1; } } else if (GL2ES2.equals(profile)) { - if(hasGL2Impl) { + if(hasGL2ES12Impl) { + return GL2ES12; + } else if(hasGL2Impl) { return GL2; } else if(hasGL3Impl) { return GL3; |