diff options
author | David Thompson <dthompson2@worcester.edu> | 2023-09-30 17:59:51 -0400 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2023-09-30 17:59:51 -0400 |
commit | b237543e4287be8bfbcd6bfc392aa81e305d7aec (patch) | |
tree | aaf4e8ee8b8e3192b4af4cc51809e9c77d4062b6 | |
parent | f7e5de964d82c036f029a458de14864eaca9e290 (diff) |
video: Add SDL_GL_MakeCurrent binding.
-rw-r--r-- | sdl2/bindings.scm | 3 | ||||
-rw-r--r-- | sdl2/video.scm | 7 |
2 files changed, 10 insertions, 0 deletions
diff --git a/sdl2/bindings.scm b/sdl2/bindings.scm index cb8dd97..058e342 100644 --- a/sdl2/bindings.scm +++ b/sdl2/bindings.scm @@ -234,6 +234,9 @@ RETURN-TYPE and accept arguments of ARG-TYPES." (define-foreign sdl-gl-delete-context void "SDL_GL_DeleteContext" '(*)) +(define-foreign sdl-gl-make-current + void "SDL_GL_MakeCurrent" '(* *)) + (define-foreign sdl-gl-swap-window void "SDL_GL_SwapWindow" '(*)) diff --git a/sdl2/video.scm b/sdl2/video.scm index 0db5314..7991697 100644 --- a/sdl2/video.scm +++ b/sdl2/video.scm @@ -63,6 +63,7 @@ delete-gl-context! call-with-gl-context swap-gl-window + gl-context-make-current! set-gl-attribute! set-gl-swap-interval!)) @@ -292,6 +293,12 @@ that takes the size of the desktop." (sdl-error "make-gl-context" "failed to create OpenGL context") (wrap-gl-context ptr)))) +(define (gl-context-make-current! window context) + "Make CONTEXT the current context for rendering to WINDOW in the +current thread." + (unless (zero? (ffi:sdl-gl-make-current (unwrap-window window) (unwrap-gl-context context))) + (sdl-error "gl-make-current" "failed to set current GL context"))) + (define (delete-gl-context! context) "Delete CONTEXT, an OpenGL context object." (ffi:sdl-gl-delete-context (unwrap-gl-context context))) |