1
爲什麼下面的代碼生成GL_INVALID_OPERATION
?在OpenGL中創建完整的一維紋理的問題
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);
可能重複的[OpenGL 2紋理內部格式GL \ _RGB8I,GL \ _RGB32UI等](http://stackoverflow.com/questions/11278928/opengl-2-texture-internal-formats- GL-rgb8i-GL-rgb32ui-等) –