• Welcome to Dark Bit Factory & Gravity.
 

GLSL: Write to multiple textures in a single pass of a fragment shader?

Started by Raizor, October 26, 2011

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Raizor

I'm currently using two FBOs, each with an attached texture to render out normals and lighting. At present, I do two passes, one with the FBO/texure for the normals and another pass with the FBO/texture for the lighting.

I'm just wondering if there's any way to write/render to multiple textures in a single fragment shader pass?

Thanks
raizor

Challenge Trophies Won:

ferris

use gl_FragData[texture_index] = ... instead of gl_FragColor. If you have all of the fbo bindings correct, it's as simple as that :)
http://iamferris.com/
http://youth-uprising.com/

Where the fun's at.
Challenge Trophies Won:

Raizor

Thanks Ferris :)

That's for a single FBO with multiple attached textures?

EDIT: No worries, found some info. Thanks again.

If anyone else is interested in this. Here is some good info on the subject.
raizor

Challenge Trophies Won: