EZAudio
EZAudio copied to clipboard
Enable GL_BLEND for EZAudioPlotGL
I've subclassed EZAudioPlotGL in my application to enable GL_BLEND
with an appropriate blend function, so that when you configure the plot with colors containing alpha values, they render as expected. Here's what my subclass implementation looks like:
- (void)redrawWithPoints:(EZAudioPlotGLPoint *)points
pointCount:(UInt32)pointCount
baseEffect:(GLKBaseEffect *)baseEffect
vertexBufferObject:(GLuint)vbo
vertexArrayBuffer:(GLuint)vab
interpolated:(BOOL)interpolated
mirrored:(BOOL)mirrored
gain:(float)gain
{
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
[super redrawWithPoints:points
pointCount:pointCount
baseEffect:baseEffect
vertexBufferObject:vbo
vertexArrayBuffer:vab
interpolated:interpolated
mirrored:mirrored
gain:gain];
glDisable(GL_BLEND);
}
Resulting waveform (notice that I'm also re-rendering part of the waveform with a higher alpha value as well, to indicate current playback progress):
Is there any reason why this couldn't be the default behavior?