-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
68 lines (57 loc) · 1.66 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include <mtlpp/mtlpp.hpp>
#include "window.hpp"
#include "MetalApp.h"
#include <vector>
#include <string>
//
//mtlpp::Device g_device;
//mtlpp::CommandQueue g_commandQueue;
//mtlpp::Buffer g_vertexBuffer;
//mtlpp::RenderPipelineState g_renderPipelineState;
//
//void MyRender(const AppMacOS &app)
//{
// // Get Command Buffer from Command Queue
// mtlpp::CommandBuffer commandBuffer = g_commandQueue.CommandBuffer();
//
// // Get Render Pass Description from window
// mtlpp::RenderPassDescriptor renderPassDesc = app.GetRenderPassDescriptor();
//
// if(renderPassDesc)
// {
// // Get Render Command Encoder
// mtlpp::RenderCommandEncoder renderCommandEncoder = commandBuffer.RenderCommandEncoder(renderPassDesc);
//
// // Set Render Pipeline State / Vertex Buffers / Draw Type
// renderCommandEncoder.SetRenderPipelineState(g_renderPipelineState);
// renderCommandEncoder.SetVertexBuffer(g_vertexBuffer, 0, 0);
// renderCommandEncoder.Draw(mtlpp::PrimitiveType::Triangle, 0, 3);
// renderCommandEncoder.EndEncoding();
//
// // Draw
// commandBuffer.Present(app.GetDrawable());
// }
//
// commandBuffer.Commit();
// commandBuffer.WaitUntilCompleted();
//
//
// cerr << "custom render func" << endl;
//}
int main(int argc, char *argv[])
{
std::vector<std::string> args;
for(int i = 1; i < argc; i++)
{
args.push_back(std::string(argv[i]));
}
MetalApp metalApp("Metal App", 1280, 720, args);
// // Create Window and pass render function to it
// Window win(g_device, &MyRender, 640, 480);
//
// // Run
// Window::Run();
// metalApp.setRender(&MyRender);
metalApp.run();
return 0;
}