Changeset 4f63fa8 in opengl-game for vulkan-game.cpp


Ignore:
Timestamp:
Aug 2, 2019, 5:17:11 PM (5 years ago)
Author:
Dmitry Portnoy <dmitry.portnoy@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
2c87504, adcd252
Parents:
fba08f2
Message:

Fix the MVP matrix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vulkan-game.cpp

    rfba08f2 r4f63fa8  
    110110
    111111const 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}}
    116116};
    117117
     
    14661466         UniformBufferObject ubo = {};
    14671467         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));
    14691469         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
    14731471
    14741472         void* data;
Note: See TracChangeset for help on using the changeset viewer.