How to set the size of openGL rendering context when made by jit.matrix

t's icon

Hi,

I am currently working on some matrix-->openGL-->matrix transition. I realized that the rendering context defined with "jit.window name @size x y" needs to have the same size as input matrix in order to not loose resolution. Now I would like to get rid of jit.window because I don't want it my patch. So if I make the rendering context with jit.matrix i don't know how to define the size. If I change the size by sending "dim x y" message my patch stops working and usually Max crashes. If I just define rendering context with jit.matrix the matrices that come out from openGL processing are heavily pixelated (I am sending in matrices with 2048 rows).

Everything works fine when I work with jit.window. jit.pwindow also causes me trouble. If I set the size of jit.pwindow to "1x2048" everything goes bonkers. My whole screen becomes a stroboscope and I need to reset my computer...?

Help pretty please:)

Bas van der Graaff's icon

1 x 2048? Are you a flatlander?

t's icon

1 x 2048 is not flatland! That's 2048 x 1!:)

I am making spatial maps for jit.repos in relative mode. So I upsample matrix as it comes out of openGL to the needed width (n x 2048) since jit.repos work on cell to cell basis. Otherwise I would be more than happy with 1 x 2048. And because I need only vertical blur for my spatial map it makes sense to send only one column in the GPU land

Bas van der Graaff's icon

Flatlanders use [jit.thin] as they can't understand seeing in 2 dimensions. So they're the same :P

I noticed pwindow has a minimum size of 10, but it will autolimit, so that shouldn't be a problem. I also have no trouble setting my pwindow to 1 x 2048 or 2048 x 1 at all when displaying a normal video.

If you just want to show the texture in a jit.window, I'd make it a jit.gl.texture and display it using jit.gl.videoplane. If you just want to show it in a jit.pwindow (you said you wanted to get rid of the jit.window), i'd skip the GL part altogether and just feed the matrix into jit.pwindow. As you're using jit.repos you don't need the GPU for the calculations.

If things are still unclear, maybe you can reproduce the crash in a sample patch?

t's icon

Basically I don't want to display at all the matrix that goes to openGL. I am using openGL only to apply Gaussian blur (vertical direction only), that is not available outside openGL. Now the thing is that if I send to openGL 1x2048 matrix, the openGL rendering context has to be the same size, otherwise everything is pixelated. So I am using jit.window just to define the size of rendering context and not to display anything. Of course jit.window automatically displays the content but that is something I don't need/want. Therefore I would prefer to define rendering context with a matrix (lonely matrix, not connected to anything at all, having only the name of openGL rendering context defined) but I can't set the size (the default size it seems to be 320x240?). So if I use matrix instead of jit.window the matrix is heavily downsampled as it comes out of openGL and is hence useless. I don't even want jit.pwindow but since it is easier to hide it I would prefer jit.pwindow more than jit.window. Although ideally I just want to define rendering context with matrix and not display at all the content that is being sent to openGL. So the question is "how to set the size of openGL rendering context when defining it with matrix?". Using the "dim $1 $2" message seems to not work when jit.render and jit.matrix share the same name...

At the link below you can download the working patch (Jitter based spectral delay with log/exp mapping). The reason I am sending the patch via sendspace is that you need 200x2048 spectral matrix in .jxf format in order to work. So one suitable .jxf file is included. Also the pfft subpatcher.

On the interface of the main patch pleas see "p spectraprocessing" and open it. There you will find subpatcher "p matrixToOpenGL-GaussBlur-andBackToMatrix". That is where all the openGL takes place, also the rendering context is defined there. Try replacing "jit.window spectralDelayLogGL @size 1 2048" with "jit.matrix spectralDelayLogGL". Also you can try setting the size of a matrix or using jit.pwindow instead.

Thanks for any help!

PS: I need to reference some stuff in the patch that is borrowed/reworked. I owe some credits to J.F.Charles, this will be done as the patch (an many others) will be finally ready to go in public. Although I've changed his technique of reading pfft data a bit...anyway, more about this soon:)