Dark Bit Factory & Gravity

PROGRAMMING => General coding questions => Topic started by: Raizor on October 26, 2011

Title: GLSL: Write to multiple textures in a single pass of a fragment shader?
Post by: Raizor on October 26, 2011
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
Title: Re: GLSL: Write to multiple textures in a single pass of a fragment shader?
Post by: ferris on October 26, 2011
use gl_FragData[texture_index] = ... instead of gl_FragColor. If you have all of the fbo bindings correct, it's as simple as that :)
Title: Re: GLSL: Write to multiple textures in a single pass of a fragment shader?
Post by: Raizor on October 26, 2011
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 (http://zach.in.tu-clausthal.de/teaching/cg_literatur/frame_buffer_objects.html) is some good info on the subject.