X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=gacela_GL.lisp;h=c17b049cc0f8688c232f931390a30565ef1570bc;hb=d0e2cdc7308eabc4727729f9ac085f2959696b90;hp=961a29a50688b8f74e25c52d0e756492742fd135;hpb=a559c9a47d17f1a7ca0a4dff3edcd39449d1821e;p=gacela.git diff --git a/gacela_GL.lisp b/gacela_GL.lisp index 961a29a..c17b049 100644 --- a/gacela_GL.lisp +++ b/gacela_GL.lisp @@ -15,7 +15,20 @@ ;;; along with this program. If not, see . -(in-package :gacela) +(eval-when (compile load eval) + (when (not (find-package 'gacela)) (make-package 'gacela :nicknames '(gg) :use '(lisp))) + (in-package 'gacela :nicknames '(gg) :use '(lisp))) + + +(defmacro mapcconst (type c-type name) + (let ((c-header (concatenate 'string c-type " gacela_" name " (void)")) + (c-body (concatenate 'string "return " name ";")) + (c-name (concatenate 'string "gacela_" name)) + (lisp-name (intern (string-upcase name)))) + `(progn + (defcfun ,c-header 0 ,c-body) + (defentry ,lisp-name () (,type ,c-name)) + (eval-when (load) (defconstant ,lisp-name (,lisp-name)))))) (clines "#include ") (clines "#include ") @@ -152,6 +165,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);") @@ -181,12 +203,21 @@ (defcfun "void gacela_glOrtho (float left, float right, float bottom, float top, float near_val, float far_val)" 0 "glOrtho (left, right, bottom, top, near_val, far_val);") +(defcfun "void gacela_glPushMatrix (void)" 0 + "glPushMatrix ();") + +(defcfun "void gacela_glPopMatrix (void)" 0 + "glPopMatrix ();") + (defcfun "void gacela_gluPerspective (double fovy, double aspect, double zNear, double zFar)" 0 "gluPerspective (fovy, aspect, zNear, zFar);") (defcfun "int gacela_gluBuild2DMipmaps (int target, int internalFormat, int width, int height, int format, int type, int data)" 0 "return gluBuild2DMipmaps (target, internalFormat, width, height, format, type, data);") +(defcfun "void gacela_gluLookAt (double eyeX, double eyeY, double eyeZ, double centerX, double centerY, double centerZ, double upX, double upY, double upZ)" 0 + "gluLookAt (eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ);") + (defentry glBegin (int) (void "gacela_glBegin")) (defentry glClear (int) (void "gacela_glClear")) (defentry glClearColor (float float float float) (void "gacela_glClearColor")) @@ -207,6 +238,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")) @@ -215,6 +247,9 @@ (defentry glNormal3f (float float float) (void "gacela_glNormal3f")) (defentry glBlendFunc (int int) (void "gacela_glBlendFunc")) (defentry glOrtho (float float float float float float) (void "gacela_glOrtho")) +(defentry glPushMatrix () (void "gacela_glPushMatrix")) +(defentry glPopMatrix () (void "gacela_glPopMatrix")) (defentry gluPerspective (double double double double) (void "gacela_gluPerspective")) (defentry gluBuild2DMipmaps (int int int int int int int) (int "gacela_gluBuild2DMipmaps")) +(defentry gluLookAt (double double double double double double double double double) (void "gacela_gluLookAt"))