modify main
This commit is contained in:
parent
96a324e5b7
commit
e1ddb44f44
12
src/Main.cpp
12
src/Main.cpp
@ -118,7 +118,6 @@ static int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevI
|
||||
Texture2D background;
|
||||
int width, height, nrChannels;
|
||||
// The FileSystem::getPath(...) is part of the GitHub repository so we can find files on any IDE/platform; replace it with your own image path.
|
||||
stbi_set_flip_vertically_on_load(true);
|
||||
unsigned char* data = stbi_load("./data/background/background.jpg", &width, &height, &nrChannels, 0);
|
||||
if (data) {
|
||||
background.Create(width, height, nrChannels, nullptr);
|
||||
@ -133,17 +132,10 @@ static int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevI
|
||||
Texture2D huaman;
|
||||
huaman.Create(imageWidth, imageHeight, 4, nullptr);
|
||||
|
||||
Texture2D huamanFace;
|
||||
huamanFace.Create(imageWidth, imageHeight, 3, nullptr);
|
||||
Texture2D huamanFaceMask;
|
||||
huamanFace.Create(imageWidth, imageHeight, 3, nullptr);
|
||||
|
||||
Shader shader("./data/shader/texture.vs", "./data/shader/texture.fs");
|
||||
shader.use();
|
||||
shader.setInt("background", 0);
|
||||
shader.setInt("human", 1);
|
||||
shader.setInt("face", 2);
|
||||
shader.setInt("face_mask", 3);
|
||||
|
||||
while (!glfwWindowShouldClose(window)) {
|
||||
|
||||
@ -162,15 +154,11 @@ static int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevI
|
||||
projection = glm::perspective(glm::radians(60.f), ratio, 1.f, 1000.f);
|
||||
|
||||
ImageBuffer::Get()->Update(ImageBuffer::IBType::Human, &huaman);
|
||||
ImageBuffer::Get()->Update(ImageBuffer::IBType::Face, &huamanFace);
|
||||
ImageBuffer::Get()->Update(ImageBuffer::IBType::FaceMask, &huamanFaceMask);
|
||||
|
||||
glBindVertexArray(VAO);
|
||||
shader.use();
|
||||
background.Active(0);
|
||||
huaman.Active(1);
|
||||
huamanFace.Active(2);
|
||||
huamanFaceMask.Active(3);
|
||||
|
||||
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user