source:
opengl-game/shaders/shader.vert@
fba08f2
| Last change on this file since fba08f2 was fba08f2, checked in by , 6 years ago | |
|---|---|
|
|
| File size: 717 bytes | |
| Rev | Line | |
|---|---|---|
| [4befb76] | 1 | #version 450 |
| [de32fda] | 2 | #extension GL_ARB_separate_shader_objects : enable |
| 3 | ||
| [fba08f2] | 4 | vec2 positions[3] = vec2[]( |
| 5 | vec2( 0.0, 0.5), | |
| 6 | vec2(-0.5, -0.5), | |
| 7 | vec2( 0.5, -0.5) | |
| 8 | ); | |
| 9 | ||
| [de32fda] | 10 | layout (binding = 0) uniform UniformBufferObject { |
| 11 | mat4 model; | |
| 12 | mat4 view; | |
| 13 | mat4 proj; | |
| 14 | } ubo; | |
| [4befb76] | 15 | |
| [80edd70] | 16 | layout(location = 0) in vec2 inPosition; |
| 17 | layout(location = 1) in vec3 inColor; | |
| [fba08f2] | 18 | layout(location = 2) in vec2 inTexCoord; |
| [4befb76] | 19 | |
| [80edd70] | 20 | layout(location = 0) out vec3 fragColor; |
| [fba08f2] | 21 | layout(location = 1) out vec2 fragTexCoord; |
| [4befb76] | 22 | |
| 23 | void main() { | |
| [fba08f2] | 24 | // gl_Position = ubo.proj * ubo.view * ubo.model * vec4(inPosition, 0.0, 1.0); |
| 25 | gl_Position = ubo.proj * ubo.view * ubo.model * vec4(positions[gl_VertexIndex], -5.0, 1.0); | |
| [80edd70] | 26 | fragColor = inColor; |
| [fba08f2] | 27 | fragTexCoord = inTexCoord; |
| [4befb76] | 28 | } |
Note:
See TracBrowser
for help on using the repository browser.
![(please configure the [header_logo] section in trac.ini)](/medieval/chrome/site/your_project_logo.png)