sagedemage / opengl_2d_game

OpenGL 2D game written in C++
MIT License
0 stars 0 forks source link

OpenGL 2D Game

OpenGL 2D game written in C++

Dependencies

Install GLFW dependencies

sudo apt install libglfw3 libglfw3-dev 

Install GLEW dependencies

sudo apt install libglew-dev

Install SDL_mixer dependencies

sudo apt install libsdl2-dev libsdl2-mixer-dev

Setup Build Directory

cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON . -B build

Test OpenGL Works

Write simple OpenGL code to draw a triangle to test that OpenGL works.

/* Render here */
glClear(GL_COLOR_BUFFER_BIT);

// Draw triangle to test OpenGL works
glBegin(GL_TRIANGLES);
glVertex2f(-0.5f, -0.5f);
glVertex2f(0.0f, 0.5f);
glVertex2f(0.5f, -0.5f);
glEnd();

/* Swap front and back buffers */
glfwSwapBuffers(window);

C++ Linter

Installation

Install clang-tidy

sudo apt install clang-tidy

Useful Resources