qopenglwidget

How to add QOpenGLWidget to QGraphicsScene?

浪尽此生 提交于 2020-01-15 10:57:07
问题 My main.cpp int main(int argc, char *argv[]) { QApplication a(argc, argv); QSurfaceFormat format; format.setDepthBufferSize(24); format.setStencilBufferSize(8); format.setVersion(3, 2); format.setProfile(QSurfaceFormat::CoreProfile); format.setSamples(4); QSurfaceFormat::setDefaultFormat(format); MyGLWidget w; w.setFormat(format); QGraphicsScene scene; QGraphicsProxyWidget* proxy = scene.addWidget(&w); scene.addText("Hello"); QGraphicsView view(&scene); view.show(); return a.exec(); } My

Qmatrix4x4 translate does not take any effect

非 Y 不嫁゛ 提交于 2019-12-11 08:49:11
问题 I didn't have a lot experience in opengl, so excuse me if the question is silly. I'm trying to move triangle with the mouseMoveEvent by translating Qmatrix4x4 field in my class glView. When i did not do anything (perspective, translate with matrix) and just call m_program->setUniformValue(m_matrixUniform, m_matrix) everything works fine, but if i just do this->m_matrix=matrix; (where matrix is just Qmatrix4x4 variable) and then m_program->setUniformValue(m_matrixUniform, m_matrix) method does