Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unsigned int Texture::loadTexure(char* filename)
- {
- SDL_Surface* img = SDL_LoadBMP(filename);
- SDL_SetColorKey(img, SDL_SRCCOLORKEY,SDL_MapRGB(img -> format, 0 , 0, 255));
- unsigned int id;
- glGenTextures(1, &id);
- glBindTexture(GL_TEXTURE_2D, id);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexImage2D(GL_TEXTURE_2D, 0, img->format->BytesPerPixel, img->w, img->h, 0, GL_BGR, GL_UNSIGNED_BYTE, img->pixels);
- SDL_FreeSurface(img);
- return id;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement