bind_vertex_attrib_array.h 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. #ifndef IGL_OPENGL_BIND_VERTEX_ATTRIB_ARRAY_H
  2. #define IGL_OPENGL_BIND_VERTEX_ATTRIB_ARRAY_H
  3. #include "gl.h"
  4. #include "../igl_inline.h"
  5. #include <Eigen/Core>
  6. #include <string>
  7. namespace igl
  8. {
  9. namespace opengl
  10. {
  11. /// Bind a per-vertex array attribute and refresh its contents from an Eigen
  12. /// matrix
  13. ///
  14. /// @param[in] program_shader id of shader program
  15. /// @param[in] name name of attribute in vertex shader
  16. /// @param[in] bufferID id of buffer to bind to
  17. /// @param[in] M #V by dim matrix of per-vertex data
  18. /// @param[in] refresh whether to actually call glBufferData or just bind the buffer
  19. /// @return id of named attribute in shader
  20. template <typename Scalar, int RowsAtCompileTime, int ColsAtCompileTime>
  21. IGL_INLINE GLint bind_vertex_attrib_array(
  22. const GLuint program_shader,
  23. const std::string &name,
  24. GLuint bufferID,
  25. const Eigen::Matrix<Scalar,RowsAtCompileTime,ColsAtCompileTime,Eigen::RowMajor> &M,
  26. const bool refresh);
  27. }
  28. }
  29. #ifndef IGL_STATIC_LIBRARY
  30. #include "bind_vertex_attrib_array.cpp"
  31. #endif
  32. #endif