-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to disable alpha in ImGui::Image? #4730
Comments
The issue template isn't there just for fun 😘 |
im serious, i need this feature and seems there aren't solution on net, |
image transparent? |
yes |
If you cannot remove the alpha component from your texture, you would need to either disable alpha blending during the rendering of that image, or swap the shader to one which omits alpha. You can do that by registering a ImDrawList call with AddCallback() to a custom callback tailored for the rendering backend you are using (eg for an OpenGL backend your custom callback would eg disable blending, then you submit another callback after the image to reenable blending). Variants of this question have been asked here before, and because you have ignored our guidelines and issue template I am closing this. |
Thank you for help, this is exactly what im looking for, and sorry for ignoring the issue template , im just new to communicate on github and didn't realize that, i'll check it then. |
I know this is an issue from 2 years ago, but in case someone comes through this, there is an easier solution than everything mentioned here for OpenGL, which is swizzling ( // Texture must be bound first
GLint swizzle[4] = {
GL_RED, // Shader Red channel source = Texture Red
GL_GREEN, // Shader Green channel source = Texture Green
GL_BLUE, // Shader Blue channel source = Texture Blue
GL_ONE // Shader Alpha channel source = One
};
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzle); As mentioned, this is for OpenGL, but most graphics APIs have swizzling, you just need to figure out how to do it for your API. |
Im working for a scene window using ImGui::Image to display my scene, there are translucent elements so the frame buffer shall shall contains texels with alpha factor after rendering the scene,
it seems the ImGui::Image take the alpha factor and blend to the window background (in my case, the window background is black)
is there some quick trick to render the color only?
The text was updated successfully, but these errors were encountered: