TextRenderer.h 1002 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /* This class extends the font rendering code in AntTweakBar
  2. so that it can be used to render text at arbitrary 3D positions */
  3. #ifndef IGL_TEXT_RENDERER_H
  4. #define IGL_TEXT_RENDERER_H
  5. #include <igl/igl_inline.h>
  6. namespace igl
  7. {
  8. class TextRenderer : public CTwGraphOpenGLCore
  9. {
  10. public:
  11. IGL_INLINE TextRenderer();
  12. IGL_INLINE virtual int Init();
  13. IGL_INLINE virtual int Shut();
  14. IGL_INLINE void BeginDraw(const Eigen::Matrix4f &view, const Eigen::Matrix4f &proj,
  15. const Eigen::Vector4f &_viewport, float _object_scale);
  16. IGL_INLINE void EndDraw();
  17. IGL_INLINE void DrawText(Eigen::Vector3d pos, Eigen::Vector3d normal, const std::string &text);
  18. protected:
  19. igl::Viewer::OpenGL_shader m_shader;
  20. std::map<std::string, void *> m_textObjects;
  21. GLuint m_shaderHandleBackup;
  22. GLuint m_TriTexUniLocationDepth;
  23. Eigen::Matrix4f view_matrix, proj_matrix;
  24. Eigen::Vector4f viewport;
  25. float object_scale;
  26. };
  27. }
  28. #ifndef IGL_STATIC_LIBRARY
  29. # include "TextRenderer.cpp"
  30. #endif
  31. #endif