Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Very simple question: Is it possible to process a vbo through different shaders? If so, how? What I want is sth like this:

reflectionShader.bind(); //starts shader
reflectionShader.load(some_values); //loads uniform vars into shader
process(vbo); //"renders" vbo using bound shader
reflectionShader.unbind(); //stops shader
refractionShader.bind();
refractionShader.load(some_other_values);
process(vbo);
refractionShader.unbind();
render(vbo); //output to screen
share|improve this question
    
I don't think most systems support that as a single batch if that's your intention. Maybe if your broaden your explanation of what you hope to acheive, someone can help you find another alternative. –  RobStone Aug 7 at 12:58

1 Answer 1

up vote 1 down vote accepted

The way to do this is with a FBO (Frame Buffer Object).

You can render each pass to a FBO and use it as a texture input in the next stage, any kind of deferred shading and post processing is reliant upon this functionality.

https://www.opengl.org/wiki/Framebuffer_Object

share|improve this answer
    
So by that you mean rendering it x times and putting the results on top of each other? That should work. I wont mark your answer as correct yet, because mb theres a better solution to this than using fbos :-) –  Addi Aug 7 at 13:46
    
Unfortunately your only options in OpenGL are either to use a texture, a uniform or shader storage buffer (which may be a texture in the implementation anyway). For your case, where you need to draw the entire screen using a technique and feed it as the input into the next technique, I don't think there's much you can do other than use an FBO. –  cfehunter Aug 7 at 14:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.