why does this crash on iluScale ?
/**
*creates a new screenshot by reading pixels from the framebuffer in the rect(x, y, x+w, y+h)
*/
public static void saveScreenShot(int x, int y, int w, int h, String path){
ByteBuffer data = ByteBuffer.allocateDirect(w*h*3).order(ByteOrder.nativeOrder());
GL11.glReadPixels(x, y, w, h, GL11.GL_RGB, GL11.GL_UNSIGNED_BYTE, data);
Buffers.temp16.clear();
IL.ilGenImages(Buffers.temp16.asIntBuffer()); // Grab a new image name.
IL.ilBindImage(((IntBuffer)Buffers.temp16.asIntBuffer()).get(0));
ILU.iluScale(w, h, 0);
//copy pixel data to devil
IL.ilSetPixels(x, y, 0, w, h, 1, IL.IL_RGB, IL.IL_UNSIGNED_BYTE, data);
IL.ilSaveImage(path);
IL.ilDeleteImages(Buffers.temp16.asIntBuffer());
System.out.println("ScreenShot saved to: "+path);
}