-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add GLM dependency and compilation works
- Loading branch information
Showing
3 changed files
with
6 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,8 @@ | ||
#version 450 // OpenGL 4.5 | ||
|
||
// from vertex shader | ||
layout(location = 0) in vec3 frag_color; | ||
// output color for framebuffer(blending) | ||
layout(location = 0) out vec4 out_color; | ||
|
||
void main() | ||
{ | ||
// we need to add alpha value to result color | ||
out_color = vec4(frag_color, 1.0); | ||
out_color = vec4(1.0, 0.0, 0.0, 1.0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,8 @@ | ||
#version 450 // OpenGL 4.5 | ||
|
||
// location = 0 means - color attachment buffer 0 | ||
layout(location = 0) out vec3 frag_color; // output color for vertex | ||
|
||
// triangle vertex positions directly in shader code | ||
// @note use () not {} in GLSL for inplace vector | ||
vec3 positions[3] = vec3[]( | ||
vec3(0.0, -0.4, 0.0), | ||
vec3(0.4, 0.4, 0.0), | ||
vec3(-0.4, 0.4, 0.0)); | ||
|
||
// triangle vertex colors directly in shader code | ||
vec3 colors[3] = vec3[]( | ||
vec3(1.0, 0.0, 0.0), | ||
vec3(0.0, 1.0, 0.0), | ||
vec3(0.0, 0.0, 1.0)); | ||
layout(location = 0) in vec3 pos; | ||
|
||
void main() | ||
{ | ||
gl_Position = vec4(positions[gl_VertexIndex], 1.0); | ||
frag_color = colors[gl_VertexIndex]; | ||
gl_Position = vec4(pos, 1.0); | ||
} |