Advertisement
Guest User

Untitled

a guest
Dec 17th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. unsigned char* data = stbi_load((path + fileName).c_str(), &tmpWidth, &tmpHeight, &tmpNrChannels, 0);
  2.  
  3. if(data){
  4. GLenum format;
  5. if(tmpNrChannels == 1)
  6. format = GL_RED;
  7. if(tmpNrChannels == 3)
  8. format = GL_RGB;
  9. if(tmpNrChannels == 4)
  10. format = GL_RGBA;
  11.  
  12. glBindTexture(GL_TEXTURE_2D, id);
  13. glTexImage2D(GL_TEXTURE_2D, 0, format, tmpWidth, tmpHeight, 0, format, GL_UNSIGNED_BYTE, data);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement