Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved Failed to render a OSG pointcloud with normals using QOpenGLFrameBufferObject

    QML and Qt Quick
    1
    1
    539
    Loading More Posts
    • 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.
    • cjmdaixi
      cjmdaixi last edited by

      Hi, everyone. I am currently working on a project that connects OpenSceneGraph and Qt Quick, especially to render a pointcloud with normals binding to each vertex. After searching a lot of references and materials, I decided to use QOpenGLFrameBufferObject according to the official example "textureinsgnode". I can now render the vertices in the pointcloud, however, the normals information seem to be missing (The result is a pure white pointcloud). My question is how to get my normals rendered? Some important code snippets are shown below:
      //constructing the pointcloud geometry in OSG
      geometry->setVertexArray(vertices);
      geometry->setNormalArray(normals, osg::Array::BIND_PER_VERTEX);
      pointIdx = new osg::DrawElementsUInt(osg::PrimitiveSet::POINTS);
      qint64 verticesSize = vertices->size();
      for (size_t i = 0; i < verticesSize; ++i)
      pointIdx->push_back(i);
      geometry->addPrimitiveSet(pointIdx);

      //constructing the framebufferobject in osgQuickRenderer.cpp
      QOpenGLFramebufferObject *osgQViewerRenderer::createFramebufferObject(const QSize &size)
      {
      qDebug()<<"create framebuffobject "<<size.width()<<"x"<<size.height();
      QOpenGLFramebufferObjectFormat format;
      format.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
      format.setSamples(4);
      return new QOpenGLFramebufferObject(size, format);
      }

      What am I missing? Any suggestion would be appreciated, thanks!

      1 Reply Last reply Reply Quote 0
      • First post
        Last post