Hi
how to set image alpha value as below?
Many thanks
const void* pixels = image.pixels.empty() ? NULL : &image.pixels[0];
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.width, image.height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!
Hi
how to set image alpha value as below?
Many thanks
const void* pixels = image.pixels.empty() ? NULL : &image.pixels[0];
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.width, image.height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
The array containing the image data is what needs to get modified to set the image color values, whether is be R,G,B or A. The call to glTexImage2D does not set the value, all that does is supply the data to OpenGL to create the actual GPU texture resource from. Assuming you created the image somehow( loaded from file, procedural etc), given the layout of the data, then it is as simple a changing byte for each image pixel.