High level interface to glx routines

cvs
Eduardo Cavazos 2005-12-29 17:49:44 +00:00
parent bd2d5813a8
commit 61349d76d6
1 changed files with 15 additions and 0 deletions

15
contrib/x11/gl.factor Normal file
View File

@ -0,0 +1,15 @@
IN: gl USING: kernel words sequences alien arrays namespaces x xlib x11 ;
: >int-array ( seq -- <int-array> )
dup length <int-array> 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 <alien> True glXCreateContext ;
: make-current ( GLXContext -- Bool ) >r dpy get win get r> glXMakeCurrent ;