Creating a texture with a different size than its fed matrix

Dec 3, 2008 at 5:37am

Creating a texture with a different size than its fed matrix

I have a matrix which I’m pumping into a 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

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, it didn’t change anything. Also tried messing around with the td.resample.jxs sample in jitter-shaders without much luck.

Any ideas?


Dec 3, 2008 at 8:39pm

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
| mycontext @capture mycapturetexture

and then elsewhere mycontext @name mycapturetexture @dim biggerX biggerY

and use that texture wherever you want?

Dec 5, 2008 at 7:26am

Thanks for the suggestion! I could not get it to work with a 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]
[ context @name input]

(jit_gl_texture input)
[ context @capture upsample]

[ 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?


Dec 16, 2008 at 6:13am


How do I do fast resampling of textures purely in the GPU?


You must be logged in to reply to this topic.