LearnOpenGL.com chapters ported to Haskell.
- Demo
- Motivation
- Getting Started
- Lighting
- Model Loading
- Advanced OpenGL
- Advanced Lighting
- Physically Based Rendering
- Release
- Develop
- Performance
- Contributing
- Help
- Vulkan
To see a demo of all examples run nix-build -A demo && ./result/bin/demo
LearnOpenGL.com is touted as one of the best learning resources for OpenGL programming. This repository is a first foray into porting the learning resources of https://learnopengl.com to Haskell. The ported examples here do not focus on fancy Haskell abstractions, but attempt to emphasize the domain using the raw OpenGL C bindings (built by @ekmett). The code is intended to be simple (and sometimes ugly) to demonstrate what's necesary to effectively use C and Haskell together in OpenGL. To help contribute to this effort please see Help.
See Hello Window.
- Link
- Haskell Implementation
- Link
- Haskell Implementation
- Link
- Haskell Implementation
- Link
- Haskell Implementation
- Link
- Haskell Implementation
- Link
- Haskell implementation
- Link
- See Colors
- Link
- Haskell implementation
Not yet implemented . Please help.
Not yet implemented . Please help.
Not yet implemented . Please help.
Not yet implemented . Please help.
Not yet implemented . Please help.
Not yet implemented. Please help.
Not yet implemented. Please help.
Not yet implemented. Please help.
Not yet implemented. Please help.
Not yet implemented. Please help.
Not yet implemented. Please help.
Not yet implemented. Please help.
To build the current project and demo script run the following:
nix-build
Entering a nix-shell
nix-shell
Adding new chapters is greatly appreciated, and will go a long way to making Haskell a first class citizen for Game development (with OpenGL).
See Contributing for more information.
There are many more advanced chapters to cover, the GettingStarted section being an necessary prerequisite. If one is so inclined to contribute to this effort I recommend doing the following:
- Clone this repo at https://github.com/dmjio/LearnOpenGL.hs
- Edit
Main.hs
to be the implementation of a chapter that interests you (the current convention is one module per chapter -- built as an executable).- Note: Most chapters build off each other, so going through all examples and building the next one in order is advised.
- Edit the shaders found in the top-level current directory of the project (or add your own as you see fit).
- Build the project with
nix-build -A app
(makes linking the C libraries into your Haskell executable much simpler not so problematic).- For more interactive develpment you can call
nix-shell
and then usecabal run opengl-exp
to run the project (linking shouldn't be a problem w/nix
). - Note: the shaders are loaded dynamically.
- Calling
nix-build -A app
will only build the top levelopengl-exp
project.
- For more interactive develpment you can call
- When done with your implementation, copy all assets from the top-level
opengl-exp
(Main.hs, shaders, etc.) into its own subfolder.- For example,
Lighting/YourChapterGoesHere/{Main.hs,vert.glsl,etc..}
. - To see an example of script that does this for you check create.sh
- For example,
- Update the
default.nix
script to include your chapter in the demo executable. - Update the
README.md
with links to your chapter.
Many people have asked why I focussed on OpenGL instead of Vulkan. The short answer is that despite Vulkan being the future of game development, it is much more difficult (especially for beginners to GPU programming). Additionally, most Vulkan learning resources have recommended OpenGL as a good learning prerequisite. OpenGL also has a much larger body of knowledge currently, making it a good first step in the learning journey. Lastly, https://learnvulkan.com/ would be a good Haskell port to have as well, when it reaches maturity.