From 90f83164ea36dae4c0f3370f8ebbf7e30fe83297 Mon Sep 17 00:00:00 2001 From: jsancho Date: Sat, 10 Oct 2009 22:14:56 +0000 Subject: [PATCH] --- gacela_GL.lisp | 10 ++++++++++ gacela_draw.lisp | 5 ++++- gacela_ttf.lisp | 5 ++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/gacela_GL.lisp b/gacela_GL.lisp index 961a29a..8b532f3 100644 --- a/gacela_GL.lisp +++ b/gacela_GL.lisp @@ -152,6 +152,15 @@ "}" "return textures;") +(defcfun "void gacela_glDeleteTextures (int n, object textures)" 0 + "GLuint text[n];" + "int i, t;" + "for (i = 0; i < n; i++) {" + ((nth (int i) textures) t) + "text[i] = t;" + "}" + "glDeleteTextures (n, &text[0]);") + (defcfun "void gacela_glBindTexture (int target, int texture)" 0 "glBindTexture (target, texture);") @@ -207,6 +216,7 @@ (defentry glVertex3f (float float float) (void "gacela_glVertex3f")) (defentry glViewport (int int int int) (void "gacela_glViewport")) (defentry glGenTextures (int) (object "gacela_glGenTextures")) +(defentry glDeleteTextures (int object) (void "gacela_glDeleteTextures")) (defentry glBindTexture (int int) (void "gacela_glBindTexture")) (defentry glTexImage2D (int int int int int int int int int) (void "gacela_glTexImage2D")) (defentry glTexParameteri (int int int) (void "gacela_glTexParameteri")) diff --git a/gacela_draw.lisp b/gacela_draw.lisp index c04fc89..79c3edb 100644 --- a/gacela_draw.lisp +++ b/gacela_draw.lisp @@ -90,7 +90,10 @@ (glTexParameteri GL_TEXTURE_2D GL_TEXTURE_MIN_FILTER min-filter) (glTexParameteri GL_TEXTURE_2D GL_TEXTURE_MAG_FILTER mag-filter) (SDL_FreeSurface image) - (set-resource key `(:id-texture ,texture :width ,real-w :height ,real-h) nil :static static) + (set-resource key + `(:id-texture ,texture :width ,real-w :height ,real-h) + (lambda () (glDeleteTextures 1 `(,texture))) + :static static) key))))))))) (defun draw-image-function (filename) diff --git a/gacela_ttf.lisp b/gacela_ttf.lisp index 63b4b2d..6fbe4e5 100644 --- a/gacela_ttf.lisp +++ b/gacela_ttf.lisp @@ -24,7 +24,10 @@ (cond ((/= font 0) (ftglSetFontFaceSize font size 72) (ftglSetFontCharMap font encoding) - (set-resource key `(:id-font ,font) nil :static static) + (set-resource key + `(:id-font ,font) + (lambda () (ftglDestroyFont font)) + :static static) key))))))) (defun render-text (text font) -- 2.39.5