50 #include <ACG/GL/acg_glew.hh>
51 #include "DrawMesh.hh"
55 DrawMeshBase::DrawMeshBase() :
57 numTris_(0), numVerts_(0),
63 vertexDecl_ =
new VertexDeclaration;
64 vertexDeclEdgeCol_ =
new VertexDeclaration;
65 vertexDeclHalfedgeCol_ =
new VertexDeclaration;
66 vertexDeclHalfedgePos_ =
new VertexDeclaration;
69 DrawMeshBase::~DrawMeshBase() {
70 if (vbo_) glDeleteBuffersARB(1, &vbo_);
71 if (ibo_) glDeleteBuffersARB(1, &ibo_);
82 void DrawMeshBase::deleteIbo() {
84 glDeleteBuffers(1, &ibo_);
88 void DrawMeshBase::bindVbo() {
90 glGenBuffersARB(1, &vbo_);
95 void DrawMeshBase::bindIbo() {
97 glGenBuffersARB(1, &ibo_);
102 void DrawMeshBase::bindLineIbo() {
109 void DrawMeshBase::bindPickVertexIbo() {
116 void DrawMeshBase::createIndexBuffer() {
117 glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB,
118 numTris_ * 3 *
sizeof(
unsigned int),
122 void DrawMeshBase::fillLineBuffer(
size_t n_edges,
void *data) {
125 glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB,
126 n_edges * 2 *
sizeof(
unsigned short),
127 data, GL_STATIC_DRAW_ARB);
129 glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB,
130 n_edges * 2 *
sizeof(
unsigned int),
131 data, GL_STATIC_DRAW_ARB);
134 void DrawMeshBase::fillVertexBuffer() {
139 void DrawMeshBase::fillInvVertexMap(
size_t n_vertices,
void *data) {
140 glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB,
sizeof(
int) * n_vertices, data, GL_STATIC_DRAW);
GLuint pickVertexIBO_
map from openmesh vertex to vbo vertex id
Namespace providing different geometric functions concerning angles.
GLenum indexType_
support for 2 and 4 byte unsigned integers
VertexDeclaration * vertexDeclEdgeCol_
vertex buffer layout declaration with per edge colors
VertexDeclaration * vertexDeclHalfedgePos_
vertex buffer layout declaration with halfedge positions only
GLuint lineIBO_
index buffer used in Wireframe / Hiddenline mode
unsigned int getVertexStride(unsigned int i=0) const
VertexDeclaration * vertexDecl_
vertex buffer layout declaration with per vertex colors
VertexDeclaration * vertexDeclHalfedgeCol_
vertex buffer layout declaration with per halfedge colors
static void bindBufferARB(GLenum _target, GLuint _buffer)
same function as bindBuffer
std::vector< char > vertices_
const int * getIndexBuffer() const