The Most Basic GLSL problem (possibly ever)
Hey guys, i have been writing some shaders, doing some blur things,
separating bright colours from a texture into another texture.
I am using FBOs and i am wondering if there is a simple way of taking
the colour i am drawing into the fragment shader and out the other side
int a colour attachment.
I want to do this so i can initiate my fragment shader,
draw to the screen and the original image goes in one colour
attachment and then the bright colours go into another colour
attachment on the same FBO.
I wonder if that makes sense...
But yeah i want to save myself an extra render by killing two birds
with one stone, but so far i haven't been able to take what i am drawing
through a fragment shader without making any alterations...
This is probably simpler than i am explaining it... help plz :(
Sounds like you need the ARB_draw_buffers extension. Although you'll need 2 colour buffers on one FBO (AFAIK you can't render to the screen and an FBO in one go).
Regards
elFarto
Regards
elFarto
yeah thats what i meant, draw to two colour buffers in on FBO, i will check out that extension, thank you
K i think i know what has happened hear :P
I wasn't very clear and i rambled, what i actually need is some GLSL
code, i have tried something like this
main()
{
gl_Position = ftrsanform():
}
main()
{
gl_FragColor = gl_Color;
}
but all i get it a black screen, what i really want is
something like this
Turn on shader
Turn on FBO with tex1 attached
DrawModels
Turn off FBO
Draw a tex1 that contains exactly what
i would have had if i just drew the models
to the screen.
I wasn't very clear and i rambled, what i actually need is some GLSL
code, i have tried something like this
main()
{
gl_Position = ftrsanform():
}
main()
{
gl_FragColor = gl_Color;
}
but all i get it a black screen, what i really want is
something like this
Turn on shader
Turn on FBO with tex1 attached
DrawModels
Turn off FBO
Draw a tex1 that contains exactly what
i would have had if i just drew the models
to the screen.
//Fragment shader
gl_FragColor = gl_Color;
In this case, gl_Color is not setup. You need to write to gl_FrontColor or something like in the vertex shader. I think the code looks like
gl_FrontColor = gl_Color;
gl_FragColor = gl_Color;
In this case, gl_Color is not setup. You need to write to gl_FrontColor or something like in the vertex shader. I think the code looks like
gl_FrontColor = gl_Color;
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement