Added folder for opengl lessons
This commit is contained in:
parent
11fc1a33d8
commit
20fa19ad53
6 changed files with 52 additions and 5 deletions
|
@ -16,5 +16,5 @@ int main(int argc, char** argcv){
|
|||
|
||||
cout << c1 << "*" << c2 << "=" << c3 << endl;
|
||||
cout << c1 << "+" << c2 << "=" << c4 << endl;
|
||||
|
||||
|
||||
}
|
|
@ -1 +1,2 @@
|
|||
add_subdirectory(core)
|
||||
add_subdirectory(core)
|
||||
add_subdirectory(opengl)
|
|
@ -2,7 +2,7 @@
|
|||
#define CORE_CPU_TYPES_H
|
||||
|
||||
/*
|
||||
* Types for x86 arquitectures
|
||||
* Types for x86 architectures
|
||||
*/
|
||||
#if defined(__x86_64__)
|
||||
//Signed type alias
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
#include <iostream>
|
||||
#include "types.hpp"
|
||||
|
||||
using namespace::std;
|
||||
|
||||
|
||||
namespace Core {
|
||||
namespace Cpu {
|
||||
|
|
5
src/opengl/CMakeLists.txt
Normal file
5
src/opengl/CMakeLists.txt
Normal file
|
@ -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)
|
43
src/opengl/gl1.cpp
Normal file
43
src/opengl/gl1.cpp
Normal file
|
@ -0,0 +1,43 @@
|
|||
#include <GLFW/glfw3.h>
|
||||
|
||||
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;
|
||||
}
|
Loading…
Reference in a new issue