39 #include <libplayercore/playercore.h> 41 #include <GLUT/glut.h> 57 {-1.0, -1.0, 1.0, 0.0};
62 output(GLfloat x, GLfloat y,
char *text)
67 glTranslatef(x, y, 0);
68 for (p = text; *p; p++)
69 glutStrokeCharacter(GLUT_STROKE_ROMAN, *p);
76 static GLfloat amb[] =
78 static GLfloat dif[] =
81 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
84 amb[3] = dif[3] = cos(
s) / 2.0 + 0.5;
85 glMaterialfv(GL_FRONT, GL_AMBIENT, amb);
86 glMaterialfv(GL_FRONT, GL_DIFFUSE, dif);
89 glTranslatef(-0.3, -0.3, 0.0);
90 glRotatef(
angle1, 1.0, 5.0, 0.0);
94 glClear(GL_DEPTH_BUFFER_BIT);
97 amb[3] = dif[3] = 0.5 - cos(
s * .95) / 2.0;
98 glMaterialfv(GL_FRONT, GL_AMBIENT, amb);
99 glMaterialfv(GL_FRONT, GL_DIFFUSE, dif);
102 glTranslatef(0.3, 0.3, 0.0);
103 glRotatef(
angle2, 1.0, 0.0, 5.0);
107 glPushAttrib(GL_ENABLE_BIT);
108 glDisable(GL_DEPTH_TEST);
109 glDisable(GL_LIGHTING);
110 glMatrixMode(GL_PROJECTION);
113 gluOrtho2D(0, 1500, 0, 1500);
114 glMatrixMode(GL_MODELVIEW);
118 glRotatef(4, 0.0, 0.0, 1.0);
119 output(200, 225,
"This is antialiased.");
120 glDisable(GL_LINE_SMOOTH);
122 output(160, 100,
"This text is not.");
124 glMatrixMode(GL_PROJECTION);
127 glMatrixMode(GL_MODELVIEW);
142 printf(
"cycle %d\n", g++ );
157 printf(
"cycle %d\n", g++ );
161 glutTimerFunc( 100,
redraw, 0 );
167 if (vis == GLUT_VISIBLE)
169 glutIdleFunc(
idle );
228 : Driver(cf, section, false, PLAYER_MSGQUEUE_DEFAULT_MAXLEN,
229 PLAYER_GRAPHICS3D_CODE)
245 puts(
"Example driver initialising");
253 glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
254 glutCreateWindow(
"blender");
258 glNewList(1, GL_COMPILE);
259 glutSolidIcosahedron();
262 glEnable(GL_LIGHTING);
270 glEnable(GL_DEPTH_TEST);
271 glEnable(GL_CULL_FACE);
273 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
274 glEnable(GL_LINE_SMOOTH);
277 glMatrixMode(GL_PROJECTION);
278 gluPerspective( 40.0,
281 glMatrixMode(GL_MODELVIEW);
282 gluLookAt(0.0, 0.0, 5.0,
285 glTranslatef(0.0, 0.6, -1.0);
288 puts(
"Example driver ready");
302 puts(
"Shutting example driver down");
310 puts(
"Example driver has been shutdown");
341 printf(
"entering main loop" );
371 puts(
"Example driver initializing");
373 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[]