2012-01-05 7 views
0

私のアプリをiOSに移植しても、テクスチャバインディングに関するgl呼び出しが同じですが、ズームアウトするとミップマップが有効になると品質が非常に悪くなります。このテクスチャ読み込みコードに何か問題はありますか?ズームアウト時にテクスチャの質が悪い

編集:これは実際に網膜ディスプレイの問題だと思っています。

NSString *path = [[NSBundle mainBundle] pathForResource:filename ofType:@"jpg"]; 
    NSData *texData = [[NSData alloc] initWithContentsOfFile:path]; 
UIImage *image = [[UIImage alloc] initWithData:texData]; 

if (image == nil) 
    NSLog(@"Do real error checking here"); 

GLuint width = CGImageGetWidth(image.CGImage); 
GLuint height = CGImageGetHeight(image.CGImage); 
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); 
void *imageData = malloc(height * width * 4); 
CGContextRef context = CGBitmapContextCreate(imageData, width, height, 8, 4 * width, colorSpace, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big); 

// Flip the Y-axis 
CGContextTranslateCTM (context, 0, height); 
CGContextScaleCTM (context, 1.0, -1.0); 

CGColorSpaceRelease(colorSpace); 
CGContextClearRect(context, CGRectMake(0, 0, width, height)); 
CGContextDrawImage(context, CGRectMake(0, 0, width, height), image.CGImage); 

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, imageData); 

CGContextRelease(context); 

free(imageData); 

答えて

関連する問題