List of usage examples for org.lwjgl.opengl GL30 glBlitFramebuffer
public static void glBlitFramebuffer(@NativeType("GLint") int srcX0, @NativeType("GLint") int srcY0, @NativeType("GLint") int srcX1, @NativeType("GLint") int srcY1, @NativeType("GLint") int dstX0, @NativeType("GLint") int dstY0, @NativeType("GLint") int dstX1, @NativeType("GLint") int dstY1, @NativeType("GLbitfield") int mask, @NativeType("GLenum") int filter)
From source file:com.badlogic.gdx.backends.jglfw.JglfwGL30.java
License:Apache License
@Override public void glBlitFramebuffer(int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1, int mask, int filter) { GL30.glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); }
From source file:com.microsoft.Malmo.MissionHandlers.VideoProducerImplementation.java
License:Open Source License
@Override public void getFrame(MissionInit missionInit, ByteBuffer buffer) { if (!this.videoParams.isWantDepth()) { getRGBFrame(buffer); // Just return the simple RGB, 3bpp image. return;/*from w ww . j ava 2 s . co m*/ } // Otherwise, do the work of extracting the depth map: final int width = this.videoParams.getWidth(); final int height = this.videoParams.getHeight(); GL30.glBindFramebuffer(GL30.GL_READ_FRAMEBUFFER, Minecraft.getMinecraft().getFramebuffer().framebufferObject); GL30.glBindFramebuffer(GL30.GL_DRAW_FRAMEBUFFER, this.fbo.framebufferObject); GL30.glBlitFramebuffer(0, 0, Minecraft.getMinecraft().getFramebuffer().framebufferWidth, Minecraft.getMinecraft().getFramebuffer().framebufferHeight, 0, 0, width, height, GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT, GL11.GL_NEAREST); this.fbo.bindFramebuffer(true); glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, buffer); glReadPixels(0, 0, width, height, GL_DEPTH_COMPONENT, GL_FLOAT, this.depthBuffer); this.fbo.unbindFramebuffer(); // Now convert the depth buffer into values from 0-255 and copy it over the alpha channel. // We either use the min and max values supplied in order to scale it, or we scale it according // to the dynamic content: float minval, maxval; // The scaling section is optional (since the depthmap is optional) - so if there is no depthScaling object, // go with the default of autoscale. if (this.videoParams.getDepthScaling() == null || this.videoParams.getDepthScaling().isAutoscale()) { minval = 1; maxval = 0; for (int i = 0; i < width * height; i++) { float f = this.depthBuffer.get(i); if (f < minval) minval = f; if (f > maxval) maxval = f; } } else { minval = this.videoParams.getDepthScaling().getMin().floatValue(); maxval = this.videoParams.getDepthScaling().getMax().floatValue(); if (minval > maxval) { // You can't trust users. float t = minval; minval = maxval; maxval = t; } } float range = maxval - minval; if (range < 0.000001) range = 0.000001f; // To avoid divide by zero errors in cases where there is no depth variance float scale = 255 / range; for (int i = 0; i < width * height; i++) { float f = this.depthBuffer.get(i); f = (f < minval ? minval : (f > maxval ? maxval : f)); f -= minval; f *= scale; buffer.put(i * 4 + 3, (byte) f); } // Reset depth buffer ready for next read: this.depthBuffer.clear(); }
From source file:com.samrj.devil.gl.DGL.java
License:Open Source License
/** * Blits the currently bound read buffer into the bound draw frame buffer. * Assumes the buffers are of equal dimensions and have compatible formats. * /* w w w . j a v a 2s . c om*/ * @param width The width of both buffers. * @param height The height of both buffers. * @param mask The bitwise OR of the flags indicating which buffers are to * be copied. The allowed flags are GL_COLOR_BUFFER_BIT, * GL_DEPTH_BUFFER_BIT and GL_STENCIL_BUFFER_BIT. */ public static void blitFBO(int width, int height, int mask) { GL30.glBlitFramebuffer(0, 0, width, height, 0, 0, width, height, mask, GL11.GL_NEAREST); }
From source file:com.xrbpowered.gl.res.buffers.RenderTarget.java
License:Open Source License
public static void blit(RenderTarget source, RenderTarget target, boolean filter) { GL30.glBindFramebuffer(GL30.GL_READ_FRAMEBUFFER, source.fbo); GL30.glBindFramebuffer(GL30.GL_DRAW_FRAMEBUFFER, target.fbo); // System.out.printf("[%d] %dx%d -> [%d] %dx%d\n", source.fbo, source.getWidth(), source.getHeight(), target.fbo, target.getWidth(), target.getHeight()); GL30.glBlitFramebuffer(0, 0, source.getWidth(), source.getHeight(), 0, 0, target.getWidth(), target.getHeight(), GL11.GL_COLOR_BUFFER_BIT, filter ? GL11.GL_LINEAR : GL11.GL_NEAREST); Client.checkError();/*from w w w . j ava 2s . c om*/ }
From source file:cuchaz.jfxgl.prism.JFXGLContext.java
License:Open Source License
@Override public void blitFBO(int srcFboId, int dstFboId, int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1) { GL30.glBindFramebuffer(GL30.GL_READ_FRAMEBUFFER, srcFboId); GL30.glBindFramebuffer(GL30.GL_DRAW_FRAMEBUFFER, dstFboId); GL30.glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, GL11.GL_COLOR_BUFFER_BIT, GL11.GL_NEAREST);/* ww w. j av a 2 s. c o m*/ }
From source file:io.root.gfx.glutils.GL.java
License:Apache License
public static void glBlitFramebuffer(int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1, int mask, int filter) { GL30.glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); }
From source file:jpcsp.graphics.RE.RenderingEngineLwjgl.java
License:Open Source License
@Override public void blitFramebuffer(int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1, int mask, int filter) { int maskGL = 0; for (int i = 0; i < buffersMaskToGL.length; i++, mask >>= 1) { if ((mask & 1) != 0) { maskGL |= buffersMaskToGL[i]; }// ww w .j a v a 2 s . c o m } GL30.glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, maskGL, mipmapFilterToGL[filter]); }
From source file:net.smert.frameworkgl.opengl.helpers.FrameBufferObjectHelper.java
License:Apache License
public void blit(int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1, int mask, int filter) { GL30.glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); }
From source file:processing.lwjgl.PGL.java
License:Open Source License
public void blitFramebuffer(int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1, int mask, int filter) { GL30.glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); }
From source file:processing.opengl.PLWJGL.java
License:Open Source License
@Override public void blitFramebuffer(int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1, int mask, int filter) { GL30.glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); }