Skip to content

michaeljclark/glcube

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

glcube

glcube is an OpenGL demo written in C11 that renders a rotating cube using programmable shaders. it depends on gl2_nano, a lightweight helper library that provides a simple vertex and index buffer abstraction, along with utilities for loading, compiling, and linking OpenGL shader programs.

glcube

Introduction

glcube is an app skeleton using gl2_nano, a framework for creating apps using the modern OpenGL and GLSL shader pipeline. this work is intended to be used as a template for tiny OpenGL demos. The shader uses the maj2random noise function derived from SHA-2, combined with UVs to create surface noise.

Project Structure

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

Build Instructions

glcube has been tested on the following operating systems:

  • Ubuntu 24.04 LTS
  • FreeBSD 14.3
  • Windows 11
  • macOS 15

glcube requires the following dependencies:

  • Microsoft Windows plus Visual Studio 2022 with CMake and C/C++.
  • Apple macOS with XCode Developer Tools and CMake plus Ninja.
  • Linux or FreeBSD with GCC or Clang and CMake plus Ninja.
cmake -B build -G Ninja
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 the same as gl2_cube with the addition of vertex array objects from OpenGL 3.x.

gl4_cube

gl4_cube is the same as gl3_cube with the addition of uniform buffer objects from OpenGL 4.x.

About

OpenGL CMake project template using C99 linmath.h

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published