Changeset 463 for trunk/src/gl/gl_context.cc
- Timestamp:
- 08/28/15 18:28:34 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gl/gl_context.cc
r462 r463 111 111 } 112 112 113 void nv::gl_context::attach( framebuffer f, texture depth )113 void nv::gl_context::attach( framebuffer f, texture depth, int layer /*= -1*/ ) 114 114 { 115 115 // TODO: framebuffer variable, so no re-binding? … … 121 121 glBindFramebuffer( GL_FRAMEBUFFER, info->glid ); 122 122 unsigned gl_type = texture_type_to_enum( tinfo->type ); 123 if ( tinfo ) 124 { 125 glFramebufferTexture2D( GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, gl_type, tinfo->glid, 0 ); 123 unsigned glid = ( tinfo ? tinfo->glid : 0 ); 124 if ( layer >= 0 ) 125 { 126 glFramebufferTextureLayer( GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, tinfo->glid, 0, layer ); 126 127 } 127 128 else 128 129 { 129 glFramebufferTexture2D( GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, gl_type, 0, 0 ); 130 } 131 } 130 glFramebufferTexture2D( GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, gl_type, glid, 0 ); 131 } 132 } 133 132 134 } 133 135 … … 328 330 { 329 331 image_format format = info->format; 330 ivec 2size = info->size;332 ivec3 size = info->size; 331 333 unsigned gl_type = texture_type_to_enum( info->type ); 332 334 333 335 glBindTexture( gl_type, info->glid ); 334 glTexImage2D( gl_type, 0, static_cast<GLint>( nv::image_format_to_internal_enum(format.format) ), size.x, size.y, 0, nv::image_format_to_enum(format.format), nv::datatype_to_gl_enum(format.type), data ); 336 if ( info->type == TEXTURE_3D || info->type == TEXTURE_2D_ARRAY ) 337 glTexImage3D( gl_type, 0, static_cast<GLint>( nv::image_format_to_internal_enum( format.format ) ), size.x, size.y, size.z, 0, nv::image_format_to_enum( format.format ), nv::datatype_to_gl_enum( format.type ), data ); 338 else 339 glTexImage2D( gl_type, 0, static_cast<GLint>( nv::image_format_to_internal_enum(format.format) ), size.x, size.y, 0, nv::image_format_to_enum(format.format), nv::datatype_to_gl_enum(format.type), data ); 335 340 } 336 341 } … … 690 695 { 691 696 // TODO: configurable: 692 load_gl_extensions( GL_EXT_FRAMEBUFFER_BLIT | GL_EXT_FRAMEBUFFER_OBJECT );697 load_gl_extensions( GL_EXT_FRAMEBUFFER_BLIT | GL_EXT_FRAMEBUFFER_OBJECT | GL_EXT_TEXTURE_ARRAY ); 693 698 force_apply_render_state( m_render_state ); 694 699
Note: See TracChangeset
for help on using the changeset viewer.