Skip to main content
GameDev.net gamedev.net
🔒 Locked

glTexImage2D

Started by MikeCyber Dec 8, 2022 at 11:09 AM 1 replies 4.8k views
Original Post
MikeCyber
MikeCyber

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

cgrant
cgrant

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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.