Handmade Hero»Episode Guide
Creating a CPU-side Lighting Testbed
?
?

Keyboard Navigation

Global Keys

[, < / ], > Jump to previous / next episode
W, K, P / S, J, N Jump to previous / next marker
t / T Toggle theatre / SUPERtheatre mode
V Revert filter to original state Y Select link (requires manual Ctrl-c)

Menu toggling

q Quotes r References f Filter y Link c Credits

In-Menu Movement

a
w
s
d
h j k l


Quotes and References Menus

Enter Jump to timecode

Quotes, References and Credits Menus

o Open URL (in new tab)

Filter Menu

x, Space Toggle category and focus next
X, ShiftSpace Toggle category and focus previous
v Invert topics / media as per focus

Filter and Link Menus

z Toggle filter / linking mode

Credits Menu

Enter Open URL (in new tab)
0:09Recap and set the stage for the day, with a few words on loadable shaders and heredoc indentation
0:09Recap and set the stage for the day, with a few words on loadable shaders and heredoc indentation
0:09Recap and set the stage for the day, with a few words on loadable shaders and heredoc indentation
2:45handmade_opengl.cpp: Try out mmozeiko's idea to put a closing quote before the heredoc text
2:45handmade_opengl.cpp: Try out mmozeiko's idea to put a closing quote before the heredoc text
2:45handmade_opengl.cpp: Try out mmozeiko's idea to put a closing quote before the heredoc text
3:41"Unfortunately it looks like here 4coder is too smart for us"α
3:41"Unfortunately it looks like here 4coder is too smart for us"α
3:41"Unfortunately it looks like here 4coder is too smart for us"α
4:27Spec out a possible string opener for 4coder to understand
4:27Spec out a possible string opener for 4coder to understand
4:27Spec out a possible string opener for 4coder to understand
5:31mmozeiko Oh, that worked: __blablaFOO
🗪
5:31mmozeiko Oh, that worked: __blablaFOO
🗪
5:31mmozeiko Oh, that worked: __blablaFOO
🗪
5:37handmade_opengl.cpp: Play further with the heredoc stuff, before admitting defeat for now with thanks to mmozeiko
5:37handmade_opengl.cpp: Play further with the heredoc stuff, before admitting defeat for now with thanks to mmozeiko
5:37handmade_opengl.cpp: Play further with the heredoc stuff, before admitting defeat for now with thanks to mmozeiko
7:19Run the game to see where we last left off, noting that we are perhaps taking an unproductive approach in developing the system for the GPU
7:19Run the game to see where we last left off, noting that we are perhaps taking an unproductive approach in developing the system for the GPU
7:19Run the game to see where we last left off, noting that we are perhaps taking an unproductive approach in developing the system for the GPU
11:35Switch our development of the lighting system to the CPU-side
11:35Switch our development of the lighting system to the CPU-side
11:35Switch our development of the lighting system to the CPU-side
13:53handmade_render_group.cpp and handmade_world_mode.cpp: Introduce LightingTest() in order to enable UpdateAndRenderWorld() to hijack the RenderGroup
13:53handmade_render_group.cpp and handmade_world_mode.cpp: Introduce LightingTest() in order to enable UpdateAndRenderWorld() to hijack the RenderGroup
13:53handmade_render_group.cpp and handmade_world_mode.cpp: Introduce LightingTest() in order to enable UpdateAndRenderWorld() to hijack the RenderGroup
19:16Run the game to see our sprites
19:16Run the game to see our sprites
19:16Run the game to see our sprites
19:40handmade_render_group.cpp: Enable LightingTest() to edit the vertices
19:40handmade_render_group.cpp: Enable LightingTest() to edit the vertices
19:40handmade_render_group.cpp: Enable LightingTest() to edit the vertices
21:45Run the game to see a completely whitewashed screen
21:45Run the game to see a completely whitewashed screen
21:45Run the game to see a completely whitewashed screen
22:58handmade_render_group.cpp: Introduce struct lighting_element
22:58handmade_render_group.cpp: Introduce struct lighting_element
22:58handmade_render_group.cpp: Introduce struct lighting_element
26:12"Don't scratch your eye"β
26:12"Don't scratch your eye"β
26:12"Don't scratch your eye"β
26:35handmade_render_group.cpp: Make LightingTest() initialise an array of lighting_element
26:35handmade_render_group.cpp: Make LightingTest() initialise an array of lighting_element
26:35handmade_render_group.cpp: Make LightingTest() initialise an array of lighting_element
27:35Blackboard: Extracting the vertex data of sprites
27:35Blackboard: Extracting the vertex data of sprites
27:35Blackboard: Extracting the vertex data of sprites
28:44handmade_render_group.cpp: Enable LightingTest() to copy that vertex data in to the Elements array
28:44handmade_render_group.cpp: Enable LightingTest() to copy that vertex data in to the Elements array
28:44handmade_render_group.cpp: Enable LightingTest() to copy that vertex data in to the Elements array
33:13Blackboard: Computing the radius
33:13Blackboard: Computing the radius
33:13Blackboard: Computing the radius
33:34handmade_render_group.cpp: Fix compile errors in LightingTest()
33:34handmade_render_group.cpp: Fix compile errors in LightingTest()
33:34handmade_render_group.cpp: Fix compile errors in LightingTest()
34:57Run the game and see no difference
34:57Run the game and see no difference
34:57Run the game and see no difference
35:03handmade_render_group.cpp: Enable LightingTest() to copy the lighting back out to the quads in a diamond shape
35:03handmade_render_group.cpp: Enable LightingTest() to copy the lighting back out to the quads in a diamond shape
35:03handmade_render_group.cpp: Enable LightingTest() to copy the lighting back out to the quads in a diamond shape
40:35Blackboard: Producing a full coordinate system from a vector for drawing out the lighting
40:35Blackboard: Producing a full coordinate system from a vector for drawing out the lighting
40:35Blackboard: Producing a full coordinate system from a vector for drawing out the lighting
46:20handmade_render_group.cpp: Enable LightingTest() to produce that coordinate system and draw out the diamond
46:20handmade_render_group.cpp: Enable LightingTest() to produce that coordinate system and draw out the diamond
46:20handmade_render_group.cpp: Enable LightingTest() to produce that coordinate system and draw out the diamond
51:10Run the game and see pure grey
51:10Run the game and see pure grey
51:10Run the game and see pure grey
51:22handmade_render_group.cpp: Investigate what LightingTest() is drawing
51:22handmade_render_group.cpp: Investigate what LightingTest() is drawing
51:22handmade_render_group.cpp: Investigate what LightingTest() is drawing
54:08handmade_render_group.cpp: Replace V0 and V2 with Vert0 and Vert2 in LightingTest()
54:08handmade_render_group.cpp: Replace V0 and V2 with Vert0 and Vert2 in LightingTest()
54:08handmade_render_group.cpp: Replace V0 and V2 with Vert0 and Vert2 in LightingTest()
55:25Run the game to determine that it's probably the pack that is incorrect
55:25Run the game to determine that it's probably the pack that is incorrect
55:25Run the game to determine that it's probably the pack that is incorrect
56:07handmade_render_group.cpp: Make LightingTest() multiply the RGBAUnpack4x8() and RGBAPack4x8() calls into the correct colour space
56:07handmade_render_group.cpp: Make LightingTest() multiply the RGBAUnpack4x8() and RGBAPack4x8() calls into the correct colour space
56:07handmade_render_group.cpp: Make LightingTest() multiply the RGBAUnpack4x8() and RGBAPack4x8() calls into the correct colour space
58:28Run the game to see that we're getting a little closer
58:28Run the game to see that we're getting a little closer
58:28Run the game to see that we're getting a little closer
58:33handmade_render_group.cpp: Continue to investigate the problem
58:33handmade_render_group.cpp: Continue to investigate the problem
58:33handmade_render_group.cpp: Continue to investigate the problem
59:30Step in to LightingTest() and inspect the Vert0 and Element->RefC
59:30Step in to LightingTest() and inspect the Vert0 and Element->RefC
59:30Step in to LightingTest() and inspect the Vert0 and Element->RefC
1:00:52handmade_render_group.cpp: Make LightingTest() work on Element when computing the lighting
1:00:52handmade_render_group.cpp: Make LightingTest() work on Element when computing the lighting
1:00:52handmade_render_group.cpp: Make LightingTest() work on Element when computing the lighting
1:01:06Run the game to see that we're good to go
1:01:06Run the game to see that we're good to go
1:01:06Run the game to see that we're good to go
1:01:14Step in to LightingTest() to inspect the positional values
1:01:14Step in to LightingTest() to inspect the positional values
1:01:14Step in to LightingTest() to inspect the positional values
1:02:05handmade_render_group.cpp: Make LightingTest() correctly set the Y
1:02:05handmade_render_group.cpp: Make LightingTest() correctly set the Y
1:02:05handmade_render_group.cpp: Make LightingTest() correctly set the Y
1:02:18Step in the LightingTest() and again inspect the positional values
1:02:18Step in the LightingTest() and again inspect the positional values
1:02:18Step in the LightingTest() and again inspect the positional values
1:02:50handmade_render_group.cpp: Make LightingTest() correctly set the base
1:02:50handmade_render_group.cpp: Make LightingTest() correctly set the base
1:02:50handmade_render_group.cpp: Make LightingTest() correctly set the base
1:04:18Step in to LightingTest() and inspect our expected positions
1:04:18Step in to LightingTest() and inspect our expected positions
1:04:18Step in to LightingTest() and inspect our expected positions
1:04:29Run the game to see how we're doing
1:04:29Run the game to see how we're doing
1:04:29Run the game to see how we're doing
1:04:42handmade_render_group.cpp: Make LightingTest() set the vertices in the same order as PushQuad()
1:04:42handmade_render_group.cpp: Make LightingTest() set the vertices in the same order as PushQuad()
1:04:42handmade_render_group.cpp: Make LightingTest() set the vertices in the same order as PushQuad()
1:05:53Run the game to see our diamond reflectors
1:05:53Run the game to see our diamond reflectors
1:05:53Run the game to see our diamond reflectors
1:07:40handmade_render_group.cpp: Toggle off the copying out of the lighting, and run the game to consider the pink and yellow debug rectangles
1:07:40handmade_render_group.cpp: Toggle off the copying out of the lighting, and run the game to consider the pink and yellow debug rectangles
1:07:40handmade_render_group.cpp: Toggle off the copying out of the lighting, and run the game to consider the pink and yellow debug rectangles
1:08:42handmade_render_group.cpp: Try to make LightingTest() more sanely set the span for long, thin rectangles
1:08:42handmade_render_group.cpp: Try to make LightingTest() more sanely set the span for long, thin rectangles
1:08:42handmade_render_group.cpp: Try to make LightingTest() more sanely set the span for long, thin rectangles
1:12:07Run the game to still see large pink rectangles
1:12:07Run the game to still see large pink rectangles
1:12:07Run the game to still see large pink rectangles
1:13:52handmade_render_group.cpp: Make LightingTest() use the correct winding when copying the lighting in
1:13:52handmade_render_group.cpp: Make LightingTest() use the correct winding when copying the lighting in
1:13:52handmade_render_group.cpp: Make LightingTest() use the correct winding when copying the lighting in
1:14:24Run the game to see that that fixes it, and consider this representation of the lighting
1:14:24Run the game to see that that fixes it, and consider this representation of the lighting
1:14:24Run the game to see that that fixes it, and consider this representation of the lighting
1:16:31handmade_render_group.cpp: Introduce a moveable light source in LightingTest()
1:16:31handmade_render_group.cpp: Introduce a moveable light source in LightingTest()
1:16:31handmade_render_group.cpp: Introduce a moveable light source in LightingTest()
1:19:41Run the game and move our light source
1:19:41Run the game and move our light source
1:19:41Run the game and move our light source
1:20:03handmade_render_group.cpp: Enable LightingTest() to propagate the light in an O(n²) fashion
1:20:03handmade_render_group.cpp: Enable LightingTest() to propagate the light in an O(n²) fashion
1:20:03handmade_render_group.cpp: Enable LightingTest() to propagate the light in an O(n²) fashion
1:26:10Run the game to see black, because the rendering is so slow
1:26:10Run the game to see black, because the rendering is so slow
1:26:10Run the game to see black, because the rendering is so slow
1:28:00handmade_world_mode.cpp: Toggle off the particles and only create one screen
1:28:00handmade_world_mode.cpp: Toggle off the particles and only create one screen
1:28:00handmade_world_mode.cpp: Toggle off the particles and only create one screen
1:29:36Run the game to see our room
1:29:36Run the game to see our room
1:29:36Run the game to see our room
1:29:52handmade_world_mode.cpp: Reduce the room size in AddStandardRoom()
1:29:52handmade_world_mode.cpp: Reduce the room size in AddStandardRoom()
1:29:52handmade_world_mode.cpp: Reduce the room size in AddStandardRoom()
1:30:48Run the game and move around our tiny room
1:30:48Run the game and move around our tiny room
1:30:48Run the game and move around our tiny room
1:31:34handmade_render_group.cpp: Reenable our O(n²) loop and run the game to see our lit room
1:31:34handmade_render_group.cpp: Reenable our O(n²) loop and run the game to see our lit room
1:31:34handmade_render_group.cpp: Reenable our O(n²) loop and run the game to see our lit room
1:32:44handmade_render_group.cpp: Change how LightingTest() sets the light colour
1:32:44handmade_render_group.cpp: Change how LightingTest() sets the light colour
1:32:44handmade_render_group.cpp: Change how LightingTest() sets the light colour
1:33:05Run the game to see the disco lighting
1:33:05Run the game to see the disco lighting
1:33:05Run the game to see the disco lighting
1:33:28handmade_render_group.cpp: Make LightingTest() clamp the emitters' colours
1:33:28handmade_render_group.cpp: Make LightingTest() clamp the emitters' colours
1:33:28handmade_render_group.cpp: Make LightingTest() clamp the emitters' colours
1:34:31Run the game to still see a little flickering
1:34:31Run the game to still see a little flickering
1:34:31Run the game to still see a little flickering
1:34:47handmade_render_group.cpp: Make LightingTest() sum into a separate colour accumulator
1:34:47handmade_render_group.cpp: Make LightingTest() sum into a separate colour accumulator
1:34:47handmade_render_group.cpp: Make LightingTest() sum into a separate colour accumulator
1:36:50Run the game to see that it's somewhat incorrect
1:36:50Run the game to see that it's somewhat incorrect
1:36:50Run the game to see that it's somewhat incorrect
1:37:08handmade_render_group.cpp: Make LightingTest() factor in the distance to the light
1:37:08handmade_render_group.cpp: Make LightingTest() factor in the distance to the light
1:37:08handmade_render_group.cpp: Make LightingTest() factor in the distance to the light
1:39:33Run the game to see that it's still a little bit wonky
1:39:33Run the game to see that it's still a little bit wonky
1:39:33Run the game to see that it's still a little bit wonky
1:41:15handmade_render_group.cpp: Make LightingTest() factor in the distance falloff
1:41:15handmade_render_group.cpp: Make LightingTest() factor in the distance falloff
1:41:15handmade_render_group.cpp: Make LightingTest() factor in the distance falloff
1:41:58Run the game and consider that we may have too much angular flickering
1:41:58Run the game and consider that we may have too much angular flickering
1:41:58Run the game and consider that we may have too much angular flickering
1:43:19handmade_render_group.cpp: Make LightingTest() propagate the light in three loops
1:43:19handmade_render_group.cpp: Make LightingTest() propagate the light in three loops
1:43:19handmade_render_group.cpp: Make LightingTest() propagate the light in three loops
1:44:13Run the game to see a lot of flickering, and consider the sanity of developing on the CPU
1:44:13Run the game to see a lot of flickering, and consider the sanity of developing on the CPU
1:44:13Run the game to see a lot of flickering, and consider the sanity of developing on the CPU
1:45:01handmade_render_group.cpp: Prevent LightingTest() from using the distance falloff, and only do one iteration
1:45:01handmade_render_group.cpp: Prevent LightingTest() from using the distance falloff, and only do one iteration
1:45:01handmade_render_group.cpp: Prevent LightingTest() from using the distance falloff, and only do one iteration
1:45:32Run the game and wonder why lateral movement causes so much flickering
1:45:32Run the game and wonder why lateral movement causes so much flickering
1:45:32Run the game and wonder why lateral movement causes so much flickering
1:46:44handmade_render_group.cpp: Consider where LightingTest() may be wrong
1:46:44handmade_render_group.cpp: Consider where LightingTest() may be wrong
1:46:44handmade_render_group.cpp: Consider where LightingTest() may be wrong
1:48:06Q&A
🗩
1:48:06Q&A
🗩
1:48:06Q&A
🗩
1:49:07kim_jorgensen Could you enable the overlay. Your head is in the way
🗪
1:49:07kim_jorgensen Could you enable the overlay. Your head is in the way
🗪
1:49:07kim_jorgensen Could you enable the overlay. Your head is in the way
🗪
1:49:35Consult Microsoft Spy++ for the currently open programs
1:49:35Consult Microsoft Spy++ for the currently open programs
1:49:35Consult Microsoft Spy++ for the currently open programs
1:52:38mmozeiko Sorry the trick didn't work, it works for editor I use. There is an option to try to use old non-raw string literals: char* shader = STRINGIFY( ... write multiline code here ... ); where STRINGIFY is macro with # preprocesor thing. Compiler will smush multi-line code into one-line string and you'll lose line numbers in error messages, but they don't seem to be used on stream anyway
🗪
1:52:38mmozeiko Sorry the trick didn't work, it works for editor I use. There is an option to try to use old non-raw string literals: char* shader = STRINGIFY( ... write multiline code here ... ); where STRINGIFY is macro with # preprocesor thing. Compiler will smush multi-line code into one-line string and you'll lose line numbers in error messages, but they don't seem to be used on stream anyway
🗪
1:52:38mmozeiko Sorry the trick didn't work, it works for editor I use. There is an option to try to use old non-raw string literals: char* shader = STRINGIFY( ... write multiline code here ... ); where STRINGIFY is macro with # preprocesor thing. Compiler will smush multi-line code into one-line string and you'll lose line numbers in error messages, but they don't seem to be used on stream anyway
🗪
1:53:44handmade_opengl.cpp: Try to #define SHADER_CODE in an effort to enable 4coder to indent our shader code
1:53:44handmade_opengl.cpp: Try to #define SHADER_CODE in an effort to enable 4coder to indent our shader code
1:53:44handmade_opengl.cpp: Try to #define SHADER_CODE in an effort to enable 4coder to indent our shader code
1:58:28thecrypticmind Hi! Not sure if this might be something for the forums, but I am on Day 60 and I just swapped to develop on my laptop and am noticing that I am missing the frame rate pretty frequently when Sleep is called: it misses with a few ms. My output log is not as smooth as yours with 33.33m/s every log message, but instead it fluctuates a bit over it. Is this something that gets addressed further down in the episodes?
🗪
1:58:28thecrypticmind Hi! Not sure if this might be something for the forums, but I am on Day 60 and I just swapped to develop on my laptop and am noticing that I am missing the frame rate pretty frequently when Sleep is called: it misses with a few ms. My output log is not as smooth as yours with 33.33m/s every log message, but instead it fluctuates a bit over it. Is this something that gets addressed further down in the episodes?
🗪
1:58:28thecrypticmind Hi! Not sure if this might be something for the forums, but I am on Day 60 and I just swapped to develop on my laptop and am noticing that I am missing the frame rate pretty frequently when Sleep is called: it misses with a few ms. My output log is not as smooth as yours with 33.33m/s every log message, but instead it fluctuates a bit over it. Is this something that gets addressed further down in the episodes?
🗪
1:58:44Brian Did the black overlay disapear during the stream, or during Q&A? From the code, if TargetActive, we fade in the CornerWindow. But if the countdown has finished and what not, then it is not active any more
🗪
1:58:44Brian Did the black overlay disapear during the stream, or during Q&A? From the code, if TargetActive, we fade in the CornerWindow. But if the countdown has finished and what not, then it is not active any more
🗪
1:58:44Brian Did the black overlay disapear during the stream, or during Q&A? From the code, if TargetActive, we fade in the CornerWindow. But if the countdown has finished and what not, then it is not active any more
🗪
2:00:01mmozeiko You can do char* shader = SHADER_CODE(n#include "shader.h"n); and then put code in new shader.h file, maybe then indentation will be fine afterwards
🗪
2:00:01mmozeiko You can do char* shader = SHADER_CODE(n#include "shader.h"n); and then put code in new shader.h file, maybe then indentation will be fine afterwards
🗪
2:00:01mmozeiko You can do char* shader = SHADER_CODE(n#include "shader.h"n); and then put code in new shader.h file, maybe then indentation will be fine afterwards
🗪
2:00:38mmozeiko No, it will work
🗪
2:00:38mmozeiko No, it will work
🗪
2:00:38mmozeiko No, it will work
🗪
2:02:28Close it down
🗩
2:02:28Close it down
🗩
2:02:28Close it down
🗩