Forums > Jitter

Is there an OpenGL equivalent of jit.scissors?

March 12, 2010 | 2:02 am

Like the msg says… is there an OpenGL equivalent of jit.scissors?

I want to read a video, slice it into vertical strips, and send each strip to a separate videoplane.


March 12, 2010 | 3:24 am

I’ve tried reading in my movie, then sending it to five videoplanes, using tex_scale_x set to 5, and tex_offset_x at 0.0, -0.2, -0.4, -0.6 and -0.8 to select each of the different slices.

This works – the display looks the same as when using jit.scissors… but… the framerate drops from 30fps using jit.scissors to 15fps using the tex_scale and tex_offset method.

I’ve attached the patch that uses jit.scissors (v3) and the patch that uses tex_offset and tex_scale (v4).

What could be wrong? Is there a (much) better way to do this? I’m trying to squeeze out as many fps as possible.


March 12, 2010 | 4:51 pm

I think td.resample.jxs (in slab helpers– texdisplace) should do this.


March 12, 2010 | 9:40 pm

The problem is you are sending the fullscale video many times to the GPU. For each rendering context you can just use one jit.gl.texture contextname @colormode uyvy to send to multiple videoplanes in the same context. This way you transfer the memory (expensive) once for each context rather than five times, and that texture is used by the video planes (cheap).

If you are able to used shared contexts (not sure on your setup if they are both on the same card). Then you should be able do something like jit.gl.render output2ch @shared_context output3ch, and just use one jit.gl.texture to send to all five videoplanes. This would be your fastest option if you are not using multiple graphics cards.


March 12, 2010 | 10:50 pm

Great, thanks!

So does jit.gl.texture output2ch @colormode uyvy actually replace the jit.gl.slab as I use it, or does it just go in the chain before it?


March 12, 2010 | 11:37 pm

OK, adding two jit.gl.textures (one per output context) before the jit.gl.slab led to an improvement, but it is still slower than the jit.scissors approach (maybe 60% of the fps).

Having the jit.gl.texture feed into a jit.gl.slab (two, one per output context), and hence to the videoplanes (five, one per output channel) got speeds back up the same level as jit.scissors. This is *without* @colormode uyvy in the texture.

Removing the jit.gl.slab entirely, and having the jit.gl.texture @colormode uyvy feed the videoplanes led to a drop in framerate. It seems that using the cc.uyvy2rgba.lite.jxs shader in the jit.gl.slab is faster than using @colormode uyvy in the jit.gl.texture?

I think maybe I need to use td.resample.jxs to cut out the slices before sending them to the videoplane…


March 13, 2010 | 3:39 am

Yes, definitely on windows, cc.uyvy2rgba.lite.jxs will be much faster. I didn’t examine your patch heavily. Just use one jit.gl.slab for each context (or one if you’re sharing), and send the output texture to the repective videoplanes. I doubt that you will get much boost by using td.resample.jxs.


March 13, 2010 | 3:24 pm

Thanks, everything is working well now. Sending the output of the jit.qt.movie directly to 2 jit.gl.slabs, and from there to the 5 videoplanes, seems to work well. The jit.gl.texture seems to be unnecessary, though adding it to the chain makes little difference.


June 10, 2011 | 9:35 am

Hi,

I know this post is old, but I just came across it as I’m experimenting with jit.gl.slab.

gpvillamil, can you quickly explain how you get the 2 jit.gl.slabs to the 5 video planes and use the td.resample.jxs ? I don’t seem to get it…

thanks!
alain


September 29, 2013 | 3:00 am

I’d like to second Alain’s request here. Could someone demonstrate a simple slicing of an image evenly into several planes with jit.gl.slab?


September 29, 2013 | 5:53 am

Go to cycling 74 examples and check out the resample example. Play around and you’ll have it figured out in no time !


September 29, 2013 | 8:59 am

Well, I seem to be able to resize alright – the thing I don’t understand is how to get the two planes to merge as one, though.. Is there another example I’m missing?

Attachments:
  1. resample.maxpat

October 1, 2013 | 1:56 pm

other than fixing your patching problems (pak is an object, not a message), you need to enable alpha-blending on your gl.videoplanes (@depth_enable 0, @blend_enable 1)

<code>

– Pasted Max Patch, click to expand. –

</code>


Viewing 13 posts - 1 through 13 (of 13 total)