Merge branch 'master' of git://factorcode.org/git/factor
commit
490ea139a9
|
@ -0,0 +1 @@
|
|||
Joe Groff
|
|
@ -0,0 +1,36 @@
|
|||
! (c)2009 Joe Groff bsd license
|
||||
USING: help.markup help.syntax multiline tools.continuations ;
|
||||
IN: opengl.debug
|
||||
|
||||
HELP: G
|
||||
{ $description "Makes the OpenGL context associated with " { $link G-world } " active for subsequent OpenGL calls. This is intended to be used from the listener, where interactively entered OpenGL calls can be directed to any window. Note that the Factor UI resets the OpenGL context every time a window is updated, so every code snippet entered in the listener must be prefixed with " { $snippet "G" } " in this use case." }
|
||||
{ $examples { $code <" USING: opengl.debug ui ;
|
||||
|
||||
[ drop t ] find-window G-world set
|
||||
G 0.0 0.0 1.0 1.0 glClearColor
|
||||
G GL_COLOR_BUFFER_BIT glClear
|
||||
"> } } ;
|
||||
|
||||
HELP: F
|
||||
{ $description "Flushes the OpenGL context associated with " { $link G-world } ", thereby committing any outstanding drawing operations." } ;
|
||||
|
||||
HELP: G-world
|
||||
{ $var-description "The world whose OpenGL context is made active by " { $link G } "." } ;
|
||||
|
||||
HELP: GB
|
||||
{ $description "A shorthand for " { $link gl-break } "." } ;
|
||||
|
||||
HELP: gl-break
|
||||
{ $description "Suspends the current thread and activates the walker like " { $link break } ", but also preserves the current OpenGL context, saves it to " { $link G-world } " for interactive use through " { $link G } ", and restores the current context when the suspended thread is continued. The shorthand word " { $link POSTPONE: GB } " can also be used." } ;
|
||||
|
||||
{ G F G-world POSTPONE: GB gl-break } related-words
|
||||
|
||||
ARTICLE: "opengl.debug" "Interactive debugging of OpenGL applications"
|
||||
"The " { $vocab-link "opengl.debug" } " vocabulary provides words to assist with interactive debugging of OpenGL applications in the Factor UI."
|
||||
{ $subsection G-world }
|
||||
{ $subsection G }
|
||||
{ $subsection F }
|
||||
{ $subsection GB }
|
||||
{ $subsection gl-break } ;
|
||||
|
||||
ABOUT: "opengl.debug"
|
|
@ -0,0 +1,23 @@
|
|||
! (c)2009 Joe Groff bsd license
|
||||
USING: accessors kernel namespaces parser tools.continuations
|
||||
ui.backend ui.gadgets.worlds words ;
|
||||
IN: opengl.debug
|
||||
|
||||
SYMBOL: G-world
|
||||
|
||||
: G ( -- )
|
||||
G-world get set-gl-context ;
|
||||
|
||||
: F ( -- )
|
||||
G-world get handle>> flush-gl-context ;
|
||||
|
||||
: gl-break ( -- )
|
||||
world get dup G-world set-global
|
||||
[ break ] dip
|
||||
set-gl-context ;
|
||||
|
||||
<< \ gl-break t "break?" set-word-prop >>
|
||||
|
||||
SYNTAX: GB
|
||||
\ gl-break parsed ;
|
||||
|
|
@ -0,0 +1 @@
|
|||
Helper words for breaking and interactively manipulating OpenGL applications
|
|
@ -29,9 +29,6 @@ HELP: set-title
|
|||
{ $description "Sets the title bar of the native window containing the world." }
|
||||
{ $notes "This word should not be called directly by user code. Instead, change the " { $snippet "title" } " slot model; see " { $link "models" } "." } ;
|
||||
|
||||
HELP: context-world
|
||||
{ $var-description "Holds the " { $link world } " whose OpenGL context was most recently made active by " { $link set-gl-context } "." } ;
|
||||
|
||||
HELP: set-gl-context
|
||||
{ $values { "world" world } }
|
||||
{ $description "Selects an OpenGL context to be the implicit destination for subsequent GL rendering calls. This word is called automatically by the UI before drawing a " { $link world } "." } ;
|
||||
|
|
|
@ -78,13 +78,11 @@ TUPLE: world-attributes
|
|||
'[ f _ [ (>>status-owner) ] [ status>> set-model ] 2bi ] when
|
||||
] [ 2drop ] if ;
|
||||
|
||||
SYMBOL: context-world
|
||||
|
||||
: window-resource ( resource -- resource )
|
||||
dup context-world get-global window-resources>> push ;
|
||||
dup world get-global window-resources>> push ;
|
||||
|
||||
: set-gl-context ( world -- )
|
||||
[ context-world set-global ]
|
||||
[ world set-global ]
|
||||
[ handle>> select-gl-context ] bi ;
|
||||
|
||||
: with-gl-context ( world quot -- )
|
||||
|
|
Loading…
Reference in New Issue