99 |
return u; |
return u; |
100 |
} |
} |
101 |
|
|
102 |
vector<GLint> getiv(vector<string> v, unsigned i, int reserve = 0) { |
template<class Int> vector<Int> getiv(vector<string> v, unsigned i, int reserve = 0) { |
103 |
vector<GLint> u; |
vector<Int> u; |
104 |
u.reserve(reserve); |
u.reserve(reserve); |
105 |
for (; i < v.size(); i++) |
for (; i < v.size(); i++) |
106 |
u.insert(u.end(), (GLint)atoi(v[i].c_str())); |
u.insert(u.end(), (GLint)atoi(v[i].c_str())); |
218 |
glTexImage2D(getToken(v[1]), atoi(v[2].c_str()), getToken(v[3]), |
glTexImage2D(getToken(v[1]), atoi(v[2].c_str()), getToken(v[3]), |
219 |
w, h, atoi(v[6].c_str()), getToken(v[7]), |
w, h, atoi(v[6].c_str()), getToken(v[7]), |
220 |
GL_FLOAT, &pixels[0]); |
GL_FLOAT, &pixels[0]); |
221 |
|
} else if (checkfunc(v, "TexImage2D_ushort", 8, true)) { |
222 |
|
int w = atoi(v[4].c_str()); |
223 |
|
int h = atoi(v[5].c_str()); |
224 |
|
vector<GLushort> pixels = getiv<GLushort>(v, 8, w * h); |
225 |
|
if (pixels.size() != (unsigned)(w * h)) { |
226 |
|
cerr << "TexImage2D dimensions " << w << "x" << h << " do not match the size " << pixels.size() << " of data\n"; |
227 |
|
return false; |
228 |
|
} |
229 |
|
glTexImage2D(getToken(v[1]), atoi(v[2].c_str()), getToken(v[3]), |
230 |
|
w, h, atoi(v[6].c_str()), getToken(v[7]), |
231 |
|
GL_UNSIGNED_SHORT, &pixels[0]); |
232 |
} else if (checkfunc(v, "ColorTableEXT", 5, true)) { |
} else if (checkfunc(v, "ColorTableEXT", 5, true)) { |
233 |
vector<GLfloat> pixels = getfv(v, 5); |
vector<GLfloat> pixels = getfv(v, 5); |
234 |
glColorTableEXT( |
glColorTableEXT( |