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. glPrimitiveRestartIndex not present when writing code in Qt Creator
Forum Updated to NodeBB v4.3 + New Features

glPrimitiveRestartIndex not present when writing code in Qt Creator

Scheduled Pinned Locked Moved General and Desktop
opengl
6 Posts 2 Posters 2.2k Views 2 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.
  • O Offline
    O Offline
    Olivier Ronat
    wrote on last edited by Olivier Ronat
    #1

    The glPrimitiveRestartIndex function is unknown by the compiler while glEnable(GL_PRIMITIVE_RESTART_INDEX) is valid.
    The <QOpenGLFunctions_4_3_Core> is included (and I have noticed in the documentation the existence of that function)
    Is this OpengL feature included in QT 5.4 or what must I do to activate it?
    Thank you for your answer

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Can you show how you are using QOpenGLFunctions_4_3_Core ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      O 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi and welcome to devnet,

        Can you show how you are using QOpenGLFunctions_4_3_Core ?

        O Offline
        O Offline
        Olivier Ronat
        wrote on last edited by
        #3

        I want to draw a cube as a pair of triangle strips separated by a primitive restart index.
        GLfloat cubePositions []={
        -1.0f, 1.0f, -1.0f // Summit 0
        , 1.0f, 1.0f, -1.0f // Summit 1
        , -1.0f,1.0f, 1.0f // Summit 2
        , 1.0f, 1.0f, 1.0f // Summit 3
        , -1.0f,-1.0f,-1.0f // Summit 4
        , 1.0f, -1.0f,-1.0f // Summit 5
        , -1.0f,-1.0f,1.0f // Summit 6
        , 1.0f,-1.0f,1.0f // Summit 7 };
        GLushort cube_indices[] =
        {
        1, 5, 0, 4, 2, 6, 3, 7 , // First strip
        0xFFFF, // <<- - This is the restart index
        6, 4, 7, 5, 3, 1, 2, 0 // Second strip
        };
        Normally when all is well defined and allocated we must do the following
        glEnable(GL_PRIMITIVE_RESTART); // OK it is working
        glPrimitiveRestartIndex(0xFFFF); // This procedure is not recognized by Qt although it is documented.
        glDrawElements(GL_TRIANGLE_STRIP, 17, GL_UNSIGNED_SHORT, NULL);

        Of course I can call 2 draw commands without primitive restart as follow:
        glDrawElements(GL_TRIANGLE_STRIP, 8, GL_UNSIGNED_SHORT, NULL);
        glDrawElements(GL_TRIANGLE_STRIP, 8, GL_UNSIGNED_SHORT, (const GLvoid *)(9 * sizeof(GLushort)));

        But I was testing advanced features and I have a problem with primitive restart when declaring which index is the restarting index
        Thank you for your help

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Sorry, I meant: how are you declaring/initializing your class with QOpenGLFunctions_4_3_Core ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          O 1 Reply Last reply
          0
          • SGaistS SGaist

            Sorry, I meant: how are you declaring/initializing your class with QOpenGLFunctions_4_3_Core ?

            O Offline
            O Offline
            Olivier Ronat
            wrote on last edited by
            #5

            @SGaist
            Thank you your question solves the problem. In fact I have derived my new class with QOpenGLFunctions and not QOpenGLFunctions_4_3_Core. So now glPrimitiveRestartIndex appears.
            For the GL functions initialisation can I use initializeOpenGLFunctions(); or must I add something else?

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              No, nothing else, that's the only thing you need to do to initialize QOpenGLFunctions

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              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