Merge branch 'master' of ssh://repo.or.cz/srv/git/tgl
[tgl.git] / src / get.c
blob30b4be531ca7d77854b506cd56d1769eb6c9db28
1 #include "zgl.h"
3 void glGetIntegerv(int pname,int *params)
5 GLContext *c=gl_get_context();
7 switch(pname) {
8 case GL_VIEWPORT:
9 params[0]=c->viewport.xmin;
10 params[1]=c->viewport.ymin;
11 params[2]=c->viewport.xsize;
12 params[3]=c->viewport.ysize;
13 break;
14 case GL_MAX_MODELVIEW_STACK_DEPTH:
15 *params = MAX_MODELVIEW_STACK_DEPTH;
16 break;
17 case GL_MAX_PROJECTION_STACK_DEPTH:
18 *params = MAX_PROJECTION_STACK_DEPTH;
19 break;
20 case GL_MAX_LIGHTS:
21 *params = MAX_LIGHTS;
22 break;
23 case GL_MAX_TEXTURE_SIZE:
24 *params = 256; /* not completely true, but... */
25 break;
26 case GL_MAX_TEXTURE_STACK_DEPTH:
27 *params = MAX_TEXTURE_STACK_DEPTH;
28 break;
29 default:
30 gl_fatal_error("glGet: option not implemented");
31 break;
35 void glGetFloatv(int pname, float *v)
37 int i;
38 int mnr = 0; /* just a trick to return the correct matrix */
39 GLContext *c = gl_get_context();
40 switch (pname) {
41 case GL_TEXTURE_MATRIX:
42 mnr++;
43 case GL_PROJECTION_MATRIX:
44 mnr++;
45 case GL_MODELVIEW_MATRIX:
47 float *p = &c->matrix_stack_ptr[mnr]->m[0][0];;
48 for (i = 0; i < 4; i++) {
49 *v++ = p[0];
50 *v++ = p[4];
51 *v++ = p[8];
52 *v++ = p[12];
53 p++;
56 break;
57 case GL_LINE_WIDTH:
58 *v = 1.0f;
59 break;
60 case GL_LINE_WIDTH_RANGE:
61 v[0] = v[1] = 1.0f;
62 break;
63 case GL_POINT_SIZE:
64 *v = 1.0f;
65 break;
66 case GL_POINT_SIZE_RANGE:
67 v[0] = v[1] = 1.0f;
68 default:
69 fprintf(stderr,"warning: unknown pname in glGetFloatv()\n");
70 break;