Simple OpenGL texture map not working?

后端 未结 7 1353
天命终不由人
天命终不由人 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:14

    My OpenGL is rusty, but I remember having same problems with with glTexImage2D . Finally I managed to make it work, but I always had more luck with gluBuild2DMipmaps so i ended up with

    gluBuild2DMipmaps (
      GL_TEXTURE_2D, type, i.width, i.height, type, GL_UNSIGNED_BYTE, i.data
    );
    

    which replaced

    glTexImage2D (
      GL_TEXTURE_2D, 0, type, i.width, i.height, 0, type, GL_UNSIGNED_BYTE, i.data 
    );
    

提交回复
热议问题