Handmade Hero»Episode Guide
Handling Multiple Display Aspect Ratios
?
?

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:10Recap and set the stage for the day
0:10Recap and set the stage for the day
0:10Recap and set the stage for the day
0:35Consult the issues1
0:35Consult the issues1
0:35Consult the issues1
2:11Determine to fix the "Wrong glViewport parameters" issue
2:11Determine to fix the "Wrong glViewport parameters" issue
2:11Determine to fix the "Wrong glViewport parameters" issue
3:52Run the game and demo the resizing situation
3:52Run the game and demo the resizing situation
3:52Run the game and demo the resizing situation
5:01handmade_opengl.cpp: Make OpenGLDisplayBitmap() and OpenGLRenderCommands() pass the WindowWidth and WindowHeight to glViewport()
5:01handmade_opengl.cpp: Make OpenGLDisplayBitmap() and OpenGLRenderCommands() pass the WindowWidth and WindowHeight to glViewport()
5:01handmade_opengl.cpp: Make OpenGLDisplayBitmap() and OpenGLRenderCommands() pass the WindowWidth and WindowHeight to glViewport()
6:27Run the game and see how it now looks
6:27Run the game and see how it now looks
6:27Run the game and see how it now looks
9:00Blackboard: Aspect Ratio Resize
9:00Blackboard: Aspect Ratio Resize
9:00Blackboard: Aspect Ratio Resize
11:03Blackboard: No aspect ratio support
11:03Blackboard: No aspect ratio support
11:03Blackboard: No aspect ratio support
12:57Blackboard: Aspect-awareness
12:57Blackboard: Aspect-awareness
12:57Blackboard: Aspect-awareness
16:48Blackboard: Black bar
16:48Blackboard: Black bar
16:48Blackboard: Black bar
18:12Blackboard: Our two cases
18:12Blackboard: Our two cases
18:12Blackboard: Our two cases
19:38handmade_render.cpp: Introduce AspectRatioFit()
19:38handmade_render.cpp: Introduce AspectRatioFit()
19:38handmade_render.cpp: Introduce AspectRatioFit()
23:43Blackboard: Calculating aspect ratios
23:43Blackboard: Calculating aspect ratios
23:43Blackboard: Calculating aspect ratios
27:16handmade_render.cpp: Make AspectRatioFit() calculate the optimal dimensions based on that fundamental aspect ratio
27:16handmade_render.cpp: Make AspectRatioFit() calculate the optimal dimensions based on that fundamental aspect ratio
27:16handmade_render.cpp: Make AspectRatioFit() calculate the optimal dimensions based on that fundamental aspect ratio
34:22handmade_opengl.cpp: Make OpenGLRenderCommands() take the DrawRegion and pass it to glViewport()
34:22handmade_opengl.cpp: Make OpenGLRenderCommands() take the DrawRegion and pass it to glViewport()
34:22handmade_opengl.cpp: Make OpenGLRenderCommands() take the DrawRegion and pass it to glViewport()
35:41handmade_math.h: Introduce GetWidth() and GetHeight()
35:41handmade_math.h: Introduce GetWidth() and GetHeight()
35:41handmade_math.h: Introduce GetWidth() and GetHeight()
39:20handmade_opengl.cpp: Introduce OpenGLBindFramebuffer()
39:20handmade_opengl.cpp: Introduce OpenGLBindFramebuffer()
39:20handmade_opengl.cpp: Introduce OpenGLBindFramebuffer()
40:54Run the game and see that it looks the same
40:54Run the game and see that it looks the same
40:54Run the game and see that it looks the same
41:06win32_handmade.cpp: Make Win32DisplayBufferInWindow() call AspectRatioFit() to set the DrawRegion
41:06win32_handmade.cpp: Make Win32DisplayBufferInWindow() call AspectRatioFit() to set the DrawRegion
41:06win32_handmade.cpp: Make Win32DisplayBufferInWindow() call AspectRatioFit() to set the DrawRegion
42:08Run the game and try out the new resizing
42:08Run the game and try out the new resizing
42:08Run the game and try out the new resizing
43:24handmade_opengl.cpp: Make OpenGLDisplayBitmap() take the DrawRegion and pass it to OpenGLBindFramebuffer()
43:24handmade_opengl.cpp: Make OpenGLDisplayBitmap() take the DrawRegion and pass it to OpenGLBindFramebuffer()
43:24handmade_opengl.cpp: Make OpenGLDisplayBitmap() take the DrawRegion and pass it to OpenGLBindFramebuffer()
45:04Run the game and see that it just works
45:04Run the game and see that it just works
45:04Run the game and see that it just works
45:33handmade_opengl.cpp: Make OpenGLDisplayBitmap() clear to the ClearColor and prevent OpenGLRenderCommands() from drawing the outlines
45:33handmade_opengl.cpp: Make OpenGLDisplayBitmap() clear to the ClearColor and prevent OpenGLRenderCommands() from drawing the outlines
45:33handmade_opengl.cpp: Make OpenGLDisplayBitmap() clear to the ClearColor and prevent OpenGLRenderCommands() from drawing the outlines
47:53Run the game, see how it all is and close that issue
47:53Run the game, see how it all is and close that issue
47:53Run the game, see how it all is and close that issue
49:33Determine to fix the "Incorrect Unproject" issue
49:33Determine to fix the "Incorrect Unproject" issue
49:33Determine to fix the "Incorrect Unproject" issue
51:53win32_handmade.cpp: DrawRegion WinMain()
51:53win32_handmade.cpp: DrawRegion WinMain()
51:53win32_handmade.cpp: DrawRegion WinMain()
53:17win32_handmade.cpp: Remove the win32_rendering_type enum in favour of a single GlobalSoftwareRendering
53:17win32_handmade.cpp: Remove the win32_rendering_type enum in favour of a single GlobalSoftwareRendering
53:17win32_handmade.cpp: Remove the win32_rendering_type enum in favour of a single GlobalSoftwareRendering
54:21Run the game and ensure that toggling the software renderer still works
54:21Run the game and ensure that toggling the software renderer still works
54:21Run the game and ensure that toggling the software renderer still works
54:43win32_handmade.cpp: Make WinMain() compute DrawRegion early on and make all the appropriate functions take it
54:43win32_handmade.cpp: Make WinMain() compute DrawRegion early on and make all the appropriate functions take it
54:43win32_handmade.cpp: Make WinMain() compute DrawRegion early on and make all the appropriate functions take it
56:52win32_handmade.cpp: Make WinMain() map the mouse position to the DrawRegion
56:52win32_handmade.cpp: Make WinMain() map the mouse position to the DrawRegion
56:52win32_handmade.cpp: Make WinMain() map the mouse position to the DrawRegion
58:56Run the game and see if the mouse cursor is now working okay
58:56Run the game and see if the mouse cursor is now working okay
58:56Run the game and see if the mouse cursor is now working okay
1:00:01win32_handmade.cpp: Make WinMain() base the mouse position on the RenderCommands dimensions
1:00:01win32_handmade.cpp: Make WinMain() base the mouse position on the RenderCommands dimensions
1:00:01win32_handmade.cpp: Make WinMain() base the mouse position on the RenderCommands dimensions
1:00:31Run the game and see that the mouse cursor is still failing
1:00:31Run the game and see that the mouse cursor is still failing
1:00:31Run the game and see that the mouse cursor is still failing
1:01:59Debugger: Resize the window, step in to WinMain() and inspect the MouseU and MouseV
1:01:59Debugger: Resize the window, step in to WinMain() and inspect the MouseU and MouseV
1:01:59Debugger: Resize the window, step in to WinMain() and inspect the MouseU and MouseV
1:03:21win32_handmade.cpp: Make WinMain() correctly compute the MouseY
1:03:21win32_handmade.cpp: Make WinMain() correctly compute the MouseY
1:03:21win32_handmade.cpp: Make WinMain() correctly compute the MouseY
1:03:56Run the game and see that the mouse coordinates are now being passed correctly
1:03:56Run the game and see that the mouse coordinates are now being passed correctly
1:03:56Run the game and see that the mouse coordinates are now being passed correctly
1:04:18Q&A
🗩
1:04:18Q&A
🗩
1:04:18Q&A
🗩
1:05:22Close that issue
1:05:22Close that issue
1:05:22Close that issue
1:06:39cubercaleb (Before today) I have a 1600x900 monitor and when I change the code to render at that resolution, both the UI picking and the collision detection for the player get all sorts of messed up, but I haven't tested that since you removed the free moving stuff
🗪
1:06:39cubercaleb (Before today) I have a 1600x900 monitor and when I change the code to render at that resolution, both the UI picking and the collision detection for the player get all sorts of messed up, but I haven't tested that since you removed the free moving stuff
🗪
1:06:39cubercaleb (Before today) I have a 1600x900 monitor and when I change the code to render at that resolution, both the UI picking and the collision detection for the player get all sorts of messed up, but I haven't tested that since you removed the free moving stuff
🗪
1:06:57hayai Can you make it so that holding shift while resizing the window makes it just scale at the intended aspect ratio?
🗪
1:06:57hayai Can you make it so that holding shift while resizing the window makes it just scale at the intended aspect ratio?
🗪
1:06:57hayai Can you make it so that holding shift while resizing the window makes it just scale at the intended aspect ratio?
🗪
1:07:52shinny_magikarp Casey, you forgot to change "UseHeight" to "UseWidth" on the second case of the black bar size's definition
🗪
1:07:52shinny_magikarp Casey, you forgot to change "UseHeight" to "UseWidth" on the second case of the black bar size's definition
🗪
1:07:52shinny_magikarp Casey, you forgot to change "UseHeight" to "UseWidth" on the second case of the black bar size's definition
🗪
1:08:09deravadom Two parter, if that's okay: A) I'd like to start working on a homemade 3D game engine of my own. How much of what you have done here transfers over? B) When do you define how long a second is in the game? How does the lighting work in regards to time?
🗪
1:08:09deravadom Two parter, if that's okay: A) I'd like to start working on a homemade 3D game engine of my own. How much of what you have done here transfers over? B) When do you define how long a second is in the game? How does the lighting work in regards to time?
🗪
1:08:09deravadom Two parter, if that's okay: A) I'd like to start working on a homemade 3D game engine of my own. How much of what you have done here transfers over? B) When do you define how long a second is in the game? How does the lighting work in regards to time?
🗪
1:09:08danyguag How would you suggest a younger developer to get into OpenGL and all of its useful extensions?2
🗪
1:09:08danyguag How would you suggest a younger developer to get into OpenGL and all of its useful extensions?2
🗪
1:09:08danyguag How would you suggest a younger developer to get into OpenGL and all of its useful extensions?2
🗪
1:11:08rohit_n Did you ever go through the NSight plugin on stream?
🗪
1:11:08rohit_n Did you ever go through the NSight plugin on stream?
🗪
1:11:08rohit_n Did you ever go through the NSight plugin on stream?
🗪
1:11:29snoringtortoise Off-topic: Which keyboard layout do you use? Have you tried the various layouts? I've read that QWERTY can be a bit less efficient for programming, what do you think?
🗪
1:11:29snoringtortoise Off-topic: Which keyboard layout do you use? Have you tried the various layouts? I've read that QWERTY can be a bit less efficient for programming, what do you think?
🗪
1:11:29snoringtortoise Off-topic: Which keyboard layout do you use? Have you tried the various layouts? I've read that QWERTY can be a bit less efficient for programming, what do you think?
🗪
1:11:57danyguag I have some experience in OpenGL but not with the extensions
🗪
1:11:57danyguag I have some experience in OpenGL but not with the extensions
🗪
1:11:57danyguag I have some experience in OpenGL but not with the extensions
🗪
1:17:07win32_handmade.cpp: Make Win32MainWindowCallback() handle fixed aspect ratio window resizing based on Raymond Chen's advice3
1:17:07win32_handmade.cpp: Make Win32MainWindowCallback() handle fixed aspect ratio window resizing based on Raymond Chen's advice3
1:17:07win32_handmade.cpp: Make Win32MainWindowCallback() handle fixed aspect ratio window resizing based on Raymond Chen's advice3
1:23:56Blackboard: Calculating that new window height
1:23:56Blackboard: Calculating that new window height
1:23:56Blackboard: Calculating that new window height
1:25:58Run the game and try resizing the window
1:25:58Run the game and try resizing the window
1:25:58Run the game and try resizing the window
1:26:31win32_handmade.cpp: Make Win32MainWindowCallback() only do aspect ratio constrained resize if the shift key is held down
1:26:31win32_handmade.cpp: Make Win32MainWindowCallback() only do aspect ratio constrained resize if the shift key is held down
1:26:31win32_handmade.cpp: Make Win32MainWindowCallback() only do aspect ratio constrained resize if the shift key is held down
1:27:30Run the game and try resizing with the shift key held down
1:27:30Run the game and try resizing with the shift key held down
1:27:30Run the game and try resizing with the shift key held down
1:29:57Debugger: Break into Win32MainWindowCallback() to determine what the cx and cy are, and investigate what is happening with the flicker
1:29:57Debugger: Break into Win32MainWindowCallback() to determine what the cx and cy are, and investigate what is happening with the flicker
1:29:57Debugger: Break into Win32MainWindowCallback() to determine what the cx and cy are, and investigate what is happening with the flicker
1:35:59Debugger: Run the game and observe our WM_WINDOWPOSCHANGING output
1:35:59Debugger: Run the game and observe our WM_WINDOWPOSCHANGING output
1:35:59Debugger: Run the game and observe our WM_WINDOWPOSCHANGING output
1:37:35win32_handmade.cpp: Make Win32MainWindowCallback() set the NewPos based on which coordinate is closer
1:37:35win32_handmade.cpp: Make Win32MainWindowCallback() set the NewPos based on which coordinate is closer
1:37:35win32_handmade.cpp: Make Win32MainWindowCallback() set the NewPos based on which coordinate is closer
1:38:53Run the game and see if that helps
1:38:53Run the game and see if that helps
1:38:53Run the game and see if that helps
1:40:10win32_handmade.cpp: Make Win32MainWindowCallback() output the aspect ratio
1:40:10win32_handmade.cpp: Make Win32MainWindowCallback() output the aspect ratio
1:40:10win32_handmade.cpp: Make Win32MainWindowCallback() output the aspect ratio
1:40:57Run the game and observe that aspect ratio
1:40:57Run the game and observe that aspect ratio
1:40:57Run the game and observe that aspect ratio
1:41:46win32_handmade.cpp: Make Win32MainWindowCallback() adjust the aspect ratio to ignore the window decorations
1:41:46win32_handmade.cpp: Make Win32MainWindowCallback() adjust the aspect ratio to ignore the window decorations
1:41:46win32_handmade.cpp: Make Win32MainWindowCallback() adjust the aspect ratio to ignore the window decorations
1:43:16Blackboard: Computing the aspect ratio for the ClientRect
1:43:16Blackboard: Computing the aspect ratio for the ClientRect
1:43:16Blackboard: Computing the aspect ratio for the ClientRect
1:46:59Run the game and see what that does
1:46:59Run the game and see what that does
1:46:59Run the game and see what that does
1:48:56Blackboard: Double-check the maths
1:48:56Blackboard: Double-check the maths
1:48:56Blackboard: Double-check the maths
1:49:16win32_handmade.cpp: Make Win32MainWindowCallback() compute the NewCx and NewCy differently
1:49:16win32_handmade.cpp: Make Win32MainWindowCallback() compute the NewCx and NewCy differently
1:49:16win32_handmade.cpp: Make Win32MainWindowCallback() compute the NewCx and NewCy differently
1:50:41win32_handmade.cpp: Make Win32MainWindowCallback() set GetWindowRect, run the game and see that it works
1:50:41win32_handmade.cpp: Make Win32MainWindowCallback() set GetWindowRect, run the game and see that it works
1:50:41win32_handmade.cpp: Make Win32MainWindowCallback() set GetWindowRect, run the game and see that it works
1:52:03hayai Yes, it helps
🗪
1:52:03hayai Yes, it helps
🗪
1:52:03hayai Yes, it helps
🗪
1:52:14cubercaleb For AdjustWindowRect you should pass WS_OVERLAPPEDWINDOW which is different from WS_OVERLAPPED, although perhaps you meant that?
🗪
1:52:14cubercaleb For AdjustWindowRect you should pass WS_OVERLAPPEDWINDOW which is different from WS_OVERLAPPED, although perhaps you meant that?
🗪
1:52:14cubercaleb For AdjustWindowRect you should pass WS_OVERLAPPEDWINDOW which is different from WS_OVERLAPPED, although perhaps you meant that?
🗪
1:52:43Wrap it up
🗩
1:52:43Wrap it up
🗩
1:52:43Wrap it up
🗩