What are the usual troubleshooting steps for OpenGL textures not showing?

前端 未结 6 511
南笙
南笙 2020-12-10 12:53

After making a few changes in my application, my textures are no longer showing. So far I\'ve checked the following:

  • The camera direction hasn\'t changed.
6条回答
  •  执念已碎
    2020-12-10 13:20

    Took me some while to figure this out...

    glMatrixMode(GL_TEXTURE);
    glLoadIdentity();
    glDisable(GL_TEXTURE_GEN_S);
    glDisable(GL_TEXTURE_GEN_T);
    glDisable(GL_TEXTURE_GEN_R);
    glDisable(GL_TEXTURE_GEN_Q);
    

    Also make sure to unbind your stuff:

    glBindBuffer(GL_ARRAY_BUFFER, 0);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
    glBindVertexArray(0);
    

    If you use a third party engine, which is optimized, it probably has a "direct state access" layer for OpenGL (to not use the slow OpenGL query functions). If so, don't call OpenGL directly, but use the engine wrappers. Otherwise your code doesn't play nice with the rest of the engine code.

提交回复
热议问题