123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- #include "create_vector_vbo.h"
- #include <cassert>
- template <typename T>
- IGL_INLINE void igl::opengl::create_vector_vbo(
- const Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic> & V,
- GLuint & V_vbo_id)
- {
-
-
-
- glGenBuffers(1,&V_vbo_id);
-
- glBindBuffer(GL_ARRAY_BUFFER,V_vbo_id);
-
-
-
- if(V.Options & Eigen::RowMajor)
- {
- glBufferData(
- GL_ARRAY_BUFFER,
- sizeof(T)*V.size(),
- V.data(),
- GL_STATIC_DRAW);
- }else
- {
-
- Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic> VT = V.transpose();
-
- glBufferData(
- GL_ARRAY_BUFFER,
- sizeof(T)*V.size(),
- VT.data(),
- GL_STATIC_DRAW);
- }
-
- glBindBuffer(GL_ARRAY_BUFFER, 0);
- }
- #ifdef IGL_STATIC_LIBRARY
- template void igl::opengl::create_vector_vbo<int>(Eigen::Matrix<int, -1, -1, 0, -1, -1> const&, unsigned int&);
- template void igl::opengl::create_vector_vbo<double>(Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, unsigned int&);
- #endif
|