Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void CMyApp::TextureFromFileAttach(const char* filename, GLuint role) const
- {
- SDL_Surface* loaded_img = IMG_Load(filename);
- int img_mode = 0;
- if (loaded_img == 0)
- {
- std::cout << "[TextureFromFile] Hiba a kép betöltése közben: " << filename << std::endl;
- return;
- }
- #if SDL_BYTEORDER == SDL_LIL_ENDIAN
- if (loaded_img->format->BytesPerPixel == 4)
- img_mode = GL_RGBA;
- else
- img_mode = GL_RGB;
- #else
- if (loaded_img->format->BytesPerPixel == 4)
- img_mode = GL_RGBA;
- else
- img_mode = GL_RGB;
- #endif
- glTexImage2D(role, 0, GL_RGBA, loaded_img->w, loaded_img->h, 0, img_mode, GL_UNSIGNED_BYTE, loaded_img->pixels);
- SDL_FreeSurface(loaded_img);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement