glCheckError: 0501 が /Users/mac/Documents/PhotoFrameApp/PhotoFrameApp/Debug.c:177 でキャッチされました
このエラーが何であるか考えていますか?
これは、Apple の GLImageProcessing サンプルを使用して UIImage の明るさ、コントラストなどを増減するために OpenGL を実装しようとしたデバッグ エラーです。アプリはクラッシュしませんが、機能しません。
ビューには、明るさ、コントラスト、色相などのさまざまな効果を含む 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];}