aboutsummaryrefslogtreecommitdiffstats
path: root/src/jake2/render/jogl
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/jogl
parentb25052fa5e55cb91372c7543cc2b4b602d3bbf2f (diff)
use a shared texture buffer (DirectBuffer) for cinematics
Diffstat (limited to 'src/jake2/render/jogl')
-rw-r--r--src/jake2/render/jogl/Draw.java23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/jake2/render/jogl/Draw.java b/src/jake2/render/jogl/Draw.java
index 5047ddb..6ae4197 100644
--- a/src/jake2/render/jogl/Draw.java
+++ b/src/jake2/render/jogl/Draw.java
@@ -2,7 +2,7 @@
* Draw.java
* Copyright (C) 2003
*
- * $Id: Draw.java,v 1.5 2004-07-16 10:11:35 cawe Exp $
+ * $Id: Draw.java,v 1.6 2005-11-21 21:19:35 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -29,8 +29,11 @@ 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 net.java.games.jogl.GL;
@@ -301,8 +304,12 @@ 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,8 +339,8 @@ public abstract class Draw extends Image {
if ( !qglColorTableEXT )
{
- int[] image32 = new int[256*256];
int destIndex = 0;
+ image32.clear();
for (i=0 ; i<trows ; i++)
{
@@ -346,7 +353,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,8 +361,8 @@ public abstract class Draw extends Image {
}
else
{
- byte[] image8 = new byte[256*256];
- int destIndex = 0;;
+ int destIndex = 0;
+ image8.clear();
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;
}
}