bind-gl-proc   macro


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/libs/external/gl/gl-getprocaddress.xtm

Implementation

(define-macro (bind-gl-proc gl-lib proc-name type . args)
  (let* ((arg-types (cddr (impc:ir:get-type-from-pretty-str (symbol->string type))))
         (arg-list (glwrapper-arg-list-symbols (length arg-types)))
         (index (impc:ti:gl-proc-alist-index (symbol->string proc-name))))
    (if (not index)
        (impc:compiler:print-compiler-error (string-append "couldn't find GLproc index for " (symbol->string proc-name))))
    `(eval (bind-func ,proc-name
             ;; docstring
             ,(if (and (not (null? args)) (string? (car args)))
                  (car args)
                  "")
             (lambda ,arg-list
               ;; print the function pointer - useful for debugging
               ;; (println ,(symbol->string proc-name)
               ;;          (aref EXTEMPORE_GL_FUNCTION_POINTERS ,index))
               (fptrcall (cast (aref EXTEMPORE_GL_FUNCTION_POINTERS
                                     ,index)
                               ,type)
                         ,@arg-list)))
           (interaction-environment))))


Back to Index