summaryrefslogtreecommitdiffstats
path: root/src/net/java/joglutils/msg/collections
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/java/joglutils/msg/collections')
-rw-r--r--src/net/java/joglutils/msg/collections/Vec2fCollection.java10
-rw-r--r--src/net/java/joglutils/msg/collections/Vec3fCollection.java10
-rw-r--r--src/net/java/joglutils/msg/collections/Vec4fCollection.java10
3 files changed, 15 insertions, 15 deletions
diff --git a/src/net/java/joglutils/msg/collections/Vec2fCollection.java b/src/net/java/joglutils/msg/collections/Vec2fCollection.java
index a5ad3d3..d0dadc1 100644
--- a/src/net/java/joglutils/msg/collections/Vec2fCollection.java
+++ b/src/net/java/joglutils/msg/collections/Vec2fCollection.java
@@ -39,8 +39,6 @@ package net.java.joglutils.msg.collections;
import java.nio.*;
-import com.sun.opengl.util.*;
-
import net.java.joglutils.msg.impl.*;
import net.java.joglutils.msg.math.*;
@@ -103,9 +101,10 @@ public class Vec2fCollection {
public void add(Vec2f value) {
FloatBuffer buf = data;
if (buf.limit() == buf.capacity()) {
- FloatBuffer newBuf = BufferUtil.newFloatBuffer(Math.max(buf.capacity() + ELEMENT_SIZE,
- round((int) (buf.capacity() * 1.5f))));
+ FloatBuffer newBuf = BufferFactory.newFloatBuffer(Math.max(buf.capacity() + ELEMENT_SIZE,
+ round((int) (buf.capacity() * 1.5f))));
newBuf.put(buf);
+ newBuf.rewind();
newBuf.limit(buf.limit());
data = newBuf;
buf = newBuf;
@@ -129,11 +128,12 @@ public class Vec2fCollection {
// Simply lower the limit
buf.limit(buf.limit() - ELEMENT_SIZE);
} else {
- buf.position(pos + 1);
+ buf.position(pos + ELEMENT_SIZE);
FloatBuffer rest = buf.slice();
buf.position(pos);
buf.put(rest);
buf.limit(buf.limit() - ELEMENT_SIZE);
+ buf.rewind();
}
return res;
}
diff --git a/src/net/java/joglutils/msg/collections/Vec3fCollection.java b/src/net/java/joglutils/msg/collections/Vec3fCollection.java
index 698017d..887b4c9 100644
--- a/src/net/java/joglutils/msg/collections/Vec3fCollection.java
+++ b/src/net/java/joglutils/msg/collections/Vec3fCollection.java
@@ -39,8 +39,6 @@ package net.java.joglutils.msg.collections;
import java.nio.*;
-import com.sun.opengl.util.*;
-
import net.java.joglutils.msg.impl.*;
import net.java.joglutils.msg.math.*;
@@ -104,9 +102,10 @@ public class Vec3fCollection {
public void add(Vec3f value) {
FloatBuffer buf = data;
if (buf.limit() == buf.capacity()) {
- FloatBuffer newBuf = BufferUtil.newFloatBuffer(Math.max(buf.capacity() + ELEMENT_SIZE,
- round((int) (buf.capacity() * 1.5f))));
+ FloatBuffer newBuf = BufferFactory.newFloatBuffer(Math.max(buf.capacity() + ELEMENT_SIZE,
+ round((int) (buf.capacity() * 1.5f))));
newBuf.put(buf);
+ newBuf.rewind();
newBuf.limit(buf.limit());
data = newBuf;
buf = newBuf;
@@ -131,11 +130,12 @@ public class Vec3fCollection {
// Simply lower the limit
buf.limit(buf.limit() - ELEMENT_SIZE);
} else {
- buf.position(pos + 1);
+ buf.position(pos + ELEMENT_SIZE);
FloatBuffer rest = buf.slice();
buf.position(pos);
buf.put(rest);
buf.limit(buf.limit() - ELEMENT_SIZE);
+ buf.rewind();
}
return res;
}
diff --git a/src/net/java/joglutils/msg/collections/Vec4fCollection.java b/src/net/java/joglutils/msg/collections/Vec4fCollection.java
index a1d1e86..2f940cd 100644
--- a/src/net/java/joglutils/msg/collections/Vec4fCollection.java
+++ b/src/net/java/joglutils/msg/collections/Vec4fCollection.java
@@ -39,8 +39,6 @@ package net.java.joglutils.msg.collections;
import java.nio.*;
-import com.sun.opengl.util.*;
-
import net.java.joglutils.msg.impl.*;
import net.java.joglutils.msg.math.*;
@@ -105,9 +103,10 @@ public class Vec4fCollection {
public void add(Vec4f value) {
FloatBuffer buf = data;
if (buf.limit() == buf.capacity()) {
- FloatBuffer newBuf = BufferUtil.newFloatBuffer(Math.max(buf.capacity() + ELEMENT_SIZE,
- round((int) (buf.capacity() * 1.5f))));
+ FloatBuffer newBuf = BufferFactory.newFloatBuffer(Math.max(buf.capacity() + ELEMENT_SIZE,
+ round((int) (buf.capacity() * 1.5f))));
newBuf.put(buf);
+ newBuf.rewind();
newBuf.limit(buf.limit());
data = newBuf;
buf = newBuf;
@@ -133,11 +132,12 @@ public class Vec4fCollection {
// Simply lower the limit
buf.limit(buf.limit() - ELEMENT_SIZE);
} else {
- buf.position(pos + 1);
+ buf.position(pos + ELEMENT_SIZE);
FloatBuffer rest = buf.slice();
buf.position(pos);
buf.put(rest);
buf.limit(buf.limit() - ELEMENT_SIZE);
+ buf.rewind();
}
return res;
}