I have a matrix which I’m pumping into a jit.gl.texture object to create a GL texture. This works great, and the texture inherits the size of the matrix that I feed in.
However, what if I want to do some processing in GL at a higher resolution than the original matrix?
Ideally, I’d like just to resample the original matrix (at an integer multiple for speed) into the texture, then process it using my fragment and vertex shaders via a jit.gl.slab.
I could just make the jit.matrix bigger, but pumping around this much data outside of GL is slow slow slow.
Is there a way to do this inside GL?
I tried @dim cx cy on the jit.gl.texture, it didn’t change anything. Also tried messing around with the td.resample.jxs sample in jitter-shaders without much luck.
you could upload your matrix to a slab, use@capture on the slab to render it to a texture, so something like
jit.matrix 4 char whatever my source is
jit.gl.slab mycontext @capture mycapturetexture
and then elsewhere
jit.gl.texture mycontext @name mycapturetexture @dim biggerX biggerY
and use that texture wherever you want?
Thanks for the suggestion! I could not get it to work with a jit.gl.slab. All I ever saw was the grey and white checkerboard of doom! However, I did get it to work by modifying your idea as follows:
[matrix 4 char 320 240]
[jit.gl.texture context @name input]
[jit.gl.videoplane context @capture upsample]
[jit.gl.texture context @name upsample @dim 640 480]
However, it is slow slow slow. About half the frame rate of the unscaled texture. And it gets slower if I increase the size of the upsample texture. Shouldn’t this be very cheap if it’s all done inside the GPU?
How do I do fast resampling of textures purely in the GPU?
Log in to reply
SUBSCRIBE TO OUR NEWSLETTER
C74 RSS Feed | © Copyright Cycling '74 | Terms & Conditions