Simple OpenGL texture map not working?

后端 未结 7 1309
天命终不由人
天命终不由人 2020-12-31 19:31

I\'m trying to figure out texture mapping in OpenGL and I can\'t get a simple example to work.

The polygon is being drawn, though it\'s not textured but just a soli

7条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-31 20:19

    I'll put this here as I had the same issue and found another post explaining the issue. The iPhone does support GL_BGRA(GL_EXT_BGRA) but seemingly only as an input format and not as an internal format. So, if you change the glTexImage2D call to have an internal format of GL_RGBA then it works.

    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_BGRA, GL_UNSIGNED_BYTE, &sprite1[54]);
    

    I hope this helps someone else that stumbles upon this post.

提交回复
热议问题