Jump to content
  • Advertisement
Sign in to follow this  
Deftoned

The Most Basic GLSL problem (possibly ever)

This topic is 3617 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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 :(

Share this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites
yeah thats what i meant, draw to two colour buffers in on FBO, i will check out that extension, thank you

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
//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;

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!