| 87 | } |
| 88 | |
| 89 | void resizetexture(int w, int h, bool mipmap, bool canreduce, GLenum target, int &tw, int &th) |
| 90 | { |
| 91 | int hwlimit = hwtexsize, |
| 92 | sizelimit = mipmap && maxtexsize ? min(maxtexsize, hwlimit) : hwlimit; |
| 93 | if(canreduce && texreduce) |
| 94 | { |
| 95 | if(texreduce==-1) |
| 96 | { |
| 97 | w = 2; |
| 98 | h = 2; |
| 99 | } |
| 100 | else |
| 101 | { |
| 102 | w = max(w>>texreduce, 2); // 1); |
| 103 | h = max(h>>texreduce, 2); // 1); |
| 104 | } |
| 105 | } |
| 106 | w = min(w, sizelimit); |
| 107 | h = min(h, sizelimit); |
| 108 | if(mipmap || w&(w-1) || h&(h-1)) |
| 109 | { |
| 110 | tw = th = 1; |
| 111 | while(tw < w) tw *= 2; |
| 112 | while(th < h) th *= 2; |
| 113 | if(w < tw - tw/4) tw /= 2; |
| 114 | if(h < th - th/4) th /= 2; |
| 115 | } |
| 116 | else |
| 117 | { |
| 118 | tw = w; |
| 119 | th = h; |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | void uploadtexture(GLenum target, GLenum internal, int tw, int th, GLenum format, GLenum type, void *pixels, int pw, int ph, bool mipmap) |
| 124 | { |
no test coverage detected