5 void g3d_matrix_mode(int mmode)
9 glMatrixMode(GL_MODELVIEW);
12 glMatrixMode(GL_PROJECTION);
17 void g3d_push_matrix(void)
22 void g3d_pop_matrix(void)
27 void g3d_load_identity(void)
32 const float *g3d_get_matrix(int which, float *mret)
38 glGetFloatv(GL_MODELVIEW_MATRIX, tmp);
42 glGetFloatv(GL_PROJECTION_MATRIX, tmp);
47 memcpy(mret, tmp, sizeof tmp);
52 void g3d_translate(float x, float y, float z)
54 glTranslatef(x, y, z);
57 void g3d_rotate(float angle, float x, float y, float z)
59 glRotatef(angle, x, y, z);
62 void g3d_scale(float x, float y, float z)
67 void g3d_draw(int prim, const struct g3d_vertex *varr, int varr_size)
69 g3d_draw_indexed(prim, varr, varr_size, 0, 0);
72 void g3d_draw_indexed(int prim, const struct g3d_vertex *varr, int varr_size,
73 const uint16_t *iarr, int iarr_size)
77 const struct g3d_vertex *vptr = varr;
78 const uint16_t *iptr = iarr;
88 glprim = GL_TRIANGLES;
97 nfaces = (iarr ? iarr_size : varr_size) / prim;
102 for(i=0; i<nfaces; i++) {
103 if(glprim == GL_POLYGON) {
107 for(j=0; j<prim; j++) {
109 vptr = varr + *iptr++;
111 glNormal3f(vptr->nx, vptr->ny, vptr->nz);
112 glColor4b(vptr->r, vptr->g, vptr->b, vptr->a);
113 glTexCoord2f(vptr->u, vptr->v);
114 glVertex4f(vptr->x, vptr->y, vptr->z, vptr->w);
118 if(glprim == GL_POLYGON) {