[video member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Moving the Perspective Divide to OpenGL" vod_platform=youtube id=EDfb-13wgk0 annotator=Miblo] [0:01][Recap and set the stage for the day] [1:18][Run the game and demo our current situation with the sorting] [2:02][Reacquaint ourselves with our work moving the perspective operations over to OpenGL] [7:00][handmade_render.h: Remove WorldScale from the camera_params struct, and consider removing MetersToPixels and PixelsToMeters globally] [12:26][handmade_render_group.h: Replace ScreenCenter in camera_transform with ScreenDim] [13:28][handmade_render_group.h: Introduce SetCameraTransform() and simplify Orthographic() and Perspective()] [13:50]["This would take a super set of the parameters"][quote 545] [16:24][Run the game to see that we're at the wrong zoom level] [16:45][handmade_world_mode.cpp: Make AddStandardRoom() set the camera height lower, and run the game] [17:34][Determine to fix the debug visualisation rectangles] [19:15][handmade_render_group.h: Remove MonitorHalfDimInMeters from the render_group struct] [22:27][handmade_render_group.cpp: Remove UnprojectOld() and make GetCameraRectangleAtDistance() compute the correct rectangle] [27:03][handmade_world_mode.cpp: Make UpdateAndRenderWorld() compute WorldCameraRect and ScreenBounds] [29:25][Run the game pnd fail to see the debug rectangles] [30:56][Step in to UpdateAndRenderWorld() and inspect the bounds] [38:45][handmade_render_group.cpp: Make Unproject() correctly compute the UnprojectedXY] [43:24][Step into UpdateAndRenderWorld() and inspect the WorldCameraRect] [44:25][A few words on easing the process of changing your code] [47:16][Run the game and determine to get the Z-sorting working by augmenting the ClipRect to be about transforms in general] [52:54][handmade_opengl.cpp: Start to change OpenGLSetScreenSpace()] [55:56][handmade_platform.h: #define NotImplemented()] [1:00:58][Blackboard: Projection coordinates] [1:04:48][handmade_opengl.cpp: Prevent OpenGLRenderCommands() from scaling the incoming dimensions] [1:05:08][Run the game and consider the incoming dimensions] [1:07:35][Blackboard: Z in the Projection Matrix and normalising by W] [1:13:52][Blackboard: Divide by incoming Z] [1:16:32][handmade_opengl.cpp: Write the Proj matrix in OpenGLRenderCommands() to enable the divide by Z] [1:18:31][handmade_render_group.cpp: Make GetRenderEntityBasisP() compute the correct Scale and P] [1:19:57][Run the game to see it unexpectedly working, and investigate why] [1:25:18][Step in to OpenGLRenderCommands() and inspect the values] [1:27:02][handmade_opengl.cpp: Make OpenGLRenderCommands() pass the Z for the bitmaps, and run the game] [1:28:12][handmade_render_group.cpp: Remove Basis.Scale from all functions, and remove the entity_basis_p_result struct] [1:30:49][handmade_render_group.cpp: Simplify GetRenderEntityBasisP()] [1:33:20][Run the game to assess our current situation] [1:35:15][handmade_render_group.h: Add FocalLength to the render_entry_cliprect struct and propagate it] [1:40:18][Run the game and consider cleaning this up] [1:40:56][handmade_render_group.h: Remove ScreenDim from the camera_transform struct and add CurrentClipRect_ to the render_group struct] [1:46:44][Remove all of the sorting code] [1:57:31][Q&A] [1:59:16][@quartertron][Can you please go double-check your matrix math in your last drawing in Milton?] [2:01:08][@quartertron][More scroll right-ish] [2:01:37][@quartertron][No, I'm just blind] [2:02:07][@deezbucks][Are you planning on making a video featuring everything you made?] [2:03:25][@pepevel][What do you have in mind when it comes to shaders? You plan to use them to sort?] [2:06:16][@jekasg][How long till ship?] [2:06:56][@roam00010011][I'm running out of excuses to clean the garage, so... someone ask something long] [2:07:11][@mvargasmoran][Could you expand on the topic of refactoring (sometimes all the code)? I use git, to move on but keep my old code. So I think I'm scared of changing things] [2:19:02][@roam00010011][I keep missing the pre-stream, so at what time tomorrow will it start?] [2:20:00][@dandymcgee][How often do you clean your garage? If you don't have a garage, where do you park your car? If you don't have a car, how do you get to Kansas?] [2:22:44][@popcorn0x90][I wonder if Jon and Casey are in the same city] [2:23:10][Close it down with a glimpse into the future] [2:24:54][Plug Asaf's annotation searcher[ref site="GitHub" page="Handmade Hero Annotations Search" url="https://asafgartner.github.io/annotations_search/"]] [2:27:36][@Miblo][Yeah, we will roll it into the new annotation system. Planning on working on the new system probably in a month from now, after HMN v1 is settled] [2:28:16][Thank Asaf for building the annotation searcher] [/video]