The typical scenario for using a texture would simply be:
//Create texture glGenTextures(1, &textureID); glBindTexture(target, textureID); glTexImage2D(target, 0, color_format, width, height, 0, color_format, GL_UNSIGNED_BYTE, data); glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); //load to program glActiveTexture(texture_unit); glBindTexture(target, textureID); //Get the uniform location in the program and attach the texture unit GLuint location = /*get_uniform_location*/; glUniform1i(location,texture_unit - GL_TEXTURE0); //Draw render();
However image load store are somewhat different. First, they don't use texture units but image units. Second you need to manually set memory barriers yourself to ensure completion of writing stage before reading. Amgon other things.
I have read the documentation and attempted to implement things myself but It seems I am doing things wrong. I'd rather just forget about what I have tried and understand properly how this needs to be done step by step.
I want to know what a typical, minimum example use of image load stores qould be.
So creation of the image, writing to the image, reading from the image.