Ignore:
Timestamp:
06/16/16 19:47:58 (9 years ago)
Author:
epyon
Message:
  • instancing support
File:
1 edited

Legend:

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

    r501 r502  
    10571057        }
    10581058}
     1059
     1060void nv::gl_context::draw_instanced( primitive prim, const render_state& rs, program p, size_t instances, vertex_array va, size_t count, size_t first /*= 0 */ )
     1061{
     1062        apply_render_state( rs );
     1063        const vertex_array_info* info = m_vertex_arrays.get( va );
     1064        if ( count > 0 && info )
     1065        {
     1066                bind( p );
     1067                bind( va );
     1068                if ( info->index.is_valid() )
     1069                {
     1070                        glDrawElementsInstanced( primitive_to_enum( prim ), static_cast<GLsizei>( count ), datatype_to_gl_enum( info->index_type ), reinterpret_cast<const void*>( get_datatype_info( info->index_type ).size * first ), instances );
     1071                }
     1072                else
     1073                {
     1074                        glDrawArraysInstanced( primitive_to_enum( prim ), static_cast<GLint>( first ), static_cast<GLsizei>( count ), instances );
     1075                }
     1076                unbind( va );
     1077                //unbind( p );
     1078        }
     1079}
Note: See TracChangeset for help on using the changeset viewer.