List of usage examples for org.lwjgl.opengl GL11 nglGetIntegerv
public static void nglGetIntegerv(int pname, long params)
From source file:com.samrj.devil.gl.DGL.java
License:Open Source License
/** * Creates a new image from the current read framebuffer and viewport. * Useful for taking screenshots.// w w w . j a v a 2s .c o m * * @return A newly allocated image. */ public static Image screenshotImage() { int x, y, w, h; { long xAddr = MemStack.push(4); long yAddr = MemStack.push(4); long wAddr = MemStack.push(4); long hAddr = MemStack.push(4); GL11.nglGetIntegerv(GL11.GL_VIEWPORT, xAddr); x = MemoryUtil.memGetInt(xAddr); y = MemoryUtil.memGetInt(yAddr); w = MemoryUtil.memGetInt(wAddr); h = MemoryUtil.memGetInt(hAddr); MemStack.pop(4); } Image out = genImage(w, h, 3, PrimType.BYTE); GL11.nglReadPixels(x, y, w, h, GL11.GL_RGB, GL11.GL_UNSIGNED_BYTE, out.address()); return out; }