diff --git a/complex.cpp b/complex.cpp index 771cdbc..4f72495 100644 --- a/complex.cpp +++ b/complex.cpp @@ -16,5 +16,5 @@ int main(int argc, char** argcv){ cout << c1 << "*" << c2 << "=" << c3 << endl; cout << c1 << "+" << c2 << "=" << c4 << endl; - + } \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 82bfe4a..67aa2e3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1 +1,2 @@ -add_subdirectory(core) \ No newline at end of file +add_subdirectory(core) +add_subdirectory(opengl) \ No newline at end of file diff --git a/src/core/cpu/types.hpp b/src/core/cpu/types.hpp index c25cd5f..6c78077 100644 --- a/src/core/cpu/types.hpp +++ b/src/core/cpu/types.hpp @@ -2,7 +2,7 @@ #define CORE_CPU_TYPES_H /* - * Types for x86 arquitectures + * Types for x86 architectures */ #if defined(__x86_64__) //Signed type alias diff --git a/src/core/cpu/utils.hpp b/src/core/cpu/utils.hpp index 53035b8..c15989c 100644 --- a/src/core/cpu/utils.hpp +++ b/src/core/cpu/utils.hpp @@ -4,8 +4,6 @@ #include #include "types.hpp" -using namespace::std; - namespace Core { namespace Cpu { diff --git a/src/opengl/CMakeLists.txt b/src/opengl/CMakeLists.txt new file mode 100644 index 0000000..d5cd85d --- /dev/null +++ b/src/opengl/CMakeLists.txt @@ -0,0 +1,5 @@ +find_package(glfw3 3.3 REQUIRED) +find_package(OpenGL REQUIRED) +add_executable(gl1 gl1.cpp) +target_link_libraries(gl1 glfw) +target_link_libraries(gl1 OpenGL::GL) diff --git a/src/opengl/gl1.cpp b/src/opengl/gl1.cpp new file mode 100644 index 0000000..1ba9af8 --- /dev/null +++ b/src/opengl/gl1.cpp @@ -0,0 +1,43 @@ +#include + +int main(void) +{ + GLFWwindow* window; + + /* Initialize the library */ + if (!glfwInit()) + return -1; + + /* Create a windowed mode window and its OpenGL context */ + window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL); + if (!window) + { + glfwTerminate(); + return -1; + } + + /* Make the window's context current */ + glfwMakeContextCurrent(window); + + /* Loop until the user closes the window */ + while (!glfwWindowShouldClose(window)) + { + /* Render here */ + glClear(GL_COLOR_BUFFER_BIT); + + glBegin(GL_TRIANGLES); + glVertex2f(-1.0f,-1.0f); + glVertex2f(0.0f,1.0f); + glVertex2f(1.0f,-1.0f); + glEnd(); + + /* Swap front and back buffers */ + glfwSwapBuffers(window); + + /* Poll for and process events */ + glfwPollEvents(); + } + + glfwTerminate(); + return 0; +} \ No newline at end of file