Browse Source

* Only call glutInit() once through the program's lifetime.

* Free the internal font when closing the GL driver.
  * Hide the window when closing the GL driver, because freeglut's
    glutDestroyWindow() does not really closes the window.
tags/v0.99.beta14
Sam Hocevar sam 17 years ago
parent
commit
db1a77f0d0
1 changed files with 8 additions and 1 deletions
  1. +8
    -1
      caca/driver_gl.c

+ 8
- 1
caca/driver_gl.c View File

@@ -44,6 +44,7 @@
* Global variables
*/

static int glut_init;
static caca_display_t *gl_d; /* FIXME: we ought to get rid of this */

/*
@@ -139,7 +140,11 @@ static int gl_init_graphics(caca_display_t *dp)
dp->drv.p->sw = ((float)dp->drv.p->font_width) / 16.0f;
dp->drv.p->sh = ((float)dp->drv.p->font_height) / 16.0f;

glutInit(&argc, argv);
if(!glut_init)
{
glut_init = 1;
glutInit(&argc, argv);
}

glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE);
glutInitWindowSize(dp->drv.p->width, dp->drv.p->height);
@@ -186,7 +191,9 @@ static int gl_init_graphics(caca_display_t *dp)

static int gl_end_graphics(caca_display_t *dp)
{
glutHideWindow();
glutDestroyWindow(dp->drv.p->window);
cucul_free_font(dp->drv.p->f);
free(dp->drv.p->txid);
free(dp->drv.p);
return 0;


Loading…
Cancel
Save