sanegl

view sanegl.c @ 0:00b315b6db1e

sanegl initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 23 Jun 2011 05:19:40 +0300
parents
children
line source
1 #include <stdio.h>
3 #define SANEGL_IMPL_
4 #include "sanegl.h"
6 struct vertex {
7 float pos[4];
8 float color[4];
9 float tex[2];
10 float norm[3];
11 };
13 static const int mode_verts[] = {
14 1, /* GL_POINTS */
15 2, /* GL_LINES */
16 -1, /* GL_LINE_LOOP TODO */
17 -1, /* GL_LINE_STRIP TODO */
18 3, /* GL_TRIANGLES */
19 -1, /* GL_TRIANGLE_STRIP TODO */
20 -1, /* GL_TRIANGLE_FAN TODO */
21 6, /* GL_QUADS (two triangles) */
22 -1, /* GL_QUAD_STRIP TODO */
23 -1 /* GL_POLYGON TODO */
24 };
26 static struct vertex vcur = {
27 {0, 0, 0, 1}, /* position */
28 {1, 1, 1, 1}, /* color */
29 {0, 0}, /* tex-coord */
30 {0, 0, 0} /* normal */
31 };
34 void glBegin(GLenum mode)
35 {
36 printf("glBegin\n");
37 }
39 void glEnd(void)
40 {
41 printf("glEnd\n");
42 }
44 void glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
45 {
46 vcur.pos[0] = x;
47 vcur.pos[1] = y;
48 vcur.pos[2] = z;
49 vcur.pos[3] = w;
51 varr[nvert++] = vcur;
52 }
54 void glColor4f(GLfloat r, GLfloat g, GLfloat, b, GLfloat a)
55 {
56 vcur.color[0] = r;
57 vcur.color[1] = g;
58 vcur.color[2] = b;
59 vcur.color[3] = a;
60 }
62 void glNormal3f(GLfloat x, GLfloat y, GLfloat z)
63 {
64 vcur.normal[0] = x;
65 vcur.normal[1] = y;
66 vcur.normal[2] = z;
67 }
69 void glTexCoord4f(GLfloat x, GLfloat y)
70 {
71 vcur.tex[0] = x;
72 vcur.tex[1] = y;
73 }