OpenGL Water Tutorial 2: Frame Buffer Objects
Why Stack Overflow recommends it
Stack Overflow users link it as a practical walkthrough of FBO setup, both as a recommendation for rendering to textures and as the source people adapt code from when they hit bugs.
Recommended by 1 people across 1 different months, 2015 to 2020.
What it is
Part 2 of ThinMatrix's OpenGL water tutorial series, covering how to render a scene to a texture using Frame Buffer Objects (FBOs), in Java with LWJGL. The presenter walks through the setup code and supplies a downloadable source for the FBO class, which later episodes use for water reflection and refraction.
What people said
Recommends pdid · 2017-02 · Stack Overflow · on “Putting a Slick2D game inside a GUI”
I would recommend using an OpenGL Frame Buffer Object (FBO) to render your scene to. An FBO acts like a 2D texture object in OpenGL, so you could then read the pixel data from the FBO and use it to render to a Buffered Image, and use that to render to your java swing canvas. This [this video] is a pretty good tutorial on how to use FBOs if you choose to implement this strategy.
Cites Joehot200 · 2015-11 · Stack Overflow · on “FBO texture is displaying completely black”
I am attempting to follow ThinMatrix's water tutorial [this video] . To do this, I need to create an FBO and render it as a texture. However as you can see, the water is completely black: [LINK] I am using the source code provided [LINK] directly from the tutorial (copied from the link). Basically, I create a FrameBuffer: public FrameBufferObject() {//call when loading the game initialiseReflectionFrameBuffer(); initialiseRefractionFrameBuffer(); //Let's ignore refraction for now, as I only use reflection at the moment. } private void initialiseReflectionFrameBuffer() { reflectionFrameBuffer = createFrameBuffer(); reflectionTexture = createTextureAttachment(REFLECTION_WIDTH,REFLECTION_HEIGHT); re
Cites yik · 2018-05 · Stack Overflow · on “Texture repeating over surface when rendered from FBO”
I am trying to render a texture to a surface from a FBO but I am getting a repeat image effect like this: Repeating Image effect [LINK] I am not sure what is doing this. I am adapting the code from this tutorial: [this video] which is in java to c++. This is my code i use to setup to FBO: GLuint frameBuffer; glGenFramebuffers(1, &frameBuffer); //generate name for frame buffer glBindFramebuffer(GL_FRAMEBUFFER, frameBuffer); //create the framebuffer glDrawBuffer(GL_COLOR_ATTACHMENT0); //indicate that we will always render to color attachment 0 //texture setup GLuint texture; glGenTextures(1, &texture); glBindTexture(GL_TEXTURE_2D, texture); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 320, 180, 0, GL_RGB
Cites Gary C. · 2020-11 · Stack Overflow · on “Rendering to different framebuffers with multithreading rendering in Vulkan”
I was trying to reproduce a result that is similar to this video: [this video] Specifically, I want to render the whole scene to a different texture, and put the texture inside the UI like this screenshot of the video: [LINK] The author of the video was using OpenGL to do this, and I was trying to achieve it in Vulkan instead. However, since my current program is using the third attachment to enable MSAA and rendering the whole scene using secondary command buffers, I have difficulty translating the way to do this in the video to Vulkan. I figured that I probably not only need more framebuffers, but also multiple renderpasses. Simply put, so far this is what I tried: Begin the first renderpass, w