delete m;
}
+void Canvas::set_status(const QString &s)
+{
+ status = s;
+ update();
+}
+
void Canvas::initializeGL()
{
mesh_shader.addShaderFromSourceFile(QGLShader::Vertex, ":/gl/mesh.vert");
mesh_shader.link();
backdrop = new Backdrop();
-
- glClearColor(0.0, 0.0, 0.0, 0.0);
- glEnable(GL_DEPTH_TEST);
}
-void Canvas::paintGL()
+void Canvas::paintEvent(QPaintEvent *event)
{
+ Q_UNUSED(event);
+
+ glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ glEnable(GL_DEPTH_TEST);
backdrop->draw();
if (mesh) draw_mesh();
+
+ QPainter painter(this);
+ if (!status.isNull())
+ painter.drawText(10, height() - 10, status);
}
+
void Canvas::draw_mesh()
{
mesh_shader.bind();
Canvas(const QGLFormat& format, QWidget* parent=0);
void initializeGL();
- void paintGL();
+ void paintEvent(QPaintEvent* event);
~Canvas();
public slots:
+ void set_status(const QString& s);
void load_mesh(Mesh* m);
float yaw;
QPoint mouse_pos;
+ QString status;
};
#endif // CANVAS_H