TinyGL 0.4.1 for MinGW
get.c
Go to the documentation of this file.
1#include "zgl.h"
2
3void glGetIntegerv(int pname,int *params)
4{
6
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;
16 break;
19 break;
20 case GL_MAX_LIGHTS:
21 *params = MAX_LIGHTS;
22 break;
24 *params = 256; /* not completely true, but... */
25 break;
28 break;
29 default:
30 gl_fatal_error("glGet: option not implemented");
31 break;
32 }
33}
34
35void glGetFloatv(int pname, float *v)
36{
37 int i;
38 int mnr = 0; /* just a trick to return the correct matrix */
40 switch (pname) {
42 mnr++;
44 mnr++;
46 {
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++;
54 }
55 }
56 break;
57 case GL_LINE_WIDTH:
58 *v = 1.0f;
59 break;
61 v[0] = v[1] = 1.0f;
62 break;
63 case GL_POINT_SIZE:
64 *v = 1.0f;
65 break;
67 v[0] = v[1] = 1.0f;
68 default:
69 fprintf(stderr,"warning: unknown pname in glGetFloatv()\n");
70 break;
71 }
72}
void gl_fatal_error(char *format,...)
Definition: error.c:4
void glGetIntegerv(int pname, int *params)
Definition: get.c:3
void glGetFloatv(int pname, float *v)
Definition: get.c:35
@ GL_TEXTURE_MATRIX
Definition: gl.h:387
@ GL_POINT_SIZE
Definition: gl.h:100
@ GL_MAX_TEXTURE_SIZE
Definition: gl.h:358
@ GL_LINE_WIDTH
Definition: gl.h:109
@ GL_MODELVIEW_MATRIX
Definition: gl.h:380
@ GL_POINT_SIZE_RANGE
Definition: gl.h:102
@ GL_MAX_TEXTURE_STACK_DEPTH
Definition: gl.h:354
@ GL_LINE_WIDTH_RANGE
Definition: gl.h:111
@ GL_VIEWPORT
Definition: gl.h:389
@ GL_MAX_LIGHTS
Definition: gl.h:356
@ GL_MAX_PROJECTION_STACK_DEPTH
Definition: gl.h:353
@ GL_MAX_MODELVIEW_STACK_DEPTH
Definition: gl.h:351
@ GL_PROJECTION_MATRIX
Definition: gl.h:383
GLContext * gl_get_context(void)
Definition: list.c:25
Definition: zgl.h:159
M4 * matrix_stack_ptr[3]
Definition: zgl.h:193
GLViewport viewport
Definition: zgl.h:203
int xmin
Definition: zgl.h:91
int ymin
Definition: zgl.h:91
int ysize
Definition: zgl.h:91
int xsize
Definition: zgl.h:91
float m[4][4]
Definition: zmath.h:7
#define MAX_MODELVIEW_STACK_DEPTH
Definition: zgl.h:36
#define MAX_TEXTURE_STACK_DEPTH
Definition: zgl.h:38
#define MAX_LIGHTS
Definition: zgl.h:41
#define MAX_PROJECTION_STACK_DEPTH
Definition: zgl.h:37