应用程序在glDrawArrays上崩溃(GL_TRIANGLE_STRIP,0,4);在GPUImageFilter中

时间:2014-01-30 13:36:52

标签: ios iphone blur gpuimage

如果我尝试将模糊区域从圆形更改为矩形并且矩形更改为圆形,我会在此行上获得此错误EXE_BAD_ACCESS“glDrawArrays(GL_TRIANGLE_STRIP,0,4);” 请任何人建议我做什么?

-(IBAction) handleTapToFocus:(UITapGestureRecognizer *)tgr
{

if (hasBlur)
{
    if (!isSquareBlurr)
    {
        blurFilter = nil;
        [self showBlurOverlay:NO];
        hasBlur = NO;
        [self prepareFilter];

        [focusImgView setImage:[UIImage imageNamed:@"rect_focus.png"]];

        blurFilter = [[GPUImageGaussianSelectiveBlurFilter alloc] initwithrect];
        [(GPUImageGaussianSelectiveBlurFilter*)blurFilter setExcludeCircleRadius:80.0/320.0];
        [(GPUImageGaussianSelectiveBlurFilter*)blurFilter setExcludeCirclePoint:CGPointMake(0.5f, 0.5f)];
        [(GPUImageGaussianSelectiveBlurFilter*)blurFilter setAspectRatio:1.0f];
        focusImgView.hidden = FALSE;
        hasBlur = YES;
        [self flashBlurOverlay];
        [self prepareFilter];
        isSquareBlurr = TRUE;
    }
    else
    {
        blurFilter = nil;
        [self showBlurOverlay:NO];
        hasBlur = NO;
        [self prepareFilter];
        [focusImgView setImage:[UIImage imageNamed:@"round_focus.png"]];
        blurFilter = [[GPUImageGaussianSelectiveBlurFilter alloc] init];
        [(GPUImageGaussianSelectiveBlurFilter*)blurFilter setExcludeCircleRadius:80.0/320.0];
        [(GPUImageGaussianSelectiveBlurFilter*)blurFilter setExcludeCirclePoint:CGPointMake(0.5f, 0.5f)];
        [(GPUImageGaussianSelectiveBlurFilter*)blurFilter setAspectRatio:1.0f];

        hasBlur = YES;
        focusImgView.hidden = TRUE;
        [self flashBlurOverlay];
        [self prepareFilter];
        isSquareBlurr = FALSE;
    }

    if (!isStatic && tgr.state == UIGestureRecognizerStateRecognized)
    {
        CGPoint location = [tgr locationInView:self.MimageView];
        AVCaptureDevice *device = stillCamera.inputCamera;
        CGPoint pointOfInterest = CGPointMake(.5f, .5f);
        CGSize frameSize = [[self MimageView] frame].size;
        if ([stillCamera cameraPosition] == AVCaptureDevicePositionFront)
        {
            location.x = frameSize.width - location.x;
        }
        pointOfInterest = CGPointMake(location.y / frameSize.height, 1.f - (location.x / frameSize.width));
        if ([device isFocusPointOfInterestSupported] && [device isFocusModeSupported:AVCaptureFocusModeAutoFocus])
        {
            NSError *error;
            if ([device lockForConfiguration:&error])
            {
                [device setFocusPointOfInterest:pointOfInterest];

                [device setFocusMode:AVCaptureFocusModeAutoFocus];

                if([device isExposurePointOfInterestSupported] && [device isExposureModeSupported:AVCaptureExposureModeContinuousAutoExposure])
                {
                    [device setExposurePointOfInterest:pointOfInterest];
                    [device setExposureMode:AVCaptureExposureModeContinuousAutoExposure];
                }

                self.focusView.center = [tgr locationInView:self.view];
                self.focusView.alpha = 1;

                [UIView animateWithDuration:0.5 delay:0.5 options:0 animations:^{
                    self.focusView.alpha = 0;
                } completion:nil];

                [device unlockForConfiguration];
            }
            else
            {
                NSLog(@"ERROR = %@", error);
            }
        }
    }
}
}

这在glDrawArrays崩溃(GL_TRIANGLE_STRIP,0,4); in - (void)renderToTextureWithVertices:(const GLfloat *)vertices textureCoordinates:(const GLfloat *)textureCoordinates sourceTexture:(GLuint)sourceTexture; GPUImageTwoPassFilter.m

的方法

崩溃的地方

0 个答案:

没有答案