OpenGL实施问题

时间:2012-07-26 09:52:46

标签: iphone xcode opengl-es

  

glCheckError:0501遇到/Users/mac/Documents/PhotoFrameApp/PhotoFrameApp/Debug.c:177

知道这个错误是什么吗?

这是一个调试错误,我尝试使用Apple的GLImageProcessing示例实现OpenGL增加,降低UIImage的亮度,对比度等。该应用程序不会崩溃但它也无法正常工作。

View有一个UITabbar,包含不同的效果,如亮度,对比度,色调等,以及用于增加或减少它们的UISlider。

实施的代码是: -

int b, i;
tabBar.selectedItem = [tabBar.items objectAtIndex:0];
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGContextRef context = CGBitmapContextCreate(nil, 30, 30, 8, 0, colorSpace, kCGImageAlphaPremultipliedFirst);
CGImageRef theCGImage = imageCollage.image.CGImage;

// Draw with white round strokes
CGContextSetLineCap(context, kCGLineCapRound);
CGContextSetRGBStrokeColor(context, 1.0, 1.0, 1.0, 1.0);
CGContextSetRGBFillColor(context, 1.0, 1.0, 1.0, 1.0);
CGContextSetLineWidth(context, 2.0);

for (b = 0; b < NUM_BUTTONS; b++)
{
    CGContextClearRect(context, CGRectMake(0, 0, 30, 30));

    switch(b)
    {
        case BUTTON_BRIGHTNESS:
        {
            const CGFloat line[8*4] = {
                15.0, 6.0, 15.0, 4.0,
                15.0,24.0, 15.0,26.0,
                6.0,15.0,  4.0,15.0,
                24.0,15.0, 26.0,15.0,
                21.5,21.5, 23.0,23.0,
                8.5, 8.5,  7.0, 7.0,
                21.5, 8.5, 23.0, 7.0,
                8.5,21.5,  7.0,23.0,                    
            };

            // A circle with eight rays around it
            CGContextStrokeEllipseInRect(context, CGRectMake(10.5, 10.5, 9.0, 9.0));
            for (i = 0; i < 8; i++)
            {
                CGContextMoveToPoint(context, line[i*4+0], line[i*4+1]);
                CGContextAddLineToPoint(context, line[i*4+2], line[i*4+3]);
                CGContextStrokePath(context);                   
            }
            break;
        }
- (void)sliderAction:(id)sender{
// Redraw the view with the new settings
obj = [[EAGLView alloc]init];
[obj drawView];}

- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item{
// Recenter the slider (this application does not accumulate multiple filters)
//slider setValue:1.0 animated:YES];
// Redraw the view with the new settings
[obj drawView];}

0 个答案:

没有答案