We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOpenGL and 3D Libraries › Glitchy grid thing in my texture
Page Index Toggle Pages: 1
Glitchy grid thing in my texture (Read 1438 times)
Glitchy grid thing in my texture
Apr 8th, 2010, 1:29am
 
I assume this is an OpenGL thing and probably also a GLGraphics thing.

I am trying to make a cellular automata running on the GPU and it is working except for one problem. The problem can be demonstrated the easiest with a very simple rule like this:

Code:

//GLSL code
if (sum != 0 ){gl_FragColor = vec4(1.);}


where sum = 8 minus the number of white pixels surrounding the current pixel. Sorry to be confusing with the "8 minus" part, if the rule doesn't make sense just keep reading.

On a completely black starting texture this should cause all the pixels to flicker back and forth between white and black. On the first pass they do indeed all turn white, but then things go strange as you can see in the screenshot.

...

When they are supposed to flip back to black some of them stay stuck as white in this weird random grid pattern with a diagonal line, which means the shader thought it counted some black pixels in those areas even though everything was clearly white. Each generation the random grid changes its randomness, adding or removing lines here and there. I swear I solved this problem the other day and I thought it was done by setting the minFilter and magFilter for my texture to GLTexture.NEAREST. But now the problem is  back.

I noticed that adjusting the grid resolution (nx and ny) values in the filter's xml file change the random pattern that is produced but I can't get it to go away entirely. What causes this  Huh
Re: Glitchy grid thing in my texture
Reply #1 - Apr 8th, 2010, 4:43am
 
It could be something to do with the results not being buffered, e.g. you change a pixel to black, and then the next pixel along uses that result in it's calculation, not its original value.
Re: Glitchy grid thing in my texture
Reply #2 - Apr 8th, 2010, 9:05am
 
Gah! You are absolutely right. I was using a pingpong texture before and then I thought I would try getting rid of it and simply feed a texture back into itself which seemed to work for awhile. I swear I already tried going back to the pingpong texture in my attempts to fix things but I guess my recollection ain't what it used to be.

Weird that not using buffering has such a semi-random effect. Thanks for point out my silly mistake.
Page Index Toggle Pages: 1