Android NDK OpenGL ES 2.0纹理间距

Hal*_*far 10 android textures opengl-es pbo

有没有办法在opengl es 2.0中使用与宽度不同的音高来设置纹理.通常我会通过使用PBO或通过glPixelStore调整GL_PACK_ROW_LENGTH来解决这个问题.但是,似乎在Android平台上都没有用于绑定缓冲区的GL_PIXEL_UNPACK_BUFFER或GL_PACK_ROW_LENGTH.

glTex(Sub)Image2D不支持此功能.

有小费吗?

Hal*_*far 0

因为我在评论中回答了这个问题,所以这里有一个更直接的答案:

// width and height is 256 and max is 512
// texture coordinates
float uMax = (width / max);
float vMax = (height / max);

_texCoords[0] = 0.0; _texCoords[1] =  vMax;
_texCoords[2] = uMax; _texCoords[3] =  vMax;
_texCoords[4] = 0.0; _texCoords[5] =  0.0;
_texCoords[6] = uMax; _texCoords[7] =  0.0;
Run Code Online (Sandbox Code Playgroud)

现在使用这些 texcoords 进行渲染,您可以将 256x256 纹理粘贴到 512x512 缓冲区中。您要使用的宽度和高度可以是等于或小于最大尺寸的任何尺寸。