Reputation: 1232
I have a texture that is semi-transparent with varying opacity at different locations. I have the main texture bitmap, and a mask bitmap. When the program executes, the alpha values from the mask bitmap are loaded into the alpha values of the main texture bitmap. The areas that I want to be transparent have a value of 255 alpha, and the areas that I want to remain totally opaque have values of 0 alpha. There are in-between values also for mid-transparency.
I have tried all manner of glBlendFunc() settings, but it is either completely invisible or it acts on the RGB colors of the source texture.
Upvotes: 0
Views: 1691
Reputation: 1
I had the same issue. I was using SDL_Image
to load my images. I realized when I was converting the image I was using SDL_DisplayFormat
instead of SDL_DisplayFormatAlpha
. This solved my issue.
Upvotes: 0
Reputation: 18015
Typically in OpenGL, 0 means transparent and 255 opaque, which is the opposite that you have.
so something like:
glBlendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA);
Should work.
Upvotes: 4