- current_context.program = programObj;
-
- DEFER(glUseProgramObjectARB, programObj);
-}
-
-static void
-accumulate_program_ticks (unsigned program_id, unsigned ticks)
-{
- context_t *ctx = ¤t_context;
- unsigned i;
-
- if (program_id >= ctx->num_program_metrics) {
- ctx->program_metrics = realloc (ctx->program_metrics,
- (program_id + 1) * sizeof (program_metrics_t));
- for (i = ctx->num_program_metrics; i < program_id + 1; i++) {
- ctx->program_metrics[i].id = i;
- ctx->program_metrics[i].ticks = 0.0;
- }
-
- ctx->num_program_metrics = program_id + 1;
- }
-
- ctx->program_metrics[program_id].ticks += ticks;
-}
-
-/* FIXME: Should sort the metrics, print out percentages, etc. */
-static void
-print_program_metrics (void)
-{
- context_t *ctx = ¤t_context;
- unsigned i;
-
- for (i = 0; i < ctx->num_program_metrics; i++) {
- if (ctx->program_metrics[i].ticks == 0.0)
- continue;
- printf ("Program %d:\t%7.2f mega-ticks\n",
- i, ctx->program_metrics[i].ticks / 1e6);
- }
-}
-
-void
-glwrap_end_frame (void)
-{
- static int initialized = 0;
- static int frames;
- static struct timeval tv_start, tv_now;
-
- if (! initialized) {
- frames = 0;
- gettimeofday (&tv_start, NULL);
- initialized = 1;
- }
-
-
- frames++;
-
- if (frames % 60 == 0) {
- double fps;
- gettimeofday (&tv_now, NULL);
-
- fps = (double) frames / (tv_now.tv_sec - tv_start.tv_sec +
- (tv_now.tv_usec - tv_start.tv_usec) / 1.0e6);
-
- printf("FPS: %.3f\n", fps);