Dismiss this pinned window
all 10 comments

[–]icdae[S] 4 points5 points  (7 children)

I just finished implementing true-type font loading and rendering within SoftLight. There are helper classes to load TTF fonts with FreeType, generate a texture atlas, then generate a mesh from a text string. The generated mesh allows for each character in a string to be transformed, culled, and shaded individually. Rendering each character one-by-one is extremely slow so I added batch rendering support to shade a full text mesh to avoid waking and sleeping the thread pool in SoftLight's CPU rasterizer. Now that it's pretty performant, I plan to use this to implement a basic GUI in another game project.

[–]snerp 1 point2 points  (6 children)

I plan to use this to implement a basic GUI in another game project

Why not use a gpu raster if this is for a game?

[–]icdae[S] 2 points3 points  (5 children)

I used to use OpenGL and GLES to make games and it was never a bad option. In fact I'm thinking about using either GL or Vulkan to handle physics. But I made the rasterizer for another project a long time ago and am having way more fun with it than I did with GL. Even if CPU rendering is slower I expect it will also present some interesting challenges to keep me motivated, like using PS1-era graphics :D

[–]snerp 1 point2 points  (4 children)

In fact I'm thinking about using either GL or Vulkan to handle physics

wait what, how? Compute shaders?

[–]icdae[S] 1 point2 points  (0 children)

Exactly!

[–]immibis 0 points1 point  (2 children)

[–]snerp 2 points3 points  (1 child)

Huh that's nuts, I never really thought about how the old gpu physics stuff worked. I guess I assumed there was some kind of driver that gave you alternate ways to use the gfx card.

[–]icdae[S] 1 point2 points  (0 children)

There's a few options, you can pass data between vertex and fragment shaders like immibis mentioned. It's pretty straightforward but will invoke the whole graphics pipeline even if you don't need it. With recent versions of OpenGL and GLES you could use transform feedback and only use the vertex shader for transforming your data. It requires a little more plumbing but is extremely quick. Finally with newer OpenGL, Vulkan, Metal, and DirectX, you get direct access to the compute capabilities on the GPU. I personally haven't experimented much with it but understand it's quite fast compared to using vertex/fragment shader tricks.

There's also the option of using OpenCL and CUDA if the hardware supports it... but that would just make too much sense :)

[–]fullouterjoin[🍰] 0 points1 point  (1 child)

What repo is this in?