diff options
author | David Thompson <dthompson2@worcester.edu> | 2016-01-02 20:08:48 -0500 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2016-01-02 20:08:48 -0500 |
commit | 6b2ecade1079c5bef1c066b9f092a8179d78d932 (patch) | |
tree | 7f49287d9b80550d56d137c88b8d410f26ddcdd6 /sdl2/video.scm | |
parent | 4ba7f87e455c53ad06b6591559465d4099593a1d (diff) |
video: Add SDL_GL_SetAttribute binding.
* sdl2/bindings.scm (sdl-get-set-attribute): New procedure.
* sdl2/video.scm (set-gl-attribute!): New procedure.
Diffstat (limited to 'sdl2/video.scm')
-rw-r--r-- | sdl2/video.scm | 56 |
1 files changed, 55 insertions, 1 deletions
diff --git a/sdl2/video.scm b/sdl2/video.scm index efd87ac..7cf14ff 100644 --- a/sdl2/video.scm +++ b/sdl2/video.scm @@ -55,7 +55,8 @@ gl-context? delete-gl-context! call-with-gl-context - swap-gl-window)) + swap-gl-window + set-gl-attribute!)) ;;; @@ -264,3 +265,56 @@ the context when PROC returns or otherwise exits.." (define (swap-gl-window window) "Update WINDOW with OpenGL rendering." (ffi:sdl-gl-swap-window (unwrap-window window))) + +(define (set-gl-attribute! attr value) + "Set the OpenGL attribute represented by the symbol ATTR to VALUE. +Possible values for ATTR are: + +- red-size +- green-size +- blue-size +- alpha-size +- buffer-size +- double-buffer +- depth-size +- stencil-size +- accum-red-size +- accum-green-size +- accum-blue-size +- stereo +- multisample-buffers +- multisample-samples +- retained-backing +- context-major-version +- contet-minor-version +- context-egl +- context-flags +- context-profile-mask +- share-with-current-context +- framebuffer-srgb-capable" + (let ((attr-enum + (match attr + ('red-size ffi:SDL_GL_RED_SIZE) + ('green-size ffi:SDL_GL_GREEN_SIZE) + ('blue-size ffi:SDL_GL_BLUE_SIZE) + ('alpha-size ffi:SDL_GL_ALPHA_SIZE) + ('buffer-size ffi:SDL_GL_BUFFER_SIZE) + ('double-buffer ffi:SDL_GL_DOUBLEBUFFER) + ('depth-size ffi:SDL_GL_DEPTH_SIZE) + ('stencil-size ffi:SDL_GL_STENCIL_SIZE) + ('accum-red-size ffi:SDL_GL_ACCUM_RED_SIZE) + ('accum-green-size ffi:SDL_GL_ACCUM_GREEN_SIZE) + ('accum-blue-size ffi:SDL_GL_ACCUM_BLUE_SIZE) + ('stereo ffi:SDL_GL_STEREO) + ('multisample-buffers ffi:SDL_GL_MULTISAMPLEBUFFERS) + ('multisample-samples ffi:SDL_GL_MULTISAMPLESAMPLES) + ('retained-backing ffi:SDL_GL_RETAINED_BACKING) + ('context-major-version ffi:SDL_GL_CONTEXT_MAJOR_VERSION) + ('contet-minor-version ffi:SDL_GL_CONTEXT_MINOR_VERSION) + ('context-egl ffi:SDL_GL_CONTEXT_EGL) + ('context-flags ffi:SDL_GL_CONTEXT_FLAGS) + ('context-profile-mask ffi:SDL_GL_CONTEXT_PROFILE_MASK) + ('share-with-current-context ffi:SDL_GL_SHARE_WITH_CURRENT_CONTEXT) + ('framebuffer-srgb-capable ffi:SDL_GL_FRAMEBUFFER_SRGB_CAPABLE)))) + (unless (zero? (ffi:sdl-gl-set-attribute attr-enum value)) + (sdl-error "set-gl-attribute!" "failed to set OpenGL attribute")))) |