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. Unused functions in the OpenGL Window Example
Forum Updated to NodeBB v4.3 + New Features

Unused functions in the OpenGL Window Example

Scheduled Pinned Locked Moved General and Desktop
opengl
5 Posts 3 Posters 1.2k Views 3 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.
  • A Offline
    A Offline
    Ailurus
    wrote on last edited by
    #1

    Hi, I'm new to Qt and fairly new to both C++ and OpenGL. I've been going over the OpenGL Window Example in detail, and I noticed that both OpenGLWindow::render() and TriangleWindow::loadShader(GLenum type, const char *source) are actually not used at all (running Qt 5.5.0 on Linux). Is there a particular reason for including these functions in the example?

    1 Reply Last reply
    0
    • N Offline
      N Offline
      N.Sumi
      wrote on last edited by N.Sumi
      #2

      Hi @Ailurus ,

      In that function, the OpenGL subclass can implement either OpenGLWindow::render() or OpenGL:: render(QPainter *painter) . virtual void render() is like your own set of openGL function. In TriangleWindow, the render function of Triangle class is overriding the render() of the openGLWindow. you can have look on it.

      TriangleWindow::loadShader(GLenum type, const char *source) has been used in the traingleWindow cpp file. Here they used this shader.

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

        Hi and welcome to devnet,

        render is called in the renderNow function

        For loadShader, good question, it looks like it's not used currently so it looks like the sample code needs a small cleanup (WIP)

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

        A 1 Reply Last reply
        0
        • SGaistS SGaist

          Hi and welcome to devnet,

          render is called in the renderNow function

          For loadShader, good question, it looks like it's not used currently so it looks like the sample code needs a small cleanup (WIP)

          A Offline
          A Offline
          Ailurus
          wrote on last edited by
          #4

          @SGaist Thanks! Yes, renderNow() calls the render() function, but in practise TriangleWindow::render() is used. OpenGLWindow::render() can therefore be an empty function I think :).

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

            If it does nothing useful, rather pure virtual but in this case, it's an example of basic reimplementation.

            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