In line-art and cel-shading, do not delete opengl resources that were not created
parent
7e0674bf03
commit
384cc60a0d
|
@ -1,5 +1,5 @@
|
||||||
USING: arrays bunny combinators.lib io io.files kernel
|
USING: arrays bunny combinators.lib io io.files kernel
|
||||||
math math.functions multiline
|
math math.functions multiline continuations debugger
|
||||||
opengl opengl.gl opengl-demo-support
|
opengl opengl.gl opengl-demo-support
|
||||||
sequences ui ui.gadgets ui.render ;
|
sequences ui ui.gadgets ui.render ;
|
||||||
IN: cel-shading
|
IN: cel-shading
|
||||||
|
@ -58,14 +58,14 @@ main()
|
||||||
<simple-gl-program> ;
|
<simple-gl-program> ;
|
||||||
|
|
||||||
M: cel-shading-gadget graft* ( gadget -- )
|
M: cel-shading-gadget graft* ( gadget -- )
|
||||||
"2.0" { "GL_ARB_shader_objects" } require-gl-version-or-extensions
|
[ "2.0" { "GL_ARB_shader_objects" } require-gl-version-or-extensions
|
||||||
0.0 0.0 0.0 1.0 glClearColor
|
0.0 0.0 0.0 1.0 glClearColor
|
||||||
GL_CULL_FACE glEnable
|
GL_CULL_FACE glEnable
|
||||||
GL_DEPTH_TEST glEnable
|
GL_DEPTH_TEST glEnable
|
||||||
cel-shading-program swap set-cel-shading-gadget-program ;
|
cel-shading-program swap set-cel-shading-gadget-program ] [ ] [ :c ] cleanup ;
|
||||||
|
|
||||||
M: cel-shading-gadget ungraft* ( gadget -- )
|
M: cel-shading-gadget ungraft* ( gadget -- )
|
||||||
cel-shading-gadget-program delete-gl-program ;
|
cel-shading-gadget-program [ delete-gl-program ] when* ;
|
||||||
|
|
||||||
: cel-shading-draw-setup ( gadget -- gadget )
|
: cel-shading-draw-setup ( gadget -- gadget )
|
||||||
[ demo-gadget-set-matrices ] keep
|
[ demo-gadget-set-matrices ] keep
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
USING: arrays bunny combinators.lib continuations io io.files kernel
|
USING: arrays bunny combinators.lib continuations io io.files kernel
|
||||||
math math.functions math.vectors multiline
|
math math.functions math.vectors multiline
|
||||||
namespaces
|
namespaces debugger
|
||||||
opengl opengl.gl opengl-demo-support
|
opengl opengl.gl opengl-demo-support
|
||||||
prettyprint
|
prettyprint
|
||||||
sequences ui ui.gadgets ui.gestures ui.render ;
|
sequences ui ui.gadgets ui.gestures ui.render ;
|
||||||
|
@ -187,7 +187,7 @@ main()
|
||||||
] if ;
|
] if ;
|
||||||
|
|
||||||
M: line-art-gadget graft* ( gadget -- )
|
M: line-art-gadget graft* ( gadget -- )
|
||||||
"2.0" { "GL_ARB_draw_buffers"
|
[ "2.0" { "GL_ARB_draw_buffers"
|
||||||
"GL_ARB_shader_objects"
|
"GL_ARB_shader_objects"
|
||||||
"GL_ARB_multitexture"
|
"GL_ARB_multitexture"
|
||||||
"GL_ARB_texture_float" }
|
"GL_ARB_texture_float" }
|
||||||
|
@ -196,16 +196,17 @@ M: line-art-gadget graft* ( gadget -- )
|
||||||
GL_CULL_FACE glEnable
|
GL_CULL_FACE glEnable
|
||||||
GL_DEPTH_TEST glEnable
|
GL_DEPTH_TEST glEnable
|
||||||
(line-art-step1-program) over set-line-art-gadget-step1-program
|
(line-art-step1-program) over set-line-art-gadget-step1-program
|
||||||
(line-art-step2-program) swap set-line-art-gadget-step2-program ;
|
(line-art-step2-program) swap set-line-art-gadget-step2-program
|
||||||
|
] [ ] [ :c ] cleanup ;
|
||||||
|
|
||||||
M: line-art-gadget ungraft* ( gadget -- )
|
M: line-art-gadget ungraft* ( gadget -- )
|
||||||
dup line-art-gadget-framebuffer [
|
dup line-art-gadget-framebuffer [
|
||||||
{ [ line-art-gadget-step1-program delete-gl-program ]
|
{ [ line-art-gadget-step1-program [ delete-gl-program ] when* ]
|
||||||
[ line-art-gadget-step2-program delete-gl-program ]
|
[ line-art-gadget-step2-program [ delete-gl-program ] when* ]
|
||||||
[ line-art-gadget-framebuffer delete-framebuffer ]
|
[ line-art-gadget-framebuffer [ delete-framebuffer ] when* ]
|
||||||
[ line-art-gadget-color-texture delete-texture ]
|
[ line-art-gadget-color-texture [ delete-texture ] when* ]
|
||||||
[ line-art-gadget-normal-texture delete-texture ]
|
[ line-art-gadget-normal-texture [ delete-texture ] when* ]
|
||||||
[ line-art-gadget-depth-texture delete-texture ]
|
[ line-art-gadget-depth-texture [ delete-texture ] when* ]
|
||||||
[ f swap set-line-art-gadget-framebuffer-dim ]
|
[ f swap set-line-art-gadget-framebuffer-dim ]
|
||||||
[ f swap set-line-art-gadget-framebuffer ] } call-with
|
[ f swap set-line-art-gadget-framebuffer ] } call-with
|
||||||
] [ drop ] if ;
|
] [ drop ] if ;
|
||||||
|
|
Loading…
Reference in New Issue