I’ve been working on my game engine, and I finally learn’t how to draw to a frame buffer & render it with a post-processing shader. Like this:
frame.begin(width, height); // Sets viewport & binds frame
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); // Clears the frame buffer
ambient.use();
ambient.setUniformf("u_lAmbient" /*Blah Blah Blah*/);
scene.renderAll(ambinent); // Render the scene graph
lighting.renderAll(scene); // Multipass the lights over the scene
frame.end(windowHeight, windowWidth); // Reset viewport & bind nothing
Then I re-draw the texture onto a quadralaterial, Simple! But when I want to make another off-scene-framebuffer from the light’s perspective ( per every light ),
frame.begin(width, height); // Sets viewport & binds frame
...
scene.renderAll(ambinent); // Render the scene graph
lighting.renderAll(scene); // Creates ANOUTHER framebuffer inside this one
...
frame.end(windowHeight, windowWidth); // Reset viewport & bind nothing
I have to un-bind the frame buffer, then bind another, and It’s been a big headache… So how should I solve this?
The goal is to get a depth-render of the scene graph from the lights perspective ( and do it every light ).