final int pixDataType = JoglTextureUtil.getGLPixelDataType(image.getDataType());
final int bpp = ImageUtils.getPixelByteSize(image.getDataFormat(), image.getDataType());
final ByteBuffer scaledImage = BufferUtils.createByteBuffer((w + 4) * h * bpp);
// ensure the buffer is ready for reading
image.getData(0).rewind();
final int error = glu.gluScaleImage(pixFormat, actualWidth, actualHeight, pixDataType,
image.getData(0), w, h, pixDataType, scaledImage);
if (error != 0) {
final int errorCode = gl.glGetError();
if (errorCode != GL.GL_NO_ERROR) {
throw new GLException(glu.gluErrorString(errorCode));