diff --git a/contrib/x11/gl.factor b/contrib/x11/gl.factor new file mode 100644 index 0000000000..5b0e2777ac --- /dev/null +++ b/contrib/x11/gl.factor @@ -0,0 +1,15 @@ +IN: gl USING: kernel words sequences alien arrays namespaces x xlib x11 ; + +: >int-array ( seq -- ) +dup length swap dup length >array [ pick set-int-nth ] 2each ; + +: >attributes ( seq -- attributes ) +0 add [ dup word? [ execute ] [ ] if ] map ; + +: choose-visual ( attributes -- XVisualInfo* ) +>attributes >int-array dpy get scr get rot glXChooseVisual ; + +: create-context ( XVisualInfo* -- GLXContext ) +>r dpy get r> 0 True glXCreateContext ; + +: make-current ( GLXContext -- Bool ) >r dpy get win get r> glXMakeCurrent ;