Commit f1eeda8e authored by Frédéric Larue's avatar Frédéric Larue

Added Draw() function to VBO that makes it possible to specify the rendering primitive type.

parent 62def1b4
......@@ -324,7 +324,11 @@ namespace GPU
m_AttribBinding.clear();
}
inline void DrawArrays() { if( m_PrimitiveType != GL_NONE ) DrawArrays( m_PrimitiveType, 0, m_Attrib.begin()->second.BufferSize() ); }
inline void DrawArrays()
{
assert( m_PrimitiveType != GL_NONE );
DrawArrays( m_PrimitiveType, 0, m_Attrib.begin()->second.BufferSize() );
}
inline void DrawArrays( GLenum mode ) { DrawArrays( mode, 0, m_Attrib.begin()->second.BufferSize() ); }
inline void DrawArrays( GLenum mode, GLint first, GLsizei count )
{
......@@ -333,7 +337,11 @@ namespace GPU
Unbind();
}
inline void DrawElements() { if( m_PrimitiveType != GL_NONE ) DrawElements( (GLenum) m_PrimitiveType ); }
inline void DrawElements()
{
assert( m_PrimitiveType != GL_NONE );
DrawElements( (GLenum) m_PrimitiveType );
}
inline void DrawElements( GLenum mode )
{
assert( m_Indices );
......@@ -350,11 +358,16 @@ namespace GPU
}
inline void Draw()
{
assert( m_PrimitiveType != GL_NONE );
Draw( (GLenum) m_PrimitiveType );
}
inline void Draw( GLenum mode )
{
if( Indices() )
DrawElements();
DrawElements( mode );
else
DrawArrays();
DrawArrays( mode );
}
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment