【问题标题】:Problems creating an integral 1D texture in OpenGL在 OpenGL 中创建完整的 1D 纹理时出现问题
【发布时间】:2012-11-28 00:35:19
【问题描述】:

为什么下面的代码会生成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);

【问题讨论】:

标签: opengl textures


【解决方案1】:

我自己找到了答案!显然,当使用整数格式将像素传输到纹理时,必须在格式说明符 (GL_RED_INTEGER) 上使用后缀 _INTEGER。更多信息在这里:Pixel Transfer

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多