My goal is to make use of compute shaders through C++ and OpenGL. The problem is that when I call glBindImageTexture() after creating and initializing a texture, it just terminates the program. I tried checking everywhere what could be the culprit, but I could not trace it back. I'm using glfw as my window and context manager, and glad (Core 4.6) as the wrapper for OpenGL. The (in my opinion) relevant part of the code is the following:
int tex_w = 512, tex_h = 512;
GLuint tex_output;
glGenTextures(1, &tex_output);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, tex_output);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, tex_w, tex_h, 0, GL_RGBA, GL_FLOAT,
nullptr);
glBindImageTexture(0, tex_output, 0, GL_FALSE, 0, GL_WRITE_ONLY, GL_RGBA32F);
This is the command I use to compile the program (I'm using MinGW on windows, 64bit):
g++ *.cpp *.c -o bin/main.exe -Iinclude -Llib -lmingw32 -lglfw3 -lopengl32 -lgdi32 -luser32
Everything works, up until calling the last function. I have checked that my system does have OpenGL 4.6 (at least that's what the checker told me), so it should have glBindImageTexture as well. In case you think the problem doesn't come from this part, here is all my code up until that point: https://pastebin.com/AYFaWpfL