Last change
on this file since 12319 was
12115,
checked in by wiesep, 6 years ago
|
Changed folder structure, deletet some unused files and cleaned up code
|
File size:
1.2 KB
|
Rev | Line | |
---|
[12115] | 1 | #version 120 |
---|
| 2 | #extension GL_EXT_geometry_shader4 : enable |
---|
| 3 | |
---|
| 4 | uniform vec4 origColour; |
---|
| 5 | uniform vec4 cloneColour; |
---|
| 6 | |
---|
| 7 | void main(void) |
---|
| 8 | { |
---|
| 9 | ///////////////////////////////////////////////////////////// |
---|
| 10 | //This example has two parts |
---|
| 11 | // step a) draw the primitive pushed down the pipeline |
---|
| 12 | // there are gl_Vertices # of vertices |
---|
| 13 | // put the vertex value into gl_Position |
---|
| 14 | // use EmitVertex => 'create' a new vertex |
---|
| 15 | // use EndPrimitive to signal that you are done creating a primitive! |
---|
| 16 | // step b) create a new piece of geometry (I.E. WHY WE ARE USING A GEOMETRY SHADER!) |
---|
| 17 | // I just do the same loop, but swizzle the x and y values |
---|
| 18 | // result => the line we want to draw, and the same line, but along the other axis |
---|
| 19 | |
---|
| 20 | //Pass-thru! |
---|
| 21 | int i; |
---|
| 22 | for (i = 0; i < gl_VerticesIn; i++) { |
---|
| 23 | gl_Position = gl_PositionIn[i]; |
---|
| 24 | gl_FrontColor = origColour; |
---|
| 25 | EmitVertex(); |
---|
| 26 | } |
---|
| 27 | EndPrimitive(); |
---|
| 28 | |
---|
| 29 | //New piece of geometry! We just swizzle the x and y terms |
---|
| 30 | for (i = 0; i < gl_VerticesIn; i++){ |
---|
| 31 | gl_Position = gl_PositionIn[i]; |
---|
| 32 | gl_Position.xy = gl_Position.yx; |
---|
| 33 | gl_FrontColor = cloneColour; |
---|
| 34 | EmitVertex(); |
---|
| 35 | } |
---|
| 36 | EndPrimitive(); |
---|
| 37 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.