git-svn-id: svn://db.shs.com.ru/libs@290 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -39,6 +39,7 @@ QGLView::QGLView(QWidget * parent): QGraphicsView(parent), fbo_selection(3) {
|
||||
setFocusPolicy(Qt::WheelFocus);
|
||||
setScene(new QGraphicsScene());
|
||||
setInteractive(true);
|
||||
need_init_ = true;
|
||||
objects_.is_root = true;
|
||||
painter_ = 0;
|
||||
backColor_ = Qt::black;
|
||||
@@ -108,8 +109,11 @@ QGLView::QGLView(QWidget * parent): QGraphicsView(parent), fbo_selection(3) {
|
||||
|
||||
|
||||
QGLView::~QGLView() {
|
||||
stop();
|
||||
if (shader_select != 0) delete shader_select;
|
||||
if (shader_halo != 0) delete shader_halo;
|
||||
currentQGLView = 0;
|
||||
currentGLTextureManager = 0;
|
||||
//if (shader_rope != 0) delete shader_rope;
|
||||
}
|
||||
|
||||
@@ -159,12 +163,13 @@ void QGLView::drawBackground(QPainter * painter, const QRectF & rect) {
|
||||
glDisable(GL_CULL_FACE);
|
||||
glReleaseTextures();
|
||||
QGraphicsView::drawBackground(painter_, rect);
|
||||
painter_ = 0;
|
||||
}
|
||||
|
||||
|
||||
void QGLView::initializeGL() {
|
||||
//qDebug() << "init glview";
|
||||
makeCurrent();
|
||||
//makeCurrent();
|
||||
#if QT_VERSION >= 0x050600
|
||||
initializeOpenGLFunctions();
|
||||
#endif
|
||||
@@ -216,11 +221,18 @@ void QGLView::initializeGL() {
|
||||
//createGLTexture(t, QImage("e/bottom.jpg"));
|
||||
//qDebug() << bindTexture(QImage("e/bottom.jpg"));
|
||||
|
||||
need_init_ = false;
|
||||
emit glInitializeDone();
|
||||
}
|
||||
|
||||
|
||||
void QGLView::paintGL() {
|
||||
#if QT_VERSION >= 0x050600
|
||||
//initializeOpenGLFunctions();
|
||||
if (need_init_)
|
||||
initializeGL();
|
||||
#endif
|
||||
//qDebug() << "paintGL";
|
||||
//QMutexLocker ml_v(&v_mutex);
|
||||
glEnable(GL_CULL_FACE);
|
||||
//glDisable(GL_CULL_FACE);
|
||||
@@ -308,6 +320,7 @@ void QGLView::paintGL() {
|
||||
renderer_->prepareScene();
|
||||
renderer_->renderScene();
|
||||
}
|
||||
emit glPainting();
|
||||
if (selectionHalo_ || hoverHalo_) {
|
||||
glReleaseTextures();
|
||||
glReleaseShaders();
|
||||
@@ -342,7 +355,7 @@ void QGLView::paintGL() {
|
||||
glResetAllTransforms();
|
||||
glReleaseFramebuffer();
|
||||
|
||||
emit glPainting();
|
||||
emit glEndPaint();
|
||||
|
||||
/*releaseShaders();
|
||||
glActiveTextureChannel(0);
|
||||
|
||||
Reference in New Issue
Block a user