Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unsigned char* data = stbi_load((path + fileName).c_str(), &tmpWidth, &tmpHeight, &tmpNrChannels, 0);
- if(data){
- GLenum format;
- if(tmpNrChannels == 1)
- format = GL_RED;
- if(tmpNrChannels == 3)
- format = GL_RGB;
- if(tmpNrChannels == 4)
- format = GL_RGBA;
- glBindTexture(GL_TEXTURE_2D, id);
- glTexImage2D(GL_TEXTURE_2D, 0, format, tmpWidth, tmpHeight, 0, format, GL_UNSIGNED_BYTE, data);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement