Black square when using ImGui::Image

Hi, Im very sure its not a bug but i am making some dump mistake somewhere.
With the 2 example codes (1 from getting started and 1 for the image) im trying to get to display some image (wikipedia in this case so i can upload it to github).

The code is here:
you can run it simply with mkdir build, cd build, cmake … (after cloning with git clone --recursive-submodules)

It only displays a black square. The whole code is in main.cpp

In CMakeLists.txt you see that I use the following backend code:

Any help appreciated. :slight_smile:

Sorry to bother you.

Code looks correct, maybe use a debugger to make sure your image data is correctly loaded (path, format etc.). A common problem people have is that the relative path is incorrect because the executable is not started from the working directory they expect.

So i figured it out. I needed to add: glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
to my texture as configuration. Instead of // glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
Thanks for the help!

1 Like