GithubHelp home page GithubHelp logo

athaun / opengl-template Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hoshiningen/opengl-template

0.0 0.0 0.0 46 KB

This is a template CMake project, pre-configured to link with GLFW, GLAD, and OpenGL.

License: MIT License

C++ 16.31% CMake 83.69%

opengl-template's Introduction


This repository is a template OpenGL project configured using CMake. It supports cross-platform builds, and provides a good starting point to begin OpenGL development.

Usage

The intended usage for this repository is to be a template for future Github repositories. See this guide for more information.

Building

To configure and build the project, do the following from the root directory of the repository:

mkdir build
cd build
cmake ..

This will configure the CMake and will generate platform-specific build files. To build, execute the following from within the build directory:

cmake --build .

Or build using whatever generated build system CMake produced.

Third Party Library Support

By default, the CMake project will automatically link with GLAD, GLFW, and OpenGL. There is optional built-in support for a few other ubiquitous libraries. Create an issue to request default support for additional libraries, or make a pull request with your addition.

GLAD

GLAD loader files will be generated based on the CMake cache variables set in CMakeLists.txt. Setting these variables allows one to specify the parameters for the loader similar to what the corresponding webservice allows you to do.

GLFW

GLFW is linked automatically against the main project. This works without requiring any additional dependencies to be installed on Windows, but Linux may require some additional steps depending on your environment:

  1. Make sure you have a working compiler (GCC / CLANG) and build system, and that they're accessible to CMake. Stable versions of GCC (note: this project supports C++17 by default) and Make can be pulled down through:

    sudo apt-get install build-essential
  2. X11 may need to be installed for OpenGL window creation:

    sudo apt-get install libx11-dev
  3. RandR headers (dependency of X11) may need to be installed as well:

    sudo apt-get install xorg-dev libglu1-mesa-dev

Optional Libraries

There is built-in support for linking with a few other libraries that are well-known in the OpenGL community. These libraries are supported through the LinkXXXX.cmake scripts found in the cmake directory.

Some of these are configured to be optionally added as sub-projects, such as ASSIMP:

set(ENABLE_ASSIMP   OFF CACHE BOOL "Add Open Asset Import Library (assimp) to the project" FORCE)

Setting these flags to ON will add them to the project and will link them with the main executable. Depending on how you extend the project structure after the template is used, you may have to manually link with these libraries again with your sub-projects.

This can be accomplished by adding the following lines:

include(${CMAKE_DIR}/<Linking Script>.cmake)
<Linking Script>(<Target> <Access>)

Where <Linking Script> is the name of the CMake script and linking macro, <Target> is the build target to link against, and <Access> is the access specifier for the linkage / header inclusion.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.