<?xml version="1.0" encoding="UTF-8"?>
	<rss version="2.0"
		xmlns:content="http://purl.org/rss/1.0/modules/content/"
		xmlns:wfw="http://wellformedweb.org/CommentAPI/"
		xmlns:dc="http://purl.org/dc/elements/1.1/"
		xmlns:atom="http://www.w3.org/2005/Atom"

			>

	<channel>
		<title>Cycling 74  &#187;  Topic: Is it possible to use GL_ACCUM at all?</title>
		<atom:link href="http://cycling74.com/forums/topic/is-it-possible-to-use-gl_accum-at-all/feed" rel="self" type="application/rss+xml" />
		<link>http://cycling74.com/forums/topic/is-it-possible-to-use-gl_accum-at-all/feed</link>
		<description></description>
		<pubDate>Wed, 19 Jun 2013 09:18:27 +0000</pubDate>
		<generator>http://bbpress.org/?v=2.2.4</generator>
		<language></language>

		
														
					
				<item>
					<guid>http://cycling74.com/forums/topic/is-it-possible-to-use-gl_accum-at-all/#post-36362</guid>
					<title><![CDATA[Is it possible to use GL_ACCUM at all?]]></title>
					<link>http://cycling74.com/forums/topic/is-it-possible-to-use-gl_accum-at-all/#post-36362</link>
					<pubDate>Sat, 15 Mar 2008 18:06:11 +0000</pubDate>
					<dc:creator>Thijs Koerselman</dc:creator>

					<description>
						<![CDATA[
						<p>I would really like to use the accumulation buffer in Jitter, but the<br />
problem seems to be that it has needs to be activated when the context is<br />
initialized. For example:</p>
<p>glutInitDisplayMode(GLUT_RGBA|GLUT_DEPTH|GLUT_ACCUM|GLUT_SINGLE);</p>
<p>Is it possible to have this kind of control from an ob3d external?</p>
<p>I&#8217;ve tied to use RTT instead, accumulating multiple render passes into a<br />
texture, but that appears to be way to slow for want i want to do. For<br />
example an 8 pass motion blur on a single rendered quad using a 1280&#215;720<br />
floating point texture gives me a framerate of about 15fps, so that&#8217;s really<br />
no alternative. The FBO backend option is currently not working on my<br />
system.</p>
<p>Am I naive to think its as simple as adding an @accumbuffer attribute to<br />
jit.window and passing the flag to the window init? Please consider it a<br />
feature request;-)</p>
<p>Thijs</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/is-it-possible-to-use-gl_accum-at-all/#post-124740</guid>
					<title><![CDATA[Re: Is it possible to use GL_ACCUM at all?]]></title>
					<link>http://cycling74.com/forums/topic/is-it-possible-to-use-gl_accum-at-all/#post-124740</link>
					<pubDate>Sat, 15 Mar 2008 18:27:38 +0000</pubDate>
					<dc:creator>Wesley Smith</dc:creator>

					<description>
						<![CDATA[
						<p>How were you doing the RTT accumulation?  Did you use feedback?<br />
wes</p>
<p>2008/3/15 Thijs Koerselman
<thijskoerselman @gmail.com>:<br />
> I would really like to use the accumulation buffer in Jitter, but the<br />
> problem seems to be that it has needs to be activated when the context is<br />
> initialized. For example:<br />
><br />
> glutInitDisplayMode(GLUT_RGBA|GLUT_DEPTH|GLUT_ACCUM|GLUT_SINGLE);<br />
><br />
> Is it possible to have this kind of control from an ob3d external?<br />
><br />
> I&#8217;ve tied to use RTT instead, accumulating multiple render passes into a<br />
> texture, but that appears to be way to slow for want i want to do. For<br />
> example an 8 pass motion blur on a single rendered quad using a 1280&#215;720<br />
> floating point texture gives me a framerate of about 15fps, so that&#8217;s really<br />
> no alternative. The FBO backend option is currently not working on my<br />
> system.<br />
><br />
> Am I naive to think its as simple as adding an @accumbuffer attribute to<br />
> jit.window and passing the flag to the window init? Please consider it a<br />
> feature request;-)<br />
><br />
> Thijs<br />
><br />
><br />
></thijskoerselman></p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/is-it-possible-to-use-gl_accum-at-all/#post-124741</guid>
					<title><![CDATA[Re: Is it possible to use GL_ACCUM at all?]]></title>
					<link>http://cycling74.com/forums/topic/is-it-possible-to-use-gl_accum-at-all/#post-124741</link>
					<pubDate>Sat, 15 Mar 2008 19:59:05 +0000</pubDate>
					<dc:creator>Thijs Koerselman</dc:creator>

					<description>
						<![CDATA[
						<p>On Sat, Mar 15, 2008 at 6:27 PM, Wesley Smith <wesley .hoke@gmail.com> wrote:</wesley></p>
<p>> How were you doing the RTT accumulation?  Did you use feedback?<br />
> wes<br />
></p>
<p>Below is the Lua script I used. The shaders are taken from Randy Jones&#8217;<br />
render node.</p>
<p>I realize that the performance hit mainly comes from calling<br />
begincapture/endcapture for every frame, but I couldn&#8217;t figure out how to<br />
make multiple renders add up in the same texture. Doing that and filtering<br />
the texture once afterwards would be more efficient. I suspect there must be<br />
a better way to clear the accum texture at the end as well. Still, the<br />
framerate has to improve dramatically for this to be useful though.</p>
<p>Thijs</p>
<p>
scene = jit.new(&#8220;jit.gl.texture&#8221;, this.drawto)<br />
scene.dim = {1280, 720}<br />
scene.type = &#8220;float32&#8243;</p>
<p>slabAccum = jit.new(&#8220;jit.gl.slab&#8221;, this.drawto)<br />
slabAccum.file = &#8220;passthru.jxs&#8221;<br />
slabAccum.dim = scene.dim</p>
<p>slabAdd = jit.new(&#8220;jit.gl.slab&#8221;, this.drawto)<br />
slabAdd.file = &#8220;twowayadd.jxs&#8221;<br />
slabAdd.dim = scene.dim</p>
<p>slabPass = jit.new(&#8220;jit.gl.slab&#8221;, this.drawto)<br />
slabPass.file = &#8220;passthru.jxs&#8221;<br />
slabPass.dim = scene.dim</p>
<p>vplane = jit.new(&#8220;jit.gl.videoplane&#8221;, this.drawto)<br />
vplane.automatic = 0<br />
vplane.transform_reset = 2<br />
vplane.texture = slabAccum.out_name</p>
<p>gAccumWindow = 20<br />
gAccumCount = 16</p>
<p>
function draw(t)</p>
<p>    slabAdd:param(&#8220;a&#8221;, (1/gAccumCount))<br />
    slabAdd:param(&#8220;b&#8221;, 1)</p>
<p>    for i=1, gAccumCount, 1 do<br />
        &#8212; start capture<br />
        jit.gl.begincapture(scene.name, 0)<br />
        &#8212; render scene<br />
        tslice = t &#8211; ((i/gAccumCount) * gAccumWindow)<br />
        renderQuad(tslice)<br />
        &#8212; end capture<br />
        jit.gl.endcapture(scene.name, 0)</p>
<p>        &#8212; accum add texture<br />
        doSlab(slabAdd, scene.name, slabPass.out_name)<br />
        doSlab(slabPass, slabAdd.out_name)<br />
    end</p>
<p>    &#8212; pass on final accumulated texture<br />
    doSlab(slabAccum, slabPass.out_name)</p>
<p>    &#8212; draw to screen<br />
    vplane:draw()</p>
<p>    &#8212; clear accum texture<br />
    slabAdd:param(&#8220;a&#8221;, 0)<br />
    slabAdd:param(&#8220;b&#8221;, 0)<br />
    doSlab(slabAdd, scene.name, slabPass.out_name)<br />
    doSlab(slabPass, slabAdd.out_name)</p>
<p>end</p>
<p>function renderQuad(t)</p>
<p>    local angle = t * 0.001 * 360.</p>
<p>    gl.Color(1, 0, 0, 1)<br />
    gl.PushMatrix()<br />
        gl.Rotate(angle, 0, 0, 1)<br />
        gl.Begin(&#8220;QUADS&#8221;)<br />
            gl.Vertex(-0.01,1,0)<br />
            gl.Vertex(0.01,1,0)<br />
            gl.Vertex(0.01,-1,0)<br />
            gl.Vertex(-0.01,-1,0)<br />
        gl.End()<br />
    gl.PopMatrix()<br />
end</p>
<p>function doSlab(slab, &#8230;)<br />
    local textures = {&#8230;}<br />
    slab.texture = textures;<br />
    slab:draw()<br />
end</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/is-it-possible-to-use-gl_accum-at-all/#post-124742</guid>
					<title><![CDATA[Re: Is it possible to use GL_ACCUM at all?]]></title>
					<link>http://cycling74.com/forums/topic/is-it-possible-to-use-gl_accum-at-all/#post-124742</link>
					<pubDate>Sat, 15 Mar 2008 20:10:17 +0000</pubDate>
					<dc:creator>Wesley Smith</dc:creator>

					<description>
						<![CDATA[
						<p>In your script, variable t is undefined.<br />
wes</p>
<p>2008/3/15 Thijs Koerselman
<thijskoerselman @gmail.com>:<br />
> On Sat, Mar 15, 2008 at 6:27 PM, Wesley Smith <wesley .hoke@gmail.com> wrote:<br />
><br />
> > How were you doing the RTT accumulation?  Did you use feedback?<br />
> > wes<br />
> ><br />
><br />
> Below is the Lua script I used. The shaders are taken from Randy Jones&#8217;<br />
> render node.<br />
><br />
> I realize that the performance hit mainly comes from calling<br />
> begincapture/endcapture for every frame, but I couldn&#8217;t figure out how to<br />
> make multiple renders add up in the same texture. Doing that and filtering<br />
> the texture once afterwards would be more efficient. I suspect there must be<br />
> a better way to clear the accum texture at the end as well. Still, the<br />
> framerate has to improve dramatically for this to be useful though.<br />
><br />
> Thijs<br />
><br />
><br />
> scene = jit.new(&#8220;jit.gl.texture&#8221;, this.drawto)<br />
> scene.dim = {1280, 720}<br />
> scene.type = &#8220;float32&#8243;<br />
><br />
> slabAccum = jit.new(&#8220;jit.gl.slab&#8221;, this.drawto)<br />
> slabAccum.file = &#8220;passthru.jxs&#8221;<br />
>  slabAccum.dim = scene.dim<br />
><br />
> slabAdd = jit.new(&#8220;jit.gl.slab&#8221;, this.drawto)<br />
> slabAdd.file = &#8220;twowayadd.jxs&#8221;<br />
> slabAdd.dim = scene.dim<br />
><br />
> slabPass = jit.new(&#8220;jit.gl.slab&#8221;, this.drawto)<br />
>  slabPass.file = &#8220;passthru.jxs&#8221;<br />
> slabPass.dim = scene.dim<br />
><br />
> vplane = jit.new(&#8220;jit.gl.videoplane&#8221;, this.drawto)<br />
> vplane.automatic = 0<br />
> vplane.transform_reset = 2<br />
> vplane.texture = slabAccum.out_name<br />
><br />
> gAccumWindow = 20<br />
> gAccumCount = 16<br />
><br />
><br />
> function draw(t)<br />
><br />
>     slabAdd:param(&#8220;a&#8221;, (1/gAccumCount))<br />
>     slabAdd:param(&#8220;b&#8221;, 1)<br />
><br />
>     for i=1, gAccumCount, 1 do<br />
>         &#8212; start capture<br />
>          jit.gl.begincapture(scene.name, 0)<br />
>         &#8212; render scene<br />
>         tslice = t &#8211; ((i/gAccumCount) * gAccumWindow)<br />
>         renderQuad(tslice)<br />
>         &#8212; end capture<br />
>         jit.gl.endcapture(scene.name, 0)<br />
><br />
>         &#8212; accum add texture<br />
>         doSlab(slabAdd, scene.name, slabPass.out_name)<br />
>         doSlab(slabPass, slabAdd.out_name)<br />
>     end<br />
><br />
>     &#8212; pass on final accumulated texture<br />
>      doSlab(slabAccum, slabPass.out_name)<br />
><br />
>     &#8212; draw to screen<br />
>     vplane:draw()<br />
><br />
>     &#8212; clear accum texture<br />
>     slabAdd:param(&#8220;a&#8221;, 0)<br />
>     slabAdd:param(&#8220;b&#8221;, 0)<br />
>     doSlab(slabAdd, scene.name, slabPass.out_name)<br />
>      doSlab(slabPass, slabAdd.out_name)<br />
><br />
> end<br />
><br />
> function renderQuad(t)<br />
><br />
>     local angle = t * 0.001 * 360.<br />
><br />
>     gl.Color(1, 0, 0, 1)<br />
>     gl.PushMatrix()<br />
>         gl.Rotate(angle, 0, 0, 1)<br />
>          gl.Begin(&#8220;QUADS&#8221;)<br />
>             gl.Vertex(-0.01,1,0)<br />
>             gl.Vertex(0.01,1,0)<br />
>             gl.Vertex(0.01,-1,0)<br />
>             gl.Vertex(-0.01,-1,0)<br />
>         gl.End()<br />
>     gl.PopMatrix()<br />
>  end<br />
><br />
> function doSlab(slab, &#8230;)<br />
>     local textures = {&#8230;}<br />
>     slab.texture = textures;<br />
>     slab:draw()<br />
> end<br />
><br />
><br />
><br />
><br />
><br />
></wesley></thijskoerselman></p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/is-it-possible-to-use-gl_accum-at-all/#post-124743</guid>
					<title><![CDATA[Re: Is it possible to use GL_ACCUM at all?]]></title>
					<link>http://cycling74.com/forums/topic/is-it-possible-to-use-gl_accum-at-all/#post-124743</link>
					<pubDate>Sat, 15 Mar 2008 20:15:35 +0000</pubDate>
					<dc:creator>Thijs Koerselman</dc:creator>

					<description>
						<![CDATA[
						<p>On Sat, Mar 15, 2008 at 8:10 PM, Wesley Smith <wesley .hoke@gmail.com> wrote:</wesley></p>
<p>> In your script, variable t is undefined.<br />
> wes<br />
></p>
<p>I use jit.gl.lua in @automatic 0 and call draw explicitly with a time<br />
argument in ms, so t is the argument.</p>
<p>Thijs</p>
<p>
><br />
> 2008/3/15 Thijs Koerselman
<thijskoerselman @gmail.com>:<br />
> > On Sat, Mar 15, 2008 at 6:27 PM, Wesley Smith <wesley .hoke@gmail.com><br />
> wrote:<br />
> ><br />
> > > How were you doing the RTT accumulation?  Did you use feedback?<br />
> > > wes<br />
> > ><br />
> ><br />
> > Below is the Lua script I used. The shaders are taken from Randy Jones&#8217;<br />
> > render node.<br />
> ><br />
> > I realize that the performance hit mainly comes from calling<br />
> > begincapture/endcapture for every frame, but I couldn&#8217;t figure out how<br />
> to<br />
> > make multiple renders add up in the same texture. Doing that and<br />
> filtering<br />
> > the texture once afterwards would be more efficient. I suspect there<br />
> must be<br />
> > a better way to clear the accum texture at the end as well. Still, the<br />
> > framerate has to improve dramatically for this to be useful though.<br />
> ><br />
> > Thijs<br />
> ><br />
> ><br />
> > scene = jit.new(&#8220;jit.gl.texture&#8221;, this.drawto)<br />
> > scene.dim = {1280, 720}<br />
> > scene.type = &#8220;float32&#8243;<br />
> ><br />
> > slabAccum = jit.new(&#8220;jit.gl.slab&#8221;, this.drawto)<br />
> > slabAccum.file = &#8220;passthru.jxs&#8221;<br />
> >  slabAccum.dim = scene.dim<br />
> ><br />
> > slabAdd = jit.new(&#8220;jit.gl.slab&#8221;, this.drawto)<br />
> > slabAdd.file = &#8220;twowayadd.jxs&#8221;<br />
> > slabAdd.dim = scene.dim<br />
> ><br />
> > slabPass = jit.new(&#8220;jit.gl.slab&#8221;, this.drawto)<br />
> >  slabPass.file = &#8220;passthru.jxs&#8221;<br />
> > slabPass.dim = scene.dim<br />
> ><br />
> > vplane = jit.new(&#8220;jit.gl.videoplane&#8221;, this.drawto)<br />
> > vplane.automatic = 0<br />
> > vplane.transform_reset = 2<br />
> > vplane.texture = slabAccum.out_name<br />
> ><br />
> > gAccumWindow = 20<br />
> > gAccumCount = 16<br />
> ><br />
> ><br />
> > function draw(t)<br />
> ><br />
> >     slabAdd:param(&#8220;a&#8221;, (1/gAccumCount))<br />
> >     slabAdd:param(&#8220;b&#8221;, 1)<br />
> ><br />
> >     for i=1, gAccumCount, 1 do<br />
> >         &#8212; start capture<br />
> >          jit.gl.begincapture(scene.name, 0)<br />
> >         &#8212; render scene<br />
> >         tslice = t &#8211; ((i/gAccumCount) * gAccumWindow)<br />
> >         renderQuad(tslice)<br />
> >         &#8212; end capture<br />
> >         jit.gl.endcapture(scene.name, 0)<br />
> ><br />
> >         &#8212; accum add texture<br />
> >         doSlab(slabAdd, scene.name, slabPass.out_name)<br />
> >         doSlab(slabPass, slabAdd.out_name)<br />
> >     end<br />
> ><br />
> >     &#8212; pass on final accumulated texture<br />
> >      doSlab(slabAccum, slabPass.out_name)<br />
> ><br />
> >     &#8212; draw to screen<br />
> >     vplane:draw()<br />
> ><br />
> >     &#8212; clear accum texture<br />
> >     slabAdd:param(&#8220;a&#8221;, 0)<br />
> >     slabAdd:param(&#8220;b&#8221;, 0)<br />
> >     doSlab(slabAdd, scene.name, slabPass.out_name)<br />
> >      doSlab(slabPass, slabAdd.out_name)<br />
> ><br />
> > end<br />
> ><br />
> > function renderQuad(t)<br />
> ><br />
> >     local angle = t * 0.001 * 360.<br />
> ><br />
> >     gl.Color(1, 0, 0, 1)<br />
> >     gl.PushMatrix()<br />
> >         gl.Rotate(angle, 0, 0, 1)<br />
> >          gl.Begin(&#8220;QUADS&#8221;)<br />
> >             gl.Vertex(-0.01,1,0)<br />
> >             gl.Vertex(0.01,1,0)<br />
> >             gl.Vertex(0.01,-1,0)<br />
> >             gl.Vertex(-0.01,-1,0)<br />
> >         gl.End()<br />
> >     gl.PopMatrix()<br />
> >  end<br />
> ><br />
> > function doSlab(slab, &#8230;)<br />
> >     local textures = {&#8230;}<br />
> >     slab.texture = textures;<br />
> >     slab:draw()<br />
> > end<br />
> ><br />
> ><br />
> ><br />
> ><br />
> ><br />
> ><br />
></wesley></thijskoerselman></p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/is-it-possible-to-use-gl_accum-at-all/#post-124744</guid>
					<title><![CDATA[Re: Is it possible to use GL_ACCUM at all?]]></title>
					<link>http://cycling74.com/forums/topic/is-it-possible-to-use-gl_accum-at-all/#post-124744</link>
					<pubDate>Sat, 15 Mar 2008 20:16:51 +0000</pubDate>
					<dc:creator>Wesley Smith</dc:creator>

					<description>
						<![CDATA[
						<p>> On Sat, Mar 15, 2008 at 8:10 PM, Wesley Smith <wesley .hoke@gmail.com> wrote:<br />
> > In your script, variable t is undefined.<br />
> ><br />
> > wes<br />
> ><br />
><br />
> I use jit.gl.lua in @automatic 0 and call draw explicitly with a time<br />
> argument in ms, so t is the argument.</wesley></p>
<p>Ah, I see that now.  Anyway, I believe I have a solution I&#8217;ll post in a bit.<br />
wes</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/is-it-possible-to-use-gl_accum-at-all/#post-124745</guid>
					<title><![CDATA[Re: Is it possible to use GL_ACCUM at all?]]></title>
					<link>http://cycling74.com/forums/topic/is-it-possible-to-use-gl_accum-at-all/#post-124745</link>
					<pubDate>Sat, 15 Mar 2008 20:29:50 +0000</pubDate>
					<dc:creator>Wesley Smith</dc:creator>

					<description>
						<![CDATA[
						<p>Hopefully this will work for you.  This script is equivalent to<br />
jit.gl.render @erase_color 0 0 0 0.1 but does it with shaders.</p>
<p>&#8211;scene texture<br />
local scene = jit.new(&#8220;jit.gl.texture&#8221;, this.drawto)<br />
scene.dim = {1280, 720}<br />
scene.type = &#8220;float32&#8243;</p>
<p>&#8211;accumulation and decay (equivalent to jit.gl.render @erase_color)<br />
local accum = jit.new(&#8220;jit.gl.slab&#8221;, this.drawto)<br />
accum.file = &#8220;co.accum.jxs&#8221;<br />
accum:param(&#8220;erase_color&#8221;, {0, 0, 0, 0.1})<br />
accum.dim = scene.dim</p>
<p>&#8211;pass thru for copy<br />
local passthru = jit.new(&#8220;jit.gl.slab&#8221;, this.drawto)<br />
passthru.dim = scene.dim</p>
<p>&#8211;set slab textures<br />
accum.texture = {scene.name, passthru.out_name}<br />
passthru.texture = accum.out_name</p>
<p>
local vplane = jit.new(&#8220;jit.gl.videoplane&#8221;, this.drawto)<br />
vplane.automatic = 0<br />
vplane.transform_reset = 2<br />
vplane.texture = accum.out_name</p>
<p>
local t = 0<br />
local dt = 1/33</p>
<p>function draw()<br />
	jit.gl.begincapture(scene.name, 0)<br />
		renderQuad(t)<br />
	jit.gl.endcapture(scene.name, 0)</p>
<p>	&#8211;process texture<br />
	accum:draw()		&#8211;accumulate and decay<br />
	passthru:draw()		&#8211;copy texture for feedback</p>
<p>	vplane:draw()</p>
<p>	t = t + dt<br />
end</p>
<p>function renderQuad(t)</p>
<p>    local angle = t*20</p>
<p>    gl.Color(1, 0, 0, 1)<br />
    gl.PushMatrix()<br />
        gl.Rotate(angle, 0, 0, 1)<br />
        gl.Begin(&#8220;QUADS&#8221;)<br />
            gl.Vertex(-0.01,1,0)<br />
            gl.Vertex(0.01,1,0)<br />
            gl.Vertex(0.01,-1,0)<br />
            gl.Vertex(-0.01,-1,0)<br />
        gl.End()<br />
    gl.PopMatrix()<br />
end</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;  And the shader<br />
//co.accum.jxs</p>
<p><jittershader name="accum"><br />
	<description><br />
	Accumulator<br />
	</description></jittershader></p>
<param name="erase_color" type="vec4" default="0. 0. 0. 0.1"/>
		<description>fade amount</description>
	
<param name="tex0" type="int" default="0" />
<param name="tex1" type="int" default="1" />
	<language name="glsl" version="1.0"><br />
		<bind param="erase_color" program="fp"></bind><br />
		<bind param="tex0" program="fp"></bind><br />
		<bind param="tex1" program="fp"></bind>
<program name="vp" type="vertex" source="sh.passthru.xform.vp.glsl"></program>
<program name="fp" type="fragment">
< ![CDATA[</p>
<p>// texcoords<br />
varying vec2 texcoord0;<br />
varying vec2 texcoord1;</p>
<p>// samplers<br />
uniform sampler2DRect tex0;<br />
uniform sampler2DRect tex1;</p>
<p>// accum amount<br />
uniform vec4 erase_color;</p>
<p>// entry point<br />
void main()<br />
{<br />
	vec4 current = texture2DRect(tex0, texcoord0);<br />
	vec4 previous = texture2DRect(tex1, texcoord1);</p>
<p>	//simulation of jit.gl.render&#8217;s @erase_color attribute<br />
	vec4 framebuffer = mix(previous, erase_color, erase_color.a);</p>
<p>	gl_FragColor = framebuffer + current;<br />
//	gl_FragColor = framebuffer;<br />
}</p>
<p>]]>
		</p></program>
	</language><br />

						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/is-it-possible-to-use-gl_accum-at-all/#post-124746</guid>
					<title><![CDATA[Re: Is it possible to use GL_ACCUM at all?]]></title>
					<link>http://cycling74.com/forums/topic/is-it-possible-to-use-gl_accum-at-all/#post-124746</link>
					<pubDate>Sat, 15 Mar 2008 22:39:41 +0000</pubDate>
					<dc:creator>Thijs Koerselman</dc:creator>

					<description>
						<![CDATA[
						<p>Thanks a lot for your help Wes, but I&#8217;m afraid this approach doesn&#8217;t make<br />
much of a difference for me. I understand that adding frames like this gives<br />
a lot better performance, since you only do one render pass per frame. For a<br />
real motion blur this doesn&#8217;t cut it, because I need to render in-between<br />
frames, rather than accumulating previous ones.</p>
<p>I also intended to use the accumulation buffer to do DOF and possibly anti<br />
aliasing. Since there is no way around multiple render passes for this, I<br />
need to utilize the full power of the GPU. I know DOF and motion blur can be<br />
faked as a post processing effect, but I really want to do these in high<br />
quality. The post processing alternative is not very useful for what I had<br />
in mind, since it gives very obvious artifacts in certain situations.</p>
<p>I really hope you / C74 will consider enabling the accumulation buffer for<br />
the render context. Even though none of the current Jitter objects make use<br />
of this buffer, at least it gives people the option to use it through C and<br />
Lua and such.</p>
<p>I&#8217;m curious to see what performance boost FBO will give, and once Apple<br />
finally sorts out the 8800 support for pre 2008 macs I&#8217;ll consider upgrading<br />
my graphics card. For now I&#8217;ll just have to forget about this and be<br />
patient.</p>
<p>Cheers,<br />
Thijs</p>
<p>On Sat, Mar 15, 2008 at 8:29 PM, Wesley Smith <wesley .hoke@gmail.com> wrote:</wesley></p>
<p>> Hopefully this will work for you.  This script is equivalent to<br />
> jit.gl.render @erase_color 0 0 0 0.1 but does it with shaders.<br />
><br />
> &#8211;scene texture<br />
> local scene = jit.new(&#8220;jit.gl.texture&#8221;, this.drawto)<br />
> scene.dim = {1280, 720}<br />
> scene.type = &#8220;float32&#8243;<br />
><br />
> &#8211;accumulation and decay (equivalent to jit.gl.render @erase_color)<br />
> local accum = jit.new(&#8220;jit.gl.slab&#8221;, this.drawto)<br />
> accum.file = &#8220;co.accum.jxs&#8221;<br />
> accum:param(&#8220;erase_color&#8221;, {0, 0, 0, 0.1})<br />
> accum.dim = scene.dim<br />
><br />
> &#8211;pass thru for copy<br />
> local passthru = jit.new(&#8220;jit.gl.slab&#8221;, this.drawto)<br />
> passthru.dim = scene.dim<br />
><br />
> &#8211;set slab textures<br />
> accum.texture = {scene.name, passthru.out_name}<br />
> passthru.texture = accum.out_name<br />
><br />
><br />
> local vplane = jit.new(&#8220;jit.gl.videoplane&#8221;, this.drawto)<br />
> vplane.automatic = 0<br />
> vplane.transform_reset = 2<br />
> vplane.texture = accum.out_name<br />
><br />
><br />
> local t = 0<br />
> local dt = 1/33<br />
><br />
> function draw()<br />
>         jit.gl.begincapture(scene.name, 0)<br />
>                 renderQuad(t)<br />
>         jit.gl.endcapture(scene.name, 0)<br />
><br />
>         &#8211;process texture<br />
>        accum:draw()            &#8211;accumulate and decay<br />
>        passthru:draw()         &#8211;copy texture for feedback<br />
><br />
>        vplane:draw()<br />
><br />
>        t = t + dt<br />
> end<br />
><br />
> function renderQuad(t)<br />
><br />
>    local angle = t*20<br />
><br />
>    gl.Color(1, 0, 0, 1)<br />
>    gl.PushMatrix()<br />
>        gl.Rotate(angle, 0, 0, 1)<br />
>        gl.Begin(&#8220;QUADS&#8221;)<br />
>            gl.Vertex(-0.01,1,0)<br />
>            gl.Vertex(0.01,1,0)<br />
>            gl.Vertex(0.01,-1,0)<br />
>            gl.Vertex(-0.01,-1,0)<br />
>        gl.End()<br />
>    gl.PopMatrix()<br />
> end<br />
><br />
><br />
><br />
> &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;  And the shader<br />
> //co.accum.jxs<br />
><br />
> <jittershader name="accum"><br />
>        <description><br />
>        Accumulator<br />
>        </description><br />
>
<param name="erase_color" type="vec4" default="0. 0. 0. 0.1"/>
>                <description>fade amount</description><br />
>        
>
<param name="tex0" type="int" default="0" />
>
<param name="tex1" type="int" default="1" />
>        <language name="glsl" version="1.0"><br />
>                <bind param="erase_color" program="fp"></bind><br />
>                <bind param="tex0" program="fp"></bind><br />
>                <bind param="tex1" program="fp"></bind><br />
>
<program name="vp" type="vertex" source="<br></program>
> sh.passthru.xform.vp.glsl&#8221; /><br />
>
<program name="fp" type="fragment">
> < ![CDATA[<br />
><br />
> // texcoords<br />
> varying vec2 texcoord0;<br />
> varying vec2 texcoord1;<br />
><br />
> // samplers<br />
> uniform sampler2DRect tex0;<br />
> uniform sampler2DRect tex1;<br />
><br />
> // accum amount<br />
> uniform vec4 erase_color;<br />
><br />
> // entry point<br />
> void main()<br />
> {<br />
>        vec4 current = texture2DRect(tex0, texcoord0);<br />
>        vec4 previous = texture2DRect(tex1, texcoord1);<br />
><br />
>        //simulation of jit.gl.render&#8217;s @erase_color attribute<br />
>        vec4 framebuffer = mix(previous, erase_color, erase_color.a);<br />
><br />
>        gl_FragColor = framebuffer + current;<br />
> //      gl_FragColor = framebuffer;<br />
> }<br />
><br />
> ]]><br />
>                </program>
>        </language><br />
> </jittershader><br />
></p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/is-it-possible-to-use-gl_accum-at-all/#post-124747</guid>
					<title><![CDATA[Re: Is it possible to use GL_ACCUM at all?]]></title>
					<link>http://cycling74.com/forums/topic/is-it-possible-to-use-gl_accum-at-all/#post-124747</link>
					<pubDate>Fri, 30 Sep 2011 13:31:42 +0000</pubDate>
					<dc:creator>llumen</dc:creator>

					<description>
						<![CDATA[
						<p>is there any documentation on how to use the co.accum.jxs shader? I want an endless feedback (as in erase_color 0 0 0 0) on a sketch that is captured into a texture. But the above post is on lua?<br />
any help would be welcome</p>
<p>best</p>
<p>pieter</p>
						]]>
					</description>

					
					
				</item>

					
		
	</channel>
	</rss>

