hi, I've searched for this already long time, but couldn't find any solution so far.
The problem is the following thing:
I created a GLWidget which is derived from QGLWidget, in this class I have overriden the method paintGL(), in which I can successfully call the gl commands like glVertex3f(..) and so on. So that works fine.
Now I am trying to make a Cube class, in which I want to make a method like drawCube(...), in which the glCommands for exactly a cube are called. I then want to call the drawCube method in the QGLWidget e.g:
public GLWidget::paintGL()
{
mycube.drawCube(this); // I am not sure which parameter I should give the cube
}
public GLWidget::paintGL()
{
mycube.drawCube(this); // I am not sure which parameter I should give the cube
}
To copy to clipboard, switch view to plain text mode
The problem I get is I don't know how to reference the GLWidget, to the Cube class, so I can actually call there its methods. (the glVertex3f(..) for example)
I hope I described my problem clear enough to understand.
Any help is very appreciated, since it would be horrible to writing all the glPaint code in only one method
thanks in advance
Bookmarks