为什么以下代码生成GL_INVALID_OPERATION
?
int8_t bytes[256];
for (int i = 0; i < 256; i++)
bytes[i] = (int8_t) i;
glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_1D, texture);
glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexImage1D(GL_TEXTURE_1D, 0, GL_R8I, 256, 0, GL_RED, GL_BYTE, bytes);
/* Here I get GL_INVALID_OPERATION */
glBindTexture(GL_TEXTURE_1D, 0);
答案 0 :(得分:2)
我自己找到了答案!显然,在使用整数格式将像素传输到纹理时,必须在格式说明符(_INTEGER
)上使用后缀GL_RED_INTEGER
。更多信息请访问:Pixel Transfer