1
0
forked from josh/JGL

69 Commits

Author SHA1 Message Date
Ori Sky Farrell
d4e9d1c906 FontCache: Use map for efficient glyph lookup
This patch updates CachedFont to now use an std::map for cached glyphs,
instead of an std::vector. std::map allows O(log n) lookup, whereas
std::vector only allows O(n) lookup.

Note: std::unordered_map technically has better lookup complexity here,
with amortized O(1) lookup. However, hashmaps have a higher inherent
overhead than red-black trees so this would only be viable when going
above around 100 entries, which should never happen here for ASCII
glyphs.
2024-07-15 10:54:49 +01:00
Ori Sky Farrell
ca9a238d98 J2D: Rewrite text rendering
This patch rewrites text rendering for J2D::DrawString to now construct
a texture atlas for all ASCII-range glyphs in the FT font face, instead
of cosntructing a texture for every glyph.

This improves text rendering performance for several reasons:

1. Binding textures is relatively expensive as the GPU is required to do
   a context switch for internal data like texture parameters, and also
   cannot optimize for accesses to the same texture across draw calls.
   This patch removes the need to call glBindTexture more than once per
   call to J2D::DrawString.
2. As a consequence of the above, all glyphs for a given string can now
   be rendered in a single call to glDrawArrays. This is done by storing
   the cached texture coordinates on CachedGlyph and constructing a full
   array of vertices and texture coordinates for the entire string at
   once, resulting in only /one/ set of client-to-device attribute
   uploads and only one draw call, instead of being required to upload
   attribute data for each glyph separately.
2024-07-15 10:40:27 +01:00
74a4705e44 Fix windows being picky. 2024-07-12 13:14:24 -04:00
ae327b96a5 Cleanup 2024-07-12 01:47:49 -04:00
eb3e037c96 Gradient FillRect + GradientLine Prerelease-21 2024-07-10 20:00:49 -04:00
672a363c53 Fluff the README a little. 2024-07-10 15:17:37 -04:00
6a16c3f87e Update main.cpp 2024-07-10 15:05:21 -04:00
23d3d1f378 Implement stub documentation & small refactors on J2D namespace 2024-07-10 15:05:46 -04:00
523806f9ef Rounded Fill Rect 2024-07-10 14:49:37 -04:00
d118ae2f8e Accept Color3 & Color4 2024-07-09 15:10:26 -04:00
5979ae41fc Performance optimization 2024-07-08 23:13:45 -04:00
652626b2e4 text Prerelease-19 2024-07-08 19:12:16 -04:00
a8145cb926 Update JGL.cpp
Setting glLineWidth inside of glBegin causes error 1282.
Prerelease-18
2024-07-07 19:59:10 -04:00
0914b496e7 Refactor & Fix inverted text & More 2024-07-07 17:10:51 -04:00
c62b58aa16 Font cache Prerelease-17 2024-07-06 22:51:25 -04:00
11ce9ac5fe ReCI test 2024-07-05 11:44:34 -04:00
7310825ddd ReCI test 2024-07-05 11:38:48 -04:00
513dc1e332 fixed syntax error in reci script 2024-07-05 10:56:43 -04:00
63bbb8794e Wrote local ReCI script for JGL 2024-07-05 10:54:59 -04:00
178f328728 ReCI test 2024-07-05 09:35:51 -04:00
1c74ee9c71 Add ReCI build test 2024-07-05 09:30:20 -04:00
608e9e29f5 Support for multiple fonts Prerelease-16 2024-07-05 05:31:25 -04:00
c53fa52f6f FreeType2 Prerelease-15 2024-06-29 15:07:02 -04:00
7fa75cac54 initial 2024-06-29 12:37:16 -04:00
Redacted
d5f9eaa5a8 Update CMakeLists.txt 2024-06-26 23:30:40 -04:00
dead018993 Update CMakeLists.txt Prerelease-14 2024-06-18 14:43:56 -04:00
Redacted
e9a339182b Update CMakeLists.txt 2024-06-18 14:22:10 -04:00
Redacted
076398b290 Update CMakeLists.txt 2024-06-18 14:19:45 -04:00
cf72d92c28 Merge branch 'master' of https://git.redacted.cc/josh/JGL Prerelease-13 2024-05-29 22:18:41 -04:00
5d99f8ec1f update 2024-05-29 22:18:40 -04:00
a388ee8021 Implement proper GL state management in DrawString2D, DrawString3D 2024-05-29 15:27:24 -04:00
41916a4089 Update JGL.cpp Release-12 2024-05-29 15:05:06 -04:00
222dd346fb Fix memleak Prerelease-11 2024-05-27 20:48:22 -04:00
e6e567725b Color Prerelease-10 2024-05-23 12:05:00 -04:00
93612bb816 Update JGL Prerelease-9 2024-05-23 10:57:48 -04:00
9ac22a8a87 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	CMakeLists.txt
Prerelease-8
2024-05-01 20:30:50 -04:00
1eaa9c6574 Migrating dependencies to latest releases 2024-05-01 20:30:21 -04:00
Redacted
f5f590164a Update CMakeLists.txt
J3ML v20
Prerelease-7
2024-03-21 15:19:53 -04:00
c45485cabd Merge remote-tracking branch 'origin/master'
# Conflicts:
#	CMakeLists.txt
2024-02-29 02:18:05 -05:00
143703dea3 Migrating Sources to LearnOpenGL 2024-02-29 02:17:42 -05:00
Redacted
48493cb2fc Update CMakeLists.txt Prerelease-6 2024-02-24 07:56:25 -05:00
5b7829b1f8 Implement LearnOpenGL::Mesh 2024-02-22 18:39:50 -05:00
868f52464e Fixed broken migration 2024-02-21 23:42:55 -05:00
d1d2493435 Migrate to latest ReWindow Prerelease-5 2024-02-21 23:27:10 -05:00
da30a7eedd Merge pull request 'dawsh' (#12) from dawsh into master
Reviewed-on: josh/JGL#12
Prerelease-4
2024-02-20 17:23:59 -05:00
5d906d6f99 Move RenderText to J2D::DrawString2D 2024-02-20 17:20:54 -05:00
6107e9a762 Small Fix (Make Another Release) 2024-02-20 15:20:08 -05:00
a38a83692f Fix render to full viewport 2024-02-20 05:18:32 -05:00
c4d6426587 Merge pull request 'dawsh' (#11) from dawsh into master
Reviewed-on: josh/JGL#11
Prerelease-3
2024-02-20 04:47:38 -05:00
817b0166c0 Implement J3D::DrawString3D 2024-02-20 04:01:29 -05:00