| 145 | } |
| 146 | |
| 147 | void createtexture(int tnum, int w, int h, void *pixels, int clamp, bool mipmap, bool canreduce, GLenum format) |
| 148 | { |
| 149 | glBindTexture(GL_TEXTURE_2D, tnum); |
| 150 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, clamp&1 ? GL_CLAMP_TO_EDGE : GL_REPEAT); |
| 151 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, clamp&2 ? GL_CLAMP_TO_EDGE : GL_REPEAT); |
| 152 | if(hasAF && min(aniso, hwmaxaniso) > 0 && mipmap) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, min(aniso, hwmaxaniso)); |
| 153 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, bilinear ? GL_LINEAR : GL_NEAREST); |
| 154 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, |
| 155 | mipmap ? |
| 156 | (trilinear ? |
| 157 | (bilinear ? GL_LINEAR_MIPMAP_LINEAR : GL_NEAREST_MIPMAP_LINEAR) : |
| 158 | (bilinear ? GL_LINEAR_MIPMAP_NEAREST : GL_NEAREST_MIPMAP_NEAREST)) : |
| 159 | (bilinear ? GL_LINEAR : GL_NEAREST)); |
| 160 | |
| 161 | int tw = w, th = h; |
| 162 | if(pixels) resizetexture(w, h, mipmap, canreduce, GL_TEXTURE_2D, tw, th); |
| 163 | uploadtexture(GL_TEXTURE_2D, format, tw, th, format, GL_UNSIGNED_BYTE, pixels, w, h, mipmap); |
| 164 | } |
| 165 | |
| 166 | #if SDL_BYTEORDER == SDL_BIG_ENDIAN |
| 167 | #define RGBAMASKS 0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff |
no test coverage detected