Ios 不支持的颜色 space 错误
Ios unsupported color space error
当我尝试将某些纹理加载到我的 opengl 应用程序中时,我收到看似压缩的 .png 文件的颜色不受支持 space 错误。
如果我右键单击并检查失败的纹理,它们将具有以下 属性。
颜色配置文件:sRGB IEC61966-2.1
.png 在压缩时似乎得到了这个 属性。我真的很想拥有这个功能,因为它可以将纹理大小减少 ~50%。
这是我的纹理加载代码:
-(GLubyte *) generatePixelDataFromImage: (UIImage *) pic{
GLubyte *pixelData = (GLubyte *) calloc(width * height *4, sizeof(GLubyte));
CGColorSpaceRef imageCS = CGImageGetColorSpace(pic.CGImage);
CGBitmapInfo bitmapInfo = (CGBitmapInfo) kCGImageAlphaPremultipliedLast;
CGContextRef gc = CGBitmapContextCreate(pixelData, width, height, 8, width*4, imageCS, bitmapInfo);
CGContextDrawImage(gc, CGRectMake(0, 0, width, height), pic.CGImage);
CGContextRelease(gc);
return pixelData;
}
这里是错误:
Error: CGBitmapContextCreate: unsupported color space. Feb 14
13:11:59 Garretts-iPhone myApp[712] : CGContextDrawImage:
invalid context 0x0. This is a serious error. This application, or a
library it uses, is using an invalid context and is thereby
contributing to an overall degradation of system stability and
reliability. This notice is a courtesy: please fix this problem. It
will become a fatal error in an upcoming update.
有没有办法以编程方式转换纹理,同时仍然具有减少存储的好处space?
来自Quartz 2D Programming Guide:
Important: iOS does not support device-independent or generic color spaces. iOS applications must use device color spaces instead.
您试过只使用 CGColorSpaceCreateDeviceRGB
作为颜色 space 吗?好看吗?
当我尝试将某些纹理加载到我的 opengl 应用程序中时,我收到看似压缩的 .png 文件的颜色不受支持 space 错误。
如果我右键单击并检查失败的纹理,它们将具有以下 属性。
颜色配置文件:sRGB IEC61966-2.1
.png 在压缩时似乎得到了这个 属性。我真的很想拥有这个功能,因为它可以将纹理大小减少 ~50%。
这是我的纹理加载代码:
-(GLubyte *) generatePixelDataFromImage: (UIImage *) pic{
GLubyte *pixelData = (GLubyte *) calloc(width * height *4, sizeof(GLubyte));
CGColorSpaceRef imageCS = CGImageGetColorSpace(pic.CGImage);
CGBitmapInfo bitmapInfo = (CGBitmapInfo) kCGImageAlphaPremultipliedLast;
CGContextRef gc = CGBitmapContextCreate(pixelData, width, height, 8, width*4, imageCS, bitmapInfo);
CGContextDrawImage(gc, CGRectMake(0, 0, width, height), pic.CGImage);
CGContextRelease(gc);
return pixelData;
}
这里是错误:
Error: CGBitmapContextCreate: unsupported color space. Feb 14 13:11:59 Garretts-iPhone myApp[712] : CGContextDrawImage: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
有没有办法以编程方式转换纹理,同时仍然具有减少存储的好处space?
来自Quartz 2D Programming Guide:
Important: iOS does not support device-independent or generic color spaces. iOS applications must use device color spaces instead.
您试过只使用 CGColorSpaceCreateDeviceRGB
作为颜色 space 吗?好看吗?