iluScale crashing vm

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);
	}

the temp16.clear may need a rewind ?

no, still crashes ???

ok, i fixed it: i should have made sure ILU had been created. Also i changed it to use devil to take the screenshot, a 800*600 shot takes ~100ms for a bmp, ~140ms for a jpg and ~300ms for a png to take and save.