aboutsummaryrefslogtreecommitdiffstats
path: root/src/jake2/render/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'src/jake2/render/opengl')
-rw-r--r--src/jake2/render/opengl/CountGL.java2
-rw-r--r--src/jake2/render/opengl/DummyGL.java6
-rw-r--r--src/jake2/render/opengl/JoglGL2.java5
-rw-r--r--src/jake2/render/opengl/JoglGL2ES1.java7
-rw-r--r--src/jake2/render/opengl/QGL.java2
5 files changed, 11 insertions, 11 deletions
diff --git a/src/jake2/render/opengl/CountGL.java b/src/jake2/render/opengl/CountGL.java
index 2752916..a671747 100644
--- a/src/jake2/render/opengl/CountGL.java
+++ b/src/jake2/render/opengl/CountGL.java
@@ -102,7 +102,7 @@ public class CountGL implements QGL {
++count;
}
- public void glDrawElements(int mode, IntBuffer indices) {
+ public void glDrawElements(int mode, ShortBuffer indices) {
++count;
}
diff --git a/src/jake2/render/opengl/DummyGL.java b/src/jake2/render/opengl/DummyGL.java
index 45cc9df..b7d4c58 100644
--- a/src/jake2/render/opengl/DummyGL.java
+++ b/src/jake2/render/opengl/DummyGL.java
@@ -1,8 +1,6 @@
package jake2.render.opengl;
-import java.nio.ByteBuffer;
-import java.nio.FloatBuffer;
-import java.nio.IntBuffer;
+import java.nio.*;
public class DummyGL implements QGL {
@@ -101,7 +99,7 @@ public class DummyGL implements QGL {
// do nothing
}
- public void glDrawElements(int mode, IntBuffer indices) {
+ public void glDrawElements(int mode, ShortBuffer indices) {
// do nothing
}
diff --git a/src/jake2/render/opengl/JoglGL2.java b/src/jake2/render/opengl/JoglGL2.java
index a1d1b17..d078585 100644
--- a/src/jake2/render/opengl/JoglGL2.java
+++ b/src/jake2/render/opengl/JoglGL2.java
@@ -3,6 +3,7 @@ package jake2.render.opengl;
import java.nio.*;
+import javax.media.opengl.GL;
import javax.media.opengl.GL2;
public class JoglGL2 implements QGL {
@@ -102,8 +103,8 @@ public class JoglGL2 implements QGL {
gl.glDrawBuffer(mode);
}
- public void glDrawElements(int mode, IntBuffer indices) {
- gl.glDrawElements(mode, indices.limit(), GL_UNSIGNED_INT, indices);
+ public void glDrawElements(int mode, ShortBuffer indices) {
+ gl.glDrawElements(mode, indices.remaining(), GL.GL_UNSIGNED_SHORT, indices);
}
public void glEnable(int cap) {
diff --git a/src/jake2/render/opengl/JoglGL2ES1.java b/src/jake2/render/opengl/JoglGL2ES1.java
index 605c152..94c0c45 100644
--- a/src/jake2/render/opengl/JoglGL2ES1.java
+++ b/src/jake2/render/opengl/JoglGL2ES1.java
@@ -172,7 +172,7 @@ public class JoglGL2ES1 implements QGL {
}
}
- public void glDrawElements(int mode, IntBuffer indices) {
+ public void glDrawElements(int mode, ShortBuffer indices) {
switch(mode) {
case GL_QUAD_STRIP:
mode=GL.GL_TRIANGLE_STRIP;
@@ -184,11 +184,12 @@ public class JoglGL2ES1 implements QGL {
final int idxLen = indices.remaining();
if ( GL_QUADS == mode && !gl.isGL2() ) {
final int idx0 = indices.position();
+ final ShortBuffer b = (ShortBuffer) indices;
for (int j = 0; j < idxLen; j++) {
- gl.glDrawArrays(GL.GL_TRIANGLE_FAN, (int)(0xffffffff & indices.get(idx0+j)), 4);
+ gl.glDrawArrays(GL.GL_TRIANGLE_FAN, (int)(0x0000ffff & b.get(idx0+j)), 4);
}
} else {
- gl.glDrawElements(mode, idxLen, GL_UNSIGNED_INT, indices);
+ gl.glDrawElements(mode, idxLen, GL.GL_UNSIGNED_SHORT, indices);
}
}
diff --git a/src/jake2/render/opengl/QGL.java b/src/jake2/render/opengl/QGL.java
index 81efe59..ca0c4dd 100644
--- a/src/jake2/render/opengl/QGL.java
+++ b/src/jake2/render/opengl/QGL.java
@@ -60,7 +60,7 @@ public interface QGL extends QGLConst {
void glDrawBuffer(int mode);
- void glDrawElements(int mode, IntBuffer indices);
+ void glDrawElements(int mode, ShortBuffer indices);
void glEnable(int cap);