Shader texture sample wrap on x axis?

I’ve created a shader that computes/draws a Conway’s Game of Life. It takes in an image (CGoL data encoded as pixels), reads the current state, and draws the next state. And it works fine… except that I want the pixels/cells to wrap on the x axis.

The texture sampling does not wrap by default. And my attempts at manually wrapping the UV coordinates simply does not work (I wish I knew why but it’s not important). I tried textureWrap(REPEAT) but I don’t think it reached the shader. I’ve tried looking up info online regarding shaders in Processing but there’s precious little available. Most info that exists is in here this forum and I haven’t found what I’m looking for.

I’m pretty new to shaders in general. I think the solution requires PJOGL but I have no idea how to use it. There’s a huge pile of complicated functions and very little info on how to wire it up. Or maybe it has to do with beginPGL() on the PGraphics2D? No idea…

Any help would be appreciated. I feel like there’s some magical 2 line incantation that solves my problem but I don’t know what it is.

edit: I’m up to here, which doesn’t quite work. Feels close…


PGL pgl = ((PGraphicsOpenGL)gameState1).beginPGL();
pgl.texParameteri(pgl.TEXTURE_2D, pgl.TEXTURE_WRAP_S, pgl.REPEAT);

gameState1.image(gameState2, 0, 0);

I decided to forget the approach entirely. Instead of encoding the data in an image (which seemed neat at the time) I’m just going to use an int array. So much easier…