确定最大纹理大小没有问题: How to detect maximum texture resolution on iPhone?
此外,文档指定了片段着色器可以处理的最大采样器数量,here
该链接在标题下指定
OpenGL ES 2.0 on the PowerVR SGX
You can use up to 8 textures in a fragment shader
你加载纹理例如:
// bind gem texture to slot #0, and inform shader via uniform
glActiveTexture( GL_TEXTURE0 );
glBindTexture( GL_TEXTURE_2D, texId_dull );
glUniform1i( [ self.program idForUniform: "U1_sampId_Gem" ], (GLuint)0 );
// ... similarly for texture #1
glActiveTexture( GL_TEXTURE1 );
glBindTexture( GL_TEXTURE_2D, texId_sparkle );
glUniform1i( [ self.program idForUniform: "U2_sampId_Sparkle" ], (GLuint)1 );
并在 GL_TEXTURE1 上使用 COMMAND 并单击会显示一直到 GL_TEXTURE31 的常量,因此看起来他们正在提前几代做准备。
但是我在哪里可以找到可以创建的最大纹理数量。
glGenTextures( n, pTexID ); // what is max n?
这是否仅受设备上可用于视频的物理内存量的限制? (我读到 VRAM 和 RAM 之间没有实际的物理区别,它们是相同的内存)。还是可以保证某个下限?
最佳答案
没错,纹理对象的数量
glGenTextures()
仅受内存限制。
顺便说一下,纹理单元的数量(在你的硬件上是 8 个)。在运行时使用
查询int num_texture_units;
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &num_texture_units);
关于iOS/GLES2 : How to programmatically determine maximum available texture units?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6504935/