Converted *.allocateDirect to BufferUtils

This commit is contained in:
Elias Naur 2004-07-29 11:41:11 +00:00
parent 42cd6ddb20
commit 72afa14aa3
4 changed files with 8 additions and 5 deletions

View File

@ -234,7 +234,7 @@ public class Keyboard {
private static boolean created;
/** The keys status from the last poll */
private static final ByteBuffer keyDownBuffer = ByteBuffer.allocateDirect(256);
private static final ByteBuffer keyDownBuffer = BufferUtils.createByteBuffer(256);
/**
* The key events from the last read: a sequence of pairs of key number,

View File

@ -35,6 +35,7 @@ import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import org.lwjgl.Sys;
import org.lwjgl.BufferUtils;
/**
* $Id$
@ -205,7 +206,7 @@ public class EAXBufferProperties {
* Creates a new EAXBufferProperties object
*/
public EAXBufferProperties() {
eaxBufferProperties = ByteBuffer.allocateDirect(EAXBUFFERPROPERTIES_SIZE);
eaxBufferProperties = BufferUtils.createByteBuffer(EAXBUFFERPROPERTIES_SIZE);
eaxBufferProperties.order(ByteOrder.nativeOrder());
}

View File

@ -48,6 +48,7 @@ import org.lwjgl.input.Controller;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.LWJGLException;
import org.lwjgl.BufferUtils;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
@ -227,7 +228,7 @@ public final class Display {
if (rampSize == 0) {
throw new LWJGLException("Display configuration not supported");
}
FloatBuffer gammaRamp = ByteBuffer.allocateDirect(rampSize*4).order(ByteOrder.nativeOrder()).asFloatBuffer();
FloatBuffer gammaRamp = BufferUtils.createFloatBuffer(rampSize);
for (int i = 0; i < rampSize; i++) {
float intensity = (float)i/(rampSize - 1);
// apply gamma

View File

@ -34,6 +34,7 @@ package org.lwjgl.opengl.glu;
import java.nio.ByteBuffer;
import org.lwjgl.opengl.GL11;
import org.lwjgl.BufferUtils;
/**
* MipMap.java
@ -103,7 +104,7 @@ public class MipMap extends Util {
if (w != width || h != height) {
// must rescale image to get "top" mipmap texture image
image = ByteBuffer.allocateDirect((w + 4) * h * bpp);
image = BufferUtils.createByteBuffer((w + 4) * h * bpp);
error = gluScaleImage(format, width, height, type, data, w, h, type, image);
if (error != 0) {
retVal = error;
@ -130,7 +131,7 @@ public class MipMap extends Util {
neww = (w < 2) ? 1 : w / 2;
newh = (h < 2) ? 1 : h / 2;
newimage = ByteBuffer.allocateDirect((neww + 4) * newh * bpp);
newimage = BufferUtils.createByteBuffer((neww + 4) * newh * bpp);
error = gluScaleImage(format, w, h, type, image, neww, newh, type, newimage);
if (error != 0) {