Results 1 to 3 of 3

Thread: Weird FPS camera and framebuffer problem

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2016
    Posts
    9

    Weird FPS camera and framebuffer problem

    I am following this tutorial about framebuffers in OpenGL. I have implemented a FPS camera before and now I implemented the framebuffer.
    Now as long as I don't use any controls (WASD and mouse) it works perfectly. But as soon as I move the camera around, a weird error happens.
    It's as if the contents of the framebuffer texture from the last frame aren't erased, but just the current frame's contents are added.

    I am using the object class from my previous question and a camera class and I'm also loading shaders with a function from another file, but it has nothing to do with this.

    Code
    main.cpp
    object.h
    camera.h
    Shaders (for the framebuffer texture quad)

    What am I missing?

  2. #2
    Senior Member Regular Contributor
    Join Date
    Jul 2012
    Posts
    459
    It's as if the contents of the framebuffer texture from the last frame aren't erased, but just the current frame's contents are added.
    I did not read your code, but I'm pretty sure you made the right assumption. Just clear the FBO before rendering the new image, just like you clear other buffers.

    See this: https://www.opengl.org/wiki/Framebuffer#Buffer_clearing

  3. #3
    Junior Member Newbie
    Join Date
    Jun 2016
    Posts
    9
    Just clear the FBO before rendering the new image, just like you clear other buffers.
    Exactly. Calling glClearColor and glClear after glBindFramebuffer fixed the problem.

    Thanks

Similar Threads

  1. A very weird problem...
    By Nimrod in forum OpenGL: Windows
    Replies: 3
    Last Post: 12-30-2004, 07:11 AM
  2. Weird CVA Problem
    By nostgard in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 05-20-2003, 02:53 PM
  3. Weird Problem
    By raverbach in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 03-26-2003, 05:38 AM
  4. weird problem
    By in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 03-23-2003, 10:14 AM
  5. Weird Problem !!!
    By Belgy in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 10-29-2002, 06:55 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean