diff options
author | Sven Gothel <[email protected]> | 2008-07-10 14:35:33 +0000 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2008-07-10 14:35:33 +0000 |
commit | ded03da17a6740b0805b039721c6c03ac67cd7cc (patch) | |
tree | 3646ce0b80d52200c44beb9d824e18a140fdb384 /src | |
parent | 4cb87cee20a57932b0dac2eb30ef0b847c2f210d (diff) |
Fixed:
- GLContextImpl GLBufferSizeTracker instantiation
- GL2ES1: added PopMatrix and PushMatrix
- GL: removed GL_FIXED
- GLU: added gluLookAt, .. float type variant
- Added: javax/media/opengl/util/FixedPoint.java for FixedPoint math (shall be increased)
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1716 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src')
-rw-r--r-- | src/classes/com/sun/opengl/impl/GLContextImpl.java | 7 | ||||
-rw-r--r-- | src/classes/javax/media/opengl/util/FixedPoint.java | 29 | ||||
-rw-r--r-- | src/classes/javax/media/opengl/util/VBOBufferDraw.java | 9 |
3 files changed, 37 insertions, 8 deletions
diff --git a/src/classes/com/sun/opengl/impl/GLContextImpl.java b/src/classes/com/sun/opengl/impl/GLContextImpl.java index ffdf81f1a..90b52a285 100644 --- a/src/classes/com/sun/opengl/impl/GLContextImpl.java +++ b/src/classes/com/sun/opengl/impl/GLContextImpl.java @@ -395,6 +395,13 @@ public abstract class GLContextImpl extends GLContext { this.bufferSizeTracker = bufferSizeTracker; } + public GLBufferSizeTracker getOrCreateBufferSizeTracker() { + if(null==bufferSizeTracker) { + bufferSizeTracker=new GLBufferSizeTracker(); + } + return bufferSizeTracker; + } + public GLBufferSizeTracker getBufferSizeTracker() { return bufferSizeTracker; } diff --git a/src/classes/javax/media/opengl/util/FixedPoint.java b/src/classes/javax/media/opengl/util/FixedPoint.java new file mode 100644 index 000000000..35e2aaaf4 --- /dev/null +++ b/src/classes/javax/media/opengl/util/FixedPoint.java @@ -0,0 +1,29 @@ + +package javax.media.opengl.util; + +public class FixedPoint { + public static final int toFixed(int value) { + if (value < -32768) value = -32768; + if (value > 32767) value = 32767; + return value * 65536; + } + + public static final int toFixed(float value) { + if (value < -32768) value = -32768; + if (value > 32767) value = 32767; + return (int)(value * 65536.0f); + } + + public static final float toFloat(int value) { + return (float)value/65536.0f; + } + + public static final int mult(int x1, int x2) { + return (int) ( ((long)x1*(long)x2)/65536 ); + } + + public static final int div(int x1, int x2) { + return (int) ( (((long)x1)<<16)/x2 ); + } +} + diff --git a/src/classes/javax/media/opengl/util/VBOBufferDraw.java b/src/classes/javax/media/opengl/util/VBOBufferDraw.java index 7a7a3d9a6..34b1be0b1 100644 --- a/src/classes/javax/media/opengl/util/VBOBufferDraw.java +++ b/src/classes/javax/media/opengl/util/VBOBufferDraw.java @@ -325,7 +325,7 @@ public abstract class VBOBufferDraw { if(clazz==FloatBuffer.class) { ((FloatBuffer)buffer).put(v); } else if(clazz==IntBuffer.class) { - ((IntBuffer)buffer).put(Float2Fixed(v)); + ((IntBuffer)buffer).put(FixedPoint.toFixed(v)); } else { throw new GLException("Float doesn't match Buffer Class: "+clazz+" :\n\t"+this); } @@ -357,13 +357,6 @@ public abstract class VBOBufferDraw { "]"; } - public static final int Float2Fixed(float value) - { - if (value < -32768) value = -32768; - if (value > 32767) value = 32767; - return (int)(value * 65536); - } - protected int glArrayType; protected int glDataType; protected Class clazz; |