Advertisement

Does need to make sure that texture is completeness when accessing image

Started by October 16, 2017 06:25 AM
1 comment, last by Yxjmir 7 years, 3 months ago

Before using void glBindImageTexture(    GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format), does need to make sure that texture is completeness. 

If you mean whether or not it exists, then it would be a good idea to check when you load the image. If you mean setup the texture then it should look similar to:


GLuint id;
glGenTextures(1, &id);
glBindTexture(GL_TEXTURE_2D, id);

// Not sure if thses are the correct things to use with glBindImageTexture
glTexImage2D(GL_TEXTURE_2D, 0, Internal_Format, width, height, 0, Image_Format, GL_UNSIGNED_BYTE, pixels);
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_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

glBindImageTexture(0, id, /* Fill in the rest of the variables */);

 

This topic is closed to new replies.

Advertisement