Error: Line 15: The class "closeit" does not exist.
...Tried to replacing line 15 with "runSketch(new String[]{"closeit"});"...
And it then started very slowly creating new windows until crashing... And it crashes on 3rd or 4th window, either with line 21 erroring with "missing a pushMatrix() to go with that popMatrix()"(wut?), or "handleDraw() called before finishing" on no particular line...
Also, code picky wise, you can replace lines 22 and 23 with col=(col+1)%255; and have your sketch... eat... 1hz of cpu time.. less.... performance boost... a little but you know...
The code-golf-y Game of Life example is fun. For people interested in studying a slightly de-obfuscated version of the same code, here it is with the loops and ternaries unpacked:
void setup() {
background(255);
fill(0);
text("Game of life", 9, 9);
loadPixels();
}
void draw() {
int n = 0;
int l = 10000;
int[]a = new int[l];
int[]p = pixels;
int nPos;
for (int i=0; i<l; i++) { // loop through pixels
n=0;
// check pixel neighbors on current frame
for (int j=0; j<9; j++) {
if (j!=4) {
// calculate index of current neighbor
nPos = (i+l-1+j%3+100*(j/3-1));
// add value of neighbor to total
n += p[nPos%l]&1;
}
}
// update pixel state on next frame
// according to the Game of Life rules
if (n==5) {
a[i] = -1<<24;
} else if (n==6) {
a[i] = p[i];
} else {
a[i] = -1;
}
}
// copy next frame to current
arrayCopy(a, p);
updatePixels();
}
@nabr
The code i posted runs for me, but did not run for someone I sent it to.
Was aware of the trailing comma due to the macros which I see you spotted, but that's valid in C which glsl is based on so maybe the omission of version was the problem?
In your first skech this gives me an error, "vCol=vec3[3u](vec3(1f,0f,0f),vec3(0f,1f,0f),vec3(0f,0f,1f))[gl_VertexID%3];" ,
replacing it with this works for me
"vCol=mat3(1,0,0, 0,1,0, 0,0,0)[gl_VertexID%3];" ,
Your second code just closes, after removing line 42 which sais exit(); it runs though is neat.
I was not aware of the Automatically generated transformation matrix, that's why I used the PMatrix3D
my second code: Yes it is generating two *.txt files in the data folder of processing sketch and exti(), after that, you can comment it out. I posted it becourse ->
your cube sketch works, but inline shader in processing are per default version 110. and i want to use [3u] unsigned int and f suffix for float. so i update it.
This will print This program wasn't written in Processing it was built for C if ran in processing.
And if ran in C (gcc or clang) it'll print the opposite
void setup(){//\
System.out.
printf("This program wasn't written in %s it was built for %s !",//\
"Processing","C"//\
/*
"C","Processing"//\
*/
);}//\
/*
main(){setup();}//*/
Comments
novelty #1
closeit.pde
you won't keep up counting them...
Error: Line 15: The class "closeit" does not exist. ...Tried to replacing line 15 with "runSketch(new String[]{"closeit"});"... And it then started very slowly creating new windows until crashing... And it crashes on 3rd or 4th window, either with line 21 erroring with "missing a pushMatrix() to go with that popMatrix()"(wut?), or "handleDraw() called before finishing" on no particular line...
Also, code picky wise, you can replace lines 22 and 23 with col=(col+1)%255; and have your sketch... eat... 1hz of cpu time.. less.... performance boost... a little but you know...
Makes a rainbow cycle of color like OP's
Return lowest int larger than 'n' with same number of 1's in it's binary representation as n.
Obtuse way to loop 1 -> 10 inclusive
Minimal Game of Life
Architector_4... the sketch is supposed to be called closeit... so, no code errors.
The code-golf-y Game of Life example is fun. For people interested in studying a slightly de-obfuscated version of the same code, here it is with the loops and ternaries unpacked:
very nice https://www.openprocessing.org/sketch/499765
it sounds like 'vyry nysh' and then musics
you can change the language somewhere. btw.
for me it sounds more like vyry nysh with german accent :)
@prince_polka
updated glsl version >=110
the problem is you cant not have a constat array anymore https://www.opengl.org/discussion_boards/showthread.php/170193-Constant-vec3-array-no-go
a wonder that it compiles with gl_VertexID. Java is awesome :)
@nabr
The code i posted runs for me, but did not run for someone I sent it to.
Was aware of the trailing comma due to the macros which I see you spotted, but that's valid in C which glsl is based on so maybe the omission of version was the problem?
In your first skech this gives me an error,
"vCol=vec3[3u](vec3(1f,0f,0f),vec3(0f,1f,0f),vec3(0f,0f,1f))[gl_VertexID%3];" ,
replacing it with this works for me"vCol=mat3(1,0,0, 0,1,0, 0,0,0)[gl_VertexID%3];" ,
Your second code just closes, after removing line 42 which sais
exit();
it runs though is neat.I was not aware of the Automatically generated transformation matrix, that's why I used the PMatrix3D
@prince_polka
my second code: Yes it is generating two *.txt files in the data folder of processing sketch and exti(), after that, you can comment it out. I posted it becourse -> your cube sketch works, but inline shader in processing are per default version 110. and i want to use [3u] unsigned int and f suffix for float. so i update it.
Strange. I works on my pc : )
What are you specs ?
@nabr
@prince_polka
..."but did not run for someone I sent it to."
life is about survival of the fittest :)
@prince_polka
ok so, it seems i have to use 1.f as suffix that was the error.
https://bl.ocks.org/tolkanabroski/ea65ae19cb1a028c59eee642c3429a4e
windows/angel bug, - whatever, i changed my comment.
This will print
This program wasn't written in Processing it was built for C
if ran in processing.And if ran in C (gcc or clang) it'll print the opposite