List of usage examples for org.lwjgl.opengl GL30 GL_FRAMEBUFFER
int GL_FRAMEBUFFER
To view the source code for org.lwjgl.opengl GL30 GL_FRAMEBUFFER.
Click Source Link
From source file:com.flowpowered.caustic.lwjgl.gl30.GL30FrameBuffer.java
License:MIT License
@Override public void create() { checkNotCreated();//from w w w .j a v a2s .c o m // Generate and bind the frame buffer id = GL30.glGenFramebuffers(); GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, id); // Disable input buffers GL11.glReadBuffer(GL11.GL_NONE); // Unbind the frame buffer GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0); // Update the state super.create(); // Check for errors LWJGLUtil.checkForGLError(); }
From source file:com.flowpowered.caustic.lwjgl.gl30.GL30FrameBuffer.java
License:MIT License
@Override public void attach(AttachmentPoint point, Texture texture) { checkCreated();/* w w w .ja v a 2s . com*/ CausticUtil.checkVersion(this, texture); texture.checkCreated(); // Bind the frame buffer GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, id); // Attach the texture GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, point.getGLConstant(), GL11.GL_TEXTURE_2D, texture.getID(), 0); // Add it to the color outputs if it's a color type if (point.isColor()) { outputBuffers.add(point.getGLConstant()); } // Update the list of output buffers updateOutputBuffers(); // Unbind the frame buffer GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0); // Check for errors LWJGLUtil.checkForGLError(); }
From source file:com.flowpowered.caustic.lwjgl.gl30.GL30FrameBuffer.java
License:MIT License
@Override public void attach(AttachmentPoint point, RenderBuffer buffer) { checkCreated();// w w w .j a v a2 s. c o m CausticUtil.checkVersion(this, buffer); buffer.checkCreated(); // Bind the frame buffer GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, id); // Attach the render buffer GL30.glFramebufferRenderbuffer(GL30.GL_FRAMEBUFFER, point.getGLConstant(), GL30.GL_RENDERBUFFER, buffer.getID()); // Add it to the color outputs if it's a color type if (point.isColor()) { outputBuffers.add(point.getGLConstant()); } // Update the list of output buffers updateOutputBuffers(); // Unbind the frame buffer GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0); // Check for errors LWJGLUtil.checkForGLError(); }
From source file:com.flowpowered.caustic.lwjgl.gl30.GL30FrameBuffer.java
License:MIT License
@Override public void detach(AttachmentPoint point) { checkCreated();//from w w w. ja va2 s . c om // Bind the frame buffer GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, id); // Detach the render buffer GL30.glFramebufferRenderbuffer(GL30.GL_FRAMEBUFFER, point.getGLConstant(), GL30.GL_RENDERBUFFER, 0); // Remove it from the color outputs if it's a color type if (point.isColor()) { outputBuffers.remove(point.getGLConstant()); } // Update the list of output buffers updateOutputBuffers(); // Unbind the frame buffer GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0); // Check for errors LWJGLUtil.checkForGLError(); }
From source file:com.flowpowered.caustic.lwjgl.gl30.GL30FrameBuffer.java
License:MIT License
@Override public boolean isComplete() { checkCreated();//from w w w . j ava2s. c o m // Bind the frame buffer GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, id); // Fetch the status and compare to the complete enum value final boolean complete = GL30.glCheckFramebufferStatus(GL30.GL_FRAMEBUFFER) == GL30.GL_FRAMEBUFFER_COMPLETE; // Unbind the frame buffer GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0); // Check for errors LWJGLUtil.checkForGLError(); return complete; }
From source file:com.flowpowered.caustic.lwjgl.gl30.GL30FrameBuffer.java
License:MIT License
@Override public void bind() { checkCreated();/* w ww . ja v a 2 s .co m*/ // Bind the frame buffer GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, id); // Check for errors LWJGLUtil.checkForGLError(); }
From source file:com.flowpowered.caustic.lwjgl.gl30.GL30FrameBuffer.java
License:MIT License
@Override public void unbind() { checkCreated();//from www . j a v a 2s. c o m // Unbind the frame buffer GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0); // Check for errors LWJGLUtil.checkForGLError(); }
From source file:com.grillecube.client.renderer.world.WorldRenderer.java
@Override protected void onInitialized() { Logger.get().log(Logger.Level.DEBUG, "Initializing " + this.getClass().getSimpleName()); GLH.glhCheckError("pre worldrenderer fbo creation"); this.fbo = GLH.glhGenFBO(); this.fbo.bind(); this.fbo.createDrawBuffer(GL30.GL_COLOR_ATTACHMENT0); this.fboTexture = GLH.glhGenTexture(); this.fboTexture.bind(GL11.GL_TEXTURE_2D); this.fboTexture.parameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); this.fboTexture.parameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); this.fbo.createTextureAttachment(this.fboTexture, GL30.GL_COLOR_ATTACHMENT0); this.fboDepthBuffer = GLH.glhGenRBO(); this.fboDepthBuffer.bind(); this.fboDepthBuffer.attachToFBO(GL30.GL_FRAMEBUFFER, GL30.GL_DEPTH_ATTACHMENT); this.fbo.unbind(); this.resizeFbo(); GLH.glhCheckError("post worldrenderer fbo creation"); this.setPostProcessingProgram(null); }
From source file:com.mtbs3d.minecrift.FBOParams.java
License:LGPL
public FBOParams(String fboName, int textureType, int internalFormat, int baseFormat, int bufferType, int fboWidth, int fboHeight) throws Exception { Minecraft mc = Minecraft.getMinecraft(); _textureType = textureType;// w ww. j a va 2 s . co m if (fboSupport == FBO_SUPPORT.USE_EXT_UNKNOWN) { // The framebuffer, which regroups 0, 1, or more textures, and 0 or 1 depth buffer. try { _frameBufferId = GL30.glGenFramebuffers(); fboSupport = FBO_SUPPORT.USE_GL30; } catch (IllegalStateException ex) { System.out.println( "[Minecrift] FBO creation: GL30.glGenFramebuffers not supported. Attempting to use EXTFramebufferObject.glGenFramebuffersEXT"); fboSupport = FBO_SUPPORT.USE_EXT; try { _frameBufferId = EXTFramebufferObject.glGenFramebuffersEXT(); } catch (IllegalStateException ex1) { System.out.println( "[Minecrift] FBO creation: EXTFramebufferObject.glGenFramebuffersEXT not supported, FBO creation failed."); throw ex1; } } } else if (fboSupport == FBO_SUPPORT.USE_GL30) { _frameBufferId = GL30.glGenFramebuffers(); } else { _frameBufferId = EXTFramebufferObject.glGenFramebuffersEXT(); } if (fboSupport == FBO_SUPPORT.USE_GL30) { _colorTextureId = GL11.glGenTextures(); _depthRenderBufferId = GL30.glGenRenderbuffers(); GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, _frameBufferId); checkGLError("FBO bind framebuffer"); GL11.glBindTexture(textureType, _colorTextureId); checkGLError("FBO bind texture"); GL11.glEnable(textureType); GL11.glTexParameterf(textureType, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); GL11.glTexParameterf(textureType, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); GL11.glTexImage2D(textureType, 0, internalFormat, fboWidth, fboHeight, 0, baseFormat, bufferType, (java.nio.ByteBuffer) null); System.out.println("[Minecrift] FBO '" + fboName + "': w: " + fboWidth + ", h: " + fboHeight); GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, textureType, _colorTextureId, 0); checkGLError("FBO bind texture framebuffer"); GL30.glBindRenderbuffer(GL30.GL_RENDERBUFFER, _depthRenderBufferId); // bind the depth renderbuffer GL30.glRenderbufferStorage(GL30.GL_RENDERBUFFER, GL14.GL_DEPTH_COMPONENT24, fboWidth, fboHeight); // get the data space for it GL30.glFramebufferRenderbuffer(GL30.GL_FRAMEBUFFER, GL30.GL_DEPTH_ATTACHMENT, GL30.GL_RENDERBUFFER, _depthRenderBufferId); checkGLError("FBO bind depth framebuffer"); } else { _colorTextureId = GL11.glGenTextures(); _depthRenderBufferId = EXTFramebufferObject.glGenRenderbuffersEXT(); EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, _frameBufferId); checkGLError("FBO bind framebuffer"); GL11.glBindTexture(textureType, _colorTextureId); checkGLError("FBO bind texture"); GL11.glEnable(textureType); GL11.glTexParameterf(textureType, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); GL11.glTexParameterf(textureType, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); GL11.glTexImage2D(textureType, 0, internalFormat, fboWidth, fboHeight, 0, baseFormat, bufferType, (java.nio.ByteBuffer) null); System.out.println("[Minecrift] FBO '" + fboName + "': w: " + fboWidth + ", h: " + fboHeight); EXTFramebufferObject.glFramebufferTexture2DEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, EXTFramebufferObject.GL_COLOR_ATTACHMENT0_EXT, textureType, _colorTextureId, 0); checkGLError("FBO bind texture framebuffer"); EXTFramebufferObject.glBindRenderbufferEXT(EXTFramebufferObject.GL_RENDERBUFFER_EXT, _depthRenderBufferId); // bind the depth renderbuffer EXTFramebufferObject.glRenderbufferStorageEXT(EXTFramebufferObject.GL_RENDERBUFFER_EXT, GL14.GL_DEPTH_COMPONENT24, fboWidth, fboHeight); // get the data space for it EXTFramebufferObject.glFramebufferRenderbufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, EXTFramebufferObject.GL_RENDERBUFFER_EXT, _depthRenderBufferId); checkGLError("FBO bind depth framebuffer"); } if (!checkFramebufferStatus()) { // OK, if we have an error here - then throw an exception System.out.println("[Minecrift] FAILED to create framebuffer!!"); throw new Exception("Failed to create framebuffer"); } }
From source file:com.mtbs3d.minecrift.FBOParams.java
License:LGPL
public void bindRenderTarget() { if (fboSupport == FBO_SUPPORT.USE_GL30) GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, _frameBufferId); else//from w w w .ja va 2s . c o m EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, _frameBufferId); }