| 98 | } |
| 99 | |
| 100 | void QuadPrimitive::renderInstances( size_t numInstances ) const |
| 101 | { |
| 102 | if( !m_vertIdsBuffer ) |
| 103 | { |
| 104 | // we don't build the actual buffer until now, because in the constructor we're not guaranteed |
| 105 | // a valid GL context. |
| 106 | CachedConverterPtr cachedConverter = CachedConverter::defaultCachedConverter(); |
| 107 | m_vertIdsBuffer = IECore::runTimeCast<const Buffer>( cachedConverter->convert( m_vertIds.get() ) ); |
| 108 | } |
| 109 | |
| 110 | Buffer::ScopedBinding indexBinding( *m_vertIdsBuffer, GL_ELEMENT_ARRAY_BUFFER ); |
| 111 | glDrawElementsInstancedARB( GL_TRIANGLES, m_vertIds->readable().size(), GL_UNSIGNED_INT, nullptr, numInstances ); |
| 112 | } |
| 113 | |
| 114 | Imath::Box3f QuadPrimitive::bound() const |
| 115 | { |