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. Difficulty using SOIL library with Qt
Forum Updated to NodeBB v4.3 + New Features

Difficulty using SOIL library with Qt

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 1.3k 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.
  • Z Offline
    Z Offline
    Zamaster
    wrote on last edited by
    #1

    Alright so after a painful extravaganza trying to build a 64bit flavor of SOIL, I managed to link to the library in my .pro file (in Qt Creator) and establish the include directory. I have hit a problem. This is with my image resources:

    I have a png in an image resource and used the resource editor "Copy Resource Path to Clipboard" feature to grab the path. I then dropped the path into a SOIL_load_OGL_texture function call within a GLWidget constructor. Heres the code:

    @MyGLWidget::MyGLWidget(QWidget *parent) :
    QGLWidget(parent)
    {
    tex = SOIL_load_OGL_texture(":/gfx/gfx/back.png", SOIL_LOAD_AUTO, SOIL_CREATE_NEW_ID, SOIL_FLAG_INVERT_Y);
    qDebug() << tex;
    }
    @

    My issue here is that 0 is always being spit back to the console, which I know means the function failed. Anybody notice anything I missed?

    1 Reply Last reply
    0
    • JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      Hi,

      I don't know how SOIL works, but the 1st thing I'd do is check that the image file can be loaded.

      Try do display ":/gfx/gfx/back.png" in a QLabel -- does it show up?

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      0
      • Z Offline
        Z Offline
        Zamaster
        wrote on last edited by
        #3

        Good thought, so I did I created a QLabel and set the internal pixmap (using Qt Creator's gui) as this image and sure enough it showed up. So it seems the resource is fine, I wonder if anyone has had experience using SOIL in Qt?

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

          Hi,

          Are you sure SOIL supports reading files from Qt's resources ?
          You should first try to load your file from the hard drive to ensure SOIL works correctly.

          Also, I would rather do that in the initializeGL function since it's the function dedicated to all the OpenGL setup

          Hope it helps

          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