Changeset 4f63fa8 in opengl-game
- Timestamp:
- Aug 2, 2019, 5:17:11 PM (5 years ago)
- Branches:
- feature/imgui-sdl, master, points-test
- Children:
- 2c87504, adcd252
- Parents:
- fba08f2
- Files:
-
- 1 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
shaders/shader.frag
rfba08f2 r4f63fa8 10 10 11 11 void main() { 12 // outColor = vec4(fragColor, 1.0);13 // outColor = texture(texSampler, fragTexCoord);14 12 outColor = vec4(fragColor * texture(texSampler, fragTexCoord).rgb, 1.0); 15 13 } -
shaders/shader.vert
rfba08f2 r4f63fa8 1 1 #version 450 2 2 #extension GL_ARB_separate_shader_objects : enable 3 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 3 10 4 layout (binding = 0) uniform UniformBufferObject { … … 22 16 23 17 void main() { 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); 18 gl_Position = ubo.proj * ubo.view * ubo.model * vec4(inPosition, 0.0, 1.0); 26 19 fragColor = inColor; 27 20 fragTexCoord = inTexCoord; -
vulkan-game.cpp
rfba08f2 r4f63fa8 110 110 111 111 const vector<Vertex> vertices = { 112 {{-0.5f, -0.5f}, {1.0f, 0.0f, 0.0f}, { 1.0f, 0.0f}},113 {{ 0.5f, -0.5f}, {0.0f, 1.0f, 0.0f}, { 0.0f, 0.0f}},114 {{ 0.5f, 0.5f}, {0.0f, 0.0f, 1.0f}, { 0.0f, 1.0f}},115 {{-0.5f, 0.5f}, {1.0f, 1.0f, 1.0f}, { 1.0f, 1.0f}}112 {{-0.5f, -0.5f}, {1.0f, 0.0f, 0.0f}, {0.0f, 1.0f}}, 113 {{ 0.5f, -0.5f}, {0.0f, 1.0f, 0.0f}, {1.0f, 1.0f}}, 114 {{ 0.5f, 0.5f}, {0.0f, 0.0f, 1.0f}, {1.0f, 0.0f}}, 115 {{-0.5f, 0.5f}, {1.0f, 1.0f, 1.0f}, {0.0f, 0.0f}} 116 116 }; 117 117 … … 1466 1466 UniformBufferObject ubo = {}; 1467 1467 ubo.model = glm::rotate(glm::mat4(1.0f), time * glm::radians(90.0f), glm::vec3(0.0f, 0.0f, 1.0f)); 1468 ubo.view = glm::lookAt(glm::vec3( 2.0f, 2.0f, 2.0f), glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 0.0f, 1.0f));1468 ubo.view = glm::lookAt(glm::vec3(0.0f, 2.0f, 2.0f), glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 1.0f, 0.0f)); 1469 1469 ubo.proj = glm::perspective(glm::radians(45.0f), swapChainExtent.width / (float)swapChainExtent.height, 0.1f, 10.0f); 1470 ubo.proj[1][1] *= -1; 1471 1472 ubo.view = glm::mat4(1.0f); 1470 ubo.proj[1][1] *= -1; // flip the y-axis so that +y is up 1473 1471 1474 1472 void* data;
Note:
See TracChangeset
for help on using the changeset viewer.