Skip to content
This repository has been archived by the owner on Mar 13, 2021. It is now read-only.
/ learnopengl Public archive

Stripped down template for learning OpenGL

Notifications You must be signed in to change notification settings

ranguli/learnopengl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

learnopengl

Getting Started

This whole template is designed to be the easiest way to start writing OpenGL code. You can begin in three commands! Tell me about it.

Install & Usage

git clone --recursive https://github.com/ranguli/learnopengl

cd ./learnopengl && cmake -DC_MAKE_TYPE=Debug . && make

Dependencies

General

git, make, gcc, and cmake are required and are easy to find yourself in your package manager.

Ubuntu

xorg-dev

Fedora

libXrandr-devel (We can add actually add libXrandr as a Git submodule and compile it automatically via CMake!) libXinerama-devel(We can do this too!)

Features

  • Randomly added Lua API

If you have Lua and all the headers, CMake will link it. This is really exciting, because Lua has a C API, is an embedded language (as in it's embedded in another language) and all sorts of other neat stuff. This means that if you use this template to explore building a game engine from scratch you'll have the opportunity to learn how to add scripting functionality. Coool.

Proposed Features

  • JavaScript Engine

Yes! Embed a JavaScript engine into the project to call (bi-directionally) code from JS to C and vice-versa. This actually really isn't hard and requires virtually no coding on our behalf, thanks to the Duktape project!

  • Networking (Years down the road)

Cython so that a Python-based server could do networking - Cython is pretty fast, and Flask / Django stuff is very scalable. No idea what Lua is like for networked programming.

Linking libraries

Because this project uses CMake, linking libraries (that also use CMake) gets way easier (sorta.) Basically each library is linked and targeted with two lines in the CMakeLists.txt file. Even if you don't know how CMake works (I sure don't!) I encourage you to figure out which 2 lines it is - you'll learn something and you might feel like a wimp for not linking with gcc or make like a Unix demi-god.

What about my glad.h, glad generator, etc?

Because the glad repo itself is linked as a git submodule, as long as you clone the repo recursively then it will put glad into the repo. Because glad uses CMake, we linked to the glad sub-directory in our CMakeLists.txt file, and now we have no need to manually copy/move/ glad.c, glad.h, or any of the multiple files that Glad requires us to typically mess with.

Caveats

Right now it just supports GLFW and Glad. That's because linking libraries that don't use CMake isn't as easy as the CMake-ones.

If you're a little dissapointed that you didn't earn some chest hair by learning The Unix Way then read up on the Linking process (Including static vs. dynamic linking) here, here, here, here and here