Forums > Jitter

gl.sketch overlapping shape problems at z=0

January 12, 2008 | 8:27 pm

I am playing with hexagon tilings in jit.gl.sketch. I want to sketch some overlapping shapes at z=0. I can draw a circle in six 60-degree arc segments and I get a seamless circle. But if I draw that same circle on top of hexagon slices, I see gaps between the arcs in the circle.

I could fix this by making the circle a little closer to the camera, but I want to stay at z=0 so when I translate the tile the circle stays centered in the hexagon.

In my patch, use the number box to send 6 consecutive numbers. The problem happens in the center. To either side you can see the circle drawing properly. On the right, the unwanted z-translation makes the circle go off-center.

How can I draw overlapping shapes at z=0 and avoid the seams?

-Adam

#P window setfont "Sans Serif" 9.;
#P number 120 54 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 31 73 57 196617 qmetro 50;
#P toggle 31 48 15 0;
#P newex 31 211 130 196617 jit.window 40 40 340 340;
#N vpatcher 299 325 1147 766;
#P origin 28 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P comment 519 249 53 196617 right tile;
#P comment 91 212 181 196617 center tile (with the problem);
#P window linecount 2;
#P message 464 267 344 196617 glmatrixmode modelview , glpushmatrix , gltranslate 0.5 0 , glrotate $1 0 0 1 , glcolor 1 0 0 , circle 0.11 -30 30 , gltranslate 0 0 -0.1 , glcolor 0 1 0;
#P window linecount 1;
#P newex 434 234 40 196617 t b b i;
#P window linecount 2;
#P message 238 93 325 196617 glmatrixmode modelview , glpushmatrix , gltranslate -0.5 0 , glrotate $1 0 0 1 , glcolor 1 0 0 , circle 0.11 -30 30 , moveto 0 0 , glpopmatrix;
#P window linecount 0;
#N vpatcher 10 59 288 286;
#P window setfont "Sans Serif" 9.;
#P newex 139 70 54 196617 onebang 1;
#P newex 190 141 40 196617 * -1.;
#P newex 139 91 27 196617 0.05;
#P newex 139 114 105 196617 expr $f1 * sqrt(3.0);
#P newex 54 165 169 196617 pack tri 0 0 0 0.15 0. 0 0.15 0. 0;
#P inlet 54 22 15 0;
#P outlet 54 187 15 0;
#P connect 1 0 2 0;
#P connect 2 0 0 0;
#P fasten 1 0 6 0 59 53 144 53;
#P connect 6 0 4 0;
#P connect 4 0 3 0;
#P connect 3 0 2 5;
#P fasten 3 0 5 0 144 136 195 136;
#P connect 5 0 2 8;
#P pop;
#P newobj 50 284 76 196617 p drawtriangle;
#P window linecount 2;
#P message 65 228 256 196617 glmatrixmode modelview , glpushmatrix , glrotate $1 0 0 1 , glcolor 1 0 0 , circle 0.11 -30 30 , glcolor 0 1 0;
#P window linecount 1;
#P newex 35 52 32 196617 * 60;
#P message 35 317 122 196617 moveto 0 0 , glpopmatrix;
#P newex 35 200 40 196617 t b b i;
#P inlet 35 28 15 0;
#P outlet 395 370 15 0;
#P window linecount 0;
#P comment 310 72 100 196617 just the circle;
#P connect 2 0 5 0;
#P connect 5 0 3 0;
#P connect 3 0 4 0;
#P connect 9 0 4 0;
#P connect 3 1 7 0;
#P connect 9 1 7 0;
#P connect 3 2 6 0;
#P fasten 5 0 8 0 40 81 243 81;
#P fasten 4 0 1 0 40 341 400 341;
#P fasten 6 0 1 0 70 278 400 278;
#P fasten 7 0 1 0 55 309 400 309;
#P fasten 8 0 1 0 243 139 400 139;
#P fasten 10 0 1 0 469 313 400 313;
#P connect 5 0 9 0;
#P connect 9 2 10 0;
#P pop;
#P newobj 120 99 59 196617 p draw tile;
#P newex 31 189 163 196617 jit.matrix canvas 4 char 300 300;
#P newex 31 141 50 196617 t b erase;
#P newex 31 165 99 196617 jit.gl.render canvas;
#P message 221 55 34 196617 reset;
#P newex 120 129 98 196617 jit.gl.sketch canvas;
#P fasten 1 0 0 0 226 124 125 124;
#P connect 5 0 0 0;
#P fasten 3 1 2 0 76 161 36 161;
#P connect 3 0 2 0;
#P connect 8 0 3 0;
#P connect 7 0 8 0;
#P connect 4 0 6 0;
#P connect 2 0 4 0;
#P connect 9 0 5 0;
#P window clipboard copycount 10;


