84 |
vector<GLfloat> u; |
vector<GLfloat> u; |
85 |
u.reserve(reserve); |
u.reserve(reserve); |
86 |
for (; i < v.size(); i++) |
for (; i < v.size(); i++) |
87 |
u.insert(u.end(), (GLfloat)atof(v[i].c_str())); |
u.insert(u.end(), (GLfloat)getTokenf(v[i])); |
88 |
return u; |
return u; |
89 |
} |
} |
90 |
|
|
92 |
vector<GLdouble> u; |
vector<GLdouble> u; |
93 |
u.reserve(reserve); |
u.reserve(reserve); |
94 |
for (; i < v.size(); i++) |
for (; i < v.size(); i++) |
95 |
u.insert(u.end(), (GLdouble)atof(v[i].c_str())); |
u.insert(u.end(), (GLdouble)getTokenf(v[i])); |
96 |
return u; |
return u; |
97 |
} |
} |
98 |
|
|
100 |
vector<Int> u; |
vector<Int> u; |
101 |
u.reserve(reserve); |
u.reserve(reserve); |
102 |
for (; i < v.size(); i++) |
for (; i < v.size(); i++) |
103 |
u.insert(u.end(), (GLint)atoi(v[i].c_str())); |
u.insert(u.end(), (GLint)getToken(v[i])); |
104 |
return u; |
return u; |
105 |
} |
} |
106 |
|
|
155 |
vector<GLdouble> params = getdv(v, 1, 16); |
vector<GLdouble> params = getdv(v, 1, 16); |
156 |
glMultMatrixd(¶ms[0]); |
glMultMatrixd(¶ms[0]); |
157 |
} else if (checkfunc(v, "Rotate", 4)) { |
} else if (checkfunc(v, "Rotate", 4)) { |
158 |
glRotated(atof(v[1].c_str()), atof(v[2].c_str()), |
glRotated(getTokenf(v[1]), getTokenf(v[2]), |
159 |
atof(v[3].c_str()), atof(v[4].c_str())); |
getTokenf(v[3]), getTokenf(v[4])); |
160 |
} else if (checkfunc(v, "Scale", 3)) { |
} else if (checkfunc(v, "Scale", 3)) { |
161 |
glScaled(atof(v[1].c_str()), atof(v[2].c_str()), |
glScaled(getTokenf(v[1]), getTokenf(v[2]), |
162 |
atof(v[3].c_str())); |
getTokenf(v[3])); |
163 |
} else if (checkfunc(v, "Translate", 3)) { |
} else if (checkfunc(v, "Translate", 3)) { |
164 |
glTranslated(atof(v[1].c_str()), atof(v[2].c_str()), |
glTranslated(getTokenf(v[1]), getTokenf(v[2]), |
165 |
atof(v[3].c_str())); |
getTokenf(v[3])); |
166 |
} else if (checkfunc(v, "BindTexture", 2)) { |
} else if (checkfunc(v, "BindTexture", 2)) { |
167 |
glBindTexture(getToken(v[1]), (GLuint)atoi(v[2].c_str())); |
glBindTexture(getToken(v[1]), (GLuint)getToken(v[2])); |
168 |
} else if (checkfunc(v, "DepthMask", 1)) { |
} else if (checkfunc(v, "DepthMask", 1)) { |
169 |
glDepthMask(atoi(v[1].c_str())); |
glDepthMask(getToken(v[1])); |
170 |
} else if (checkfunc(v, "ColorMask", 4)) { |
} else if (checkfunc(v, "ColorMask", 4)) { |
171 |
glColorMask(atoi(v[1].c_str()), |
glColorMask(getToken(v[1]), |
172 |
atoi(v[2].c_str()), |
getToken(v[2]), |
173 |
atoi(v[3].c_str()), |
getToken(v[3]), |
174 |
atoi(v[4].c_str()) |
getToken(v[4]) |
175 |
); |
); |
176 |
} else if (checkfunc(v, "AlphaFunc", 2)) { |
} else if (checkfunc(v, "AlphaFunc", 2)) { |
177 |
glAlphaFunc(getToken(v[1]), atof(v[2].c_str())); |
glAlphaFunc(getToken(v[1]), getTokenf(v[2])); |
178 |
} else if (checkfunc(v, "DepthFunc", 1)) { |
} else if (checkfunc(v, "DepthFunc", 1)) { |
179 |
glDepthFunc(getToken(v[1])); |
glDepthFunc(getToken(v[1])); |
180 |
} else if (checkfunc(v, "BlendFunc", 2)) { |
} else if (checkfunc(v, "BlendFunc", 2)) { |
181 |
glBlendFunc(getToken(v[1]), getToken(v[2])); |
glBlendFunc(getToken(v[1]), getToken(v[2])); |
182 |
} else if (checkfunc(v, "StencilFunc", 3)) { |
} else if (checkfunc(v, "StencilFunc", 3)) { |
183 |
glStencilFunc(getToken(v[1]), atoi(v[2].c_str()), atoi(v[3].c_str())); |
glStencilFunc(getToken(v[1]), getToken(v[2]), getToken(v[3])); |
184 |
} else if (checkfunc(v, "StencilOp", 3)) { |
} else if (checkfunc(v, "StencilOp", 3)) { |
185 |
glStencilOp(getToken(v[1]), getToken(v[2]), getToken(v[3])); |
glStencilOp(getToken(v[1]), getToken(v[2]), getToken(v[3])); |
186 |
} else if (checkfunc(v, "StencilMask", 1)) { |
} else if (checkfunc(v, "StencilMask", 1)) { |
187 |
glStencilMask(atoi(v[1].c_str())); |
glStencilMask(getToken(v[1])); |
188 |
} else if (checkfunc(v, "PolygonMode", 2)) { |
} else if (checkfunc(v, "PolygonMode", 2)) { |
189 |
glPolygonMode(getToken(v[1]), getToken(v[2])); |
glPolygonMode(getToken(v[1]), getToken(v[2])); |
190 |
} else if (checkfunc(v, "BlendEquation", 1)) { |
} else if (checkfunc(v, "BlendEquation", 1)) { |
191 |
glBlendEquation(getToken(v[1])); |
glBlendEquation(getToken(v[1])); |
192 |
} else if (checkfunc(v, "BlendColor", 4)) { |
} else if (checkfunc(v, "BlendColor", 4)) { |
193 |
glBlendColor(atof(v[1].c_str()), atof(v[2].c_str()), |
glBlendColor(getTokenf(v[1]), getTokenf(v[2]), |
194 |
atof(v[3].c_str()), atof(v[4].c_str())); |
getTokenf(v[3]), getTokenf(v[4])); |
195 |
} else if (checkfunc(v, "SecondaryColorEXT", 3)) { |
} else if (checkfunc(v, "SecondaryColorEXT", 3)) { |
196 |
#ifdef GL_EXT_secondary_color |
#ifdef GL_EXT_secondary_color |
197 |
glSecondaryColor3dEXT(atof(v[1].c_str()), atof(v[2].c_str()), |
glSecondaryColor3dEXT(getTokenf(v[1]), getTokenf(v[2]), |
198 |
atof(v[3].c_str())); |
getTokenf(v[3])); |
199 |
#else |
#else |
200 |
cerr << "Warning: SecondaryColorEXT attempted but support\n" |
cerr << "Warning: SecondaryColorEXT attempted but support\n" |
201 |
"was not compiled in because GL_EXT_secondary_color\n" |
"was not compiled in because GL_EXT_secondary_color\n" |
209 |
glFogf(getToken(v[1]), getTokenf(v[2])); |
glFogf(getToken(v[1]), getTokenf(v[2])); |
210 |
} |
} |
211 |
} else if (checkfunc(v, "TexImage2D", 8, true)) { |
} else if (checkfunc(v, "TexImage2D", 8, true)) { |
212 |
int w = atoi(v[4].c_str()); |
int w = getToken(v[4]); |
213 |
int h = atoi(v[5].c_str()); |
int h = getToken(v[5]); |
214 |
vector<GLfloat> pixels = getfv(v, 8, w * h); |
vector<GLfloat> pixels = getfv(v, 8, w * h); |
215 |
if (pixels.size() % (unsigned)(w * h)) { |
if (pixels.size() % (unsigned)(w * h)) { |
216 |
cerr << "TexImage2D dimensions " << w << "x" << h << " do not match the size " << pixels.size() << " of data\n"; |
cerr << "TexImage2D dimensions " << w << "x" << h << " do not match the size " << pixels.size() << " of data\n"; |
217 |
return false; |
return false; |
218 |
} |
} |
219 |
glTexImage2D(getToken(v[1]), atoi(v[2].c_str()), getToken(v[3]), |
glTexImage2D(getToken(v[1]), getToken(v[2]), getToken(v[3]), |
220 |
w, h, atoi(v[6].c_str()), getToken(v[7]), |
w, h, getToken(v[6]), getToken(v[7]), |
221 |
GL_FLOAT, &pixels[0]); |
GL_FLOAT, &pixels[0]); |
222 |
} else if (checkfunc(v, "TexImage2D_ushort", 8, true)) { |
} else if (checkfunc(v, "TexImage2D_ushort", 8, true)) { |
223 |
int w = atoi(v[4].c_str()); |
int w = getToken(v[4]); |
224 |
int h = atoi(v[5].c_str()); |
int h = getToken(v[5]); |
225 |
vector<GLushort> pixels = getiv<GLushort>(v, 8, w * h); |
vector<GLushort> pixels = getiv<GLushort>(v, 8, w * h); |
226 |
if (pixels.size() % (unsigned)(w * h)) { |
if (pixels.size() % (unsigned)(w * h)) { |
227 |
cerr << "TexImage2D dimensions " << w << "x" << h << " do not match the size " << pixels.size() << " of data\n"; |
cerr << "TexImage2D dimensions " << w << "x" << h << " do not match the size " << pixels.size() << " of data\n"; |
228 |
return false; |
return false; |
229 |
} |
} |
230 |
glTexImage2D(getToken(v[1]), atoi(v[2].c_str()), getToken(v[3]), |
glTexImage2D(getToken(v[1]), getToken(v[2]), getToken(v[3]), |
231 |
w, h, atoi(v[6].c_str()), getToken(v[7]), |
w, h, getToken(v[6]), getToken(v[7]), |
232 |
GL_UNSIGNED_SHORT, &pixels[0]); |
GL_UNSIGNED_SHORT, &pixels[0]); |
233 |
} else if (checkfunc(v, "ColorTable", 5, true) || |
} else if (checkfunc(v, "ColorTable", 5, true) || |
234 |
checkfunc(v, "ColorTableEXT", 5, true) |
checkfunc(v, "ColorTableEXT", 5, true) |
236 |
vector<GLfloat> pixels = getfv(v, 5); |
vector<GLfloat> pixels = getfv(v, 5); |
237 |
glColorTableEXT( |
glColorTableEXT( |
238 |
getToken(v[1]), getToken(v[2]), |
getToken(v[1]), getToken(v[2]), |
239 |
atoi(v[3].c_str()), |
getToken(v[3]), |
240 |
getToken(v[4]), |
getToken(v[4]), |
241 |
GL_FLOAT, &pixels[0]); |
GL_FLOAT, &pixels[0]); |
242 |
} else if (checkfunc(v, "SeparableFilter2D", 6, true)) { |
} else if (checkfunc(v, "SeparableFilter2D", 6, true)) { |
243 |
vector<GLfloat> filters = getfv(v, 6); |
vector<GLfloat> filters = getfv(v, 6); |
244 |
int w = atoi(v[3].c_str()); |
int w = getToken(v[3]); |
245 |
int h = atoi(v[4].c_str()); |
int h = getToken(v[4]); |
246 |
|
|
247 |
glSeparableFilter2D( |
glSeparableFilter2D( |
248 |
getToken(v[1]), |
getToken(v[1]), |
255 |
|
|
256 |
} else if (checkfunc(v, "ConvolutionFilter2D", 6, true)) { |
} else if (checkfunc(v, "ConvolutionFilter2D", 6, true)) { |
257 |
vector<GLfloat> filters = getfv(v, 6); |
vector<GLfloat> filters = getfv(v, 6); |
258 |
int w = atoi(v[3].c_str()); |
int w = getToken(v[3]); |
259 |
int h = atoi(v[4].c_str()); |
int h = getToken(v[4]); |
260 |
|
|
261 |
glConvolutionFilter2D( |
glConvolutionFilter2D( |
262 |
getToken(v[1]), |
getToken(v[1]), |
311 |
mask |= getToken(v[i]); |
mask |= getToken(v[i]); |
312 |
glClear(mask); |
glClear(mask); |
313 |
} else if (checkfunc(v, "ClearDepth", 1)) { |
} else if (checkfunc(v, "ClearDepth", 1)) { |
314 |
glClearDepth(atof(v[1].c_str())); |
glClearDepth(getTokenf(v[1])); |
315 |
} else if (checkfunc(v, "ClearColor", 4)) { |
} else if (checkfunc(v, "ClearColor", 4)) { |
316 |
glClearColor(atof(v[1].c_str()), |
glClearColor(getTokenf(v[1]), |
317 |
atof(v[2].c_str()), |
getTokenf(v[2]), |
318 |
atof(v[3].c_str()), |
getTokenf(v[3]), |
319 |
atof(v[4].c_str())); |
getTokenf(v[4])); |
320 |
} else if (checkfunc(v, "ActiveTextureARB", 1)) { |
} else if (checkfunc(v, "ActiveTextureARB", 1)) { |
321 |
glActiveTextureARB(getToken(v[1])); |
glActiveTextureARB(getToken(v[1])); |
322 |
} else if (checkfunc(v, "ActiveTexture", 1)) { |
} else if (checkfunc(v, "ActiveTexture", 1)) { |
329 |
Begin = false; |
Begin = false; |
330 |
} else if (checkfunc(v, "Vertex", 2, true)) { |
} else if (checkfunc(v, "Vertex", 2, true)) { |
331 |
switch (v.size()) { |
switch (v.size()) { |
332 |
case 3: glVertex2d(atof(v[1].c_str()), |
case 3: glVertex2d(getTokenf(v[1]), |
333 |
atof(v[2].c_str())); break; |
getTokenf(v[2])); break; |
334 |
case 4: glVertex3d(atof(v[1].c_str()), |
case 4: glVertex3d(getTokenf(v[1]), |
335 |
atof(v[2].c_str()), |
getTokenf(v[2]), |
336 |
atof(v[3].c_str())); break; |
getTokenf(v[3])); break; |
337 |
default: |
default: |
338 |
cerr << "Ignoring extra arguments to Vertex\n"; |
cerr << "Ignoring extra arguments to Vertex\n"; |
339 |
case 5: glVertex4d(atof(v[1].c_str()), |
case 5: glVertex4d(getTokenf(v[1]), |
340 |
atof(v[2].c_str()), |
getTokenf(v[2]), |
341 |
atof(v[3].c_str()), |
getTokenf(v[3]), |
342 |
atof(v[4].c_str())); break; |
getTokenf(v[4])); break; |
343 |
} |
} |
344 |
} else if (checkfunc(v, "TexCoord", 1, true)) { |
} else if (checkfunc(v, "TexCoord", 1, true)) { |
345 |
switch (v.size()) { |
switch (v.size()) { |
346 |
case 2: glTexCoord1d(atof(v[1].c_str())); break; |
case 2: glTexCoord1d(getTokenf(v[1])); break; |
347 |
case 3: glTexCoord2d(atof(v[1].c_str()), |
case 3: glTexCoord2d(getTokenf(v[1]), |
348 |
atof(v[2].c_str())); break; |
getTokenf(v[2])); break; |
349 |
case 4: glTexCoord3d(atof(v[1].c_str()), |
case 4: glTexCoord3d(getTokenf(v[1]), |
350 |
atof(v[2].c_str()), |
getTokenf(v[2]), |
351 |
atof(v[3].c_str())); break; |
getTokenf(v[3])); break; |
352 |
default: |
default: |
353 |
cerr << "Ignoring extra arguments to TexCoord\n"; |
cerr << "Ignoring extra arguments to TexCoord\n"; |
354 |
case 5: glTexCoord4d(atof(v[1].c_str()), |
case 5: glTexCoord4d(getTokenf(v[1]), |
355 |
atof(v[2].c_str()), |
getTokenf(v[2]), |
356 |
atof(v[3].c_str()), |
getTokenf(v[3]), |
357 |
atof(v[4].c_str())); break; |
getTokenf(v[4])); break; |
358 |
} |
} |
359 |
} else if (checkfunc(v, "MultiTexCoord", 2, true)) { |
} else if (checkfunc(v, "MultiTexCoord", 2, true)) { |
360 |
GLenum tex = getToken(v[1]); |
GLenum tex = getToken(v[1]); |
361 |
switch (v.size()) { |
switch (v.size()) { |
362 |
case 3: glMultiTexCoord1d(tex, atof(v[2].c_str())); break; |
case 3: glMultiTexCoord1d(tex, getTokenf(v[2])); break; |
363 |
case 4: glMultiTexCoord2d(tex, |
case 4: glMultiTexCoord2d(tex, |
364 |
atof(v[2].c_str()), |
getTokenf(v[2]), |
365 |
atof(v[3].c_str())); break; |
getTokenf(v[3])); break; |
366 |
case 5: glMultiTexCoord3d(tex, |
case 5: glMultiTexCoord3d(tex, |
367 |
atof(v[2].c_str()), |
getTokenf(v[2]), |
368 |
atof(v[3].c_str()), |
getTokenf(v[3]), |
369 |
atof(v[4].c_str())); break; |
getTokenf(v[4])); break; |
370 |
default: |
default: |
371 |
cerr << "Ignoring extra arguments to MultiTexCoord\n"; |
cerr << "Ignoring extra arguments to MultiTexCoord\n"; |
372 |
case 6: glMultiTexCoord4d(tex, |
case 6: glMultiTexCoord4d(tex, |
373 |
atof(v[2].c_str()), |
getTokenf(v[2]), |
374 |
atof(v[3].c_str()), |
getTokenf(v[3]), |
375 |
atof(v[4].c_str()), |
getTokenf(v[4]), |
376 |
atof(v[5].c_str())); break; |
getTokenf(v[5])); break; |
377 |
} |
} |
378 |
} else if (checkfunc(v, "Color", 3, true)) { |
} else if (checkfunc(v, "Color", 3, true)) { |
379 |
switch (v.size()) { |
switch (v.size()) { |
380 |
case 4: glColor3d(atof(v[1].c_str()), |
case 4: glColor3d(getTokenf(v[1]), |
381 |
atof(v[2].c_str()), |
getTokenf(v[2]), |
382 |
atof(v[3].c_str())); break; |
getTokenf(v[3])); break; |
383 |
default: |
default: |
384 |
cerr << "Ignoring extra arguments to Color\n"; |
cerr << "Ignoring extra arguments to Color\n"; |
385 |
case 5: glColor4d(atof(v[1].c_str()), |
case 5: glColor4d(getTokenf(v[1]), |
386 |
atof(v[2].c_str()), |
getTokenf(v[2]), |
387 |
atof(v[3].c_str()), |
getTokenf(v[3]), |
388 |
atof(v[4].c_str())); break; |
getTokenf(v[4])); break; |
389 |
} |
} |
390 |
} else if (checkfunc(v, "Normal", 3)) { |
} else if (checkfunc(v, "Normal", 3)) { |
391 |
glNormal3d(atof(v[1].c_str()), |
glNormal3d(getTokenf(v[1]), |
392 |
atof(v[2].c_str()), |
getTokenf(v[2]), |
393 |
atof(v[3].c_str())); |
getTokenf(v[3])); |
394 |
} else if (checkfunc(v, "LineWidth", 1)) { |
} else if (checkfunc(v, "LineWidth", 1)) { |
395 |
glLineWidth(atof(v[1].c_str())); |
glLineWidth(getTokenf(v[1])); |
396 |
} else if (checkfunc(v, "PointSize", 1)) { |
} else if (checkfunc(v, "PointSize", 1)) { |
397 |
glPointSize(atof(v[1].c_str())); |
glPointSize(getTokenf(v[1])); |
398 |
|
|
399 |
#ifdef GL_REGISTER_COMBINERS_NV |
#ifdef GL_REGISTER_COMBINERS_NV |
400 |
|
|
415 |
cerr << "Inv num params CombinerParameterNV\n"; |
cerr << "Inv num params CombinerParameterNV\n"; |
416 |
return false; |
return false; |
417 |
} |
} |
418 |
glCombinerParameterfNV(pname, atof(v[2].c_str())); |
glCombinerParameterfNV(pname, getTokenf(v[2])); |
419 |
} else { |
} else { |
420 |
cerr << "Invalid CombinerParameterNV first param: "<<pname<<"\n"; |
cerr << "Invalid CombinerParameterNV first param: "<<pname<<"\n"; |
421 |
return false; |
return false; |
465 |
// type, stride, vstride, packed not used |
// type, stride, vstride, packed not used |
466 |
vector<GLfloat> params = getfv(v, 5, v.size()); |
vector<GLfloat> params = getfv(v, 5, v.size()); |
467 |
GLenum target = getToken(v[1]); |
GLenum target = getToken(v[1]); |
468 |
int index = atoi(v[2].c_str()); |
int index = getToken(v[2]); |
469 |
int uorder = atoi(v[3].c_str()); |
int uorder = getToken(v[3]); |
470 |
int vorder = atoi(v[4].c_str()); |
int vorder = getToken(v[4]); |
471 |
glMapControlPointsNV( |
glMapControlPointsNV( |
472 |
target, |
target, |
473 |
index, |
index, |
491 |
|
|
492 |
#ifdef GL_VERTEX_PROGRAM_NV |
#ifdef GL_VERTEX_PROGRAM_NV |
493 |
} else if (checkfunc(v, "BindProgramNV", 2)) { |
} else if (checkfunc(v, "BindProgramNV", 2)) { |
494 |
glBindProgramNV(getToken(v[1]), (GLuint)atoi(v[2].c_str())); |
glBindProgramNV(getToken(v[1]), (GLuint)getToken(v[2])); |
495 |
} else if (checkfunc(v, "TrackMatrixNV", 4)) { |
} else if (checkfunc(v, "TrackMatrixNV", 4)) { |
496 |
glTrackMatrixNV(getToken(v[1]), |
glTrackMatrixNV(getToken(v[1]), |
497 |
atoi(v[2].c_str()), |
getToken(v[2]), |
498 |
getToken(v[3]), |
getToken(v[3]), |
499 |
getToken(v[4])); |
getToken(v[4])); |
500 |
} else if (checkfunc(v, "ProgramParameterNV", 6)) { |
} else if (checkfunc(v, "ProgramParameterNV", 6)) { |
501 |
glProgramParameter4fNV( |
glProgramParameter4fNV( |
502 |
getToken(v[1]), |
getToken(v[1]), |
503 |
atoi(v[2].c_str()), |
getToken(v[2]), |
504 |
atof(v[3].c_str()), |
getTokenf(v[3]), |
505 |
atof(v[4].c_str()), |
getTokenf(v[4]), |
506 |
atof(v[5].c_str()), |
getTokenf(v[5]), |
507 |
atof(v[6].c_str())); |
getTokenf(v[6])); |
508 |
|
|
509 |
#endif |
#endif |
510 |
|
|