/*! *\file render_stats_opengl.hpp */ #ifndef RENDER_STATS_OPENGL_HPP #define RENDER_STATS_OPENGL_HPP class Render_stats_opengl; /* Global informations */ #include "../info/info.hpp" #include "../interface/interface_console.hpp" #include "render_stats.hpp" #include #include "resource.hpp" /*! * \brief This class redefined the OpenGL widget - QGLWidget - to display the trace. */ class Render_stats_opengl : public QGLWidget, public Render_stats { Q_OBJECT private: /*! * \brief Contains container text coordinates. */ std::list _text_pos; /*! * \brief Contains container strings. */ std::list _text_value; GLuint _rect_list; double _translated_y; double _translated_x; public: /*! * \brief The default constructor */ Render_stats_opengl(QWidget *parent); /*! * \brief The destructor */ ~Render_stats_opengl(); /*! * \brief Call by the system to initialize the OpenGL render area. */ void initializeGL(); /*! * \brief Call by the system when the render area was resized (occurs during a window resizement). * \param width : the new width of the render area. * \param height : the new height of the render area. */ void resizeGL(int width, int height); /*! * \brief Call by the system each time the render area need to be updated. */ void paintGL(); /*! * \brief Proceeds with the initialization of draw functions. */ void start_draw(); /*! * \brief Draw the text of a container. * \param x the x position of the text. * \param y the y position of the text. * \param value the string value of the text. */ void draw_text(const Element_pos x, const Element_pos y, const std::string value); /*! * \brief Draw a line. * \param x the x position of the text. * \param y the y position of the text. * \param value the string value of the text. */ void draw_horizontal_line(const Element_pos x, const Element_pos y, const Element_pos size_x); /*! * \brief Draw a line. * \param x the x position of the text. * \param y the y position of the text. * \param value the string value of the text. */ void draw_vertical_line(const Element_pos x, const Element_pos y, const Element_pos size_x); void draw_axis(const Element_pos x, const Element_pos y, const Element_pos size_x, const Element_pos size_y); /*! * \brief Draw a rectangle. * \param x the x position of the text. * \param y the y position of the text. * \param value the string value of the text. */ void draw_rect(const Element_pos x, const Element_pos y, const Element_pos w, const Element_pos h, const Element_pos r, const Element_pos g, const Element_pos b); /*! * \brief Proceeds with the end of draw functions. */ void end_draw(); void translate_y(int value); void translate_x(int value); /*! * \brief Set the height of the render area. */ void set_total_height(Element_pos h); /*! * \brief Set the width of the render area. */ void set_total_width(Element_pos w); void clear(); }; inline void Render_stats_opengl::start_draw(){ _text_pos.clear(); _text_value.clear(); makeCurrent(); _rect_list = glGenLists(10); glNewList(_rect_list, GL_COMPILE); } inline void Render_stats_opengl::draw_text(const Element_pos x, const Element_pos y, const std::string value) { _text_pos.push_back(x); _text_pos.push_back(y); _text_value.push_back(value); // std::cout << "text: " << value << " @ position : ("<