Skip to content

Commit d183ab8

Browse files
krupitskasozkriff
andauthored
N14: OpenGL Preprocessor (#285)
* Newsletter 14: OpenGL preprocessor * Update index.md * N14: gl-tera: Style tweak Co-authored-by: Andrey Lesnikov <[email protected]>
1 parent a602910 commit d183ab8

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

content/posts/newsletter-014/index.md

+23
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,29 @@ prior to Jan 1, 2021.
127127

128128
## Learning Material Updates
129129

130+
### [OpenGL Preprocessor for Rust]
131+
132+
With the full power of Cargo build scripts and [Tera], you can create an advanced
133+
GLSL preprocessor which can generate code conditionally, in loops, and even
134+
inherit code from other templates.
135+
136+
![An OpenGL preprocessor for Rust](opengl_preprocessor.png)
137+
138+
Writing plain GLSL code is uncomfortable, code is quite often is duplicated, libraries
139+
aren't something natural for GLSL (means you can't out of the box do #include "library.glsl").
140+
The last point is especially problematic if some constants actually originate in
141+
your game logic (like the number of player types). Updating these values manually
142+
in your shader code is repetitive and prone to both error and simple forgetfulness.
143+
It's really helpful to build some kind of preprocessor for your GLSL code,
144+
which can include other files, so you can organize your code into manageable chunks.
145+
With the power of [Tera], it's now easy to accomplish.
146+
Because Rust is also often used for web projects, which need a lot of templated
147+
web-pages preprocessing, we can borrow such technology for our needs,
148+
combine it with cargo build scripts and create a compile-time preprocessing tool.
149+
150+
[tera]: https://tera.netlify.app
151+
[OpenGL Preprocessor for Rust]: https://codecrash.me/an-opengl-preprocessor-for-rust
152+
130153
## Library & Tooling Updates
131154

132155
### [Thunderdome]
Loading

0 commit comments

Comments
 (0)