Results 1 to 3 of 3

Thread: Qt and SOIL library

  1. #1
    Join Date
    Mar 2014
    Posts
    12
    Qt products
    Qt5
    Platforms
    Windows

    Default Qt and SOIL library

    Alright so after building a 64bit flavor of SOIL, I linked to the library in my .pro file (in Qt Creator) and established 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:
    Qt Code:
    1. MyGLWidget::MyGLWidget(QWidget *parent) :
    2. QGLWidget(parent)
    3. {
    4. tex = SOIL_load_OGL_texture(":/gfx/gfx/back.png", SOIL_LOAD_AUTO, SOIL_CREATE_NEW_ID, SOIL_FLAG_INVERT_Y);
    5. qDebug() << tex;
    6. }
    To copy to clipboard, switch view to plain text mode 


    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? (I have verified that the image resource is indeed working by loading it in a QLabel)

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qt and SOIL library

    That SOIL API doesn't look like if SOIL is a Qt library, it looks more like a plain C library instead.

    Only Qt based file access, e.g. using QFile, understands Qt's resource paths.

    If the library can work with the data directly then you can use QResource to get access to the built-in data.
    If it can only deal with files, write the data to a QTemporaryFile and pass its filename to the external API.

    Cheers,
    _

  3. #3
    Join Date
    Mar 2014
    Posts
    12
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Qt and SOIL library

    Ah, duh, exactly what I needed. Thanks!

Similar Threads

  1. Link error with Qt 4.8.2 and SOIL
    By fiodis in forum Newbie
    Replies: 3
    Last Post: 23rd June 2013, 23:25
  2. Replies: 3
    Last Post: 20th December 2012, 13:48
  3. Dynamic library on Mac, Library not loaded
    By grayfox in forum Newbie
    Replies: 2
    Last Post: 2nd July 2011, 03:42
  4. Replies: 2
    Last Post: 19th February 2011, 12:26
  5. Replies: 4
    Last Post: 18th December 2009, 19:55

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.