Textures in OpenGL ES 2.0 for Android

流过昼夜 提交于 2019-12-02 21:15:30

A few observations/questions:

  1. I don't know how you changed the fragment shader, but the version that is currently posted needs a precision specifier. Just add:

    precision mediump float;
    

    to the top, and it should work. Now regarding the black screen here are some questions:

  2. When you change the glClearColor to something not black and comment out all the draw commands, does it still look black? If so, then you have a bigger problem than textures.

  3. Second, if you ignore the texture output and try drawing each sprite as just a flat colored rectangle with no texture data, what do you get? You should be able to see some colored rectangle on the screen.

  4. Finally, you need to bind the texture before you call glDrawElements. (Though this shouldn't matter in this example since you haven't changed the state yet.)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!