January 15, 2008 | 4:02 am

Found a solution. I needed to use two jit.gl.sketch objects set to different layers. Makes sense :)

-Adam

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 393 83 43 196617 layer 2;
#P message 336 83 43 196617 layer 0;
#P newex 286 138 142 196617 jit.gl.sketch canvas @layer 2;
#P number 120 54 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 31 73 57 196617 qmetro 50;
#P toggle 31 48 15 0;
#P newex 31 211 130 196617 jit.window 40 40 340 340;
#N vpatcher 35 399 615 785;
#P origin 28 0;
#P window setfont "Sans Serif" 9.;
#P message 225 172 160 196617 glcolor 1 0 0 , circle 0.11 -30 30;
#P comment 484 331 50 196617 layer 2;
#P outlet 491 310 15 0;
#N vpatcher 10 59 305 363;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 69 79 68 196617 glcolor 0 1 0;
#P window linecount 0;
#P newex 54 43 40 196617 t b b b;
#P newex 139 119 54 196617 onebang 1;
#P newex 190 190 40 196617 * -1.;
#P newex 139 140 27 196617 0.05;
#P newex 139 163 105 196617 expr $f1 * sqrt(3.0);
#P newex 54 214 169 196617 pack tri 0 0 0 0.15 0. 0 0.15 0. 0;
#P inlet 54 22 15 0;
#P outlet 29 249 15 0;
#P connect 8 0 0 0;
#P connect 2 0 0 0;
#P connect 1 0 7 0;
#P connect 7 0 2 0;
#P connect 7 1 8 0;
#P fasten 7 2 6 0 89 67 144 67;
#P connect 6 0 4 0;
#P connect 4 0 3 0;
#P connect 3 0 2 5;
#P fasten 3 0 5 0 144 185 195 185;
#P connect 5 0 2 8;
#P pop;
#P newobj 211 211 76 196617 p drawtriangle;
#P message 239 124 274 196617 glmatrixmode modelview , glpushmatrix , glrotate $1 0 0 1;
#P newex 197 61 32 196617 * 60;
#P message 197 253 131 196617 moveto 0 0 0 , glpopmatrix;
#P newex 197 98 53 196617 t b b b i;
#P inlet 197 37 15 0;
#P outlet 15 304 15 0;
#P comment 7 327 50 196617 layer 1;
#P fasten 4 0 1 0 202 277 20 277;
#P connect 10 0 1 0;
#P connect 6 0 1 0;
#P connect 2 0 5 0;
#P connect 5 0 3 0;
#P connect 3 0 4 0;
#P connect 3 1 7 0;
#P connect 3 2 10 0;
#P connect 3 3 6 0;
#P fasten 6 0 8 0 244 148 496 148;
#P fasten 4 0 8 0 202 277 496 277;
#P fasten 7 0 8 0 216 233 496 233;
#P pop;
#P newobj 120 83 59 196617 p draw tile;
#P newex 31 189 163 196617 jit.matrix canvas 4 char 300 300;
#P newex 31 141 50 196617 t b erase;
#P newex 31 165 177 196617 jit.gl.render canvas @depth_enable 0;
#P message 286 55 34 196617 reset;
#P newex 120 136 142 196617 jit.gl.sketch canvas @layer 1;
#P connect 1 0 0 0;
#P connect 1 0 10 0;
#P connect 5 1 10 0;
#P connect 11 0 10 0;
#P connect 12 0 10 0;
#P connect 5 0 0 0;
#P connect 9 0 5 0;
#P connect 4 0 6 0;
#P connect 2 0 4 0;
#P fasten 3 1 2 0 76 161 36 161;
#P connect 3 0 2 0;
#P connect 8 0 3 0;
#P connect 7 0 8 0;
#P window clipboard copycount 13;


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