Skip to content

OpenGL CMake project template using C99 linmath.h

Notifications You must be signed in to change notification settings

michaeljclark/glcube

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

glcube

glcube is OpenGL cube demo in C11 using programmable shaders. The demo uses the linmath.h and gl2_util.h headers which contain a simple vertex and index buffer abstraction, functions for loading and compiling shaders plus basic mouse navigation.

glcube

Introduction

glcube is an app skeleton using gl2_util.h, a nano framework for creating apps using the modern OpenGL and GLSL shader pipeline. The CMakeLists.txt is intended to be used as a template for tiny demos.

The shader uses a noise function derived from SHA-2, combined with UVs to create deterministic surface noise.

Project Structure

  • src/gl2_cube.c - OpenGL 2.1 cube using the gl2_util.h shader loader.
  • src/gl3_cube.c - OpenGL 3.2 cube using the gl2_util.h shader loader.
  • src/gl4_cube.c - OpenGL 4.5 cube using the gl2_util.h shader loader.
  • src/gl2_util.h - header functions for OpenGL buffers and shaders.
  • src/linmath.h - public domain linear algebra header functions.

Build Instructions

sudo apt-get install -y cmake ninja-build
cmake -G Ninja -B build .
cmake --build build

Examples

The project includes several versions of glcube ported to multiple APIs.

gl2_cube

gl2_cube is a 3D cube renderer using OpenGL 2.x and GLSL shaders.

gl3_cube

gl3_cube is mostly the same as gl2_cube with the addition of vertex array objects which were added in OpenGL 3.x.

gl4_cube

gl4_cube is mostly the same as gl3_cube with the addition of uniform buffer objects which were added in OpenGL 4.x.

About

OpenGL CMake project template using C99 linmath.h

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published