create_mesh_vbo.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 Alec Jacobson <[email protected]>
  4. //
  5. // This Source Code Form is subject to the terms of the Mozilla Public License
  6. // v. 2.0. If a copy of the MPL was not distributed with this file, You can
  7. // obtain one at http://mozilla.org/MPL/2.0/.
  8. #ifndef IGL_OPENGL_CREATE_MESH_VBO_H
  9. #define IGL_OPENGL_CREATE_MESH_VBO_H
  10. #include "../igl_inline.h"
  11. #include "gl.h"
  12. #include <Eigen/Core>
  13. namespace igl
  14. {
  15. namespace opengl
  16. {
  17. /// Create a VBO (Vertex Buffer Object) for a mesh. Actually two VBOs: one
  18. /// GL_ARRAY_BUFFER for the vertex positions (V) and one
  19. /// GL_ELEMENT_ARRAY_BUFFER for the triangle indices (F)
  20. ///
  21. /// @param[in] V #V by 3 eigen Matrix of mesh vertex 3D positions
  22. /// @param[in] F #F by 3 eigen Matrix of face (triangle) indices
  23. /// @param[out] V_vbo_id buffer id for vertex positions
  24. /// @param[out] F_vbo_id buffer id for face indices
  25. ///
  26. /// \note when using glDrawElements VBOs for V and F using Eigen::MatrixXd and
  27. /// Eigen::MatrixXi will have types GL_DOUBLE and GL_UNSIGNED_INT respectively
  28. ///
  29. IGL_INLINE void create_mesh_vbo(
  30. const Eigen::MatrixXd & V,
  31. const Eigen::MatrixXi & F,
  32. GLuint & V_vbo_id,
  33. GLuint & F_vbo_id);
  34. /// \overload
  35. ///
  36. /// @param[in] N #V by 3 eigen Matrix of mesh vertex 3D normals
  37. /// @param[out] N_vbo_id buffer id for vertex positions
  38. IGL_INLINE void create_mesh_vbo(
  39. const Eigen::MatrixXd & V,
  40. const Eigen::MatrixXi & F,
  41. const Eigen::MatrixXd & N,
  42. GLuint & V_vbo_id,
  43. GLuint & F_vbo_id,
  44. GLuint & N_vbo_id);
  45. }
  46. }
  47. #ifndef IGL_STATIC_LIBRARY
  48. # include "create_mesh_vbo.cpp"
  49. #endif
  50. #endif