factor/contrib/x11/gl.factor

18 lines
612 B
Factor
Raw Normal View History

2005-12-29 12:49:44 -05:00
IN: gl USING: kernel words sequences alien arrays namespaces x xlib x11 ;
: >int-array ( seq -- <int-array> )
2006-02-03 02:02:59 -05:00
dup length "int" <c-array> swap dup length >array [ pick set-int-nth ] 2each ;
2005-12-29 12:49:44 -05:00
: >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 <alien> True glXCreateContext ;
: make-current ( GLXContext -- ) >r dpy get win get r> glXMakeCurrent drop ;
2005-12-30 21:12:46 -05:00
2006-01-18 14:06:34 -05:00
: swap-buffers ( -- ) dpy get win get glXSwapBuffers ;