diff --git a/Debug/Window_practice.exe b/Debug/Window_practice.exe index fdc54b4..43f80cc 100644 Binary files a/Debug/Window_practice.exe and b/Debug/Window_practice.exe differ diff --git a/Debug/Window_practice.pdb b/Debug/Window_practice.pdb index 7e260ea..348f7a3 100644 Binary files a/Debug/Window_practice.pdb and b/Debug/Window_practice.pdb differ diff --git a/Window_practice/Debug/Main.obj b/Window_practice/Debug/Main.obj index 072cbd9..94555a8 100644 Binary files a/Window_practice/Debug/Main.obj and b/Window_practice/Debug/Main.obj differ diff --git a/Window_practice/Debug/Window_practice.ilk b/Window_practice/Debug/Window_practice.ilk index 5e2b014..ee8c681 100644 Binary files a/Window_practice/Debug/Window_practice.ilk and b/Window_practice/Debug/Window_practice.ilk differ diff --git a/Window_practice/Debug/Window_practice.log b/Window_practice/Debug/Window_practice.log index 7f84570..a75dc57 100644 --- a/Window_practice/Debug/Window_practice.log +++ b/Window_practice/Debug/Window_practice.log @@ -1,2 +1,5 @@  Main.cpp +LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library +LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library +glew32s.lib(glew.obj) : warning LNK4099: PDB '' was not found with 'glew32s.lib(glew.obj)' or at ''; linking object as if no debug info Window_practice.vcxproj -> C:\dev\Glfw_Practice\c++\Window_practice\Debug\Window_practice.exe diff --git a/Window_practice/Debug/Window_practice.tlog/link.read.1.tlog b/Window_practice/Debug/Window_practice.tlog/link.read.1.tlog index d98202f..aaab8f2 100644 Binary files a/Window_practice/Debug/Window_practice.tlog/link.read.1.tlog and b/Window_practice/Debug/Window_practice.tlog/link.read.1.tlog differ diff --git a/Window_practice/Debug/vc142.idb b/Window_practice/Debug/vc142.idb index 30e8081..202cb9e 100644 Binary files a/Window_practice/Debug/vc142.idb and b/Window_practice/Debug/vc142.idb differ diff --git a/Window_practice/Debug/vc142.pdb b/Window_practice/Debug/vc142.pdb index 5654d6e..faaba5c 100644 Binary files a/Window_practice/Debug/vc142.pdb and b/Window_practice/Debug/vc142.pdb differ diff --git a/Window_practice/src/Main.cpp b/Window_practice/src/Main.cpp index 5d85638..b36f5ac 100644 --- a/Window_practice/src/Main.cpp +++ b/Window_practice/src/Main.cpp @@ -112,21 +112,36 @@ int main(void){ std::cout << "OpenGL version: " << glGetString(GL_VERSION) << std::endl; //vertex positions - float positions[6] = { - -0.5f, -0.5f, //Vertex2f - 0.0f, 0.5f, //Vertex2f - 0.5f, -0.5f //Vertex2f + float positions[] = { + -0.5f, -0.5f, + 0.5f, -0.5f, + 0.5f, 0.5f, + -0.5f, 0.5f }; + //index buffer + unsigned int indecies[]{ + 0, 1, 2, + 2, 3, 0 + }; + + + //Vertex buffer(s) unsigned int buffer; glGenBuffers(1, &buffer); //number of buffer to generate glBindBuffer(GL_ARRAY_BUFFER, buffer); //binding the buffer - glBufferData(GL_ARRAY_BUFFER, 6 * sizeof(float), positions, GL_STATIC_DRAW); + glBufferData(GL_ARRAY_BUFFER, 6 * 2 * sizeof(float), positions, GL_STATIC_DRAW); glEnableVertexAttribArray(0); glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 2, 0); + //index buffer setup + unsigned int ibo; //index buffer object + glGenBuffers(1, &ibo); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo); //binding the buffer + glBufferData(GL_ELEMENT_ARRAY_BUFFER, 6 * sizeof(unsigned int), indecies, GL_STATIC_DRAW); + ShaderProgramSource source = ParseShader("res/shaders/Basic.shader"); std::cout << "VERTEX" << std::endl; std::cout << source.VertexSource << std::endl; @@ -143,7 +158,7 @@ int main(void){ /* Render here */ glClear(GL_COLOR_BUFFER_BIT); - glDrawArrays(GL_TRIANGLES, 0, 3); //without index buffer + glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, nullptr); /* Swap front and back buffers */ glfwSwapBuffers(window);