Displaying Image


#1

Hello everyone,

I’m new at Cinder and i’m trying to displaying image but i got this error " Failed to load asset with relative path: C:" , my image is in C:\

texture = gl::Texture2d::create(loadImage(loadAsset(“C:\0.png”)))

Thanks you


#2

Hi

‘loadAsset’ loads from the assets folder of your project (I.e. myprojectFolder/assets).
Put your png there and change the loading path to just “0.png”.
Have a look at the examples, you will find some that are loading files exactly as you would like to do.

Welcome to Cinder!

L


#3

You should use loadFile instead of loadAsset if your path is not relative to the asset folder. Also you want to make sure to escape any backslash or use forward slash instead. So "C:\0.png" should be "C:\\0.png".


#4

Haaaaa , tanks i’m feeling so stupid , i totally forgot the fact that \ is not a
character

Thanks you very much