diff --git a/Debug/Window_practice.exe b/Debug/Window_practice.exe index 259910a..1d658c3 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 9d215c7..4709e0c 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 08f1725..6912edf 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 6a96939..22a9aa5 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..2226f79 100644 --- a/Window_practice/Debug/Window_practice.log +++ b/Window_practice/Debug/Window_practice.log @@ -1,2 +1,10 @@  Main.cpp +C:\dev\Glfw_Practice\c++\Window_practice\Window_practice\src\VertexBufferLayout.h(5,10): warning C4067: unexpected tokens following preprocessor directive - expected a newline + Rernderer.cpp + VertexArray.cpp +C:\dev\Glfw_Practice\c++\Window_practice\Window_practice\src\VertexBufferLayout.h(5,10): warning C4067: unexpected tokens following preprocessor directive - expected a newline + Generating Code... +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 'vc120.pdb' was not found with 'glew32s.lib(glew.obj)' or at 'C:\dev\Glfw_Practice\c++\Window_practice\Debug\vc120.pdb'; 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/CL.command.1.tlog b/Window_practice/Debug/Window_practice.tlog/CL.command.1.tlog index d3f6f4b..30e312e 100644 Binary files a/Window_practice/Debug/Window_practice.tlog/CL.command.1.tlog and b/Window_practice/Debug/Window_practice.tlog/CL.command.1.tlog differ diff --git a/Window_practice/Debug/Window_practice.tlog/CL.read.1.tlog b/Window_practice/Debug/Window_practice.tlog/CL.read.1.tlog index ff2c7d9..830722c 100644 Binary files a/Window_practice/Debug/Window_practice.tlog/CL.read.1.tlog and b/Window_practice/Debug/Window_practice.tlog/CL.read.1.tlog differ diff --git a/Window_practice/Debug/Window_practice.tlog/CL.write.1.tlog b/Window_practice/Debug/Window_practice.tlog/CL.write.1.tlog index 908397d..746aeb1 100644 Binary files a/Window_practice/Debug/Window_practice.tlog/CL.write.1.tlog and b/Window_practice/Debug/Window_practice.tlog/CL.write.1.tlog differ diff --git a/Window_practice/Debug/Window_practice.tlog/link.command.1.tlog b/Window_practice/Debug/Window_practice.tlog/link.command.1.tlog index 8536775..9e14e8d 100644 Binary files a/Window_practice/Debug/Window_practice.tlog/link.command.1.tlog and b/Window_practice/Debug/Window_practice.tlog/link.command.1.tlog differ 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 a753cd3..8ab241a 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/Window_practice.tlog/link.write.1.tlog b/Window_practice/Debug/Window_practice.tlog/link.write.1.tlog index ef1a633..e5f7702 100644 Binary files a/Window_practice/Debug/Window_practice.tlog/link.write.1.tlog and b/Window_practice/Debug/Window_practice.tlog/link.write.1.tlog differ diff --git a/Window_practice/Debug/vc142.idb b/Window_practice/Debug/vc142.idb index f0560b3..b15abdc 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 341b1b2..9845afc 100644 Binary files a/Window_practice/Debug/vc142.pdb and b/Window_practice/Debug/vc142.pdb differ diff --git a/Window_practice/Window_practice.vcxproj b/Window_practice/Window_practice.vcxproj index 4a974b3..d658f02 100644 --- a/Window_practice/Window_practice.vcxproj +++ b/Window_practice/Window_practice.vcxproj @@ -148,13 +148,16 @@ + + + diff --git a/Window_practice/Window_practice.vcxproj.filters b/Window_practice/Window_practice.vcxproj.filters index e280cae..3c07f0e 100644 --- a/Window_practice/Window_practice.vcxproj.filters +++ b/Window_practice/Window_practice.vcxproj.filters @@ -27,6 +27,9 @@ Source Files + + Source Files + @@ -41,6 +44,12 @@ Header Files + + Header Files + + + Header Files + diff --git a/Window_practice/src/Main.cpp b/Window_practice/src/Main.cpp index e7e32d3..33a3777 100644 --- a/Window_practice/src/Main.cpp +++ b/Window_practice/src/Main.cpp @@ -9,6 +9,7 @@ #include "Renderer.h" #include "VertexBuffer.h" #include "IndexBuffer.h" +#include "VertexArray.h" struct ShaderProgramSource { std::string VertexSource; @@ -71,7 +72,6 @@ static unsigned int CompileShader(unsigned int type, const std::string& source) return 0; } - return id; } @@ -100,7 +100,7 @@ int main(void){ //OpenGL version and profile glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); - glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); + glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); //core does not have deafult vao //Main window creation GLFWwindow* window = glfwCreateWindow(640, 480, "OpenGl practice", NULL, NULL); @@ -129,7 +129,7 @@ int main(void){ -0.5f, 0.5f }; - //index buffer + //index buffer indecies unsigned int indecies[]{ 0, 1, 2, 2, 3, 0 @@ -140,22 +140,15 @@ int main(void){ GLCall(glGenVertexArrays(1, &vao)); GLCall(glBindVertexArray(vao)); - //Vertex buffer(s) + VertexArray va; VertexBuffer vb(positions, 4 * 2 * sizeof(float)); - - GLCall(glEnableVertexAttribArray(0)); - GLCall(glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 2, 0)); - - //index buffer + VertexBufferLayout layout; + layout.Push(2); + va.AddBuffer(vb, layout); IndexBuffer ib(indecies, 6); - //Shader to console ShaderProgramSource source = ParseShader("res/shaders/Basic.shader"); - /*std::cout << "VERTEX" << std::endl; - std::cout << source.VertexSource << std::endl; //to write shader to console - std::cout << "FRAGMENT" << std::endl; - std::cout << source.FragmentSource << std::endl;*/ - + //Creating the shader unsigned int shader = CreateShader(source.VertexSource, source.FragmentSource); glUseProgram(shader); @@ -184,7 +177,7 @@ int main(void){ GLCall(glUseProgram(shader)); GLCall(glUniform4f(location, r, 0.3f, 0.8f, 1.0f)); - GLCall(glBindVertexArray(vao)); + va.Bind(); ib.Bind(); GLCall(glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, nullptr)); @@ -207,4 +200,4 @@ int main(void){ } glfwTerminate(); return 0; -} \ No newline at end of file +} \ No newline at end of file