🎉 Celebrating 25 Years of GameDev.net! 🎉

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!

glTexImage2D

Started by
1 comment, last by cgrant 1 year, 6 months ago

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);

Advertisement

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.

This topic is closed to new replies.

Advertisement