<PRIVATE
-PIXEL-FORMAT-ATTRIBUTE-TABLE: NSOpenGLPFA H{
+PIXEL-FORMAT-ATTRIBUTE-TABLE: NSOpenGLPFA { } H{
{ double-buffered { $ NSOpenGLPFADoubleBuffer } }
{ stereo { $ NSOpenGLPFAStereo } }
{ offscreen { $ NSOpenGLPFAOffScreen } }
{ [ * * malloc ] [ 2drop ] [ drop nip ] [ nip * ] } 3cleave ;
:: gadget-offscreen-context ( world -- context buffer )
- world world-pixel-format-attributes offscreen suffix
- <pixel-format> [
- :> pf
+ world [
+ nip :> pf
NSOpenGLContext -> alloc pf handle>> f -> initWithFormat:shareContext:
dup world pf offscreen-buffer
4 npick [ -> setOffScreen:width:height:rowbytes: ] dip
- ] with-disposal ;
+ ] with-world-pixel-format ;
M: cocoa-ui-backend (open-offscreen-buffer) ( world -- )
dup gadget-offscreen-context <offscreen-handle> >>handle drop ;
<PRIVATE
-FUNCTOR: define-pixel-format-attribute-table ( NAME TABLE -- )
+FUNCTOR: define-pixel-format-attribute-table ( NAME PERM TABLE -- )
>PFA DEFINES >${NAME}
>PFA-int-array DEFINES >${NAME}-int-array
[ drop { } ] if* ;
: >PFA-int-array ( attribute -- int-array )
- [ >PFA ] map concat 0 suffix >int-array ;
+ [ >PFA ] map concat PERM prepend 0 suffix >int-array ;
;FUNCTOR
SYNTAX: PIXEL-FORMAT-ATTRIBUTE-TABLE:
- scan scan-object define-pixel-format-attribute-table ;
+ scan scan-object scan-object define-pixel-format-attribute-table ;
PRIVATE>
TUPLE: offscreen-world < world ;
+M: offscreen-world world-pixel-format-attributes
+ { offscreen T{ depth-bits { value 16 } } } ;
+
: <offscreen-world> ( gadget title status -- world )
offscreen-world new-world ;