현재 Image I/O를 사용하여 iOS에서 텍스처를로드하고 Core Graphics로 이미지 데이터를 추출합니다. 그럼 난 이렇게는 OpenGL에 이미지 데이터를 보낼 수 있습니다Objective-c : OpenGL에 텍스처를로드하는 가장 효율적인 방법
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture->width, texture->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, texture->imageData);
문제는 코어 그래픽 부분은 난 그냥 이미지 데이터를 추출하는 설정에 필요 코어 그래픽으로 그리는, 정말 느린 것입니다 ... 난 그것을 화면에 표시하고 싶지 않습니다. 아이폰 OS 이미지 데이터를 추출하는보다 효율적인 방법이 있어야합니다 ... 여기
내 코드입니다 :...
myTexRef = CGImageSourceCreateWithURL((__bridge CFURLRef)url, myOptions);
...
MyTexture2D* texture;
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
void *imageData = malloc(tileSize.width * tileSize.height * 4);
CGContextRef imgContext = CGBitmapContextCreate(imageData, tileSize.width, tileSize.height, 8, 4 * tileSize.width, colorSpace, kCGImageAlphaNoneSkipLast | kCGBitmapByteOrder32Big);
CGColorSpaceRelease(colorSpace);
CGContextClearRect(imgContext, CGRectMake(0, 0, tileSize.width, tileSize.height));
CGContextTranslateCTM(imgContext, 0, 0);
...
CGImageRef tiledImage = CGImageCreateWithImageInRect (imageRef, tileArea);
CGRect drawRect = CGRectMake(0, 0, tileSize.width, tileSize.height);
// *** THIS CALL IS REALLY EXPENSIVE!
CGContextDrawImage(imgContext, drawRect, tiledImage);
CGImageRelease(tiledImage);
// TamTexture2D takes the ownership of imageData and will be responsible to free it
texture = new MyTexture2D(tileSize.width, tileSize.height, imageData);
CGContextRelease(imgContext);
코드가 이미지 데이터 (타일링)를로드하는 것 이상을 수행하는 것 같습니다. 최적화에 대한 도움이 필요하면 전체 코드를 게시해야합니다. –