Java Code Examples for org.lwjgl.opengl.GL11#glDrawBuffer()
The following examples show how to use
org.lwjgl.opengl.GL11#glDrawBuffer() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PbufferRenderer.java From tribaltrouble with GNU General Public License v2.0 | 6 votes |
PbufferRenderer(int width, int height, PixelFormat format, boolean use_copyteximage, OffscreenRendererFactory factory) throws LWJGLException { super(width, height, use_copyteximage); this.factory = factory; pbuffer = new Pbuffer(width, height, format, null, null); GLStateStack state_stack = new GLStateStack(); pbuffer.makeCurrent(); GLStateStack.setCurrent(state_stack); try { pbuffer.makeCurrent(); Renderer.dumpWindowInfo(); init(); if (!GLUtils.getGLBoolean(GL11.GL_DOUBLEBUFFER)) { GL11.glReadBuffer(GL11.GL_FRONT); GL11.glDrawBuffer(GL11.GL_FRONT); } } catch (LWJGLException e) { pbuffer.destroy(); throw e; } }
Example 2
Source File: Fbo.java From LowPolyWater with The Unlicense | 5 votes |
/** * Copy the contents of a colour attachment of this FBO to the screen. * * @param colourIndex * - The index of the colour buffer that should be blitted. */ public void blitToScreen(int colourIndex) { GL30.glBindFramebuffer(GL30.GL_DRAW_FRAMEBUFFER, 0); GL11.glDrawBuffer(GL11.GL_BACK); GL30.glBindFramebuffer(GL30.GL_READ_FRAMEBUFFER, fboId); GL11.glReadBuffer(GL30.GL_COLOR_ATTACHMENT0 + colourIndex); GL30.glBlitFramebuffer(0, 0, width, height, 0, 0, Display.getWidth(), Display.getHeight(), GL11.GL_COLOR_BUFFER_BIT, GL11.GL_NEAREST); GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0); }
Example 3
Source File: Fbo.java From LowPolyWater with The Unlicense | 5 votes |
/** * Copy the contents of this FBO to another FBO. This can be used to resolve * multisampled FBOs. * * @param srcColourIndex * - Index of the colour buffer in this (the source) FBO. * @param target * - The target FBO. * @param targetColourIndex * - The index of the target colour buffer in the target FBO. */ public void blitToFbo(int srcColourIndex, Fbo target, int targetColourIndex) { GL30.glBindFramebuffer(GL30.GL_DRAW_FRAMEBUFFER, target.fboId); GL11.glDrawBuffer(GL30.GL_COLOR_ATTACHMENT0 + targetColourIndex); GL30.glBindFramebuffer(GL30.GL_READ_FRAMEBUFFER, fboId); GL11.glReadBuffer(GL30.GL_COLOR_ATTACHMENT0 + srcColourIndex); int bufferBit = depthAttachment != null && target.depthAttachment != null ? GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT : GL11.GL_COLOR_BUFFER_BIT; GL30.glBlitFramebuffer(0, 0, width, height, 0, 0, target.width, target.height, bufferBit, GL11.GL_NEAREST); GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0); }
Example 4
Source File: Fbo.java From LowPolyWater with The Unlicense | 4 votes |
/** * Switch back to the default frame buffer. */ public void unbindAfterRender() { GL30.glBindFramebuffer(GL30.GL_DRAW_FRAMEBUFFER, 0); GL11.glDrawBuffer(GL11.GL_BACK); GL11.glViewport(0, 0, Display.getWidth(), Display.getHeight()); }
Example 5
Source File: Fbo.java From LowPolyWater with The Unlicense | 3 votes |
/** * Bind the FBO so that it can be rendered to. Anything rendered while the * FBO is bound will be rendered to the FBO. * * @param colourIndex * - The index of the colour buffer that should be drawn to. */ public void bindForRender(int colourIndex) { // should add support for binding multiple colour attachments GL11.glDrawBuffer(GL30.GL_COLOR_ATTACHMENT0 + colourIndex); GL30.glBindFramebuffer(GL30.GL_DRAW_FRAMEBUFFER, fboId); GL11.glViewport(0, 0, width, height); }