aboutsummaryrefslogtreecommitdiffstats
path: root/src/jake2/render/fastjogl/Draw.java
diff options
context:
space:
mode:
authorCarsten Weisse <[email protected]>2005-11-21 21:19:35 +0000
committerCarsten Weisse <[email protected]>2005-11-21 21:19:35 +0000
commit03843343c5f3e9e1b47103b01578345ad0278e9c (patch)
tree35d334108ae0de59aab8faf2b6c707690bfae30d /src/jake2/render/fastjogl/Draw.java
parentb25052fa5e55cb91372c7543cc2b4b602d3bbf2f (diff)
use a shared texture buffer (DirectBuffer) for cinematics
Diffstat (limited to 'src/jake2/render/fastjogl/Draw.java')
-rw-r--r--src/jake2/render/fastjogl/Draw.java19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/jake2/render/fastjogl/Draw.java b/src/jake2/render/fastjogl/Draw.java
index d3c62b6..ab4d3ef 100644
--- a/src/jake2/render/fastjogl/Draw.java
+++ b/src/jake2/render/fastjogl/Draw.java
@@ -2,7 +2,7 @@
* Draw.java
* Copyright (C) 2003
*
- * $Id: Draw.java,v 1.4 2004-08-22 14:25:14 salomo Exp $
+ * $Id: Draw.java,v 1.5 2005-11-21 21:16:36 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -29,8 +29,13 @@ import jake2.Defines;
import jake2.client.VID;
import jake2.qcommon.Com;
import jake2.render.image_t;
+import jake2.util.Lib;
import java.awt.Dimension;
+import java.nio.ByteBuffer;
+import java.nio.IntBuffer;
+
+import org.lwjgl.BufferUtils;
import net.java.games.jogl.GL;
@@ -301,7 +306,11 @@ public abstract class Draw extends Image {
// ====================================================================
-
+ // allocate a 256 * 256 texture buffer
+ private ByteBuffer image8 = Lib.newByteBuffer(256 * 256 * Defines.SIZE_OF_INT);
+ // share the buffer
+ private IntBuffer image32 = image8.asIntBuffer();
+
/*
=============
Draw_StretchRaw
@@ -332,7 +341,6 @@ public abstract class Draw extends Image {
if ( !qglColorTableEXT )
{
- int[] image32 = new int[256*256];
int destIndex = 0;
for (i=0 ; i<trows ; i++)
@@ -346,7 +354,7 @@ public abstract class Draw extends Image {
frac = fracstep >> 1;
for (j=0 ; j<256 ; j++)
{
- image32[destIndex + j] = r_rawpalette[data[sourceIndex + (frac>>16)] & 0xff];
+ image32.put(destIndex + j, r_rawpalette[data[sourceIndex + (frac>>16)] & 0xff]);
frac += fracstep;
}
}
@@ -354,7 +362,6 @@ public abstract class Draw extends Image {
}
else
{
- byte[] image8 = new byte[256*256];
int destIndex = 0;;
for (i=0 ; i<trows ; i++)
@@ -368,7 +375,7 @@ public abstract class Draw extends Image {
frac = fracstep >> 1;
for (j=0 ; j<256 ; j++)
{
- image8[destIndex + j] = data[sourceIndex + (frac>>16)];
+ image8.put(destIndex + j, data[sourceIndex + (frac>>16)]);
frac += fracstep;
}
}