Results 1 to 10 of 10

Thread: CL_ProviderFactory: Unknown image provider type png

  1. #1

    Default CL_ProviderFactory: Unknown image provider type png

    Hi!
    Now my first problem with ClanLib.^^
    When I try to load an image via CL_ProviderFactorym I get the Exception:
    Unknown image provider type png
    But when I try this:
    Code:
    map<string, CL_ProviderType *>::iterator i = CL_ProviderFactory::types.find(string("png"));
    if(i == CL_ProviderFactory::types.end())
    	cout << "the end" << endl;
    I don't get any output like "the end".

    Any ideas?
    Thank you for help.
    The User

  2. #2
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Bergen, Norway
    Posts
    588

    Default

    Can you post your code please

  3. #3

    Default

    I think the problem is that I tried to open the file before CL_SetupDisplay, now it should work.
    Thank you.

  4. #4

    Default Unknown image provider type png

    When I used:

    CL_SpriteDescription desc_simple;
    desc_simple.add_frame(CL_PNGProvider::load("Pic/test.png"));
    CL_Sprite sprite(gc, desc_simple);

    like this it worked. but I am really stuck. The imageprovider cannot load images and shows the error -"Unknown image provider type png"
    Because of this even I cannot use resource file to load images to sprite.

    Anyone there to help?

  5. #5
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Bergen, Norway
    Posts
    588

    Default

    As posted above, make sure clanCore and clanDisplay is initialised (CL_Setup**) before you try to load anything.

  6. #6
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    As already mentioned by "The User"

    Either you are not calling CL_SetupDisplay, or CL_SetupDisplay is out of scope (ie, the destructor was called)

    Try inserting your code before the main loop in the Basic2D example.

  7. #7

    Default unknown image type

    clanCore and clanDisplay was initialised (CL_Setup**) before I tried to load anything.

    but the problem is that when I use CL_ImageProviderFactory for image loading, it does not work. but if I use CL_PNGProvider, image is loaded properly. I am getting this error in every cases like:

    case 1. CL_CollisionOutline outline("image.png");
    case 2. sprite = new CL_Sprite(gc, "my_sprite", resources);
    sprite.draw();




    Is there any way to tell CL_ImageProviderFactory what type of image I shall load?

    or any other alternative? I am stuck really.
    Last edited by spark03; 02-04-2010 at 08:58 AM.

  8. #8
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    The SpritesRTS example calls the same functions as you mention, and it works

    So I think the bug is somewhere in your code initialisation

    Without you attaching the source code, I can't help

  9. #9
    Lesser Knight
    Join Date
    Mar 2009
    Posts
    54

    Default

    Quote Originally Posted by spark03 View Post
    clanCore and clanDisplay was initialised (CL_Setup**) before I tried to load anything.

    but the problem is that when I use CL_ImageProviderFactory for image loading, it does not work. but if I use CL_PNGProvider, image is loaded properly. I am getting this error in every cases like:

    case 1. CL_CollisionOutline outline("image.png");
    case 2. sprite = new CL_Sprite(gc, "my_sprite", resources);
    sprite.draw();




    Is there any way to tell CL_ImageProviderFactory what type of image I shall load?

    or any other alternative? I am stuck really.
    I bet if you do something like this:
    Code:
    CL_SetupDisplay display;
    ImageProviderFactory::load(...)
    it will work!

  10. #10

    Default

    If you use static somewhere (in a singleton maybe?) you risk executing code before proper initialization, as statics are constructed before entering main().

Similar Threads

  1. A Castlevania/Metroid type game
    By illspirit in forum Novashell Game Creation System
    Replies: 20
    Last Post: 01-27-2009, 11:14 AM
  2. Where is my Image?
    By Martin in forum Official ClanLib SDK Forums
    Replies: 2
    Last Post: 03-19-2008, 11:28 AM
  3. Image Manipulation
    By joeymitchell in forum Official ClanLib SDK Forums
    Replies: 0
    Last Post: 12-04-2007, 04:50 PM
  4. Rendering into my custom image and then drawing this image to the display
    By ValkaVALES in forum Official ClanLib SDK Forums
    Replies: 4
    Last Post: 07-03-2007, 09:53 AM
  5. Image help
    By in forum Dink Smallwood HD
    Replies: 2
    Last Post: 02-04-2004, 08:42 PM

Bookmarks

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
  •