diff options
author | Sven Gothel <[email protected]> | 2008-07-25 16:26:27 +0000 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2008-07-25 16:26:27 +0000 |
commit | db40249b86a14c2178be8a2f61dc97f4ac1f1424 (patch) | |
tree | c570b317b13c11bf2e6b1c79d157aac24df32409 /make | |
parent | 4ce0d2396726dcd285f753fcacd0acc4e2b60469 (diff) |
../jogl.log
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1735 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'make')
24 files changed, 1050 insertions, 393 deletions
diff --git a/make/build.xml b/make/build.xml index d150e04ad..56a920fd5 100644 --- a/make/build.xml +++ b/make/build.xml @@ -149,7 +149,7 @@ <property name="java.part.glutess" value="com/sun/opengl/impl/glu/tessellator/**"/> - <property name="java.part.glugl2es1" + <property name="java.part.glumipmap" value="com/sun/opengl/impl/glu/mipmap/**"/> <property name="java.part.glugl2" @@ -429,7 +429,7 @@ <property name="jogl.gles2.dbg.jar" value="${build}/jogl.gles2.dbg.jar" /> <property name="jogl.egl.jar" value="${build}/jogl.egl.jar" /> <property name="jogl.glutess.jar" value="${build}/jogl.glu.tess.jar" /> - <property name="jogl.glugl2es1.jar" value="${build}/jogl.glu.gl2es1.jar" /> + <property name="jogl.glumipmap.jar" value="${build}/jogl.glu.mipmap.jar" /> <property name="jogl.glugl2.jar" value="${build}/jogl.glu.gl2.jar" /> <property name="jogl.gl2es12.x11.jar" value="${build}/jogl.gl2es12.x11.jar" /> <property name="jogl.gl2es12.win.jar" value="${build}/jogl.gl2es12.win.jar" /> @@ -760,6 +760,7 @@ <copy file="../src/classes/javax/media/opengl/util/BufferUtil.java.javase" tofile="../build/gensrc/classes/javax/media/opengl/util/BufferUtil.java" /> </target> + <!-- Generate the BufferUtil class for this particular profile --> <target name="java.generate.BufferUtil" depends="java.generate.BufferUtil.javase, java.generate.BufferUtil.javame_cdc_fp" /> <target name="java.generate.gl.platforms" > @@ -776,7 +777,8 @@ - from the C GL headers. This involves setting the taskdef and creating - the classpath reference id then running the task on each header. --> - <target name="java.generate" depends="build.gluegen, java.generate.check" unless="java.generate.skip"> + <target name="java.generate" depends="build.gluegen, java.generate.BufferUtil, java.generate.check" unless="java.generate.skip"> + <!-- Add the GlueGen and BuildStaticGLInfo tasks to ANT --> <taskdef name="gluegen" classname="com.sun.gluegen.ant.GlueGenTask" classpathref="gluegen.classpath" /> @@ -830,9 +832,6 @@ <classpath refid="gluegen.classpath" /> </staticglgen> - <!-- Generate the BufferUtil class for this particular profile --> - <antcall target="java.generate.BufferUtil" inheritrefs="true" /> - <!-- Generate GLU class --> <antcall target="java.generate.glu.base" inheritrefs="true" /> <antcall target="java.generate.glu.GL2ES1" inheritrefs="true" /> @@ -1002,6 +1001,7 @@ - will be generated. --> <target name="java.compile.firstpass" depends="java.generate,java.generate.cg"> + <!-- Perform the first pass Java compile. --> <javac destdir="${classes}" classpath="${gluegen-rt.jar}" @@ -1552,7 +1552,7 @@ <jar manifest="tempversion" destfile="${jogl.core.jar}"> <fileset dir="${classes}" includes="javax/media/opengl/**, com/sun/gluegen/runtime/**, com/sun/opengl/**" - excludes="${java.excludes.fixme} ${java.part.egl}, ${java.part.gl2es12.x11}, ${java.part.gl2es12.win}, ${java.part.gl2es12.osx}, ${java.part.gl2es12.dbg}, ${java.part.gl2.x11}, ${java.part.gl2.win}, ${java.part.gl2.osx}, ${java.part.gl2.dbg}, ${java.part.es1}, ${java.part.es1.dbg}, ${java.part.es2}, ${java.part.es2.dbg}, ${java.part.awt}, ${java.part.glutess}, ${java.part.glugl2es1}, ${java.part.glugl2}, ${java.part.util} ${java.part.util.awt} ${java.part.util.gl2}, ${java.part.newt}, ${java.part.newt.awt}"/> + excludes="${java.excludes.fixme} ${java.part.egl}, ${java.part.gl2es12.x11}, ${java.part.gl2es12.win}, ${java.part.gl2es12.osx}, ${java.part.gl2es12.dbg}, ${java.part.gl2.x11}, ${java.part.gl2.win}, ${java.part.gl2.osx}, ${java.part.gl2.dbg}, ${java.part.es1}, ${java.part.es1.dbg}, ${java.part.es2}, ${java.part.es2.dbg}, ${java.part.awt}, ${java.part.glutess}, ${java.part.glumipmap}, ${java.part.glugl2}, ${java.part.util} ${java.part.util.awt} ${java.part.util.gl2}, ${java.part.newt}, ${java.part.newt.awt}"/> </jar> <jar manifest="tempversion" destfile="${jogl.gles1.jar}"> <fileset dir="${classes}" @@ -1619,9 +1619,9 @@ <fileset dir="${classes}" includes="${java.part.glutess}"/> </jar> - <jar manifest="tempversion" destfile="${jogl.glugl2es1.jar}"> + <jar manifest="tempversion" destfile="${jogl.glumipmap.jar}"> <fileset dir="${classes}" - includes="${java.part.glugl2es1}"/> + includes="${java.part.glumipmap}"/> </jar> <jar manifest="tempversion" destfile="${jogl.glugl2.jar}"> <fileset dir="${classes}" diff --git a/make/gl-es1.cfg b/make/gl-es1.cfg index 0329e64d4..047f7a133 100755 --- a/make/gl-es1.cfg +++ b/make/gl-es1.cfg @@ -66,7 +66,7 @@ Include intptr.cfg IncludeAs CustomJavaCode GLES1Impl gl-impl-CustomJavaCode-common.java IncludeAs CustomJavaCode GLES1Impl gl-impl-CustomJavaCode-gles1.java -IncludeAs CustomCCode gl-impl-CustomCCode.c +IncludeAs CustomCCode gl-impl-CustomCCode-gles1.c Import javax.media.opengl.GLES1 Import javax.media.opengl.GLES2 diff --git a/make/gl-es2.cfg b/make/gl-es2.cfg index cdf936ba9..85e591c8e 100755 --- a/make/gl-es2.cfg +++ b/make/gl-es2.cfg @@ -39,11 +39,7 @@ LocalProcAddressCallingConvention __ALL__ GL_APIENTRY # Pick up on-line OpenGL javadoc thanks to user cylab on javagaming.org forums TagNativeBinding true -CustomJavaCode GLES2Impl public void glClearDepth(double depth) { -CustomJavaCode GLES2Impl glClearDepthf((float)depth); } - -CustomJavaCode GLES2Impl public void glDepthRange(double zNear, double zFar) { -CustomJavaCode GLES2Impl glDepthRangef((float)zNear, (float)zFar); } +IncludeAs CustomJavaCode GLES2 gl-if-CustomJavaCode-gles2.java CustomCCode /* Define GL_GLEXT_PROTOTYPES so that the OpenGL extension prototypes in CustomCCode "glext.h" are parsed. */ @@ -55,13 +51,20 @@ CustomCCode #include <GLES2/gl2ext.h> CustomCCode #include <stdlib.h> Include intptr.cfg +JavaPrologue glDrawArrays glDrawArraysPrologue(); +JavaEpilogue glDrawArrays glDrawArraysEpilogue(); +JavaPrologue glDrawElements glDrawArraysPrologue(); +JavaEpilogue glDrawElements glDrawArraysEpilogue(); + IncludeAs CustomJavaCode GLES2Impl gl-impl-CustomJavaCode-common.java IncludeAs CustomJavaCode GLES2Impl gl-impl-CustomJavaCode-gles2.java IncludeAs CustomJavaCode GLES2Impl gl-impl-CustomJavaCode-gl2_es2.java -IncludeAs CustomCCode gl-impl-CustomCCode.c +IncludeAs CustomCCode gl-impl-CustomCCode-gles2.c Import javax.media.opengl.GLES1 Import javax.media.opengl.GLES2 Import javax.media.opengl.GL2 Import javax.media.opengl.util.BufferUtil +Import javax.media.opengl.util.PMVMatrix +Import java.io.PrintStream diff --git a/make/gl-gl2.cfg b/make/gl-gl2.cfg index 6fdfb54cd..7ab0b35ad 100644 --- a/make/gl-gl2.cfg +++ b/make/gl-gl2.cfg @@ -55,9 +55,10 @@ Include intptr.cfg IncludeAs CustomJavaCode GL2Impl gl-impl-CustomJavaCode-common.java IncludeAs CustomJavaCode GL2Impl gl-impl-CustomJavaCode-gl2.java IncludeAs CustomJavaCode GL2Impl gl-impl-CustomJavaCode-gl2_es2.java -IncludeAs CustomCCode gl-impl-CustomCCode.c +IncludeAs CustomCCode gl-impl-CustomCCode-gl2.c Import javax.media.opengl.GLES1 Import javax.media.opengl.GLES2 Import javax.media.opengl.GL2 Import javax.media.opengl.util.BufferUtil +Import java.io.PrintStream diff --git a/make/gl-gl2es12.cfg b/make/gl-gl2es12.cfg index 8bd3d7f4d..fb772b73b 100644 --- a/make/gl-gl2es12.cfg +++ b/make/gl-gl2es12.cfg @@ -51,9 +51,10 @@ Include intptr.cfg IncludeAs CustomJavaCode GL2ES12Impl gl-impl-CustomJavaCode-common.java IncludeAs CustomJavaCode GL2ES12Impl gl-impl-CustomJavaCode-gl2es12.java IncludeAs CustomJavaCode GL2ES12Impl gl-impl-CustomJavaCode-gl2_es2.java -IncludeAs CustomCCode gl-impl-CustomCCode.c +IncludeAs CustomCCode gl-impl-CustomCCode-gl2es12.c Import javax.media.opengl.GLES1 Import javax.media.opengl.GLES2 Import javax.media.opengl.GL2ES12 Import javax.media.opengl.util.BufferUtil +Import java.io.PrintStream diff --git a/make/gl-if-CustomJavaCode-gl.java b/make/gl-if-CustomJavaCode-gl.java index 5ac1a8cbe..07905f071 100644 --- a/make/gl-if-CustomJavaCode-gl.java +++ b/make/gl-if-CustomJavaCode-gl.java @@ -1,4 +1,29 @@ + public static final int GL_LIGHT0 = 0x4000; + public static final int GL_LIGHT1 = 0x4001; + public static final int GL_LIGHT2 = 0x4002; + public static final int GL_LIGHT3 = 0x4003; + public static final int GL_LIGHT4 = 0x4004; + public static final int GL_LIGHT5 = 0x4005; + public static final int GL_LIGHT6 = 0x4006; + public static final int GL_LIGHT7 = 0x4007; + public static final int GL_LIGHTING = 0xB50; + public static final int GL_AMBIENT = 0x1200; + public static final int GL_DIFFUSE = 0x1201; + public static final int GL_SPECULAR = 0x1202; + public static final int GL_POSITION = 0x1203; + public static final int GL_COLOR_MATERIAL = 0xB57; + public static final int GL_FLAT = 0x1D00; + public static final int GL_SMOOTH = 0x1D01; + + public static final int GL_MODELVIEW = 0x1700; + public static final int GL_PROJECTION = 0x1701; + + public static final int GL_VERTEX_ARRAY = 0x8074; + public static final int GL_NORMAL_ARRAY = 0x8075; + public static final int GL_COLOR_ARRAY = 0x8076; + public static final int GL_TEXTURE_COORD_ARRAY = 0x8078; + public boolean isGL2(); public boolean isGLES1(); @@ -25,3 +50,56 @@ public boolean matchesProfile(String test_profile); + public String toString(); + + public GLContext getContext(); + + public void glClearDepth( double depth ); + + public void glDepthRange(double zNear, double zFar); + + public void glPopMatrix(); + + public void glPushMatrix(); + + public void glLoadIdentity() ; + + public void glLoadMatrixf(java.nio.FloatBuffer m) ; + public void glLoadMatrixf(float[] m, int m_offset); + + public void glMatrixMode(int mode) ; + + public void glMultMatrixf(java.nio.FloatBuffer m) ; + public void glMultMatrixf(float[] m, int m_offset); + + public void glTranslatef(float x, float y, float z) ; + + public void glRotatef(float angle, float x, float y, float z); + + public void glScalef(float x, float y, float z) ; + + public void glOrthof(float left, float right, float bottom, float top, float zNear, float zFar) ; + + public void glFrustumf(float left, float right, float bottom, float top, float zNear, float zFar); + + public void glEnableClientState(int arrayName); + public void glDisableClientState(int arrayName); + + public void glVertexPointer(int size, int type, int stride, java.nio.Buffer pointer); + public void glVertexPointer(int size, int type, int stride, long pointer_buffer_offset); + + public void glColorPointer(int size, int type, int stride, java.nio.Buffer pointer); + public void glColorPointer(int size, int type, int stride, long pointer_buffer_offset); + public void glColor4f(float red, float green, float blue, float alpha); + + public void glNormalPointer(int type, int stride, java.nio.Buffer pointer); + public void glNormalPointer(int type, int stride, long pointer_buffer_offset); + + public void glTexCoordPointer(int size, int type, int stride, java.nio.Buffer pointer); + public void glTexCoordPointer(int size, int type, int stride, long pointer_buffer_offset); + + public void glLightfv(int light, int pname, java.nio.FloatBuffer params); + public void glLightfv(int light, int pname, float[] params, int params_offset); + + public void glShadeModel(int mode); + diff --git a/make/gl-if-CustomJavaCode-gles2.java b/make/gl-if-CustomJavaCode-gles2.java new file mode 100644 index 000000000..33d0f555f --- /dev/null +++ b/make/gl-if-CustomJavaCode-gles2.java @@ -0,0 +1,151 @@ + + public static final int GL_NVIDIA_PLATFORM_BINARY_NV = 0x890B; + + /** + * Emulated FixedFunction matrix bit, enables PVM matrix functionality, + * referenced below. + * + * <br>Enabled by default. + * + * @see #enableFixedFunctionEmulationMode + * @see #disableFixedFunctionEmulationMode + * @see #getEnabledFixedFunctionEmulationModes + * @see #GL_MODELVIEW + * @see #GL_PROJECTION + * @see #glPopMatrix() + * @see #glPushMatrix() + * @see #glLoadIdentity() + * @see #glLoadMatrixf(java.nio.FloatBuffer) + * @see #glMatrixMode(int) + * @see #glMultMatrixf(java.nio.FloatBuffer) + * @see #glTranslatef(float, float, float) + * @see #glRotatef(float, float, float, float) + * @see #glScalef(float, float, float) + * @see #glOrthof(float, float, float, float, float, float) + * @see #glFrustumf(float, float, float, float, float, float) + * @see #glPopMatrix() + * @see #glPushMatrix() + * @see #glLoadIdentity() + * @see #glLoadMatrixf(java.nio.FloatBuffer) + * @see #glMatrixMode(int) + * @see #glMultMatrixf(java.nio.FloatBuffer) + * @see #glTranslatef(float, float, float) + * @see #glRotatef(float, float, float, float) + * @see #glScalef(float, float, float) + * @see #glOrthof(float, float, float, float, float, float) + * @see #glFrustumf(float, float, float, float, float, float) + */ + public static final int FIXED_EMULATION_MATRIX = (1 << 0) ; + + /** + * Emulated FixedFunction vertex color bit, enables vertex|color arrays , + * referenced below. + * + * <br>Disabled by default. + * + * @see #enableFixedFunctionEmulationMode + * @see #disableFixedFunctionEmulationMode + * @see #getEnabledFixedFunctionEmulationModes + * @see #GL_VERTEX_ARRAY + * @see #GL_NORMAL_ARRAY + * @see #GL_COLOR_ARRAY + * @see #GL_TEXTURE_COORD_ARRAY + * @see #glEnableClientState(int); + * @see #glVertexPointer(int, int, int, Buffer); + * @see #glVertexPointer(int, int, int, long); + * @see #glColorPointer(int, int, int, Buffer); + * @see #glColorPointer(int, int, int, long); + * @see #glNormalPointer(int, int, int, Buffer); + * @see #glNormalPointer(int, int, int, long); + * @see #glTexCoordPointer(int, int, int, Buffer); + * @see #glTexCoordPointer(int, int, int, long); + * @see #glDrawArrays(int, int, int); + */ + public static final int FIXED_EMULATION_VERTEXCOLOR = (1 << 1) ; + + /** + * Emulated FixedFunction vertex color bit, enables normal arrays and lights + * Not implemented yet. + */ + public static final int FIXED_EMULATION_NORMALLIGHT = (1 << 2) ; + + /** + * Emulated FixedFunction vertex color bit, enables texcoord arrays and textures + * Can be enabled or disabled only in combination with FIXED_EMULATION_VERTEXCOLOR. + */ + public static final int FIXED_EMULATION_TEXTURE = (1 << 4) ; + + /** + * Emulated FixedFunction implementation. + * @see #disableFixedFunctionEmulationMode + * @see #getEnabledFixedFunctionEmulationModes + */ + public void enableFixedFunctionEmulationMode(int mode); + + /** + * Emulated FixedFunction implementation. + * @see #enableFixedFunctionEmulationMode + * @see #getEnabledFixedFunctionEmulationModes + */ + public void disableFixedFunctionEmulationMode(int mode); + + /** + * Emulated FixedFunction matrix implementation. + * @see #enableFixedFunctionEmulationMode + */ + public int getEnabledFixedFunctionEmulationModes(); + + /** + * Emulated FixedFunction matrix implementation. + * + * Fetches the internal matrix of matrixName. + * @param matrixName GL_MODELVIEW or GL_PROJECTION + * @see #getEnabledFixedFunctionEmulationModes + * @see #enableFixedFunctionEmulationMode + * @see #disableFixedFunctionEmulationMode + */ + public PMVMatrix getPMVMatrix(); + + /** + * Emulated FixedFunction matrix implementation. + * + * Fetches the internal matrix of matrixName. + * @param matrixName GL_MODELVIEW or GL_PROJECTION + * @see #enableFixedFunctionEmulationMode + * @see #disableFixedFunctionEmulationMode + * @see #getEnabledFixedFunctionEmulationModes + */ + public FloatBuffer glGetPMVMatrixf(); + + /** + * Emulated FixedFunction matrix implementation. + * + * Fetches the internal matrix of matrixName. + * @param matrixName GL_MODELVIEW or GL_PROJECTION + * @see #enableFixedFunctionEmulationMode + * @see #disableFixedFunctionEmulationMode + * @see #getEnabledFixedFunctionEmulationModes + */ + public FloatBuffer glGetMatrixf(int matrixName); + + /** + * Emulated FixedFunction matrix implementation. + * + * Fetches the internal matrix of matrixName. + * @param matrixName GL_MODELVIEW or GL_PROJECTION + * @see #enableFixedFunctionEmulationMode + * @see #disableFixedFunctionEmulationMode + * @see #getEnabledFixedFunctionEmulationModes + */ + public FloatBuffer glGetMatrixf(); + + /** + * Emulated FixedFunction matrix implementation. + * + * Fetches the internal matrix of matrixName. + * @param matrixName GL_MODELVIEW or GL_PROJECTION + * @see #enableFixedFunctionEmulationMode + * @see #disableFixedFunctionEmulationMode + * @see #getEnabledFixedFunctionEmulationModes + */ + public int glGetMatrixMode(); diff --git a/make/gl-if-gl.cfg b/make/gl-if-gl.cfg index 14fab64f9..9696360d2 100755 --- a/make/gl-if-gl.cfg +++ b/make/gl-if-gl.cfg @@ -20,11 +20,6 @@ Ignore ^gl.*x Ignore ^gl.*xOES Ignore glEGL.* -CustomJavaCode GL public String toString(); -CustomJavaCode GL public GLContext getContext(); -CustomJavaCode GL public void glClearDepth( double depth ); -CustomJavaCode GL public void glDepthRange(double zNear, double zFar); - EmitProcAddressTable false ProcAddressTableClassName DontGenerateProcAddressTableStuff GetProcAddressTableExpr DontGenerateProcAddressTableStuff diff --git a/make/gl-if-gl2_es2.cfg b/make/gl-if-gl2_es2.cfg index 6211d562f..24d620588 100755 --- a/make/gl-if-gl2_es2.cfg +++ b/make/gl-if-gl2_es2.cfg @@ -36,6 +36,15 @@ GLHeader GLES2/gl2ext.h # Pick up on-line OpenGL javadoc thanks to user cylab on javagaming.org forums TagNativeBinding true +CustomJavaCode GL2ES2 public String glGetShaderInfoLog(int shaderObj); +CustomJavaCode GL2ES2 public String glGetProgramInfoLog(int programObj); +CustomJavaCode GL2ES2 public boolean glIsShaderStatusValid(int shaderObj, int name); +CustomJavaCode GL2ES2 public boolean glIsShaderStatusValid(int shaderObj, int name, PrintStream verboseOut); +CustomJavaCode GL2ES2 public boolean glIsShaderStatusValid(IntBuffer shaders, int name); +CustomJavaCode GL2ES2 public boolean glIsShaderStatusValid(IntBuffer shaders, int name, PrintStream verboseOut); +CustomJavaCode GL2ES2 public boolean glIsProgramStatusValid(int programObj, int name); +CustomJavaCode GL2ES2 public boolean glIsProgramValid(int programObj); +CustomJavaCode GL2ES2 public boolean glIsProgramValid(int programObj, PrintStream verboseOut); CustomJavaCode GL2ES2 public void glShaderSource(int shader, java.lang.String[] source); CustomJavaCode GL2ES2 public void glShaderSource(IntBuffer shaders, java.lang.String[][] sources); CustomJavaCode GL2ES2 public void glShaderBinary(IntBuffer shaders, int binFormat, java.nio.Buffer bin); @@ -48,4 +57,18 @@ CustomJavaCode GL2ES2 */ CustomJavaCode GL2ES2 public void glShaderBinaryOrSource(IntBuffer shaders, CustomJavaCode GL2ES2 int binFormat, java.nio.Buffer bin, CustomJavaCode GL2ES2 java.lang.String[][] sources); +CustomJavaCode GL2ES2 public void glCreateShader(int type, IntBuffer shaders); +CustomJavaCode GL2ES2 public void glCompileShader(IntBuffer shaders); +CustomJavaCode GL2ES2 public boolean glCreateCompileShader(IntBuffer shader, int shaderType, +CustomJavaCode GL2ES2 int binFormat, java.nio.Buffer bin, +CustomJavaCode GL2ES2 java.lang.String[][] sources); +CustomJavaCode GL2ES2 public boolean glCreateCompileShader(IntBuffer shader, int shaderType, +CustomJavaCode GL2ES2 int binFormat, java.nio.Buffer bin, +CustomJavaCode GL2ES2 java.lang.String[][] sources, +CustomJavaCode GL2ES2 PrintStream verboseOut); +CustomJavaCode GL2ES2 public void glAttachShader(int program, IntBuffer shaders); +CustomJavaCode GL2ES2 public void glDetachShader(int program, IntBuffer shaders); +CustomJavaCode GL2ES2 public void glDeleteShader(IntBuffer shaders); + +Import java.io.PrintStream diff --git a/make/gl-ignore-gl2_es12-special.cfg b/make/gl-ignore-gl2_es12-special.cfg index 5c1370977..e8fdd9f9c 100644 --- a/make/gl-ignore-gl2_es12-special.cfg +++ b/make/gl-ignore-gl2_es12-special.cfg @@ -11,7 +11,7 @@ Ignore GL_ALPHA_SCALE Ignore GL_ALPHA_TEST Ignore GL_ALPHA_TEST_FUNC Ignore GL_ALPHA_TEST_REF -Ignore GL_AMBIENT +#Ignore GL_AMBIENT Ignore GL_AMBIENT_AND_DIFFUSE Ignore GL_AND Ignore GL_AND_INVERTED @@ -52,7 +52,7 @@ Ignore GL_COLOR_ARRAY_SIZE Ignore GL_COLOR_ARRAY_STRIDE Ignore GL_COLOR_ARRAY_TYPE Ignore GL_COLOR_LOGIC_OP -Ignore GL_COLOR_MATERIAL +#Ignore GL_COLOR_MATERIAL Ignore GL_COMBINE Ignore GL_COMBINE_ALPHA Ignore GL_COMBINE_RGB @@ -77,7 +77,7 @@ Ignore GL_DELETE_STATUS Ignore GL_DEPTH_COMPONENT Ignore GL_DEPTH_COMPONENT24_OES Ignore GL_DEPTH_COMPONENT32_OES -Ignore GL_DIFFUSE +#Ignore GL_DIFFUSE Ignore GL_DOT3_RGB Ignore GL_DOT3_RGBA Ignore GL_EMISSION @@ -88,7 +88,7 @@ Ignore GL_EXP Ignore GL_EXP2 Ignore GL_FIXED_OES Ignore GL_FIXED -Ignore GL_FLAT +#Ignore GL_FLAT Ignore GL_FLOAT_MAT2 Ignore GL_FLOAT_MAT3 Ignore GL_FLOAT_MAT4 @@ -126,15 +126,15 @@ Ignore GL_INTERPOLATE Ignore GL_INT_VEC2 Ignore GL_INT_VEC3 Ignore GL_INT_VEC4 -Ignore GL_LIGHT0 -Ignore GL_LIGHT1 -Ignore GL_LIGHT2 -Ignore GL_LIGHT3 -Ignore GL_LIGHT4 -Ignore GL_LIGHT5 -Ignore GL_LIGHT6 -Ignore GL_LIGHT7 -Ignore GL_LIGHTING +#Ignore GL_LIGHT0 +#Ignore GL_LIGHT1 +#Ignore GL_LIGHT2 +#Ignore GL_LIGHT3 +#Ignore GL_LIGHT4 +#Ignore GL_LIGHT5 +#Ignore GL_LIGHT6 +#Ignore GL_LIGHT7 +#Ignore GL_LIGHTING Ignore GL_LIGHT_MODEL_AMBIENT Ignore GL_LIGHT_MODEL_TWO_SIDE Ignore GL_LINEAR_ATTENUATION @@ -255,7 +255,7 @@ Ignore GL_POINT_SIZE_MIN Ignore GL_POINT_SMOOTH Ignore GL_POINT_SMOOTH_HINT Ignore GL_POINT_SPRITE_OES -Ignore GL_POSITION +#Ignore GL_POSITION Ignore GL_PREVIOUS Ignore GL_PRIMARY_COLOR Ignore GL_PROJECTION @@ -280,10 +280,10 @@ Ignore GL_SHADER_SOURCE_LENGTH Ignore GL_SHADER_TYPE Ignore GL_SHADING_LANGUAGE_VERSION Ignore GL_SHININESS -Ignore GL_SMOOTH +#Ignore GL_SMOOTH Ignore GL_SMOOTH_LINE_WIDTH_RANGE Ignore GL_SMOOTH_POINT_SIZE_RANGE -Ignore GL_SPECULAR +#Ignore GL_SPECULAR Ignore GL_SPOT_CUTOFF Ignore GL_SPOT_DIRECTION Ignore GL_SPOT_EXPONENT @@ -372,9 +372,9 @@ Ignore glClearDepthfOES Ignore glClientActiveTexture Ignore glClipPlanef Ignore glClipPlanefOES -Ignore glColor4f +#Ignore glColor4f Ignore glColor4ub -Ignore glColorPointer +#Ignore glColorPointer Ignore glCompileShader Ignore glCoverageMaskNV Ignore glCoverageOperationNV @@ -382,7 +382,7 @@ Ignore glDeleteProgram Ignore glDeleteShader Ignore glDepthRangefOES Ignore glDetachShader -Ignore glDisableClientState +#Ignore glDisableClientState Ignore glDisableVertexAttribArray Ignore glDrawTexfOES Ignore glDrawTexfvOES @@ -391,7 +391,7 @@ Ignore glDrawTexivOES Ignore glDrawTexsOES Ignore glDrawTexsvOES Ignore glDrawTexxvOES -Ignore glEnableClientState +#Ignore glEnableClientState Ignore glEnableVertexAttribArray Ignore glFogf Ignore glFogfv @@ -435,7 +435,7 @@ Ignore glGetUniformiv Ignore glGetVertexAttribfv Ignore glGetVertexAttribiv Ignore glLightf -Ignore glLightfv +#Ignore glLightfv Ignore glLightModelf Ignore glLightModelfv Ignore glLightModelxv @@ -443,20 +443,20 @@ Ignore glLightModelxvOES Ignore glLightxv Ignore glLightxvOES Ignore glLinkProgram -Ignore glLoadIdentity -Ignore glLoadMatrixf +#Ignore glLoadIdentity +#Ignore glLoadMatrixf Ignore glLogicOp Ignore glMaterialf Ignore glMaterialfv Ignore glMaterialxv Ignore glMaterialxvOES Ignore glMatrixIndexPointerOES -Ignore glMatrixMode +#Ignore glMatrixMode Ignore glMultiTexCoord4f -Ignore glMultMatrixf +#Ignore glMultMatrixf Ignore glNormal3f -Ignore glNormalPointer -Ignore glOrthof +#Ignore glNormalPointer +#Ignore glOrthof Ignore glOrthofOES Ignore glPointParameterf Ignore glPointParameterfv @@ -466,14 +466,14 @@ Ignore glPointSize Ignore glPointSizePointer Ignore glReleaseShaderCompiler Ignore glRotatef -Ignore glScalef -Ignore glShadeModel +#Ignore glScalef +#Ignore glShadeModel Ignore glShaderBinary Ignore glShaderSource Ignore glStencilFuncSeparate Ignore glStencilMaskSeparate Ignore glStencilOpSeparate -Ignore glTexCoordPointer +#Ignore glTexCoordPointer Ignore glTexEnvf Ignore glTexEnvfv Ignore glTexEnvi @@ -487,7 +487,7 @@ Ignore glTexGenivOES Ignore glTexGenxvOES Ignore glTexParameterxv Ignore glTexParameterxvOES -Ignore glTranslatef +#Ignore glTranslatef Ignore glUniform1f Ignore glUniform1fv Ignore glUniform1i @@ -518,5 +518,5 @@ Ignore glVertexAttrib3fv Ignore glVertexAttrib4f Ignore glVertexAttrib4fv Ignore glVertexAttribPointer -Ignore glVertexPointer +#Ignore glVertexPointer Ignore glWeightPointerOES diff --git a/make/gl-impl-CustomCCode-gl2.c b/make/gl-impl-CustomCCode-gl2.c new file mode 100644 index 000000000..4764097c6 --- /dev/null +++ b/make/gl-impl-CustomCCode-gl2.c @@ -0,0 +1,15 @@ +/* Java->C glue code: + * Java package: net.java.games.jogl.impl.GLImpl + * Java method: long dispatch_glMapBuffer(int target, int access) + * C function: void * glMapBuffer(GLenum target, GLenum access); + */ +JNIEXPORT jlong JNICALL +Java_com_sun_opengl_impl_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; +} + diff --git a/make/gl-impl-CustomCCode-gl2es12.c b/make/gl-impl-CustomCCode-gl2es12.c new file mode 100644 index 000000000..62ce45b5c --- /dev/null +++ b/make/gl-impl-CustomCCode-gl2es12.c @@ -0,0 +1,15 @@ +/* Java->C glue code: + * Java package: net.java.games.jogl.impl.GLImpl + * Java method: long dispatch_glMapBuffer(int target, int access) + * C function: void * glMapBuffer(GLenum target, GLenum access); + */ +JNIEXPORT jlong JNICALL +Java_com_sun_opengl_impl_GL2ES12Impl_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; +} + diff --git a/make/gl-impl-CustomCCode-gles1.c b/make/gl-impl-CustomCCode-gles1.c new file mode 100644 index 000000000..caf804903 --- /dev/null +++ b/make/gl-impl-CustomCCode-gles1.c @@ -0,0 +1,16 @@ +typedef GLvoid* (GL_APIENTRY* PFNGLMAPBUFFERPROC) (GLenum target, GLenum access); +/* Java->C glue code: + * Java package: net.java.games.jogl.impl.GLImpl + * Java method: long dispatch_glMapBuffer(int target, int access) + * C function: void * glMapBuffer(GLenum target, GLenum access); + */ +JNIEXPORT jlong JNICALL +Java_com_sun_opengl_impl_GLES1Impl_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; +} + diff --git a/make/gl-impl-CustomCCode-gles2.c b/make/gl-impl-CustomCCode-gles2.c new file mode 100644 index 000000000..1be264bd9 --- /dev/null +++ b/make/gl-impl-CustomCCode-gles2.c @@ -0,0 +1,16 @@ +typedef GLvoid* (GL_APIENTRY* PFNGLMAPBUFFERPROC) (GLenum target, GLenum access); +/* Java->C glue code: + * Java package: net.java.games.jogl.impl.GLImpl + * Java method: long dispatch_glMapBuffer(int target, int access) + * C function: void * glMapBuffer(GLenum target, GLenum access); + */ +JNIEXPORT jlong JNICALL +Java_com_sun_opengl_impl_GLES2Impl_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; +} + diff --git a/make/gl-impl-CustomCCode.c b/make/gl-impl-CustomCCode.c deleted file mode 100644 index 20d4b0430..000000000 --- a/make/gl-impl-CustomCCode.c +++ /dev/null @@ -1,33 +0,0 @@ -/* Java->C glue code: - * Java package: net.java.games.jogl.impl.GLImpl - * Java method: long dispatch_glMapBuffer(int target, int access) - * C function: LPVOID glMapBuffer(GLenum target, GLenum access); - */ -/* -JNIEXPORT jlong JNICALL -Java_com_sun_opengl_impl_GLImpl_dispatch_1glMapBuffer(JNIEnv *env, jobject _unused, jint target, jint access, jlong glProcAddress) { - PFNGLMAPBUFFERPROC ptr_glMapBuffer; - LPVOID _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: net.java.games.jogl.impl.GLImpl - * Java method: long dispatch_glMapBufferARB(int target, int access) - * C function: LPVOID glMapBufferARB(GLenum target, GLenum access); - */ -/* -JNIEXPORT jlong JNICALL -Java_com_sun_opengl_impl_GLImpl_dispatch_1glMapBufferARB(JNIEnv *env, jobject _unused, jint target, jint access, jlong glProcAddress) { - PFNGLMAPBUFFERARBPROC ptr_glMapBufferARB; - LPVOID _res; - ptr_glMapBufferARB = (PFNGLMAPBUFFERARBPROC) (intptr_t) glProcAddress; - assert(ptr_glMapBufferARB != NULL); - _res = (* ptr_glMapBufferARB) ((GLenum) target, (GLenum) access); - return (jlong) (intptr_t) _res; -} -*/ diff --git a/make/gl-impl-CustomJavaCode-common.java b/make/gl-impl-CustomJavaCode-common.java index fb8a3ba0b..2ddfccc27 100644 --- a/make/gl-impl-CustomJavaCode-common.java +++ b/make/gl-impl-CustomJavaCode-common.java @@ -77,21 +77,3 @@ return false; } - public final String toString() { - StringBuffer buf = new StringBuffer(); - buf.append("GL: "); - buf.append(getClass().getName()); - buf.append(" (GLContext: "); - GLContext context = getContext(); - buf.append(context.getClass().getName()); - buf.append(", GLDrawable: "); - GLDrawable drawable = context.getGLDrawable(); - buf.append(drawable.getClass().getName()); - buf.append(", Factory: "); - GLDrawableFactory factory = drawable.getFactory(); - buf.append(factory.getClass().getName()); - buf.append(")"); - return buf.toString(); - } - - diff --git a/make/gl-impl-CustomJavaCode-gl2.java b/make/gl-impl-CustomJavaCode-gl2.java index 43faac362..2efdfd94c 100644 --- a/make/gl-impl-CustomJavaCode-gl2.java +++ b/make/gl-impl-CustomJavaCode-gl2.java @@ -351,4 +351,21 @@ native private long dispatch_glMapBuffer(int target, int access, long glProcAddr // nothing to do } + public final String toString() { + StringBuffer buf = new StringBuffer(); + buf.append("GL: "); + buf.append(getClass().getName()); + buf.append(" (GLContext: "); + GLContext context = getContext(); + buf.append(context.getClass().getName()); + buf.append(", GLDrawable: "); + GLDrawable drawable = context.getGLDrawable(); + buf.append(drawable.getClass().getName()); + buf.append(", Factory: "); + GLDrawableFactory factory = drawable.getFactory(); + buf.append(factory.getClass().getName()); + buf.append(")"); + return buf.toString(); + } + diff --git a/make/gl-impl-CustomJavaCode-gl2_es2.java b/make/gl-impl-CustomJavaCode-gl2_es2.java index 064a8cb08..cdc5c3898 100644 --- a/make/gl-impl-CustomJavaCode-gl2_es2.java +++ b/make/gl-impl-CustomJavaCode-gl2_es2.java @@ -1,4 +1,106 @@ + public String glGetShaderInfoLog(int shaderObj) { + int[] infoLogLength=new int[1]; + glGetShaderiv(shaderObj, GL_INFO_LOG_LENGTH, infoLogLength, 0); + + if(infoLogLength[0]==0) { + return "(InfoLog null)"; + } + int[] charsWritten=new int[1]; + byte[] infoLogBytes = new byte[infoLogLength[0]]; + glGetShaderInfoLog(shaderObj, infoLogLength[0], charsWritten, 0, infoLogBytes, 0); + + return new String(infoLogBytes, 0, charsWritten[0]); + } + + public String glGetProgramInfoLog(int programObj) { + int[] infoLogLength=new int[1]; + glGetProgramiv(programObj, GL_INFO_LOG_LENGTH, infoLogLength, 0); + + if(infoLogLength[0]==0) { + return "(InfoLog null)"; + } + int[] charsWritten=new int[1]; + byte[] infoLogBytes = new byte[infoLogLength[0]]; + glGetProgramInfoLog(programObj, infoLogLength[0], charsWritten, 0, infoLogBytes, 0); + + return new String(infoLogBytes, 0, charsWritten[0]); + } + + public boolean glIsShaderStatusValid(int shaderObj, int name) { + return glIsShaderStatusValid(shaderObj, name, null); + } + public boolean glIsShaderStatusValid(int shaderObj, int name, PrintStream verboseOut) { + int[] ires = new int[1]; + glGetShaderiv(shaderObj, name, ires, 0); + + boolean res = ires[0]==1; + if(!res && null!=verboseOut) { + verboseOut.println("Shader status invalid: "+glGetShaderInfoLog(shaderObj)); + } + return res; + } + public boolean glIsShaderStatusValid(IntBuffer shaders, int name) { + return glIsShaderStatusValid(shaders, name, null); + } + public boolean glIsShaderStatusValid(IntBuffer shaders, int name, PrintStream verboseOut) { + boolean res = true; + shaders.rewind(); + while(shaders.hasRemaining()) { + res = glIsShaderStatusValid(shaders.get(), name, verboseOut) && res; + } + shaders.rewind(); + return res; + } + + public boolean glIsProgramStatusValid(int programObj, int name) { + int[] ires = new int[1]; + glGetProgramiv(programObj, name, ires, 0); + + return ires[0]==1; + } + + public boolean glIsProgramValid(int programObj) { + return glIsProgramValid(programObj, null); + } + public boolean glIsProgramValid(int programObj, PrintStream verboseOut) { + int[] ires = new int[1]; + if(!glIsProgram(programObj)) { + if(null!=verboseOut) { + verboseOut.println("Program name invalid: "+programObj); + } + return false; + } + if(!glIsProgramStatusValid(programObj, GL_LINK_STATUS)) { + if(null!=verboseOut) { + verboseOut.println("Program link failed: "+programObj+"\n\t"+ glGetProgramInfoLog(programObj)); + } + return false; + } + if(!glIsProgramStatusValid(programObj, GL_VALIDATE_STATUS)) { + if(null!=verboseOut) { + verboseOut.println("Program status invalid: "+programObj+"\n\t"+ glGetProgramInfoLog(programObj)); + } + return false; + } + glValidateProgram(programObj); + if(!glIsProgramStatusValid(programObj, GL_VALIDATE_STATUS)) { + if(null!=verboseOut) { + verboseOut.println("Program validation failed: "+programObj+"\n\t"+ glGetProgramInfoLog(programObj)); + } + return false; + } + return true; + } + + public void glCreateShader(int type, IntBuffer shaders) { + shaders.clear(); + while(shaders.hasRemaining()) { + shaders.put(glCreateShader(type)); + } + shaders.rewind(); + } + public void glShaderSource(int shader, java.lang.String[] source) { @@ -72,4 +174,62 @@ throw new GLException("Method \"glShaderBinaryOrSource\" without binary nor source"); } + public void glCompileShader(IntBuffer shaders) + { + shaders.rewind(); + while(shaders.hasRemaining()) { + glCompileShader(shaders.get()); + } + shaders.rewind(); + } + + public boolean glCreateCompileShader(IntBuffer shader, int shaderType, + int binFormat, java.nio.Buffer bin, + java.lang.String[][] sources) + { + return glCreateCompileShader(shader, shaderType, + binFormat, bin, + sources, null); + } + + public boolean glCreateCompileShader(IntBuffer shader, int shaderType, + int binFormat, java.nio.Buffer bin, + java.lang.String[][] sources, + PrintStream verboseOut) + { + glCreateShader(shaderType, shader); + + glShaderBinaryOrSource(shader, binFormat, bin, sources); + + glCompileShader(shader); + + return glIsShaderStatusValid(shader, GL_COMPILE_STATUS, verboseOut); + } + + public void glAttachShader(int program, IntBuffer shaders) + { + shaders.rewind(); + while(shaders.hasRemaining()) { + glAttachShader(program, shaders.get()); + } + shaders.rewind(); + } + + public void glDetachShader(int program, IntBuffer shaders) + { + shaders.rewind(); + while(shaders.hasRemaining()) { + glDetachShader(program, shaders.get()); + } + shaders.rewind(); + } + + public void glDeleteShader(IntBuffer shaders) { + shaders.rewind(); + while(shaders.hasRemaining()) { + glDeleteShader(shaders.get()); + } + shaders.clear(); + } + diff --git a/make/gl-impl-CustomJavaCode-gl2es12.java b/make/gl-impl-CustomJavaCode-gl2es12.java index 0fe69bccd..4f5dbae1c 100644 --- a/make/gl-impl-CustomJavaCode-gl2es12.java +++ b/make/gl-impl-CustomJavaCode-gl2es12.java @@ -323,4 +323,20 @@ native private long dispatch_glMapBuffer(int target, int access, long glProcAddr // nothing to do } + public final String toString() { + StringBuffer buf = new StringBuffer(); + buf.append("GL: "); + buf.append(getClass().getName()); + buf.append(" (GLContext: "); + GLContext context = getContext(); + buf.append(context.getClass().getName()); + buf.append(", GLDrawable: "); + GLDrawable drawable = context.getGLDrawable(); + buf.append(drawable.getClass().getName()); + buf.append(", Factory: "); + GLDrawableFactory factory = drawable.getFactory(); + buf.append(factory.getClass().getName()); + buf.append(")"); + return buf.toString(); + } diff --git a/make/gl-impl-CustomJavaCode-gles1.java b/make/gl-impl-CustomJavaCode-gles1.java index b29393e17..0715fb844 100755 --- a/make/gl-impl-CustomJavaCode-gles1.java +++ b/make/gl-impl-CustomJavaCode-gles1.java @@ -253,3 +253,21 @@ 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); + + public final String toString() { + StringBuffer buf = new StringBuffer(); + buf.append("GL: "); + buf.append(getClass().getName()); + buf.append(" (GLContext: "); + GLContext context = getContext(); + buf.append(context.getClass().getName()); + buf.append(", GLDrawable: "); + GLDrawable drawable = context.getGLDrawable(); + buf.append(drawable.getClass().getName()); + buf.append(", Factory: "); + GLDrawableFactory factory = drawable.getFactory(); + buf.append(factory.getClass().getName()); + buf.append(")"); + return buf.toString(); + } + diff --git a/make/gl-impl-CustomJavaCode-gles2.java b/make/gl-impl-CustomJavaCode-gles2.java index 24618485b..f2682ab74 100755 --- a/make/gl-impl-CustomJavaCode-gles2.java +++ b/make/gl-impl-CustomJavaCode-gles2.java @@ -5,6 +5,7 @@ private boolean inBeginEndPair; public GLES2Impl(GLContextImpl context) { this._context = context; this.bufferSizeTracker = context.getBufferSizeTracker(); + this.enableFixedFunctionEmulationMode(FIXED_EMULATION_MATRIX); } public boolean isFunctionAvailable(String glFunctionName) { @@ -264,3 +265,335 @@ 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); +public void glClearDepth(double depth) { + glClearDepthf((float)depth); +} + +public void glDepthRange(double zNear, double zFar) { + glDepthRangef((float)zNear, (float)zFar); +} + +protected int fixedFunctionEmulationMode = 0; + +protected boolean fixedFunctionShaderActive=false; +protected FixedFuncShader fixedFunction=null; +protected ShaderData shaderData=null; + +protected boolean fixedFunctionMatrixEnabled=false; +protected PMVMatrix pmvMatrix = null; + +public void enableFixedFunctionEmulationMode(int modes) { + // clear unsupported modes + modes = modes & ~FIXED_EMULATION_NORMALLIGHT; + + fixedFunctionEmulationMode|=modes; + + if( 0 != (modes & FIXED_EMULATION_MATRIX ) ) { + if ( !fixedFunctionMatrixEnabled) { + // setup ressources + fixedFunctionMatrixEnabled=true; + + pmvMatrix = new PMVMatrix(); + } + } + + // currently only for shader type: FIXED_EMULATION_VERTEXCOLOR + if( 0 != (modes & FIXED_EMULATION_VERTEXCOLOR ) ) { + fixedFunctionShaderActive=true; + if(null==fixedFunction) { + if( 0 != (modes & FIXED_EMULATION_TEXTURE ) ) { + shaderData = new FixedFuncShaderVertexColorTexture(); + } else { + shaderData = new FixedFuncShaderVertexColor(); + } + fixedFunction = new FixedFuncShader(this, pmvMatrix, shaderData); + } + } +} + +public void disableFixedFunctionEmulationMode(int modes) { + // clear unsupported modes + modes = modes & ~FIXED_EMULATION_NORMALLIGHT; + + fixedFunctionEmulationMode&=~modes; + + if( 0 != (modes & FIXED_EMULATION_MATRIX ) ) { + if ( fixedFunctionMatrixEnabled) { + // release ressources + fixedFunctionMatrixEnabled=false; + pmvMatrix = null; + } + } + + // currently only for shader type: FIXED_EMULATION_VERTEXCOLOR + if( 0 != (modes & FIXED_EMULATION_VERTEXCOLOR ) ) { + if(null!=fixedFunction) { + fixedFunction.release(this); + } + fixedFunctionShaderActive=false; + } +} + +public int getEnabledFixedFunctionEmulationModes() { + return fixedFunctionEmulationMode; +} + +public PMVMatrix getPMVMatrix() { + return pmvMatrix; +} + +public int glGetMatrixMode() { + if(!fixedFunctionMatrixEnabled) { + throw new GLUnsupportedException("not enabled"); + } + return pmvMatrix.glGetMatrixMode(); +} +public void glMatrixMode(int mode) { + if(!fixedFunctionMatrixEnabled) { + throw new GLUnsupportedException("not enabled"); + } + pmvMatrix.glMatrixMode(mode); +} +public final FloatBuffer glGetPMVMatrixf() { + if(!fixedFunctionMatrixEnabled) { + throw new GLUnsupportedException("not enabled"); + } + return pmvMatrix.glGetPMVMatrixf(); +} +public FloatBuffer glGetMatrixf(int matrixName) { + if(!fixedFunctionMatrixEnabled) { + throw new GLUnsupportedException("not enabled"); + } + return pmvMatrix.glGetMatrixf(matrixName); +} + +public FloatBuffer glGetMatrixf() { + if(!fixedFunctionMatrixEnabled) { + throw new GLUnsupportedException("not enabled"); + } + return pmvMatrix.glGetMatrixf(); +} + +public void glLoadMatrixf(java.nio.FloatBuffer m) { + if(!fixedFunctionMatrixEnabled) { + throw new GLUnsupportedException("not enabled"); + } + pmvMatrix.glLoadMatrixf(m); +} +public void glLoadMatrixf(float[] m, int m_offset) { + glLoadMatrixf(BufferUtil.newFloatBuffer(m, m_offset)); +} +public void glPopMatrix() { + if(!fixedFunctionMatrixEnabled) { + throw new GLUnsupportedException("not enabled"); + } + pmvMatrix.glPopMatrix(); +} + +public void glPushMatrix() { + if(!fixedFunctionMatrixEnabled) { + throw new GLUnsupportedException("not enabled"); + } + pmvMatrix.glPushMatrix(); +} + +public void glLoadIdentity() { + if(!fixedFunctionMatrixEnabled) { + throw new GLUnsupportedException("not enabled"); + } + pmvMatrix.glLoadIdentity(); +} +public void glMultMatrixf(java.nio.FloatBuffer m) { + if(!fixedFunctionMatrixEnabled) { + throw new GLUnsupportedException("not enabled"); + } + pmvMatrix.glMultMatrixf(m); +} +public void glMultMatrixf(float[] m, int m_offset) { + glMultMatrixf(BufferUtil.newFloatBuffer(m, m_offset)); +} +public void glTranslatef(float x, float y, float z) { + if(!fixedFunctionMatrixEnabled) { + throw new GLUnsupportedException("not enabled"); + } + pmvMatrix.glTranslatef(x, y, z); +} +public void glRotatef(float angdeg, float x, float y, float z) { + if(!fixedFunctionMatrixEnabled) { + throw new GLUnsupportedException("not enabled"); + } + pmvMatrix.glRotatef(angdeg, x, y, z); +} + +public void glScalef(float x, float y, float z) { + if(!fixedFunctionMatrixEnabled) { + throw new GLUnsupportedException("not enabled"); + } + pmvMatrix.glScalef(x, y, z); +} +public void glOrthof(float left, float right, float bottom, float top, float zNear, float zFar) { + if(!fixedFunctionMatrixEnabled) { + throw new GLUnsupportedException("not enabled"); + } + pmvMatrix.glOrthof(left, right, bottom, top, zNear, zFar); +} +public void glFrustumf(float left, float right, float bottom, float top, float zNear, float zFar) { + if(!fixedFunctionMatrixEnabled) { + throw new GLUnsupportedException("not enabled"); + } + pmvMatrix.glFrustumf(left, right, bottom, top, zNear, zFar); +} + +public void glEnableClientState(int glArrayName) { + if(!fixedFunctionShaderActive) { + throw new GLUnsupportedException("not enabled"); + } + fixedFunction.glEnableClientState(this, glArrayName); +} +public void glDisableClientState(int glArrayName) { + if(!fixedFunctionShaderActive) { + throw new GLUnsupportedException("not enabled"); + } + fixedFunction.glDisableClientState(this, glArrayName); +} +public void glVertexPointer(int size, int type, int stride, java.nio.Buffer pointer) { + if(!fixedFunctionShaderActive) { + throw new GLUnsupportedException("not enabled"); + } + checkArrayVBODisabled(); + BufferFactory.rangeCheck(pointer, 1); + if (!BufferFactory.isDirect(pointer)) { + throw new GLException("Argument \"pointer\" was not a direct buffer"); } + fixedFunction.glVertexPointer(this, size, type, stride, pointer); +} +public void glVertexPointer(int size, int type, int stride, long pointer_buffer_offset) { + if(!fixedFunctionShaderActive) { + throw new GLUnsupportedException("not enabled"); + } + checkArrayVBOEnabled(); + fixedFunction.glVertexPointer(this, size, type, stride, pointer_buffer_offset); +} + +public void glColorPointer(int size, int type, int stride, java.nio.Buffer pointer) { + if(!fixedFunctionShaderActive) { + throw new GLUnsupportedException("not enabled"); + } + checkArrayVBODisabled(); + BufferFactory.rangeCheck(pointer, 1); + if (!BufferFactory.isDirect(pointer)) { + throw new GLException("Argument \"pointer\" was not a direct buffer"); } + fixedFunction.glColorPointer(this, size, type, stride, pointer); +} +public void glColorPointer(int size, int type, int stride, long pointer_buffer_offset) { + if(!fixedFunctionShaderActive) { + throw new GLUnsupportedException("not enabled"); + } + checkArrayVBOEnabled(); + fixedFunction.glColorPointer(this, size, type, stride, pointer_buffer_offset); +} +public void glColor4f(float red, float green, float blue, float alpha) { + if(!fixedFunctionShaderActive) { + throw new GLUnsupportedException("not enabled"); + } + fixedFunction.glColor4fv(this, BufferUtil.newFloatBuffer(new float[] { red, green, blue, alpha })); +} + +public void glNormalPointer(int type, int stride, java.nio.Buffer pointer) { + if(!fixedFunctionShaderActive) { + throw new GLUnsupportedException("not enabled"); + } + checkArrayVBODisabled(); + BufferFactory.rangeCheck(pointer, 1); + if (!BufferFactory.isDirect(pointer)) { + throw new GLException("Argument \"pointer\" was not a direct buffer"); } + fixedFunction.glNormalPointer(this, type, stride, pointer); +} +public void glNormalPointer(int type, int stride, long pointer_buffer_offset) { + if(!fixedFunctionShaderActive) { + throw new GLUnsupportedException("not enabled"); + } + checkArrayVBOEnabled(); + fixedFunction.glNormalPointer(this, type, stride, pointer_buffer_offset); +} + +public void glTexCoordPointer(int size, int type, int stride, java.nio.Buffer pointer) { + if(!fixedFunctionShaderActive) { + throw new GLUnsupportedException("not enabled"); + } + checkArrayVBODisabled(); + BufferFactory.rangeCheck(pointer, 1); + if (!BufferFactory.isDirect(pointer)) { + throw new GLException("Argument \"pointer\" was not a direct buffer"); } + fixedFunction.glTexCoordPointer(this, size, type, stride, pointer); +} +public void glTexCoordPointer(int size, int type, int stride, long pointer_buffer_offset) { + if(!fixedFunctionShaderActive) { + throw new GLUnsupportedException("not enabled"); + } + checkArrayVBOEnabled(); + fixedFunction.glTexCoordPointer(this, size, type, stride, pointer_buffer_offset); +} +private final void glDrawArraysPrologue() { + if(fixedFunctionShaderActive) { + fixedFunction.syncUniforms(this); + } +} +private final void glDrawArraysEpilogue() { + if(fixedFunctionShaderActive) { + fixedFunction.glUseProgram(this, false); + } +} +public void glLightfv(int light, int pname, java.nio.FloatBuffer params) { + if(!fixedFunctionShaderActive) { + throw new GLUnsupportedException("not enabled"); + } + fixedFunction.glLightfv(this, light, pname, params); +} +public void glLightfv(int light, int pname, float[] params, int params_offset) { + glLightfv(light, pname, BufferUtil.newFloatBuffer(params, params_offset)); +} +public void glShadeModel(int mode) { + if(!fixedFunctionShaderActive) { + throw new GLUnsupportedException("not enabled"); + } + fixedFunction.glShadeModel(this, mode); +} + +public final String toString() { + StringBuffer buf = new StringBuffer(); + buf.append("GL: "); + buf.append(getClass().getName()); + buf.append(" (GLContext: "); + GLContext context = getContext(); + buf.append(context.getClass().getName()); + buf.append(", GLDrawable: "); + GLDrawable drawable = context.getGLDrawable(); + buf.append(drawable.getClass().getName()); + buf.append(", Factory: "); + GLDrawableFactory factory = drawable.getFactory(); + buf.append(factory.getClass().getName()); + buf.append(", fixedEmul: [ "); + if( 0 != (fixedFunctionEmulationMode & FIXED_EMULATION_MATRIX) ) { + buf.append("FIXED_EMULATION_MATRIX "); + } + if( 0 != (fixedFunctionEmulationMode & FIXED_EMULATION_VERTEXCOLOR) ) { + buf.append("FIXED_EMULATION_VERTEXCOLOR "); + } + if( 0 != (fixedFunctionEmulationMode & FIXED_EMULATION_TEXTURE) ) { + buf.append("FIXED_EMULATION_TEXTURE "); + } + if( 0 != (fixedFunctionEmulationMode & FIXED_EMULATION_NORMALLIGHT) ) { + buf.append("FIXED_EMULATION_NORMALLIGHT "); + } + buf.append("], matrixEnabled: "+fixedFunctionMatrixEnabled); + buf.append(", shaderData: "+shaderData); + buf.append(", shaderActive: "+fixedFunctionShaderActive); + if(null!=pmvMatrix) { + buf.append(", matrixDirty: "+pmvMatrix.isDirty()); + } + buf.append(" )"); + + return buf.toString(); +} + + diff --git a/make/glu-CustomJavaCode-base.java b/make/glu-CustomJavaCode-base.java index 26396e71f..8e2127804 100755 --- a/make/glu-CustomJavaCode-base.java +++ b/make/glu-CustomJavaCode-base.java @@ -100,6 +100,11 @@ public static final GLU createGLU(String profile) throws GLUnsupportedException return new GLU(); } +public GLU() +{ + this.project = new ProjectFloat(); +} + public static final GL getCurrentGL() throws GLException { GLContext curContext = GLContext.getCurrent(); if (curContext == null) { @@ -1151,106 +1156,193 @@ public static final int GLU_TESS_WINDING_NEGATIVE = 100133; public static final int GLU_TESS_WINDING_ABS_GEQ_TWO = 100134; public static final double GLU_TESS_MAX_COORD = 1.0e150; -public void gluCylinder(GLUquadric quad, double base, double top, double height, int slices, int stacks) { - throw new GLUnsupportedException("not implemented"); +//---------------------------------------------------------------------- +// Quadric functionality +// + +protected static boolean availableGLUquadricImpl = false; +protected static boolean checkedGLUquadricImpl = false; + +/** + * Optional, throws GLUnsupportedException if not available in profile + */ +protected static final void validateGLUquadricImpl() { + if(!checkedGLUquadricImpl) { + availableGLUquadricImpl = GLReflection.isClassAvailable("com.sun.opengl.impl.glu.GLUquadricImpl"); + checkedGLUquadricImpl = true; + } + if(!availableGLUquadricImpl) { + throw new GLUnsupportedException("GLUquadric not available (GLUquadricImpl)"); + } } -/** Interface to C language function: <br> <code> void gluDeleteQuadric(GLUquadric * quad); </code> */ -public void gluDeleteQuadric(GLUquadric quad) { - throw new GLUnsupportedException("not implemented"); + +/** Option (throws GLUnsupportedException if not available in profile). <br> Interface to C language function: <br> <code> void gluCylinder(GLUquadric * quad, GLdouble base, GLdouble top, GLdouble height, GLint slices, GLint stacks); </code> */ +public final void gluCylinder(GLUquadric quad, double base, double top, double height, int slices, int stacks) { + validateGLUquadricImpl(); + ((GLUquadricImpl) quad).drawCylinder(getCurrentGL(), (float) base, (float) top, (float) height, slices, stacks); } -/** Interface to C language function: <br> <code> void gluDisk(GLUquadric * quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops); </code> */ -public void gluDisk(GLUquadric quad, double inner, double outer, int slices, int loops) { - throw new GLUnsupportedException("not implemented"); +/** Option (throws GLUnsupportedException if not available in profile). <br> Interface to C language function: <br> <code> void gluDeleteQuadric(GLUquadric * quad); </code> */ +public final void gluDeleteQuadric(GLUquadric quad) { + validateGLUquadricImpl(); } -/** Interface to C language function: <br> <code> GLUquadric * gluNewQuadric(void); </code> */ -public GLUquadric gluNewQuadric() { - throw new GLUnsupportedException("not implemented"); +/** Option (throws GLUnsupportedException if not available in profile). <br> Interface to C language function: <br> <code> void gluDisk(GLUquadric * quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops); </code> */ +public final void gluDisk(GLUquadric quad, double inner, double outer, int slices, int loops) { + validateGLUquadricImpl(); + ((GLUquadricImpl) quad).drawDisk(getCurrentGL(), (float) inner, (float) outer, slices, loops); } -/** Interface to C language function: <br> <code> void gluPartialDisk(GLUquadric * quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops, GLdouble start, GLdouble sweep); </code> */ -public void gluPartialDisk(GLUquadric quad, double inner, double outer, int slices, int loops, double start, double sweep) { - throw new GLUnsupportedException("not implemented"); +/** Option (throws GLUnsupportedException if not available in profile). <br> Interface to C language function: <br> <code> GLUquadric * gluNewQuadric(void); </code> */ +public final GLUquadric gluNewQuadric() { + validateGLUquadricImpl(); + return new GLUquadricImpl(); } -/** Interface to C language function: <br> <code> void gluQuadricDrawStyle(GLUquadric * quad, GLenum draw); </code> */ -public void gluQuadricDrawStyle(GLUquadric quad, int draw) { - throw new GLUnsupportedException("not implemented"); +/** Option (throws GLUnsupportedException if not available in profile). <br> Interface to C language function: <br> <code> void gluPartialDisk(GLUquadric * quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops, GLdouble start, GLdouble sweep); </code> */ +public final void gluPartialDisk(GLUquadric quad, double inner, double outer, int slices, int loops, double start, double sweep) { + validateGLUquadricImpl(); + ((GLUquadricImpl) quad).drawPartialDisk(getCurrentGL(), (float) inner, (float) outer, slices, loops, (float) start, (float) sweep); } -/** Interface to C language function: <br> <code> void gluQuadricNormals(GLUquadric * quad, GLenum normal); </code> */ -public void gluQuadricNormals(GLUquadric quad, int normal) { - throw new GLUnsupportedException("not implemented"); +/** Option (throws GLUnsupportedException if not available in profile). <br> Interface to C language function: <br> <code> void gluQuadricDrawStyle(GLUquadric * quad, GLenum draw); </code> */ +public final void gluQuadricDrawStyle(GLUquadric quad, int draw) { + validateGLUquadricImpl(); + ((GLUquadricImpl) quad).setDrawStyle(draw); } -/** Interface to C language function: <br> <code> void gluQuadricOrientation(GLUquadric * quad, GLenum orientation); </code> */ -public void gluQuadricOrientation(GLUquadric quad, int orientation) { - throw new GLUnsupportedException("not implemented"); +/** Option (throws GLUnsupportedException if not available in profile). <br> Interface to C language function: <br> <code> void gluQuadricNormals(GLUquadric * quad, GLenum normal); </code> */ +public final void gluQuadricNormals(GLUquadric quad, int normal) { + validateGLUquadricImpl(); + ((GLUquadricImpl) quad).setNormals(normal); } -/** Interface to C language function: <br> <code> void gluQuadricTexture(GLUquadric * quad, GLboolean texture); </code> */ -public void gluQuadricTexture(GLUquadric quad, boolean texture) { - throw new GLUnsupportedException("not implemented"); +/** Option (throws GLUnsupportedException if not available in profile). <br> Interface to C language function: <br> <code> void gluQuadricOrientation(GLUquadric * quad, GLenum orientation); </code> */ +public final void gluQuadricOrientation(GLUquadric quad, int orientation) { + validateGLUquadricImpl(); + ((GLUquadricImpl) quad).setOrientation(orientation); } -/** Interface to C language function: <br> <code> void gluSphere(GLUquadric * quad, GLdouble radius, GLint slices, GLint stacks); </code> */ -public void gluSphere(GLUquadric quad, double radius, int slices, int stacks) { - throw new GLUnsupportedException("not implemented"); +/** Option (throws GLUnsupportedException if not available in profile). <br> Interface to C language function: <br> <code> void gluQuadricTexture(GLUquadric * quad, GLboolean texture); </code> */ +public final void gluQuadricTexture(GLUquadric quad, boolean texture) { + validateGLUquadricImpl(); + ((GLUquadricImpl) quad).setTextureFlag(texture); } -public void gluOrtho2D(float left, float right, float bottom, float top) { - throw new GLUnsupportedException("not implemented"); +/** Option (throws GLUnsupportedException if not available in profile). <br> Interface to C language function: <br> <code> void gluSphere(GLUquadric * quad, GLdouble radius, GLint slices, GLint stacks); </code> */ +public final void gluSphere(GLUquadric quad, double radius, int slices, int stacks) { + validateGLUquadricImpl(); + ((GLUquadricImpl) quad).drawSphere(getCurrentGL(), (float) radius, slices, stacks); } -public void gluOrtho2D(double left, double right, double bottom, double top) { - throw new GLUnsupportedException("not implemented"); +//---------------------------------------------------------------------- +// Projection routines +// + +private ProjectFloat project; + +public void gluOrtho2D(float left, float right, float bottom, float top) { + project.gluOrtho2D(getCurrentGL(), left, right, bottom, top); } public void gluPerspective(float fovy, float aspect, float zNear, float zFar) { - throw new GLUnsupportedException("not implemented"); + project.gluPerspective(getCurrentGL(), fovy, aspect, zNear, zFar); } -public void gluPerspective(double fovy, double aspect, double zNear, double zFar) { - throw new GLUnsupportedException("not implemented"); +public void gluLookAt(float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ) { + project.gluLookAt(getCurrentGL(), eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ); } -public void gluLookAt(float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ) { - throw new GLUnsupportedException("not implemented"); +/** Interface to C language function: <br> <code> GLint gluProject(GLdouble objX, GLdouble objY, GLdouble objZ, const GLdouble * model, const GLdouble * proj, const GLint * view, GLdouble * winX, GLdouble * winY, GLdouble * winZ); </code> + * <P> Accepts the outgoing window coordinates as a single array. + */ +public boolean gluProject(float objX, float objY, float objZ, float[] model, int model_offset, float[] proj, int proj_offset, int[] view, int view_offset, float[] winPos, int winPos_offset) { + return project.gluProject(objX, objY, objZ, model, model_offset, proj, proj_offset, view, view_offset, winPos, winPos_offset); +} + +/** Interface to C language function: <br> <code> GLint gluProject(GLdouble objX, GLdouble objY, GLdouble objZ, const GLdouble * model, const GLdouble * proj, const GLint * view, GLdouble * winX, GLdouble * winY, GLdouble * winZ); </code> + * <P> Accepts the outgoing window coordinates as a single buffer. + */ +public boolean gluProject(float objX, float objY, float objZ, java.nio.FloatBuffer model, java.nio.FloatBuffer proj, java.nio.IntBuffer view, java.nio.FloatBuffer winPos) { + return project.gluProject(objX, objY, objZ, model, proj, view, winPos); +} + +/** 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(float winX, float winY, float winZ, float[] model, int model_offset, float[] proj, int proj_offset, int[] view, int view_offset, float[] objPos, int objPos_offset) { + return project.gluUnProject(winX, winY, winZ, model, model_offset, proj, proj_offset, view, view_offset, objPos, objPos_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 buffer. + */ +public boolean gluUnProject(float winX, float winY, float winZ, java.nio.FloatBuffer model, java.nio.FloatBuffer proj, java.nio.IntBuffer view, java.nio.FloatBuffer objPos) { + return project.gluUnProject(winX, winY, winZ, model, proj, view, objPos); +} + +/** 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(float winX, float winY, float winZ, float clipW, float[] model, int model_offset, float[] proj, int proj_offset, int[] view, int view_offset, float nearVal, float farVal, float[] objPos, int objPos_offset) { + return project.gluUnProject4(winX, winY, winZ, clipW, model, model_offset, proj, proj_offset, view, view_offset, nearVal, farVal, 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 buffer. + */ +public boolean gluUnProject4(float winX, float winY, float winZ, float clipW, java.nio.FloatBuffer model, java.nio.FloatBuffer proj, java.nio.IntBuffer view, float nearVal, float farVal, java.nio.FloatBuffer objPos) { + return project.gluUnProject4(winX, winY, winZ, clipW, model, proj, view, nearVal, farVal, objPos); +} + +public void gluPickMatrix(float x, float y, float delX, float delY, int[] viewport, int viewport_offset) { + project.gluPickMatrix(getCurrentGL(), x, y, delX, delY, viewport, viewport_offset); +} + +public void gluPickMatrix(float x, float y, float delX, float delY, java.nio.IntBuffer viewport) { + project.gluPickMatrix(getCurrentGL(), x, y, delX, delY, viewport); +} + +public void gluOrtho2D(double left, double right, double bottom, double top) { + project.gluOrtho2D(getCurrentGL(), (float)left, (float)right, (float)bottom, (float)top); +} + +public void gluPerspective(double fovy, double aspect, double zNear, double zFar) { + project.gluPerspective(getCurrentGL(), (float)fovy, (float)aspect, (float)zNear, (float)zFar); } public void gluLookAt(double eyeX, double eyeY, double eyeZ, double centerX, double centerY, double centerZ, double upX, double upY, double upZ) { - throw new GLUnsupportedException("not implemented"); + project.gluLookAt(getCurrentGL(), (float)eyeX, (float)eyeY, (float)eyeZ, (float)centerX, (float)centerY, (float)centerZ, (float)upX, (float)upY, (float)upZ); } /** Interface to C language function: <br> <code> GLint gluProject(GLdouble objX, GLdouble objY, GLdouble objZ, const GLdouble * model, const GLdouble * proj, const GLint * view, GLdouble * winX, GLdouble * winY, GLdouble * winZ); </code> * <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) { - throw new GLUnsupportedException("not implemented"); + return project.gluProject((float)objX, (float)objY, (float)objZ, BufferUtil.getFloatArray(model), model_offset, BufferUtil.getFloatArray(proj), proj_offset, view, view_offset, BufferUtil.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) { - throw new GLUnsupportedException("not implemented"); + return project.gluUnProject((float)winX, (float)winY, (float)winZ, BufferUtil.getFloatArray(model), model_offset, BufferUtil.getFloatArray(proj), proj_offset, view, view_offset, BufferUtil.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) { - throw new GLUnsupportedException("not implemented"); + return project.gluUnProject4((float)winX, (float)winY, (float)winZ, (float)clipW, BufferUtil.getFloatArray(model), model_offset, BufferUtil.getFloatArray(proj), proj_offset, view, view_offset, (float)nearVal, (float)farVal, BufferUtil.getFloatArray(objPos), objPos_offset); } public void gluPickMatrix(double x, double y, double delX, double delY, int[] viewport, int viewport_offset) { - throw new GLUnsupportedException("not implemented"); + project.gluPickMatrix(getCurrentGL(), (float)x, (float)y, (float)delX, (float)delY, viewport, viewport_offset); } public void gluPickMatrix(double x, double y, double delX, double delY, IntBuffer viewport) { - throw new GLUnsupportedException("not implemented"); + project.gluPickMatrix(getCurrentGL(), (float)x, (float)y, (float)delX, (float)delY, viewport); } /** diff --git a/make/glu-CustomJavaCode-gl2.java b/make/glu-CustomJavaCode-gl2.java index 5aef1a7ac..247e37c87 100644 --- a/make/glu-CustomJavaCode-gl2.java +++ b/make/glu-CustomJavaCode-gl2.java @@ -139,59 +139,6 @@ public final boolean isFunctionAvailable(String gluFunctionName) } //---------------------------------------------------------------------- -// Quadric functionality -// - -/** Interface to C language function: <br> <code> void gluCylinder(GLUquadric * quad, GLdouble base, GLdouble top, GLdouble height, GLint slices, GLint stacks); </code> */ -public final void gluCylinder(GLUquadric quad, double base, double top, double height, int slices, int stacks) { - ((GLUquadricImpl) quad).drawCylinder(getCurrentGL2(), (float) base, (float) top, (float) height, slices, stacks); -} - -/** Interface to C language function: <br> <code> void gluDeleteQuadric(GLUquadric * quad); </code> */ -public final void gluDeleteQuadric(GLUquadric quad) { -} - -/** Interface to C language function: <br> <code> void gluDisk(GLUquadric * quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops); </code> */ -public final void gluDisk(GLUquadric quad, double inner, double outer, int slices, int loops) { - ((GLUquadricImpl) quad).drawDisk(getCurrentGL2(), (float) inner, (float) outer, slices, loops); -} - -/** Interface to C language function: <br> <code> GLUquadric * gluNewQuadric(void); </code> */ -public final GLUquadric gluNewQuadric() { - return new GLUquadricImpl(); -} - -/** Interface to C language function: <br> <code> void gluPartialDisk(GLUquadric * quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops, GLdouble start, GLdouble sweep); </code> */ -public final void gluPartialDisk(GLUquadric quad, double inner, double outer, int slices, int loops, double start, double sweep) { - ((GLUquadricImpl) quad).drawPartialDisk(getCurrentGL2(), (float) inner, (float) outer, slices, loops, (float) start, (float) sweep); -} - -/** Interface to C language function: <br> <code> void gluQuadricDrawStyle(GLUquadric * quad, GLenum draw); </code> */ -public final void gluQuadricDrawStyle(GLUquadric quad, int draw) { - ((GLUquadricImpl) quad).setDrawStyle(draw); -} - -/** Interface to C language function: <br> <code> void gluQuadricNormals(GLUquadric * quad, GLenum normal); </code> */ -public final void gluQuadricNormals(GLUquadric quad, int normal) { - ((GLUquadricImpl) quad).setNormals(normal); -} - -/** Interface to C language function: <br> <code> void gluQuadricOrientation(GLUquadric * quad, GLenum orientation); </code> */ -public final void gluQuadricOrientation(GLUquadric quad, int orientation) { - ((GLUquadricImpl) quad).setOrientation(orientation); -} - -/** Interface to C language function: <br> <code> void gluQuadricTexture(GLUquadric * quad, GLboolean texture); </code> */ -public final void gluQuadricTexture(GLUquadric quad, boolean texture) { - ((GLUquadricImpl) quad).setTextureFlag(texture); -} - -/** Interface to C language function: <br> <code> void gluSphere(GLUquadric * quad, GLdouble radius, GLint slices, GLint stacks); </code> */ -public final void gluSphere(GLUquadric quad, double radius, int slices, int stacks) { - ((GLUquadricImpl) quad).drawSphere(getCurrentGL2(), (float) radius, slices, stacks); -} - -//---------------------------------------------------------------------- // Projection routines // diff --git a/make/glu-CustomJavaCode-gl2es1.java b/make/glu-CustomJavaCode-gl2es1.java index 253af74b0..24f161985 100755 --- a/make/glu-CustomJavaCode-gl2es1.java +++ b/make/glu-CustomJavaCode-gl2es1.java @@ -33,7 +33,7 @@ static { public GLUgl2es1() { - this.project = new ProjectFloat(); + super(); } //---------------------------------------------------------------------- @@ -75,195 +75,6 @@ public String gluGetString(int name) { */ //---------------------------------------------------------------------- -// Quadric functionality -// - -protected static boolean availableGLUquadricImpl = false; -protected static boolean checkedGLUquadricImpl = false; - -/** - * Optional, throws GLUnsupportedException if not available in profile - */ -protected static final void validateGLUquadricImpl() { - if(!checkedGLUquadricImpl) { - availableGLUquadricImpl = GLReflection.isClassAvailable("com.sun.opengl.impl.glu.GLUquadricImpl"); - checkedGLUquadricImpl = true; - } - if(!availableGLUquadricImpl) { - throw new GLUnsupportedException("GLUquadric not available (GLUquadricImpl)"); - } -} - - -/** Option (throws GLUnsupportedException if not available in profile). <br> Interface to C language function: <br> <code> void gluCylinder(GLUquadric * quad, GLdouble base, GLdouble top, GLdouble height, GLint slices, GLint stacks); </code> */ -public final void gluCylinder(GLUquadric quad, double base, double top, double height, int slices, int stacks) { - validateGLUquadricImpl(); - ((GLUquadricImpl) quad).drawCylinder(getCurrentGL2ES1(), (float) base, (float) top, (float) height, slices, stacks); -} - -/** Option (throws GLUnsupportedException if not available in profile). <br> Interface to C language function: <br> <code> void gluDeleteQuadric(GLUquadric * quad); </code> */ -public final void gluDeleteQuadric(GLUquadric quad) { - validateGLUquadricImpl(); -} - -/** Option (throws GLUnsupportedException if not available in profile). <br> Interface to C language function: <br> <code> void gluDisk(GLUquadric * quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops); </code> */ -public final void gluDisk(GLUquadric quad, double inner, double outer, int slices, int loops) { - validateGLUquadricImpl(); - ((GLUquadricImpl) quad).drawDisk(getCurrentGL2ES1(), (float) inner, (float) outer, slices, loops); -} - -/** Option (throws GLUnsupportedException if not available in profile). <br> Interface to C language function: <br> <code> GLUquadric * gluNewQuadric(void); </code> */ -public final GLUquadric gluNewQuadric() { - validateGLUquadricImpl(); - return new GLUquadricImpl(); -} - -/** Option (throws GLUnsupportedException if not available in profile). <br> Interface to C language function: <br> <code> void gluPartialDisk(GLUquadric * quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops, GLdouble start, GLdouble sweep); </code> */ -public final void gluPartialDisk(GLUquadric quad, double inner, double outer, int slices, int loops, double start, double sweep) { - validateGLUquadricImpl(); - ((GLUquadricImpl) quad).drawPartialDisk(getCurrentGL2ES1(), (float) inner, (float) outer, slices, loops, (float) start, (float) sweep); -} - -/** Option (throws GLUnsupportedException if not available in profile). <br> Interface to C language function: <br> <code> void gluQuadricDrawStyle(GLUquadric * quad, GLenum draw); </code> */ -public final void gluQuadricDrawStyle(GLUquadric quad, int draw) { - validateGLUquadricImpl(); - ((GLUquadricImpl) quad).setDrawStyle(draw); -} - -/** Option (throws GLUnsupportedException if not available in profile). <br> Interface to C language function: <br> <code> void gluQuadricNormals(GLUquadric * quad, GLenum normal); </code> */ -public final void gluQuadricNormals(GLUquadric quad, int normal) { - validateGLUquadricImpl(); - ((GLUquadricImpl) quad).setNormals(normal); -} - -/** Option (throws GLUnsupportedException if not available in profile). <br> Interface to C language function: <br> <code> void gluQuadricOrientation(GLUquadric * quad, GLenum orientation); </code> */ -public final void gluQuadricOrientation(GLUquadric quad, int orientation) { - validateGLUquadricImpl(); - ((GLUquadricImpl) quad).setOrientation(orientation); -} - -/** Option (throws GLUnsupportedException if not available in profile). <br> Interface to C language function: <br> <code> void gluQuadricTexture(GLUquadric * quad, GLboolean texture); </code> */ -public final void gluQuadricTexture(GLUquadric quad, boolean texture) { - validateGLUquadricImpl(); - ((GLUquadricImpl) quad).setTextureFlag(texture); -} - -/** Option (throws GLUnsupportedException if not available in profile). <br> Interface to C language function: <br> <code> void gluSphere(GLUquadric * quad, GLdouble radius, GLint slices, GLint stacks); </code> */ -public final void gluSphere(GLUquadric quad, double radius, int slices, int stacks) { - validateGLUquadricImpl(); - ((GLUquadricImpl) quad).drawSphere(getCurrentGL2ES1(), (float) radius, slices, stacks); -} - -//---------------------------------------------------------------------- -// Projection routines -// - -private ProjectFloat project; - -public final void gluOrtho2D(float left, float right, float bottom, float top) { - project.gluOrtho2D(getCurrentGL2ES1(), left, right, bottom, top); -} - -public final void gluPerspective(float fovy, float aspect, float zNear, float zFar) { - project.gluPerspective(getCurrentGL2ES1(), fovy, aspect, zNear, zFar); -} - -public final void gluLookAt(float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ) { - project.gluLookAt(getCurrentGL2ES1(), eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ); -} - -/** Interface to C language function: <br> <code> GLint gluProject(GLdouble objX, GLdouble objY, GLdouble objZ, const GLdouble * model, const GLdouble * proj, const GLint * view, GLdouble * winX, GLdouble * winY, GLdouble * winZ); </code> - * <P> Accepts the outgoing window coordinates as a single array. - */ -public final boolean gluProject(float objX, float objY, float objZ, float[] model, int model_offset, float[] proj, int proj_offset, int[] view, int view_offset, float[] winPos, int winPos_offset) { - return project.gluProject(objX, objY, objZ, model, model_offset, proj, proj_offset, view, view_offset, winPos, winPos_offset); -} - -/** Interface to C language function: <br> <code> GLint gluProject(GLdouble objX, GLdouble objY, GLdouble objZ, const GLdouble * model, const GLdouble * proj, const GLint * view, GLdouble * winX, GLdouble * winY, GLdouble * winZ); </code> - * <P> Accepts the outgoing window coordinates as a single buffer. - */ -public final boolean gluProject(float objX, float objY, float objZ, java.nio.FloatBuffer model, java.nio.FloatBuffer proj, java.nio.IntBuffer view, java.nio.FloatBuffer winPos) { - return project.gluProject(objX, objY, objZ, model, proj, view, winPos); -} - -/** 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 final boolean gluUnProject(float winX, float winY, float winZ, float[] model, int model_offset, float[] proj, int proj_offset, int[] view, int view_offset, float[] objPos, int objPos_offset) { - return project.gluUnProject(winX, winY, winZ, model, model_offset, proj, proj_offset, view, view_offset, objPos, objPos_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 buffer. - */ -public final boolean gluUnProject(float winX, float winY, float winZ, java.nio.FloatBuffer model, java.nio.FloatBuffer proj, java.nio.IntBuffer view, java.nio.FloatBuffer objPos) { - return project.gluUnProject(winX, winY, winZ, model, proj, view, objPos); -} - -/** 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 final boolean gluUnProject4(float winX, float winY, float winZ, float clipW, float[] model, int model_offset, float[] proj, int proj_offset, int[] view, int view_offset, float nearVal, float farVal, float[] objPos, int objPos_offset) { - return project.gluUnProject4(winX, winY, winZ, clipW, model, model_offset, proj, proj_offset, view, view_offset, nearVal, farVal, 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 buffer. - */ -public final boolean gluUnProject4(float winX, float winY, float winZ, float clipW, java.nio.FloatBuffer model, java.nio.FloatBuffer proj, java.nio.IntBuffer view, float nearVal, float farVal, java.nio.FloatBuffer objPos) { - return project.gluUnProject4(winX, winY, winZ, clipW, model, proj, view, nearVal, farVal, objPos); -} - -public final void gluPickMatrix(float x, float y, float delX, float delY, int[] viewport, int viewport_offset) { - project.gluPickMatrix(getCurrentGL2ES1(), x, y, delX, delY, viewport, viewport_offset); -} - -public final void gluPickMatrix(float x, float y, float delX, float delY, java.nio.IntBuffer viewport) { - project.gluPickMatrix(getCurrentGL2ES1(), x, y, delX, delY, viewport); -} - -public final void gluOrtho2D(double left, double right, double bottom, double top) { - project.gluOrtho2D(getCurrentGL2ES1(), (float)left, (float)right, (float)bottom, (float)top); -} - -public final void gluPerspective(double fovy, double aspect, double zNear, double zFar) { - project.gluPerspective(getCurrentGL2ES1(), (float)fovy, (float)aspect, (float)zNear, (float)zFar); -} - -public final void gluLookAt(double eyeX, double eyeY, double eyeZ, double centerX, double centerY, double centerZ, double upX, double upY, double upZ) { - project.gluLookAt(getCurrentGL2ES1(), (float)eyeX, (float)eyeY, (float)eyeZ, (float)centerX, (float)centerY, (float)centerZ, (float)upX, (float)upY, (float)upZ); -} - -/** Interface to C language function: <br> <code> GLint gluProject(GLdouble objX, GLdouble objY, GLdouble objZ, const GLdouble * model, const GLdouble * proj, const GLint * view, GLdouble * winX, GLdouble * winY, GLdouble * winZ); </code> - * <P> Accepts the outgoing window coordinates as a single array. - */ -public final 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, BufferUtil.getFloatArray(model), model_offset, BufferUtil.getFloatArray(proj), proj_offset, view, view_offset, BufferUtil.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 final 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, BufferUtil.getFloatArray(model), model_offset, BufferUtil.getFloatArray(proj), proj_offset, view, view_offset, BufferUtil.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 final 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, BufferUtil.getFloatArray(model), model_offset, BufferUtil.getFloatArray(proj), proj_offset, view, view_offset, (float)nearVal, (float)farVal, BufferUtil.getFloatArray(objPos), objPos_offset); -} - -public final void gluPickMatrix(double x, double y, double delX, double delY, int[] viewport, int viewport_offset) { - project.gluPickMatrix(getCurrentGL2ES1(), (float)x, (float)y, (float)delX, (float)delY, viewport, viewport_offset); -} - -public final void gluPickMatrix(double x, double y, double delX, double delY, IntBuffer viewport) { - project.gluPickMatrix(getCurrentGL2ES1(), (float)x, (float)y, (float)delX, (float)delY, viewport); -} - -//---------------------------------------------------------------------- // Mipmap and image scaling functionality protected static boolean availableMipmap = false; |