Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt + OpenGL + Graphics View Framework, crash with access 0x00000000
Forum Updated to NodeBB v4.3 + New Features

Qt + OpenGL + Graphics View Framework, crash with access 0x00000000

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 560 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    czlc
    wrote on last edited by
    #1

    I create a new Qt application with OpenGL,just add scene in like this:

    @{
    ui->setupUi(this);

    QGraphicsView *pSceneView = new QGraphicsView(this);
    setCentralWidget(pSceneView);
    QGLWidget *pGLWidget = new QGLWidget;
    pSceneView->setViewport(pGLWidget);
    pSceneView->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
    pSceneView->setScene(new MainScene);
    pGLWidget->makeCurrent();

    QGLFunctions *glFuncs = new QGLFunctions(pGLWidget->context());
    GLuint i;
    glFuncs->glGenBuffers(1, &i);
    glFuncs->glBindBuffer(GL_ARRAY_BUFFER, i); // unbind buffer cause crash
    }@

    the class MainScene is inherit from QGraphicsScene, just set SceneRect and rewrite drawBackground like this:
    @MainScene::MainScene(QObject parent / = 0 */)
    :QGraphicsScene(parent)
    {
    setSceneRect(-1024/2, -768/2, 1024, 768);
    }

    void MainScene::drawBackground(QPainter *painter, const QRectF &rect)
    {
    painter->drawRect(sceneRect());
    }@

    if i don't rewrite drawBackground or don't call glBindBuffer, it didn't crash。the Qt version is 5.3.2, os is windows 7。

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved