MCPcopy Create free account
hub / github.com/assaultcube/AC / createtexture

Function createtexture

source/src/texture.cpp:147–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

145}
146
147void 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

Callers 6

loadsurfaceFunction · 0.85
drawreflectionFunction · 0.85
drawminimapFunction · 0.85
createexpmodtexFunction · 0.85
genshadowMethod · 0.85
loadshadowsMethod · 0.85

Calls 3

minFunction · 0.85
resizetextureFunction · 0.85
uploadtextureFunction · 0.85

Tested by

no test coverage detected