From d2d20162fe199b1b7c79d46530d0bb29780beeeb Mon Sep 17 00:00:00 2001
From: Xerxes Rånby <xerxes@zafena.se>
Date: Fri, 5 Jul 2013 15:18:03 +0200
Subject: glredbook1314/mvarray: glMultiDrawElements require direct NIO buffer
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Xerxes Rånby <xerxes@zafena.se>
---
 src/redbook/src/glredbook1314/mvarray.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

(limited to 'src')

diff --git a/src/redbook/src/glredbook1314/mvarray.java b/src/redbook/src/glredbook1314/mvarray.java
index ffa1d58..e97d2aa 100644
--- a/src/redbook/src/glredbook1314/mvarray.java
+++ b/src/redbook/src/glredbook1314/mvarray.java
@@ -11,6 +11,7 @@ import java.nio.IntBuffer;
 import javax.media.opengl.*;
 import javax.swing.JFrame;
 import com.jogamp.common.nio.PointerBuffer;
+import com.jogamp.common.nio.Buffers;
 import com.jogamp.opengl.util.GLBuffers;
 import javax.media.opengl.awt.GLJPanel;
 import javax.media.opengl.glu.GLU;
@@ -49,6 +50,9 @@ public class mvarray //
 
     private int count[] = { 7, 6 };
 
+    private IntBuffer countBuf = //
+    Buffers.newDirectIntBuffer(count);
+
     // static GLvoid * indices[2] = {oneIndices, twoIndices};
     private PointerBuffer indices = PointerBuffer.allocateDirect(2);
 
@@ -86,7 +90,7 @@ public class mvarray //
         gl.glColor3f(1.0f, 1.0f, 1.0f);
 
         if (mde_bug)
-            gl.glMultiDrawElements(GL.GL_LINE_STRIP, count, 0,//
+            gl.glMultiDrawElements(GL.GL_LINE_STRIP, countBuf,//
                     GL.GL_UNSIGNED_BYTE, indices, 2);
         else {
             // workaround for glMultiDrawElem bug before July
-- 
cgit v1.2.3