adjust pixel format syntax. override offscreen-world pixel-format-attributes instead of special-casing
parent
2a7c26c20a
commit
54e9447ec4
|
@ -24,7 +24,7 @@ SINGLETON: cocoa-ui-backend
|
|||
|
||||
<PRIVATE
|
||||
|
||||
PIXEL-FORMAT-ATTRIBUTE-TABLE: NSOpenGLPFA H{
|
||||
PIXEL-FORMAT-ATTRIBUTE-TABLE: NSOpenGLPFA { } H{
|
||||
{ double-buffered { $ NSOpenGLPFADoubleBuffer } }
|
||||
{ stereo { $ NSOpenGLPFAStereo } }
|
||||
{ offscreen { $ NSOpenGLPFAOffScreen } }
|
||||
|
@ -148,13 +148,12 @@ M: cocoa-ui-backend raise-window* ( world -- )
|
|||
{ [ * * 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 ;
|
||||
|
|
|
@ -63,7 +63,7 @@ M: pixel-format dispose
|
|||
|
||||
<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
|
||||
|
@ -82,11 +82,11 @@ M: pixel-format-attribute >PFA
|
|||
[ 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>
|
||||
|
|
|
@ -6,6 +6,9 @@ IN: ui.offscreen
|
|||
|
||||
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 ;
|
||||
|
||||
|
|
Loading…
Reference in New Issue