瀏覽代碼

* 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 年之前
父節點
當前提交
db1a77f0d0
共有 1 個文件被更改,包括 8 次插入1 次删除
  1. +8
    -1
      caca/driver_gl.c

+ 8
- 1
caca/driver_gl.c 查看文件

@@ -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…
取消
儲存