10.11.2014 Views

Master's Thesis - Studierstube Augmented Reality Project - Graz ...

Master's Thesis - Studierstube Augmented Reality Project - Graz ...

Master's Thesis - Studierstube Augmented Reality Project - Graz ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

5.3 Visualization nodes and subgraphs<br />

chosen large enough to provide sufficient texture columns for adequate lines. Listing<br />

5.5 gives an insight into two of the used shader; one for the calculation which is only<br />

invoked if this is necessary and one to display the results.<br />

Listing 5.5: Pseudo shader code for the simplest form of a GPGPU stream line calculation.<br />

1 init arbitrary positions in init_1D_texture<br />

2<br />

3 [ Fragment shader ] // output : position texture<br />

4 uniform init_1D_texture ;<br />

5 uniform seed region parameters ;<br />

6 uniform positon_texture ;<br />

7 uniform moving ; // indicates if the seed region moves<br />

8 uniform velocity_3D_texture ;<br />

9<br />

10 texCoord = gl_TexCoord [0]. xy<br />

11 initVec = init_1D_texture (u,v);<br />

12 // + considerations for the rotation and dilation<br />

13 // of the seed reagion<br />

14<br />

15 if texCoord .y < 1.0 // the start point of the line<br />

16<br />

17 gl_FragColor . xyz = initVec . xyz ;<br />

18 gl_FragColor .a = 0.0;<br />

19<br />

20 else<br />

21<br />

22 texCoord .y -= 1.0; // get the previous supporting point<br />

23 posVec = positon_texture ( texCoord .xy)<br />

24<br />

25 // end if<br />

26<br />

27<br />

28 if moving > 0 // seed region is moving<br />

29 // no calculations are necessary<br />

30<br />

31 gl_FragColor . xyz = initVec . xyz ;<br />

32 gl_FragColor .a = 0.0;<br />

33 else<br />

34<br />

35 // perform one integration step .<br />

36 // field texture is accessed in RK4<br />

37 gl_FragColor = RK4 ( posVec .xyz , step -size , time );<br />

38<br />

39 // end if<br />

40 }<br />

41 // End of fragment shader<br />

42<br />

43 [ Vertex shader ] // input : as many vertices organized in<br />

107

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!