Ignore:
Timestamp:
06/08/16 20:14:43 (9 years ago)
Author:
epyon
Message:
  • massive particle_engine updates
  • more image data types
  • texture layers for framebuffers
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gl/gl_context.cc

    r499 r500  
    132132}
    133133
    134 void nv::gl_context::attach( framebuffer f, output_slot slot, texture t )
     134void nv::gl_context::attach( framebuffer f, output_slot slot, texture t, int layer /* = -1*/ )
    135135{
    136136        // TODO: framebuffer variable, so no re-binding?
     
    143143                glBindFramebuffer( GL_FRAMEBUFFER, info->glid );
    144144                unsigned gl_type = texture_type_to_enum( tinfo->type );
    145 
    146                 if ( tinfo )
    147                 {
    148                         //              if ( tinfo->size.y == 0 )
    149                                 //                      glFramebufferTexture1D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0+(unsigned)slot, GL_TEXTURE_1D, tinfo->glid, 0 );
    150                         glFramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0+unsigned( slot ), gl_type, tinfo->glid, 0 );
     145                unsigned tglid = tinfo ? tinfo->glid : 0;
     146
     147                if ( layer >= 0 )
     148                {
     149                        glFramebufferTextureLayer( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + unsigned( slot ), tglid, 0, layer );
    151150                }
    152151                else
    153152                {
    154                         glFramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0+unsigned( slot ), gl_type, 0, 0 );
     153                        glFramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + unsigned( slot ), gl_type, tglid, 0 );
    155154                }
    156155
     
    171170                if ( layer >= 0 )
    172171                {
    173                         glFramebufferTextureLayer( GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, tinfo->glid, 0, layer );
     172                        glFramebufferTextureLayer( GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, glid, 0, layer );
    174173                }
    175174                else
Note: See TracChangeset for help on using the changeset viewer.