lvandeve / lodepng

PNG encoder and decoder in C and C++.
zlib License
2.03k stars 420 forks source link

Lodepng can't read file #146

Closed Gabryx64 closed 3 years ago

Gabryx64 commented 3 years ago

I was trying to decode a png into a GLFWimage, but lodepng doesn't read files, even when putting a wrong filename it doesn't gives errors

This is my code:

void Window::setCursor(const char* filepath)
{
    std::vector<unsigned char> imageData;
    unsigned width, height; 

    unsigned error = lodepng::decode(imageData, width, height, filepath);   

    if(error) { exit(-1); }

    unsigned char* pixels = imageData.data();

    GLFWimage image;
    image.width = width;
    image.height = height;
    image.pixels = pixels;

    cursor = glfwCreateCursor(&image, 0, 0);

    if(cursor == NULL) { exit(-1); }

    glfwSetCursor(window, cursor);
}

Probably it returns a blank or something array so that is why glfw doesn't give error too

Gabryx64 commented 3 years ago

After some debugging, if found out that the problem is glfw, not lodepng