How to use updateGL method qith QGLView
UpdateGL method is found in QGLWidget class. Since, QGLView is an extension of QGLWidget, it should contain a method to update. I need to put my update code somewhere. One option is to use the QTimer but is there any other possibility? Some reference on this question is here.
I've corrected that, but anyway, if you plan to use Qt3D you should rather take a look at the dev branch which is the future of Qt3D
Hello, thanks for the reply. Is there any way to explicitly call the paintgl method in QT?
Just call update, that should be enough
Is the update() method present in the QGLView class. Because, whenever I write update, I get an error saying identifier not found
It's the only slot of QGLView. What version of Qt3D are you using ?
I am using qt3d for QT5.3.2.
It worked for me. My QGLview was ingheriting the QWindow class earlier. I changed it to inherit the Qwidget class instead and I could find the update() function.
However, when you say QGLview slot. I tried it without the QWidget class and it did not work for me. But, with Qwidget it works as you mentioned.
Thank you for your support. I hope you could clarify on the update slot for QGLview without inheriting the QWidget?
I tried this way. But , I am still getting the same error.
C:\Qt\qt-qt3d\tutorials\qt3d\cube4\cubeview.cpp:128: error: undefined reference to `CubeView::update()'
class CubeView : public QGLView
CubeView(QWindow *parent = 0); ~CubeView();
void paintGL(QGLPainter *painter);
//!  constructor, initialize the cube, cursor and camera
builder1 << QGL::Faceted;
builder1 << QGLCube(2);
cube = builder1.finalizedSceneNode();
QGLBuilder cursor_builder; cursor_builder <<QGL::Faceted; cursor_builder <<QGLCube(0.5); cursor=cursor_builder.finalizedSceneNode(); //camera setup camera()->setFieldOfView(35); camera()->setNearPlane(1); camera()->setFarPlane(15);
//!  set texture for cube and cursor
//timer to call the update action slot QTimer *timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(update_action())); timer->start(50);
//!  update the cursor based on the haptic position
QVector3D *p2=new QVector3D(1,1,1--);
void CubeView::paintGL(QGLPainter *painter)
painter->setFaceColor(QGL::AllFaces, QColor(170, 202, 0));
cube->draw(painter); handcursor.bind(); cursor->draw(painter);