glhash is an OpenGL compute shader implementing SHA-2-256 in GLSL.
glhash is a OpenGL 4.x compute shader demo using gl2_nano,
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.
src/gl4_hash.c- OpenGL 4.x compute demo usinggl2_nano.hloader.src/gl2_nano.h- header functions for OpenGL buffers and shaders.
This project template uses ExternalProject to build and link the
GLFW and Glad libraries. These projects have stable APIs with stable
symbols, so in this case it is a deliberate choice to use the latest
versions. This has the advantage of avoiding submodules.
It is possible to build using the system GLFW found using PkgConfig,
however, we believe ExternalProject is a good choice for OpenGL samples
that prefer the latest version of GLFW versus a buggy or misconfigured
version bundled with the operating system.
The following cmake configuration options are offered:
-DVULKAN_SDK=<path_to_vulkan_sdk>(used to find glslangValidator)-DSPIRV_BINARIES=OFF(default ON if glslangValidator is found)-DEXTERNAL_GLFW=OFF(default ON, if disabled, pkg-config is used)-DEXTERNAL_GLAD=OFF(default ON, if disabled, glad is not used)
To invoke the example using GLSL shader source:
./build/gl4_hash
To invoke the example using SPIR-V binary module:
./build/gl4_hash --spir
glhash has been tested on the following operating systems:
- Ubuntu 24.04 LTS
- FreeBSD 14.3
- Windows 11
glhash requires the following dependencies:
- Microsoft Windows plus Visual Studio 2022 with CMake and C/C++.
- Linux or FreeBSD with GCC or Clang and CMake plus Ninja.
cmake -B build -G Ninja
cmake --build build