Open og0 opened 12 years ago
For performance reasons, GPUImageView is always opaque. Rendering translucent OpenGL ES content over other interface elements imposes a significant penalty.
That said, it might be possible to make this an option with the view. I can look into that, but in the meantime the only way to get overlaid content is via the appropriate blends.
@og0 I'm not sure what your exact use case is, but could you do all the compositing in the GPUImage framework and render that to an opaque GPUImageView? That would seem to be the best solution.
Hello and thanks for your answers. Sorry to answer so late i was in holidays.
What i need to do is to display a network streamed video in the background, and i read somewhere it was not possible to do it in GPUImage, am i wrong ? That's why i thought about using a GPUImageView to display a translucent video on top of a Quicktime movie player (used for the stream). But i'm not sure this is the best idea...
So an option to make the GPUImageView translucent would be useful for me (if performances allow it of course).
hello, BradLarson. Could you please add an option to make the gpuimageview translucent.
Here is a blog post about a alpha + h.264 implementation for iOS http://iosgraphicsanimation.wordpress.com/2013/06/05/h-264-video-with-an-alpha-channel/
@mdejong - You're really promoting this everywhere, aren't you, Mo?
I don't know about everywhere? Only places that nerdy types who might want to implement animations on iOS might see it :)
@BradLarson really good job on GPUImage!
I find the solution of the GPUImageView solid backgroundColor with this aswer http://stackoverflow.com/a/25167715/1549585
Hi,
First congratulations for GPUImage. I have a question, i would like to simulate a video with alpha channel, so i'm trying to use two H.264 videos : one with RGB and another with alpha informations in its RGB channels (i.e. opaque on white pixels and translucent in black pixels). Ideally this video would be played in a GPUImageView, which will be on top of another background UIView.
My first step is to check that the GPUImageView can be translucent. At the moment i'm playing only the grayscale mask video and i don't manage to see my background, the video is always fully opaque. In my custom shader, even if i force alpha to 0, i can see the whole opaque video (i shouldn't see the video, i even shouldn't see the GPUImage view). I forced the GPUImageView alpha to 0.
Is it possible to obtain what i want ? This is my code :
(void)viewDidLoad { [super viewDidLoad];
NSURL *sampleURL = [[NSBundle mainBundle] URLForResource:@"alphamask" withExtension:@"mp4"]; _aMovieFile = [[GPUImageMovie alloc] initWithURL:sampleURL];
filter = [[GPUImageFilter alloc] initWithFragmentShaderFromFile:@"AlphaMask"]; [_aMovieFile addTarget:filter];
imageView = [[GPUImageView alloc] initWithFrame:CGRectMake(20., 50., 600., 600.)]; [imageView setBackgroundColorRed:0. green:0. blue:0. alpha:0.]; [self.view addSubview:imageView];
[_aMovieFile addTarget:filter]; [filter addTarget:imageView];
[_aMovieFile startProcessing]; }
varying highp vec2 textureCoordinate;
uniform sampler2D inputImageTexture;
void main() { lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate); lowp vec4 outputColor;
}
Thanks in advance !