Closed mgian closed 7 years ago
@maxGimeno: Can you have a look at this pull-request and comment? I know it was something that was wanted, for the port to Android.
The only problem I see is that the doc has not been updated and still cites QGLWidget everywhere instead of QOpenGLWidget. I also wonder why I had to use QOpenGLFunctions for glClearColor() and it is not done here, but I guess it is because we wanted OpenGL ES compatible code, which is not an issue here.
Removing the #ifdef block as the side effect, as I understand, to make it incompatible with earlier versions of the library, which as today are at least 3 years old, since the new widget is shipped starting with this version of Qt. I am not sure it is a good idea to drop the support fot Qt libraries < 5.4.
I will fix the degrees typo and the renderText and update the pull request (As note, the examples/contribs/terrain example does not compile anyway)
Thanks for these.
My understanding is that qglColor
is a simple helper function that is not present in QOpenGLWidget
. But I would rather replace it everywhere by a native OpenGL glColor4f
call, rather than keep #ifdef
around. This is already what you did line 153 in examples/constrainedCamera/constrainedCamera.cpp
. I don't think there's a backward compatibility issue with this approach.
I updated the pull request, but the reimplementation of renderText() method seems to be a little more difficult, so I need some more time.
You can do renderText like this
void QGLViewer::renderText(int textPosX, int textPosY, const QString &text, const QFont & font, const QColor& fontColor) {
// Render text
QPainter painter(this);
painter.setPen(fontColor);
painter.setFont(font);
painter.drawText(textPosX, textPosY, text);
painter.end();
}
Interesting workaround, thanks. Needs to be fully tested, but that's a good option.
On Fri, Jun 9, 2017 at 12:23 PM, oracle3001 notifications@github.com wrote:
You can do renderText like this
void QGLViewer::renderText(int textPosX, int textPosY, const QString &text, const QFont & font, const QColor& fontColor) {
// Render text QPainter painter(this); painter.setPen(fontColor); painter.setFont(font); painter.drawText(textPosX, textPosY, text); painter.end();
}
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/GillesDebunne/libQGLViewer/pull/36#issuecomment-307353640, or mute the thread https://github.com/notifications/unsubscribe-auth/ABzymjh9RJbuSJ7vL3RrooxefU6D0l47ks5sCR0RgaJpZM4NAq7w .
I updated the my code using the workaround suggested by @oracle3001 and it seems to work reasonably well. I have also updated the documentation to refer to the new QOpenGLWidget However I have not update the examples in the 'contrib'
I manually merged your branch into master, and added a few extra changes.
Thanks a lot for this contribution. Closing this PR.
G
This should be a porting to the new QOpenGLWidget. It seems to work pretty well.