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. Using older OpenGL versions (QOpenGLFunctions_3_0 compile error)
Forum Updated to NodeBB v4.3 + New Features

Using older OpenGL versions (QOpenGLFunctions_3_0 compile error)

Scheduled Pinned Locked Moved Unsolved General and Desktop
opengloculusrift
4 Posts 2 Posters 1.5k 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.
  • Joel BodenmannJ Offline
    Joel BodenmannJ Offline
    Joel Bodenmann
    wrote on last edited by
    #1

    Hello folks,

    I'm currently trying to make a small proof-of-concept demonstration that shows that Qt can be used to render to an OculusRift using the OculusSDK and OpenGL.
    It has been quite a while since I last played with OpenGL and it seems that a lot of stuff changed, especially with OpenGL ES and stuff like that.

    The OculusSDK comes with an OpenGL example that runs fine. However, it's not using Qt - it's a bare Windows application. I'd like to just render a simple cube to the Oculus.
    So far, the integration of the Oculus stuff has not been any problem at all. I'm able to talk to the goggles and retrieve sensor values. I'm a bit stuck with the rendering though: The OculusSDK provides a function that basically returns an OpenGL texture I can render to. I assume that once I retrieved that texture I can just render to it using OpenGL like I'm used to (after binding using glBindTexture() or similar).

    My big problem right now is the OpenGL + Qt combination. Right now I have a custom class that inherits from QOpenGLFunctions. However, it seems that QOpenGLFunctions uses/exposes the OpenGL ES 2.0 API. The Oculus examples use something like OpenGL 2.0 or 3.0 (non-ES). There are no shaders being programmed and stuff like that. There are also simple calls to glBegin() and glEnd() which seem to have disappeared in more recent OpenGL versions.
    So I digged a bit through the Qt documentation and it seems that QOpenGLFunctions_3_0 provides the API I'm looking for. I hoped that this would be quite easy: Instead of inheriting from QOpenGLFunctions I modified my class to inherit from QOpenGLFunctions_3_0 but I'm unable to compile. I get tons of "strange" compile errors: http://paste.ugfx.io/show/9ff63943c3

    My question: How can I write a Qt application using Qt 5.9 and MSVC 2015 32-bit using an older OpenGL API? Am I missing something obvious here?

    I'd appreciate any kind of help.

    Industrial process automation software: https://simulton.com
    Embedded Graphics & GUI library: https://ugfx.io

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by A Former User
      #2

      Hi! You don't need to use QOpenGLFunctions at all. Just create a QOpenGLWidget or QOpenGLWindow, override the needed virtual functions and use the OpenGL C API as always. You might also need to change the settings for the default surface type in main.cpp. I've just posted example code for the latter here.

      Joel BodenmannJ 1 Reply Last reply
      2
      • ? A Former User

        Hi! You don't need to use QOpenGLFunctions at all. Just create a QOpenGLWidget or QOpenGLWindow, override the needed virtual functions and use the OpenGL C API as always. You might also need to change the settings for the default surface type in main.cpp. I've just posted example code for the latter here.

        Joel BodenmannJ Offline
        Joel BodenmannJ Offline
        Joel Bodenmann
        wrote on last edited by
        #3

        Thank you a lot for your reply, much appreciated!

        The reason I'm using QOpenGLFunctions is because I don't want to render to a window/widget on the desktop machine. As far as I know, using QOpenGLWidget or QOpenGLWindow would mean that I render to a window/widget on the desktop rather than to the buffer that the OculusSDK will use to render to the VR goggles. Or am I mistaken here?

        Industrial process automation software: https://simulton.com
        Embedded Graphics & GUI library: https://ugfx.io

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          If you don't need to render to anything else but to that texture you receive from the Oculus SDK, then you actually don't need anything Qt-related. Just use OpenGL C API provided by the platform.

          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