ios - iPad 缺少 OpenGL 扩展字符串 GL_APPLE_texture_2D_limited_npot

标签 ios ipad opengl-es

在我的 iOS 游戏中,我想在可用时使用 GL_APPLE_texture_2D_limited_npot 扩展来节省内存(游戏有 NPOT 纹理,在我当前的实现中,我添加了一些填充来使它们成为 2 的幂)。

我正在我的 iPad(第一代)上进行测试。到目前为止我读到的所有内容都表明所有支持 OpenGLES2 的 iOS 设备(包括 iPad)也支持 GL_APPLE_texture_2D_limited_npot(这非常好,因为我的游戏使用 OpenGLES2)。我已经在我的 iPad 上进行了测试,它确实支持(如果我将 wrap 设置为 GL_CLAMP_TO_EDGE,我删除了填充并且图像可以工作),但是当我调用 glGetString(GL_EXTENSIONS) 时扩展没有显示。代码:

const char *extensions = (const char *)glGetString(GL_EXTENSIONS);
std::cout << extensions << "\n";

结果:

GL_OES_depth_texture GL_OES_depth24 GL_OES_element_index_uint GL_OES_fbo_render_mipmap GL_OES_mapbuffer GL_OES_packed_depth_stencil GL_OES_rgb8_rgba8 GL_OES_standard_derivatives GL_OES_texture_float GL_OES_texture_half_float GL_OES_vertex_array_object GL_EXT_blend_minmax GL_EXT_debug_label GL_EXT_debug_marker GL_EXT_discard_framebuffer GL_EXT_read_format_bgra GL_EXT_separate_shader_objects GL_EXT_shader_texture_lod GL_EXT_texture_filter_anisotropic GL_APPLE_framebuffer_multisample GL_APPLE_rgb_422 GL_APPLE_texture_format_BGRA8888 GL_APPLE_texture_max_level GL_IMG_read_format GL_IMG_texture_compression_pvrtc

为什么这个扩展没有用 glGetString(GL_EXTENSIONS) 显示?检查它的正确方法是什么?所有 OpenGLES2 iOS 设备真的都支持它吗?

最佳答案

OpenGL ES 2.0 在规范中支持非 2 次方纹理。无需扩展。这是规范:http://www.khronos.org/registry/gles/specs/2.0/es_full_spec_2.0.25.pdf (第 69 页):

If wt and ht are the specified image width and height, and if either wt or ht are less than zero, then the error INVALID_VALUE is generated. The maximum allowable width and height of a two-dimensional texture image must be at least 2k-lod for image arrays of level zero through k, where k is the log base 2 of MAX_TEXTURE_SIZE. and lod is the level-of-detail of the image array. It may be zero for image arrays of any level-of-detail greater than k. The error INVALID_VALUE is generated if the specified image is too large to be stored under any conditions.

没有关于二次幂限制的字眼(在 OpenGL ES 1.x 标准中)。

如果您阅读扩展规范 - http://www.khronos.org/registry/gles/extensions/APPLE/APPLE_texture_2D_limited_npot.txt ,然后您会注意到它是根据 OpenGL ES 1.1 规范编写的。

关于ios - iPad 缺少 OpenGL 扩展字符串 GL_APPLE_texture_2D_limited_npot,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10265978/

相关文章:

ios - 在触发预定的 UILocalNotification 之前调用的方法?

ios - 解密保存在钥匙串(keychain)中的字符串

ios - 打开邮件、消息、Twitter 或 Facebook 等系统应用程序时,不会调用 UIDocumentInteractionControllerDelegate 方法

ios - iPad 边距左右有空白

javascript - 使用 webgl 2.0、延迟着色、帧缓冲区对带有三 Angular 形网格的场景进行光线追踪

ios - 如何使用自定义转换 ios7 制作 uiview 全屏 View Controller

ios - 如何支持iPad纵向模式180度变体?

iphone - 无法加载 nib 错误信息

android - 在android opengl es中检测面向相机的立方体的一侧

performance - OpenGL ES 2.0 : The most efficient setup for a VBO with GL_STREAM_DRAW?