39 #include <libplayercore/playercore.h> 41 #include <GLUT/glut.h> 54 void output(GLfloat x, GLfloat y,
char *text)
59 glTranslatef(x, y, 0);
60 for (p = text; *p; p++)
61 glutStrokeCharacter(GLUT_STROKE_ROMAN, *p);
67 static GLfloat amb[] = { 0.4, 0.4, 0.4, 0.0 };
68 static GLfloat dif[] = { 1.0, 1.0, 1.0, 0.0 };
70 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
73 amb[3] = dif[3] = cos(
s) / 2.0 + 0.5;
74 glMaterialfv(GL_FRONT, GL_AMBIENT, amb);
75 glMaterialfv(GL_FRONT, GL_DIFFUSE, dif);
78 glTranslatef(-0.3, -0.3, 0.0);
79 glRotatef(
angle1, 1.0, 5.0, 0.0);
83 glClear(GL_DEPTH_BUFFER_BIT);
86 amb[3] = dif[3] = 0.5 - cos(
s * .95) / 2.0;
87 glMaterialfv(GL_FRONT, GL_AMBIENT, amb);
88 glMaterialfv(GL_FRONT, GL_DIFFUSE, dif);
91 glTranslatef(0.3, 0.3, 0.0);
92 glRotatef(
angle2, 1.0, 0.0, 5.0);
96 glPushAttrib(GL_ENABLE_BIT);
97 glDisable(GL_DEPTH_TEST);
98 glDisable(GL_LIGHTING);
99 glMatrixMode(GL_PROJECTION);
102 gluOrtho2D(0, 1500, 0, 1500);
103 glMatrixMode(GL_MODELVIEW);
107 glRotatef(4, 0.0, 0.0, 1.0);
108 output(200, 225,
"This is antialiased.");
109 glDisable(GL_LINE_SMOOTH);
111 output(160, 100,
"This text is not.");
113 glMatrixMode(GL_PROJECTION);
116 glMatrixMode(GL_MODELVIEW);
130 printf(
"cycle %d\n", g++);
144 printf(
"cycle %d\n", g++);
148 glutTimerFunc(100,
redraw, 0);
153 if (vis == GLUT_VISIBLE)
172 virtual int ProcessMessage(MessageQueue *resp_queue, player_msghdr *hdr,
void *data);
207 : Driver(cf, section, false, PLAYER_MSGQUEUE_DEFAULT_MAXLEN, PLAYER_GRAPHICS3D_CODE),
foop(0)
222 puts(
"Example driver initialising");
230 glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
231 glutCreateWindow(
"blender");
235 glNewList(1, GL_COMPILE);
236 glutSolidIcosahedron();
239 glEnable(GL_LIGHTING);
247 glEnable(GL_DEPTH_TEST);
248 glEnable(GL_CULL_FACE);
250 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
251 glEnable(GL_LINE_SMOOTH);
254 glMatrixMode(GL_PROJECTION);
255 gluPerspective( 40.0,
258 glMatrixMode(GL_MODELVIEW);
259 gluLookAt(0.0, 0.0, 5.0,
262 glTranslatef(0.0, 0.6, -1.0);
264 puts(
"Example driver ready");
277 puts(
"Shutting example driver down");
285 puts(
"Example driver has been shutdown");
313 printf(
"entering main loop");
343 puts(
"Example driver initializing");
345 puts(
"Example driver done");
GLfloat light2_position[]
Driver * ExampleDriver_Init(ConfigFile *cf, int section)
void output(GLfloat x, GLfloat y, char *text)
void ExampleDriver_Register(DriverTable *table)
ExampleDriver(ConfigFile *cf, int section)
virtual int ProcessMessage(MessageQueue *resp_queue, player_msghdr *hdr, void *data)
int player_driver_init(DriverTable *table)
GLfloat light1_position[]