Problem with drawing text by QOpenGlFunctions
-
Hi all!
I have some problem with drawing text by QOpenGlFunctions.
QOpenGlFunctions vs QGraphicsItem
See img:
OpenGlTest.png
QGraphicsItemTest.png//your code here
if (!m_device) m_device = new QOpenGLPaintDevice;
m_device->setSize(size());
QPainter painter(m_device);
painter->drawText(QPoint(100, 200), "Hello world!");
How can I solve this problem? Where can I dig? I look forward to any proposal.
Sorry for my bad English, please write if it have mistakes.Answer:
problem is solving by clearning bufferglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
-
-
@mrjj yes, thanks
-
@ataryq
btw did u try with
painter.setRenderHint(QPainter::Antialiasing); -
@mrjj no, problem is solving by clearning buffer
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);