瀏覽代碼

no message

Hongtae Kim 6 年之前
父節點
當前提交
4af82416b3
共有 2 個檔案被更改,包括 41 行新增0 行删除
  1. 13
    0
      Data/triangle.frag
  2. 28
    0
      Data/triangle.vert

+ 13
- 0
Data/triangle.frag 查看文件

@@ -0,0 +1,13 @@
1
+#version 450
2
+
3
+#extension GL_ARB_separate_shader_objects : enable
4
+#extension GL_ARB_shading_language_420pack : enable
5
+
6
+layout (location = 0) in vec3 inColor;
7
+
8
+layout (location = 0) out vec4 outFragColor;
9
+
10
+void main() 
11
+{
12
+  outFragColor = vec4(inColor, 1.0);
13
+}

+ 28
- 0
Data/triangle.vert 查看文件

@@ -0,0 +1,28 @@
1
+#version 450
2
+
3
+#extension GL_ARB_separate_shader_objects : enable
4
+#extension GL_ARB_shading_language_420pack : enable
5
+
6
+layout (location = 0) in vec3 inPos;
7
+layout (location = 1) in vec3 inColor;
8
+
9
+layout (binding = 0) uniform UBO 
10
+{
11
+	mat4 projectionMatrix;
12
+	mat4 modelMatrix;
13
+	mat4 viewMatrix;
14
+} ubo;
15
+
16
+layout (location = 0) out vec3 outColor;
17
+
18
+out gl_PerVertex 
19
+{
20
+    vec4 gl_Position;   
21
+};
22
+
23
+
24
+void main() 
25
+{
26
+	outColor = inColor;
27
+	gl_Position = ubo.projectionMatrix * ubo.viewMatrix * ubo.modelMatrix * vec4(inPos.xyz, 1.0);
28
+}