1

In this simple cinder example (from cinder introduction - http://libcinder.org/docs/v0.8.4/hello_cinder.html) I get this compilation error:

myImage = gl::Texture( loadImage( loadResource( "image.jpg" ) ) );

Error 1 error C2661: 'cinder::app::App::loadResource' : no overloaded function takes 1 arguments

However documentation says:

DataSourceRef cinder::app::loadResource (   const std::string &     macPath  )

Any ideas?

dvgvrco
  • 91
  • 1
  • 4

2 Answers2

2

Are you referring to the same function:

cinder::app::App::loadResoure
cinder::app::loadResource

Never used this lib, but doc says the first function needs more parameters:

http://libcinder.org/docs/v0.8.4/classcinder_1_1app_1_1_app.html#afef905bb792960152d38c2680f88ea33

static DataSourceRef cinder::app::App::loadResource (   
       const std::string &  macPath,
       int  mswID,
       const std::string &  mswType  
)   
PiotrNycz
  • 23,099
  • 7
  • 66
  • 112
  • Thanks. Apparently cinder handles resources differently on windows. Tutorial was for mac. For more info on cinder resources: (http://libcinder.org/docs/v0.8.4/_cinder_resources.html) It seems that cinder support for windows is still in its infancy. – dvgvrco Oct 25 '12 at 10:40
  • I wouldn't say Cinder support for Windows is in its infancy. Both the OS X and Windows platforms are actively kept up-to-date and one is not much different from the other. Cinder's documentation is somewhat behind, though, which is the cause for your error: the function was changed after the documentation was written. Cinder has a very active forum where questions like the one you posted here usually are answered within hours, see http://forum.libcinder.org , but I guess you already found out by now :) – Paul Houx May 06 '13 at 15:41
0

You better try loading as an assets instead of a resource:

    gl::TextureRef      texImagen;
    texImagen = gl::Texture::create( loadImage( getAssetPath( "image.jpg" ) ) );

Where image.jpg is located int the assets folder. Assets are loaded at runtime from this assets folder. This folder can be at the same leve of the program or up to three above.

Resources are located in the resources folders and are copied at compilation stage and packaged with the app or executable.

To use the include the resources header

   #include "Resources.h"

which contains something like this

#pragma once
#include "cinder/CinderResources.h"
#define MY_IMAGE       CINDER_RESOURCE( ../resources/, image.jpg, 1, IMAGE )

Then you can load it

texImagen = gl::Texture::create( loadResource( MY_IMAGE ) );

Beware that if you are in Xcode, your image must be added to your project, just drag it to the project tree.

Xumo
  • 136
  • 4