Forums > Jitter

Wrapping a GL world, or "plumber mechanics"

May 30, 2010 | 8:20 am

Hello,

I have been struggling to find a way to mimic the old style of arcade games, where characters that go off-screen to the left are scrolled back from the right, and vice versa.

In a modest form, this "effect" can be achieved by simple modulus calculations. However, this approach requires a player (or shape) to be off-screen for a couple of pixels before entering as new from the other side.

To have a more "fluid" effect, where a shape enters the screen AS it is moving off (sharing halves on both sides), the thing starts getting more complex. I have been trying to do this with [gl.sketch] and glulookat/glviewport commands, picking different views of the screen and compositing them, but my framerate drops considerably.

I have also tried compositing different parts of the screen with a repo shader, but the process seems to be exceedingly clumsy. Finally, I tried rendering to_texture each view of the render screen, but for some reason, my textures just register with the last triggered position.

I’m pretty sure this is no big deal, so if anyone can point me in the right direction I would appreciate very much! Whatever idea, it needs to work with ortho on 2.

Here is a patch with the basic idea and modulus calculations:

– Pasted Max Patch, click to expand. –

Thank you very much!


May 30, 2010 | 10:28 am

This may be a stupid suggestion, but: have you thought about using two plumbers?


May 30, 2010 | 6:59 pm

Actually, that’s probably the first and most logical solution. Creating/running duplicate shapes (plumbers, gridshapes, sketches) on run-time is what first springs to mind.

The only problem is that I’m already tolling my memory with 9 different plumbers in 36 different run-time situations + unique slabs per layer, so I’m looking for more efficient, general and "sophisticated" suggestions, things that I’ve grown accustomed to see with GL methods.

However, if you think this is probably the least expensive way to do this, I’ll stick to it.


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