I want to create large openGL models, so I want to divide it in multiple classes. For that, I wrote two classes,
/////////////////// glhandle.cpp ////////////////////////////////////////
#include "glhandle.h" //Contains defn of GLHandle class
#include "buildingpainter.h"
void GLHandle::paintGL() {
//SOME DRAWING CODE HERE
BuildingPainter p=BuildingPainter p=BuildingPainter(this->context());
p.draw();
}
//ResizeGL(), initializeGL() and other functions
/////////////////// glhandle.cpp ////////////////////////////////////////
#include "glhandle.h" //Contains defn of GLHandle class
#include "buildingpainter.h"
void GLHandle::paintGL() {
//SOME DRAWING CODE HERE
BuildingPainter p=BuildingPainter p=BuildingPainter(this->context());
p.draw();
}
//ResizeGL(), initializeGL() and other functions
To copy to clipboard, switch view to plain text mode
and
////////////////// BuildingPainter.cpp ///////////////////////////////
#include "buildingpainter.h" //Defn of BuildingPainter class
BuildingPainter
::BuildingPainter(QWidget *parent
) :}
// This constructor is called: So that openGL states should be copied
}
void BuildingPainter::draw() {
//More drawing Code here
}
////////////////// BuildingPainter.cpp ///////////////////////////////
#include "buildingpainter.h" //Defn of BuildingPainter class
BuildingPainter::BuildingPainter(QWidget *parent) :
QGLWidget(parent) {
}
// This constructor is called: So that openGL states should be copied
BuildingPainter::BuildingPainter(const QGLContext *refs): QGLWidget(refs) {
}
void BuildingPainter::draw() {
//More drawing Code here
}
To copy to clipboard, switch view to plain text mode
However, I am getting compile error:
error: ‘QGLWidget::QGLWidget(const QGLWidget&)’ is private
in definition of BuildingPainter.
What is right way to do it so that I can render different parts of my model from different classes?
Bookmarks