Author Topic: GLSL: Write to multiple textures in a single pass of a fragment shader?  (Read 4649 times)

0 Members and 1 Guest are viewing this topic.

Offline Raizor

  • Founder Member
  • Pentium
  • ********
  • Posts: 1154
  • Karma: 175
    • View Profile
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:

Offline ferris

  • Pentium
  • *****
  • Posts: 841
  • Karma: 84
    • View Profile
    • Youth Uprising Home
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:

Offline Raizor

  • Founder Member
  • Pentium
  • ********
  • Posts: 1154
  • Karma: 175
    • View Profile
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.
« Last Edit: October 27, 2011 by Raizor »
raizor

Challenge Trophies Won: