diff options
Diffstat (limited to 'src/classes/com/sun/opengl/impl')
4 files changed, 51 insertions, 20 deletions
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)); |