View Full Version : Only first texture rendered to framebuffer is shown.

10-27-2014, 09:35 AM

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 :

Here's how I switch textures in my SpriteBatch

Good.jpg is what I want. Bad.jpg is what is being rendered from my FrameBuffers color Texture.

10-29-2014, 12:59 AM
If you don't have enough information to help me, please ask!

10-29-2014, 01:04 AM
Your sprite batch isn't flushing when you switch textures.

10-29-2014, 05:03 AM
Your sprite batch isn't flushing when you switch textures.

Note that this is a part of my SpriteBatch code. And it is flushing. When I render, I check and see if the texture that got called to be rendered is the same as the texture before. If it's not. Then it flushes.

Overall note. My framebuffer works perfectly fine. My SpriteBatch works perfectly when rendering to the screen, but not when rendering to my framebuffer. Is there something my texture bindings could do to effect my FrameBuffer?