Non power of two textures in iOS

后端 未结 2 772
猫巷女王i
猫巷女王i 2020-12-05 02:39

In my iOS app (targeted for iPad), I\'d like to use non power of two (NPT) textures. My GL_VERSION query returns \"OpenGL ES 2.0 APPLE\". According to the spec, it should su

相关标签:
2条回答
  • 2020-12-05 03:01

    As mentioned in my edit, I found the solution. NPOT on ES 2.0 requires that you use linear filtering and clamp to edge. Also, no mipmaps.

    0 讨论(0)
  • 2020-12-05 03:27
    - (BOOL)isSupportNPOT {
    //    GL_OES_texture_npot
    //    GL_APPLE_texture_2D_limited_npot
    //    GL_ARB_texture_non_power_of_two
        EAGLContext *context_ = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES1];
        [EAGLContext setCurrentContext:context_];
        NSArray *extensionNames = nil;
        NSString *extensionsString = [NSString stringWithCString:(const char *)glGetString(GL_EXTENSIONS) encoding:NSASCIIStringEncoding];
        extensionNames = [extensionsString componentsSeparatedByString:@" "];
        BOOL isSupport = [extensionNames containsObject:@"GL_APPLE_texture_2D_limited_npot"];
        [EAGLContext setCurrentContext:nil];
        NSLog(@"Apple Opengl support NPOT is %@", isSupport ? @"YES" : @"NO");
        return isSupport;
    }
    
    0 讨论(0)
提交回复
热议问题