@@ -44,6 +44,7 @@ @implementation CCConfiguration
4444
4545@synthesize maxTextureSize = _maxTextureSize, maxTextureUnits=_maxTextureUnits;
4646@synthesize supportsPVRTC = _supportsPVRTC;
47+ @synthesize supportsNPOT = _supportsNPOT;
4748@synthesize supportsBGRA8888 = _supportsBGRA8888;
4849@synthesize supportsDiscardFramebuffer = _supportsDiscardFramebuffer;
4950@synthesize supportsShareableVAO = _supportsShareableVAO;
@@ -181,6 +182,12 @@ -(void) getOpenGLvariables
181182 glGetIntegerv (GL_MAX_TEXTURE_SIZE, &_maxTextureSize);
182183 glGetIntegerv (GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &_maxTextureUnits );
183184
185+ #ifdef __CC_PLATFORM_IOS
186+ _supportsNPOT = YES ;
187+ #elif defined(__CC_PLATFORM_MAC)
188+ _supportsNPOT = [self checkForGLExtension: @" GL_ARB_texture_non_power_of_two" ];
189+ #endif
190+
184191 _supportsPVRTC = [self checkForGLExtension: @" GL_IMG_texture_compression_pvrtc" ];
185192
186193 // It seems that somewhere between firmware iOS 3.0 and 4.2 Apple renamed
@@ -215,6 +222,14 @@ -(GLint) maxTextureUnits
215222 return _maxTextureUnits;
216223}
217224
225+ -(BOOL ) supportsNPOT
226+ {
227+ if ( ! _openGLInitialized )
228+ [self getOpenGLvariables ];
229+
230+ return _supportsNPOT;
231+ }
232+
218233-(BOOL ) supportsPVRTC
219234{
220235 if ( ! _openGLInitialized )
@@ -293,6 +308,7 @@ -(void) dumpInfo
293308 printf (" cocos2d: GL_MAX_SAMPLES: %d \n " , _maxSamplesAllowed);
294309 printf (" cocos2d: GL supports PVRTC: %s \n " , (_supportsPVRTC ? " YES" : " NO" ) );
295310 printf (" cocos2d: GL supports BGRA8888 textures: %s \n " , (_supportsBGRA8888 ? " YES" : " NO" ) );
311+ printf (" cocos2d: GL supports NPOT textures: %s \n " , (_supportsNPOT ? " YES" : " NO" ) );
296312 printf (" cocos2d: GL supports discard_framebuffer: %s \n " , (_supportsDiscardFramebuffer ? " YES" : " NO" ) );
297313 printf (" cocos2d: GL supports shareable VAO: %s \n " , (_supportsShareableVAO ? " YES" : " NO" ) );
298314
0 commit comments