Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/branches/Shader_HS18/programs/Example/GLSLES/SwizzleGP.glsles @ 12091

Last change on this file since 12091 was 12091, checked in by wiesep, 5 years ago

Updated programs and adjusted Material to work with GLSL>150

File size: 3.1 KB
Line 
1#version 120                                                                                                                                                           
2#extension GL_EXT_geometry_shader4 : enable                                                                                                     
3
4uniform vec4 origColor;                                                                                                                                         
5uniform vec4 cloneColor;                                                                                                                                       
6
7void main(void)                                                                                                                                                         
8{                                                                                                                                                                                       
9
10        //increment variable                                                                                                                                   
11        int i;                                                                                                                                                                 
12
13        /////////////////////////////////////////////////////////////                                                   
14        //This example has two parts                                                                                                                   
15        //      step a) draw the primitive pushed down the pipeline                                                                     
16        //               there are gl_Vertices # of vertices                                                                                   
17        //               put the vertex value into gl_Position                                                                                 
18        //               use EmitVertex => 'create' a new vertex                                                                               
19        //              use EndPrimitive to signal that you are done creating a primitive!                             
20        //      step b) create a new piece of geometry (I.E. WHY WE ARE USING A GEOMETRY SHADER!)       
21        //              I just do the same loop, but swizzle the x and y values                                                 
22        //      result => the line we want to draw, and the same line, but along the other axis         
23
24        //Pass-thru!                                                                                                                                                   
25        for(i=0; i< gl_VerticesIn; i++){                                                                                                               
26                gl_Position = gl_PositionIn[i];                                                                                                         
27                gl_FrontColor = origColor;                                                                                                                     
28                EmitVertex();                                                                                                                                           
29        }                                                                                                                                                                               
30        EndPrimitive();                                                                                                                                                 
31        //New piece of geometry!  We just swizzle the x and y terms                                                             
32        for(i=0; i< gl_VerticesIn; i++){                                                                                                               
33                gl_Position = gl_PositionIn[i];                                                                                                         
34                gl_Position.xy = gl_Position.yx;                                                                                                       
35                gl_FrontColor = cloneColor;                                                                                                                     
36                EmitVertex();                                                                                                                                           
37        }                                                                                                                                                                               
38        EndPrimitive();                                                                                                                                                 
39
40}
41#version 120                                                                                                                                                           
42#extension GL_EXT_geometry_shader4 : enable                                                                                                     
43
44uniform vec4 origColor;                                                                                                                                         
45uniform vec4 cloneColor;                                                                                                                                       
46
47void main(void)                                                                                                                                                         
48{                                                                                                                                                                                       
49
50        //increment variable                                                                                                                                   
51        int i;                                                                                                                                                                 
52
53        /////////////////////////////////////////////////////////////                                                   
54        //This example has two parts                                                                                                                   
55        //      step a) draw the primitive pushed down the pipeline                                                                     
56        //               there are gl_Vertices # of vertices                                                                                   
57        //               put the vertex value into gl_Position                                                                                 
58        //               use EmitVertex => 'create' a new vertex                                                                               
59        //              use EndPrimitive to signal that you are done creating a primitive!                             
60        //      step b) create a new piece of geometry (I.E. WHY WE ARE USING A GEOMETRY SHADER!)       
61        //              I just do the same loop, but swizzle the x and y values                                                 
62        //      result => the line we want to draw, and the same line, but along the other axis         
63
64        //Pass-thru!                                                                                                                                                   
65        for(i=0; i< gl_VerticesIn; i++){                                                                                                               
66                gl_Position = gl_PositionIn[i];                                                                                                         
67                gl_FrontColor = origColor;                                                                                                                     
68                EmitVertex();                                                                                                                                           
69        }                                                                                                                                                                               
70        EndPrimitive();                                                                                                                                                 
71        //New piece of geometry!  We just swizzle the x and y terms                                                             
72        for(i=0; i< gl_VerticesIn; i++){                                                                                                               
73                gl_Position = gl_PositionIn[i];                                                                                                         
74                gl_Position.xy = gl_Position.yx;                                                                                                       
75                gl_FrontColor = cloneColor;                                                                                                                     
76                EmitVertex();                                                                                                                                           
77        }                                                                                                                                                                               
78        EndPrimitive();                                                                                                                                                 
79
80}
Note: See TracBrowser for help on using the repository browser.