IOhannes m zmoelnig a écrit :
cyrille henry wrote:
i try anything i can think of, but i did never change the drawing behaviour : it work with cube in draw quad or draw triangles mode, but no line.
...
so it actually was opposite to what you experience. mabye i introduced some problems when i defaulted to "triangles" (mainly because that's the major default mode in Gem)
i'll try in the next days...
did you find a good resource to explain all of this?
no, but i didn't even search. probably matthias's mail points to some good ressources.
thanks it help, event if i still have lot's of questions...
ouch, ouch, Ctrl-Z of course my stupid little message boxes should be followed by something like...
| [route read ] | | [symbol] | [open $1( | | | [glsl_geometry] | | +-----------------+ | [glsl_program]
sorry for the confusion...
no problem, that's what i understand.
so, to keep you inform, here is the 1st goemetry shader i'm working on.
it just replace triangles with pyramids...
#version 120 #extension GL_EXT_geometry_shader4 : enable
void main(void) { //increment variable int i;
vec4 pos1,pos2, pos3, pos4; // tmp vec3 high;
for(i=0; i< gl_VerticesIn; i += 3){ // for all triangles pos1 = gl_PositionIn[i]; pos2 = gl_PositionIn[i+1]; pos3 = gl_PositionIn[i+2]; pos4 = (pos1 + pos2 + pos3) / 3.; // center of the triangle
high = 10.*cross(pos2.xyz-pos1.xyz,pos3.xyz-pos2.xyz); // hight and orientation of the piramide
high = normalize(high); high *= length(pos2-pos1); pos4.xyz += high;
gl_Position = gl_ModelViewProjectionMatrix * pos1; EmitVertex(); gl_Position = gl_ModelViewProjectionMatrix * pos2; EmitVertex(); gl_Position = gl_ModelViewProjectionMatrix * pos4; EmitVertex(); gl_Position = gl_ModelViewProjectionMatrix * pos3; EmitVertex(); gl_Position = gl_ModelViewProjectionMatrix * pos1; EmitVertex(); EndPrimitive(); // new primitive }
}
void main() { gl_Position = gl_Vertex; }
void main() { gl_FragColor = vec4(1.0,1.0,1.0,0.6); // set color }
#N canvas 685 31 564 661 10; #X msg 26 105 print; #X msg 14 320 print; #X msg 15 461 print; #X floatatom 185 382 9 0 0 0 ID - -; #X floatatom 160 154 9 0 0 0 ID - -; #X obj 204 447 print linking; #X obj 183 404 pack 0 0 0; #X msg 15 217 print; #X floatatom 143 260 9 0 0 0 ID - -; #X obj 71 18 gemhead; #X msg 186 426 link $1 $2 $3; #X obj 71 43 alpha; #X floatatom 110 485 5 0 0 0 - - -; #X floatatom 152 485 5 0 0 0 - - -; #X floatatom 197 486 5 0 0 0 - - -; #X obj 66 463 glsl_program; #X obj 169 51 t b b b b; #X msg 244 84 -1; #X obj 167 32 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X obj 161 132 change; #X obj 143 239 change; #X obj 187 359 change; #X obj 226 548 t a b; #X obj 226 591 newWave 25 25; #X msg 285 563 D1 0.01 , D2 0; #X obj 284 542 loadbang; #X msg 406 566 2; #X obj 71 107 glsl_geometry; #X obj 60 217 glsl_vertex; #X obj 61 334 glsl_fragment; #X msg 104 83 open tri2p.geo; #X msg 105 195 open tri2p.vert; #X msg 86 305 open tri2p.frag; #X obj 169 6 loadbang; #X text 197 29 reload; #X obj 322 98 gemwin; #X msg 332 53 create , 1; #X msg 341 75 destroy; #X obj 69 502 rotateXYZ -55 10 0; #X text 290 144 replace triangle with piramides; #X obj 63 546 triangle; #X connect 0 0 27 0; #X connect 1 0 29 0; #X connect 2 0 15 0; #X connect 3 0 6 0; #X connect 4 0 6 2; #X connect 6 0 10 0; #X connect 7 0 28 0; #X connect 8 0 6 1; #X connect 9 0 11 0; #X connect 10 0 5 0; #X connect 10 0 15 0; #X connect 11 0 27 0; #X connect 12 0 38 1; #X connect 13 0 38 2; #X connect 14 0 38 3; #X connect 15 0 38 0; #X connect 16 0 17 0; #X connect 16 1 32 0; #X connect 16 2 31 0; #X connect 16 3 30 0; #X connect 17 0 21 0; #X connect 18 0 16 0; #X connect 19 0 4 0; #X connect 20 0 8 0; #X connect 21 0 3 0; #X connect 22 0 23 0; #X connect 22 1 23 0; #X connect 24 0 23 0; #X connect 25 0 24 0; #X connect 26 0 23 3; #X connect 27 0 28 0; #X connect 27 1 19 0; #X connect 28 0 29 0; #X connect 28 1 20 0; #X connect 29 0 15 0; #X connect 29 1 21 0; #X connect 30 0 27 0; #X connect 31 0 28 0; #X connect 32 0 29 0; #X connect 33 0 18 0; #X connect 36 0 35 0; #X connect 37 0 35 0; #X connect 38 0 22 0;