Oolite 1.91.0.7646-241128-10e222e
Loading...
Searching...
No Matches
OOConcreteTexture.m File Reference
+ Include dependency graph for OOConcreteTexture.m:

Go to the source code of this file.

Classes

category  OOConcreteTexture(Private)
 

Functions

static BOOL DecodeFormat (OOTextureDataFormat format, uint32_t options, GLenum *outFormat, GLenum *outInternalFormat, GLenum *outType)
 

Function Documentation

◆ DecodeFormat()

static BOOL DecodeFormat ( OOTextureDataFormat format,
uint32_t options,
GLenum * outFormat,
GLenum * outInternalFormat,
GLenum * outType )
static

Definition at line 671 of file OOConcreteTexture.m.

672{
673 NSCParameterAssert(outFormat != NULL && outInternalFormat != NULL && outType != NULL);
674
675 switch (format)
676 {
678 *outFormat = GL_RGBA;
679 *outInternalFormat = options & kOOTextureSRGBA ? GL_SRGB_ALPHA : GL_RGBA;
680 *outType = RGBA_IMAGE_TYPE;
681 return YES;
682
684 if (options & kOOTextureAlphaMask)
685 {
686 *outFormat = GL_ALPHA;
687 *outInternalFormat = GL_ALPHA8;
688 }
689 else
690 {
691 *outFormat = GL_LUMINANCE;
692 *outInternalFormat = GL_LUMINANCE8;
693 }
694 *outType = GL_UNSIGNED_BYTE;
695 return YES;
696
698 *outFormat = GL_LUMINANCE_ALPHA;
699 *outInternalFormat = GL_LUMINANCE8_ALPHA8;
700 *outType = GL_UNSIGNED_BYTE;
701 return YES;
702
703 default:
704 OOLog(kOOLogParameterError, @"Unexpected texture format %u.", format);
705 return NO;
706 }
707}
#define OOLog(class, format,...)
Definition OOLogging.h:88
NSString *const kOOLogParameterError
Definition OOLogging.m:647
@ kOOTextureDataGrayscaleAlpha
Definition OOTexture.h:111
@ kOOTextureDataGrayscale
Definition OOTexture.h:110
@ kOOTextureDataRGBA
Definition OOTexture.h:109
@ kOOTextureSRGBA
Definition OOTexture.h:63
@ kOOTextureAlphaMask
Definition OOTexture.h:60