src/mesh.c

changeset 208
658bccb1bf73
parent 175
e5544920377e
equal deleted inserted replaced
207:4d184a8706b1 208:658bccb1bf73
64 } 64 }
65 65
66 void asc_mesh_draw_triangle_strip(const AscMesh *mesh) { 66 void asc_mesh_draw_triangle_strip(const AscMesh *mesh) {
67 glBindVertexArray(mesh->vao); 67 glBindVertexArray(mesh->vao);
68 glDrawArrays(GL_TRIANGLE_STRIP, 0, mesh->vtx_count); 68 glDrawArrays(GL_TRIANGLE_STRIP, 0, mesh->vtx_count);
69 asc_error_catch_all_gl();
69 #ifndef NDEBUG 70 #ifndef NDEBUG
70 // only unbind in debug mode to detect accidental re-use of the wrong VAO 71 // only unbind in debug mode to detect accidental re-use of the wrong VAO
71 glBindVertexArray(0); 72 glBindVertexArray(0);
72 #endif 73 #endif
73 } 74 }
126 glBindVertexArray(mesh->vao); 127 glBindVertexArray(mesh->vao);
127 glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(asc_vertex2d), (void*)offsetof(asc_vertex2d, pos)); 128 glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(asc_vertex2d), (void*)offsetof(asc_vertex2d, pos));
128 glEnableVertexAttribArray(0); 129 glEnableVertexAttribArray(0);
129 glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, sizeof(asc_vertex2d), (void*)offsetof(asc_vertex2d, uv)); 130 glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, sizeof(asc_vertex2d), (void*)offsetof(asc_vertex2d, uv));
130 glEnableVertexAttribArray(1); 131 glEnableVertexAttribArray(1);
132
133 asc_error_catch_all_gl();
131 } 134 }

mercurial