Hi!
I’ve tried to create a framebuffer this past week, but I’ve encountered some problems. Only the first texture I render to my framebuffer is shown. I’ve multiple texture ids and only the first texture i render is shown in my framebuffers color texture.
These are the steps I’m doing for rendering.
Clear the screen, depth and stencil buffers.
Bind the FrameBuffer. See FrameBuffer.bind().
Use my SpriteBatch to render three solid quads (as texture) with different sizes and different positions.
Unbind my FrameBufer. See FrameBuffer.unbind()
Bind my FrameBuffer’s colorTexture
Render my FrameBuffer with my SpriteBatch
Here’s some facts I know about the problem.
The textures shows the right color. They are not white.
The first texture I render is shown, while the other two isn’t. If I change the order, the first texture still gets rendered.
With three textures, I mean three separate texture ids.
I’ve depth test enabled.
No OpenGL error or FrameBuffer error is being thrown.
When rendering using my SpriteBatch directly to the screen all three quads is shown.
The size of my FrameBuffer is the size of my screen.
I think there’s something wrong with my texture bindning. I’ve a SpriteBatch where I switch textures.
Position is not the problem.
I can render multiple times with my first texture. All gets rendered towards my FrameBuffer.
Here’s my framebuffer :
www.pastebin.com/J8XAFZBi
Here’s how I switch textures in my SpriteBatch
www.pastebin.com/LF0fVqM1
Good.jpg is what I want. Bad.jpg is what is being rendered from my FrameBuffers color Texture.