diff options
author | Sven Gothel <[email protected]> | 2008-08-11 12:16:28 +0000 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2008-08-11 12:16:28 +0000 |
commit | 1ef16ee89df4d0dd4df0c1356e5b52eba20f3850 (patch) | |
tree | 6430cf0e20dd6bfba9b12552e5f8803a6869a312 | |
parent | 2bf0794404b9ec92e13577f3b812a3947b57a0d1 (diff) |
Minor CVM/ES1 fixes
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1747 232f8b59-042b-4e1e-8c03-345bb8c30851
6 files changed, 68 insertions, 20 deletions
diff --git a/make/make.jogl.cdcfp.linux-x86.sh b/make/make.jogl.cdcfp.linux-x86.sh new file mode 100644 index 000000000..e8caa4b57 --- /dev/null +++ b/make/make.jogl.cdcfp.linux-x86.sh @@ -0,0 +1,14 @@ +#! /bin/sh + +. ../../setenv-build-jogl.sh + +# -Dc.compiler.debug=true + +ant -v \ + -Djogl.cdcfp=true \ + -Dgluegen.cpptasks.detected.os=true \ + -DisUnix=true \ + -DisLinux=true \ + -DisLinuxX86=true \ + -DisX11=true \ + $* 2>&1 | tee make.jogl.cdcfp.linux-x86.log diff --git a/src/classes/com/sun/opengl/impl/glsl/FixedFuncShaderVertexColor.java b/src/classes/com/sun/opengl/impl/glsl/FixedFuncShaderVertexColor.java index f327d9570..3d0bed73d 100644 --- a/src/classes/com/sun/opengl/impl/glsl/FixedFuncShaderVertexColor.java +++ b/src/classes/com/sun/opengl/impl/glsl/FixedFuncShaderVertexColor.java @@ -40,13 +40,13 @@ public class FixedFuncShaderVertexColor { "\n"+ "void setTexCoord(in HIGHP vec4 defpos) {\n"+ " mgl_TexCoord[0] = ( 0 != (mgl_TexCoordEnabled & 1) ) ? mgl_MultiTexCoord0 : defpos;\n"+ - " mgl_TexCoord[1] = ( 0 != (mgl_TexCoordEnabled & 2) ) ? mgl_MultiTexCoord0 : defpos;\n"+ - " mgl_TexCoord[2] = ( 0 != (mgl_TexCoordEnabled & 4) ) ? mgl_MultiTexCoord0 : defpos;\n"+ - " mgl_TexCoord[3] = ( 0 != (mgl_TexCoordEnabled & 8) ) ? mgl_MultiTexCoord0 : defpos;\n"+ - " mgl_TexCoord[4] = ( 0 != (mgl_TexCoordEnabled & 16) ) ? mgl_MultiTexCoord0 : defpos;\n"+ - " mgl_TexCoord[5] = ( 0 != (mgl_TexCoordEnabled & 32) ) ? mgl_MultiTexCoord0 : defpos;\n"+ - " mgl_TexCoord[6] = ( 0 != (mgl_TexCoordEnabled & 64) ) ? mgl_MultiTexCoord0 : defpos;\n"+ - " mgl_TexCoord[7] = ( 0 != (mgl_TexCoordEnabled & 128) ) ? mgl_MultiTexCoord0 : defpos;\n"+ + " mgl_TexCoord[1] = ( 0 != (mgl_TexCoordEnabled & 2) ) ? mgl_MultiTexCoord1 : defpos;\n"+ + " mgl_TexCoord[2] = ( 0 != (mgl_TexCoordEnabled & 4) ) ? mgl_MultiTexCoord2 : defpos;\n"+ + " mgl_TexCoord[3] = ( 0 != (mgl_TexCoordEnabled & 8) ) ? mgl_MultiTexCoord3 : defpos;\n"+ + " mgl_TexCoord[4] = ( 0 != (mgl_TexCoordEnabled & 16) ) ? mgl_MultiTexCoord4 : defpos;\n"+ + " mgl_TexCoord[5] = ( 0 != (mgl_TexCoordEnabled & 32) ) ? mgl_MultiTexCoord5 : defpos;\n"+ + " mgl_TexCoord[6] = ( 0 != (mgl_TexCoordEnabled & 64) ) ? mgl_MultiTexCoord6 : defpos;\n"+ + " mgl_TexCoord[7] = ( 0 != (mgl_TexCoordEnabled & 128) ) ? mgl_MultiTexCoord7 : defpos;\n"+ "}\n"+ "\n"+ "void main(void)\n"+ diff --git a/src/classes/com/sun/opengl/impl/glsl/FixedFuncShaderVertexColorLight.java b/src/classes/com/sun/opengl/impl/glsl/FixedFuncShaderVertexColorLight.java index 888ef89c2..2034c2acd 100644 --- a/src/classes/com/sun/opengl/impl/glsl/FixedFuncShaderVertexColorLight.java +++ b/src/classes/com/sun/opengl/impl/glsl/FixedFuncShaderVertexColorLight.java @@ -68,13 +68,13 @@ public class FixedFuncShaderVertexColorLight { "\n"+ "void setTexCoord(in HIGHP vec4 defpos) {\n"+ " mgl_TexCoord[0] = ( 0 != (mgl_TexCoordEnabled & 1) ) ? mgl_MultiTexCoord0 : defpos;\n"+ - " mgl_TexCoord[1] = ( 0 != (mgl_TexCoordEnabled & 2) ) ? mgl_MultiTexCoord0 : defpos;\n"+ - " mgl_TexCoord[2] = ( 0 != (mgl_TexCoordEnabled & 4) ) ? mgl_MultiTexCoord0 : defpos;\n"+ - " mgl_TexCoord[3] = ( 0 != (mgl_TexCoordEnabled & 8) ) ? mgl_MultiTexCoord0 : defpos;\n"+ - " mgl_TexCoord[4] = ( 0 != (mgl_TexCoordEnabled & 16) ) ? mgl_MultiTexCoord0 : defpos;\n"+ - " mgl_TexCoord[5] = ( 0 != (mgl_TexCoordEnabled & 32) ) ? mgl_MultiTexCoord0 : defpos;\n"+ - " mgl_TexCoord[6] = ( 0 != (mgl_TexCoordEnabled & 64) ) ? mgl_MultiTexCoord0 : defpos;\n"+ - " mgl_TexCoord[7] = ( 0 != (mgl_TexCoordEnabled & 128) ) ? mgl_MultiTexCoord0 : defpos;\n"+ + " mgl_TexCoord[1] = ( 0 != (mgl_TexCoordEnabled & 2) ) ? mgl_MultiTexCoord1 : defpos;\n"+ + " mgl_TexCoord[2] = ( 0 != (mgl_TexCoordEnabled & 4) ) ? mgl_MultiTexCoord2 : defpos;\n"+ + " mgl_TexCoord[3] = ( 0 != (mgl_TexCoordEnabled & 8) ) ? mgl_MultiTexCoord3 : defpos;\n"+ + " mgl_TexCoord[4] = ( 0 != (mgl_TexCoordEnabled & 16) ) ? mgl_MultiTexCoord4 : defpos;\n"+ + " mgl_TexCoord[5] = ( 0 != (mgl_TexCoordEnabled & 32) ) ? mgl_MultiTexCoord5 : defpos;\n"+ + " mgl_TexCoord[6] = ( 0 != (mgl_TexCoordEnabled & 64) ) ? mgl_MultiTexCoord6 : defpos;\n"+ + " mgl_TexCoord[7] = ( 0 != (mgl_TexCoordEnabled & 128) ) ? mgl_MultiTexCoord7 : defpos;\n"+ "}\n"+ "\n"+ "void main(void)\n"+ diff --git a/src/classes/com/sun/opengl/impl/glu/GLUquadricImpl.java b/src/classes/com/sun/opengl/impl/glu/GLUquadricImpl.java index 031d23c50..e8d039d1e 100644 --- a/src/classes/com/sun/opengl/impl/glu/GLUquadricImpl.java +++ b/src/classes/com/sun/opengl/impl/glu/GLUquadricImpl.java @@ -137,6 +137,7 @@ public class GLUquadricImpl implements GLUquadric { private int normals; private boolean immModeSinkEnabled; private boolean immModeSinkImmediate; + public int normalType; public static final boolean USE_NORM = true; public static final boolean USE_TEXT = false; @@ -149,17 +150,18 @@ public class GLUquadricImpl implements GLUquadric { orientation = GLU.GLU_OUTSIDE; textureFlag = false; normals = GLU.GLU_SMOOTH; + normalType = GLProfile.isGLES1()?GL.GL_BYTE:GL.GL_FLOAT; if(useGLSL) { immModeSink = ImmModeSink.createGLSL (GL.GL_STATIC_DRAW, 32, 3, GL.GL_FLOAT, // vertex 0, GL.GL_FLOAT, // color - USE_NORM?3:0, GL.GL_SHORT, // normal + USE_NORM?3:0, normalType,// normal USE_TEXT?2:0, GL.GL_FLOAT); // texture } else { immModeSink = ImmModeSink.createFixed(GL.GL_STATIC_DRAW, 32, 3, GL.GL_FLOAT, // vertex 0, GL.GL_FLOAT, // color - USE_NORM?3:0, GL.GL_SHORT, // normal + USE_NORM?3:0, normalType,// normal USE_TEXT?2:0, GL.GL_FLOAT); // texture } immModeSinkImmediate=true; @@ -198,13 +200,13 @@ public class GLUquadricImpl implements GLUquadric { immModeSink = ImmModeSink.createGLSL (GL.GL_STATIC_DRAW, 32, 3, GL.GL_FLOAT, // vertex 0, GL.GL_FLOAT, // color - USE_NORM?3:0, GL.GL_SHORT, // normal + USE_NORM?3:0, normalType,// normal USE_TEXT?2:0, GL.GL_FLOAT); // texture } else { immModeSink = ImmModeSink.createFixed(GL.GL_STATIC_DRAW, 32, 3, GL.GL_FLOAT, // vertex 0, GL.GL_FLOAT, // color - USE_NORM?3:0, GL.GL_SHORT, // normal + USE_NORM?3:0, normalType,// normal USE_TEXT?2:0, GL.GL_FLOAT); // texture } return res; @@ -1136,7 +1138,7 @@ public class GLUquadricImpl implements GLUquadric { } } - private final void glNormal3f(GL gl, float x, float y, float z) { + private final void glNormal3f_s(GL gl, float x, float y, float z) { short a=(short)(x*0xFFFF); short b=(short)(y*0xFFFF); short c=(short)(z*0xFFFF); @@ -1147,6 +1149,35 @@ public class GLUquadricImpl implements GLUquadric { } } + private final void glNormal3f_b(GL gl, float x, float y, float z) { + byte a=(byte)(x*0xFF); + byte b=(byte)(y*0xFF); + byte c=(byte)(z*0xFF); + if(immModeSinkEnabled) { + immModeSink.glNormal3b(a, b, c); + } else { + ((GL2)gl).glNormal3b(a, b, c); + } + } + + private final void glNormal3f(GL gl, float x, float y, float z) { + switch(normalType) { + case GL.GL_FLOAT: + if(immModeSinkEnabled) { + immModeSink.glNormal3f(x,y,z); + } else { + ((GL2)gl).glNormal3f(x,y,z); + } + break; + case GL.GL_SHORT: + glNormal3f_s(gl, x, y, z); + break; + case GL.GL_BYTE: + glNormal3f_b(gl, x, y, z); + break; + } + } + private final void glTexCoord2f(GL gl, float x, float y) { if(immModeSinkEnabled) { immModeSink.glTexCoord2f(x, y); diff --git a/src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawable.java b/src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawable.java index b898f69e9..702ceb7b4 100644 --- a/src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawable.java +++ b/src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawable.java @@ -83,7 +83,7 @@ public abstract class X11GLXDrawable extends GLDrawableImpl { XVisualInfo[] infos = X11Lib.XGetVisualInfo(display, X11Lib.VisualIDMask, template, count, 0); getFactory().unlockToolkit(); if (infos == null || infos.length == 0) { - throw new GLException("Error while getting XVisualInfo for visual ID " + visualID); + throw new GLException("Error while getting XVisualInfo for visual ID " + visualID+", "+this); } if (DEBUG) { System.err.println("!!! Fetched XVisualInfo for visual ID 0x" + Long.toHexString(visualID)); diff --git a/src/classes/javax/media/opengl/GLProfile.java b/src/classes/javax/media/opengl/GLProfile.java index aec2a7789..65e103937 100644 --- a/src/classes/javax/media/opengl/GLProfile.java +++ b/src/classes/javax/media/opengl/GLProfile.java @@ -66,7 +66,10 @@ public class GLProfile { NativeLibLoader.loadGL2(); DRIHack.end(); } if(GL2ES12.equals(profile)) { + // See DRIHack.java for an explanation of why this is necessary + DRIHack.begin(); NativeLibLoader.loadGL2ES12(); + DRIHack.end(); } else if(GLES1.equals(profile) || GLES2.equals(profile)) { Object eGLDrawableFactory = GLReflection.createInstance("com.sun.opengl.impl.egl.EGLDrawableFactory"); if(null==eGLDrawableFactory) { |