/ src /
/src/qt.opengl.lisp
1 ;;; Copyright (C) 2010 Tobias Rautenkranz <tobias@rautenkranz.ch>
2 ;;;
3 ;;; This program is free software: you can redistribute it and/or modify
4 ;;; it under the terms of the GNU General Public License as published by
5 ;;; the Free Software Foundation, either version 3 of the License, or
6 ;;; (at your option) any later version.
7 ;;;
8 ;;; This program is distributed in the hope that it will be useful,
9 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
10 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 ;;; GNU General Public License for more details.
12 ;;;
13 ;;; You should have received a copy of the GNU General Public License
14 ;;; along with this program. If not, see <http://www.gnu.org/licenses/>.
15 ;;;
16 ;;; As a special exception, the copyright holders of this library give you
17 ;;; permission to link this library with independent modules to produce an
18 ;;; executable, regardless of the license terms of these independent
19 ;;; modules, and to copy and distribute the resulting executable under
20 ;;; terms of your choice, provided that you also meet, for each linked
21 ;;; independent module, the terms and conditions of the license of that
22 ;;; module. An independent module is a module which is not derived from or
23 ;;; based on this library. If you modify this library, you may extend this
24 ;;; exception to your version of the library, but you are not obligated to
25 ;;; do so. If you do not wish to do so, delete this exception statement
26 ;;; from your version.
27
28 (in-package :qt.opengl)
29
30 (smoke:define-smoke-module :cl-smoke.qt libsmokeqtopengl
31 (*qtopengl-smoke* "qtopengl_Smoke")
32 (init-qtopengl-smoke "init_qtopengl_Smoke"))
33
34 ;;; OpenGL type conversion using the types as defined in:
35 ;;; http://www.opengl.org/registry/ABI/#2
36 ;;; Note: this is probably not that portable.
37
38 ;;; GLuint
39 (defun coerce-gluint (pointer)
40 (mem-ref pointer :unsigned-int))
41
42 (define-to-lisp-translation "GLuint" coerce-gluint foreign-free)
43
44 (defun to-gluint (integer)
45 (make-auto-pointer (foreign-alloc :unsigned-int :initial-element integer)))
46
47 (define-from-lisp-translation "GLuint" integer to-gluint)
48
49 ;;; GLint
50 (defun coerce-glint (pointer)
51 (mem-ref pointer :int))
52
53 (define-to-lisp-translation "GLint" coerce-glint foreign-free)
54
55 (defun to-glint (integer)
56 (make-auto-pointer (foreign-alloc :int :initial-element integer)))
57
58 (define-from-lisp-translation "GLint" integer to-glint)
59
60 ;;; GLenum
61 ; no GLenum returned, thus no to-lisp translation
62 (define-from-lisp-translation "GLenum" integer to-gluint)