alphablending

opengl es2 premultiplied vs straight alpha + blending

依然范特西╮ 提交于 2019-12-04 13:59:14
问题 Opengl es2 on the iphone. Some objects are made with multiple layers of sprites with alphas. Then I also have UI elements that are also composited together from various sprites that I fade in/out over top of everything else. I do the fading by adjusting the alpha in the shader. My textures are PNG with alpha made in photoshop. I don't premultply them on purpose. I want them to be straight alpha, but in my app they're acting as if they're premultiplied where I can see a dark edge around a

Transparent FrameBuffer background in OpenGL

房东的猫 提交于 2019-12-04 13:34:55
问题 I want to use glClear and glClearColor to fill a frame buffer with a colour including alpha transparency. However the framebuffer always renders as opaque when binded to a texture which is rendered to the screen. I want everything which is rendered to the framebuffer to kept their transparency. I just want to change the background. See the following code: def create_texture(surface): surface.texture = glGenTextures(1) glMatrixMode(GL_MODELVIEW) glLoadIdentity() #Loads model matrix

Blending anti-aliased circles with regl

孤街醉人 提交于 2019-12-04 10:55:35
I'm rendering circles using regl, and have three goals: The canvas should be transparent, showing HTML content behind it. Circles should be antialiased smoothly. Overlapping circles should look reasonable (blend colors, no corners showing) So far, I have this: Glitch code and demo . UPDATE: The demo links now reflect the working, accepted answer. Code below is unchanged. index.js const regl = require('regl'); const glsl = require('glslify'); const vertexShader = glsl.file('../shaders/vertex.glsl'); const fragmentShader = glsl.file('../shaders/fragment.glsl'); // Create webgl context and clear.

Alphablend and TransparentBlt

时间秒杀一切 提交于 2019-12-04 09:40:24
This question is related to my earlier question on SO. I want to combine two layers with alpha applied only to a specific portion of the source layer. One way I tried was to set SourceConstantAlpha to $ff (and have the function use the alpha channel in the source layer). This kind of works - although slow (I guess I can speed it up by using ScanLines), the kind of part is that I cannot figure out what to set the alpha channel to. The documentation suggests that the calculation is: st.Red = Src.Red + (1 - Src.Alpha) * Dst.Red I have tried a few different values by guess work, but my first

Alpha Compositing Algorithm (Blend Modes)

寵の児 提交于 2019-12-04 08:01:55
问题 I'm trying to implement blend modes from the PDF specification, for my own pleasure, in SASS. PDF Specification: http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/PDF32000_2008.pdf Page 322 is the alpha compositing section. The input values are in RGBA format, but now I'm trying to implement blending of the alpha component. How do I excatly go about doing it? From what I gather my values should be between 0.0 and 1.0, that's done. However from the specs it seems that you should

iPhone opengl es alpha-blending. I have black color in edge

时光毁灭记忆、已成空白 提交于 2019-12-04 06:00:22
I am developing iPhone game. I have the below Source image to draw it to the background. The Source image has alpha 0x00 and gradation around edge and the background's alpha is 0xff. When I draw the source image to the background, I have black color like you could see the Result image. I am using OpenGL ES glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) method. I have changed every possible arguments, but every time it is not moved. Why do I have the black color in the edge of the source image? What is the problem? Does not every games in iphone use gradation? Do I need to make the source

OpenGL: How to do RGBA->RGBA blitting without changing destination alpha

ぃ、小莉子 提交于 2019-12-03 21:01:48
I have an OpenGL RGBA texture and I blit another RGBA texture onto it using a framebuffer object. The problem is that if I use the usual blend functions with glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA), the resulting blit causes the destination texture alpha to change, making it slightly transparent for places where alpha previously was 1. I would like the destination surface alpha never to change, but otherwise the effect on RGB values should be exactly like with GL_SRC_ALPHA and GL_ONE_MINUS_SRC_ALPHA . So the blend factor functions should be (As,As,As,0) and (1-As,1-As,1-As,1). How

Alpha Blending 2 RGBA colors in C [duplicate]

主宰稳场 提交于 2019-12-03 17:45:58
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: How to do alpha blend fast? What is the fastest way to alpha blend 2 RGBA (Integer) colors? As a note, the target color where to blend is always opaque, only the second color can have different levels of transparency. I am trying to find the fastest way in C, taking into account that the final resulting color from the blend must end up with no transparency, fully opaque (alpha = 0xff) 回答1: int blend(unsigned

Fade in an alpha-blended PNG form in Delphi

浪子不回头ぞ 提交于 2019-12-03 09:23:34
I asked a question about this some years back when Vista was first released, but never resolved the problem and shelved it as something to consider later. I have a splash screen that I went to great effort to make look great. It's a 32bpp alpha-blended PNG. I have some code (which I can dig up if required!) that works great under Windows XP or under Vista+ when desktop composition is turned off. However, under Vista+ all the transparent parts are black, destroying everything that looks great about it! So, my question is this: as anyone been able to display a 32bpp alpha-blended PNG as a splash

opengl es2 premultiplied vs straight alpha + blending

空扰寡人 提交于 2019-12-03 08:47:44
Opengl es2 on the iphone. Some objects are made with multiple layers of sprites with alphas. Then I also have UI elements that are also composited together from various sprites that I fade in/out over top of everything else. I do the fading by adjusting the alpha in the shader. My textures are PNG with alpha made in photoshop. I don't premultply them on purpose. I want them to be straight alpha, but in my app they're acting as if they're premultiplied where I can see a dark edge around a white sprite drawn over a white background. If I set my blend mode to: glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC