2011-05-08 15:38:26 +02:00
|
|
|
#define FORBIDDEN_SYMBOL_EXCEPTION_fprintf
|
2011-06-09 11:17:15 +02:00
|
|
|
#define FORBIDDEN_SYMBOL_EXCEPTION_stderr
|
2006-05-16 14:52:36 +00:00
|
|
|
|
2009-05-08 07:32:33 +00:00
|
|
|
#include "graphics/tinygl/zgl.h"
|
2005-01-12 15:20:02 +00:00
|
|
|
|
2014-02-20 18:46:49 +01:00
|
|
|
void tglGetIntegerv(int pname, int *params) {
|
2009-05-25 13:19:29 +00:00
|
|
|
TinyGL::GLContext *c = TinyGL::gl_get_context();
|
2005-01-12 15:20:02 +00:00
|
|
|
|
2008-07-29 19:28:19 +00:00
|
|
|
switch (pname) {
|
2006-05-16 14:52:36 +00:00
|
|
|
case TGL_VIEWPORT:
|
2008-07-29 19:28:19 +00:00
|
|
|
params[0] = c->viewport.xmin;
|
|
|
|
params[1] = c->viewport.ymin;
|
|
|
|
params[2] = c->viewport.xsize;
|
|
|
|
params[3] = c->viewport.ysize;
|
2006-05-16 14:52:36 +00:00
|
|
|
break;
|
2008-07-29 19:28:19 +00:00
|
|
|
case TGL_MAX_MODELVIEW_STACK_DEPTH:
|
|
|
|
*params = MAX_MODELVIEW_STACK_DEPTH;
|
|
|
|
break;
|
|
|
|
case TGL_MAX_PROJECTION_STACK_DEPTH:
|
|
|
|
*params = MAX_PROJECTION_STACK_DEPTH;
|
|
|
|
break;
|
|
|
|
case TGL_MAX_LIGHTS:
|
|
|
|
*params = T_MAX_LIGHTS;
|
|
|
|
break;
|
|
|
|
case TGL_MAX_TEXTURE_SIZE:
|
2014-07-05 13:08:34 +02:00
|
|
|
*params = c->_textureSize;
|
2008-07-29 19:28:19 +00:00
|
|
|
break;
|
|
|
|
case TGL_MAX_TEXTURE_STACK_DEPTH:
|
|
|
|
*params = MAX_TEXTURE_STACK_DEPTH;
|
|
|
|
break;
|
2014-06-20 14:13:52 +02:00
|
|
|
case TGL_BLEND:
|
2014-07-25 15:23:50 +02:00
|
|
|
*params = c->fb->isBlendingEnabled();
|
2014-06-20 14:13:52 +02:00
|
|
|
break;
|
2014-07-04 08:43:19 +02:00
|
|
|
case TGL_ALPHA_TEST:
|
2014-07-25 15:23:50 +02:00
|
|
|
*params = c->fb->isAplhaTestEnabled();
|
2014-07-04 08:43:19 +02:00
|
|
|
break;
|
2008-07-29 19:28:19 +00:00
|
|
|
default:
|
2014-07-04 08:43:19 +02:00
|
|
|
error("tglGet: option not implemented");
|
2008-07-29 19:28:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2005-01-12 15:20:02 +00:00
|
|
|
}
|
|
|
|
|
2008-09-26 11:59:46 +00:00
|
|
|
void tglGetFloatv(int pname, float *v) {
|
2008-07-29 19:28:19 +00:00
|
|
|
int i;
|
|
|
|
int mnr = 0; // just a trick to return the correct matrix
|
2009-05-25 13:19:29 +00:00
|
|
|
TinyGL::GLContext *c = TinyGL::gl_get_context();
|
2008-07-29 19:28:19 +00:00
|
|
|
switch (pname) {
|
|
|
|
case TGL_TEXTURE_MATRIX:
|
2014-02-20 18:46:49 +01:00
|
|
|
mnr++;
|
2008-07-29 19:28:19 +00:00
|
|
|
case TGL_PROJECTION_MATRIX:
|
2014-02-20 18:46:49 +01:00
|
|
|
mnr++;
|
|
|
|
case TGL_MODELVIEW_MATRIX: {
|
2014-06-22 14:37:02 +02:00
|
|
|
float *p = &c->matrix_stack_ptr[mnr]->_m[0][0];
|
2014-02-20 18:46:49 +01:00
|
|
|
for (i = 0; i < 4; i++) {
|
2014-06-22 14:37:02 +02:00
|
|
|
*v++ = p[0];
|
|
|
|
*v++ = p[4];
|
|
|
|
*v++ = p[8];
|
|
|
|
*v++ = p[12];
|
|
|
|
p++;
|
2014-02-20 18:46:49 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2008-07-29 19:28:19 +00:00
|
|
|
case TGL_LINE_WIDTH:
|
|
|
|
*v = 1.0f;
|
|
|
|
break;
|
|
|
|
case TGL_LINE_WIDTH_RANGE:
|
|
|
|
v[0] = v[1] = 1.0f;
|
|
|
|
break;
|
|
|
|
case TGL_POINT_SIZE:
|
|
|
|
*v = 1.0f;
|
|
|
|
break;
|
|
|
|
case TGL_POINT_SIZE_RANGE:
|
|
|
|
v[0] = v[1] = 1.0f;
|
2013-12-08 11:29:11 -08:00
|
|
|
break;
|
2008-07-29 19:28:19 +00:00
|
|
|
default:
|
|
|
|
fprintf(stderr, "warning: unknown pname in glGetFloatv()\n");
|
|
|
|
break;
|
|
|
|
}
|
2005-01-12 15:20:02 +00:00
|
|
|
}
|