|
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
On Monday, June 30, 2003, at 11:10 AM, Christopher Nagel wrote:// This yields a yellowish image
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, [image size].width,
[image size].height, 0, GL_RGB, GL_UNSIGNED_BYTE,
[[image TIFFRepresentation] bytes] );
Yeah, that won't work, but why would you expect it to? GL accepts raw pixel data for a texture, which a TIFFRepresentation will not provide -- this code is functionally equivalent to dumping the raw data of a TIFF file for use as a GL texture.
The only reason I can imagine why it even almost seems to work is because TIFFRepresentation probably produces an image without compression, which must be close enough to the raw pixels to resemble the image somehow.
Yet NSBitmapImageRep is initialized with TIFFRepresentation.
That shouldn't matter. You could initialize it with any representation you like, and bitmapData would always returns the raw pixels.
I was trying to avoid the overhead of creating the NSBitmapImageRep, just for kicks.
You might check if [image representations] already has a bitmap image rep rather than always creating one. WIth many types of files (i.e. TIFFs, JPEGs, BMPs, etc) that representation will already exist in the image, and only in cases where it does not exist would you be forced to create the rep.
| References: | |
| >Re: NSImage vs. NSBitmapImageRep color differences? (From: Thomas Finley <email@hidden>) |
| Home | Archives | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2011 Apple Inc. All rights reserved.