How check Texture Load ?

I cant check error loading,If the picture name is incorrect.Error inside the library.
Example
Texture2D texture = LoadTexture("image.png");
if(TEXTURE LOAD)
{
// loading OK!
}

Comments

  • Actually, raylib shows a command line WARNING in case filename is not correct.

    You can check if texture has been correctly loaded with:

    if (texture.id > 0) // Texture correctly loaded
  • But an error before if(texture.id > 0)
    Here is my log command line, there is no WARNING in it
    image
  • Ouch, that's bad! Neither the loading warning is displayed... it seems there is a problem with the "image.png" file, please, could you share a small sample with the loading and the "image.png" file to check it?
  • I make TiledLayer,its very big code.A small example is not needed,i use sample from raylib-master/examples/textures/textures_logo_raylib.c
    Just changed the file name "resources/raylib_logo.png"
    Maybe it's because I have Linux Mint?


    image
  • ok, just tried it and it works ok on Windows, image is not displayed and output is:
    INFO: Initializing raylib (v1.7.0)
    INFO: Display device initialized successfully
    INFO: Display size: 2160 x 1440
    INFO: Render size: 800 x 450
    INFO: Screen size: 800 x 450
    INFO: Viewport offsets: 0, 0
    INFO: GLAD: OpenGL extensions loaded successfully
    INFO: OpenGL 3.3 Core profile supported
    INFO: GPU: Vendor: Intel
    INFO: GPU: Renderer: Intel(R) HD Graphics 4400
    INFO: GPU: Version: 3.3.0 - Build 20.19.15.4568
    INFO: GPU: GLSL: 3.30 - Build 20.19.15.4568
    INFO: Number of supported extensions: 219
    INFO: [EXTENSION] DXT compressed textures supported
    INFO: [EXTENSION] ETC2/EAC compressed textures supported
    INFO: [EXTENSION] Anisotropic textures filtering supported (max: 16X)
    INFO: [TEX ID 1] Texture created successfully (1x1)
    INFO: [TEX ID 1] Base white texture loaded successfully
    INFO: [VSHDR ID 1] Vertex shader compiled successfully
    INFO: [FSHDR ID 2] Fragment shader compiled successfully
    INFO: [SHDR ID 3] Shader program loaded successfully
    INFO: [SHDR ID 3] Default shader loaded successfully
    INFO: [CPU] Default buffers initialized successfully (lines, triangles, quads)
    INFO: [VAO ID 1] Default buffers VAO initialized successfully (lines)
    INFO: [VAO ID 2] Default buffers VAO initialized successfully (triangles)
    INFO: [VAO ID 3] Default buffers VAO initialized successfully (quads)
    INFO: OpenGL default states initialized successfully
    INFO: [TEX ID 2] Texture created successfully (128x128)
    INFO: [TEX ID 2] Default font loaded successfully
    WARNING: [resources/raylib_log_.png] Image could not be loaded
    WARNING: Texture could not be created
  • I think it could be related to IsFileExtension() function, but can not test...
  • if i change extensions i have WARNING
    WARNING: [../../resources/tiles.pn] Image fileformat not supported
    WARNING: [../../resources/tiles.pn] Image could not be loaded

    But if change the name WARNING not working

  • edited June 12
    The result is that sends something to the picture, and does not work correctly
    It is better to check the opening of a file


    image
  • Thank you.It's sure someone will save time.
Sign In or Register to comment.