p.begin(myGlWidget);
...
// get the width and height from the glcontext
width = glcx->device()->width();
height = glcx->device()->height()
...
// setting some openGL state
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glViewport(0, 0, width, height);
gluProject(x, y, z, &m[0][0], &p[0][0], &v[0], &w_x, &w_y, &w_z);
w_y = height - w_y;
// At this point it w_x, w_y should have been in windows
// co-orrdinates... but still the following line draws the text at
// very top-left in glwidget, any reason ???
p.
drawLine(QRect(0,
0, width, height
));
================ (B
)// restoring the openGL state
p.end();
QPainter p;
p.begin(myGlWidget);
...
// get the width and height from the glcontext
const QGLContext *glcx = myGlWidget->context();
width = glcx->device()->width();
height = glcx->device()->height()
...
// setting some openGL state
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glViewport(0, 0, width, height);
gluProject(x, y, z, &m[0][0], &p[0][0], &v[0], &w_x, &w_y, &w_z);
w_y = height - w_y;
// At this point it w_x, w_y should have been in windows
// co-orrdinates... but still the following line draws the text at
// very top-left in glwidget, any reason ???
p.drawText(QPointF(w_x, w_y), QString(text));=========== (A)
p.drawLine(QRect(0, 0, width, height));================ (B)
// restoring the openGL state
p.end();
To copy to clipboard, switch view to plain text mode
Bookmarks