Assume we have created a program that renders toThe typical scenario for using a texture. Say the declaration is 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 shadingProgram;location = /*get_uniform_location*/;
glUniform1i(location,texture_unit - GL_TEXTURE0);
//Draw
render();
Assume the shader has compiled successfully and it makes use of the imageStore() funtion.
Just like textures we need to bind the target texture we wish to write to to a binding pointHowever image load store are somewhat different. But we do notFirst, they don't use texture units, we use but image binding units. We also have an additional requirementSecond you need to explicetly callmanually set memory barriers yourself to ensure completion of the writing processstage before reading. Amgon other things.
SoI 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 wouldI 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 andto the image, reading from a texture using load/store operations?the image.