[video member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Fixing Miscellaneous Bugs" vod_platform=youtube id=YssqJ7eDnv0 annotator=Miblo] [1:09][Run the game and note a bug when walking up the stairs after resizing the window] [5:52][Consult docs.GL to see whether or not the glScissor operates relative to the viewport[ref site="docs.GL" page="glScissor" url="http://docs.gl/gl3/glScissor"]] [7:03][handmade_opengl.cpp: Make OpenGLRenderCommands() do glScissor() in the space of the DrawRegion] [12:23][handmade_math.h: Introduce a version of Offset() which takes a rectangle2i] [13:11][Run the game and see if that is now correct] [13:28][handmade_opengl.cpp: Enable OpenGLRenderCommands() to reset the glScissor() whenever we clear] [17:47][Run the game, see how that now looks and investigate why the render target is being offset] [26:21][handmade_opengl.cpp: Make OpenGLRenderCommands() call OpenGLBindFramebuffer()] [27:19][Run the game and see that it works] [28:17][handmade_opengl.cpp: Make OpenGLRenderCommands() instead set the CurrentRenderTargetIndex to a bogus value up front, so we know we're going through the same path] [29:04][Run the game and see that this uses the correct viewport] [29:48][Consult the issues[ref site="GitHub" page="HandmadeHero/cpp Issues" url="https://github.com/HandmadeHero/cpp/issues"]] [30:06][handmade_render.cpp: Make BlendRenderTarget() set the SourceRowAdvance to the SourceTarget->Pitch] [30:23][Run the game, see no change but that it will indeed now be correct, and close the "Wrong pitch" issue] [31:25][Determine to fix the "sRGB typo fix not saved?" issue, regarding the GL_VERSION comment] [35:12][handmade_opengl.cpp: Make OpenGLGetInfo() call glGetIntegerv() to get the GL_VERSION[ref site="docs.GL" page="glGet" url="http://docs.gl/gl3/glGet"]] [38:58][Run the game, hypothesise that we've fixed the issue, and close it] [39:58][Determine to fix the "Check GL init fallback" issue] [40:38][win32_handmade.cpp: Make Win32InitOpenGL() always call Win32SetPixelFormat()] [41:36][Run the game, believe the issue to be fixed and close it] [42:28][Consider the "Unnecessary DescribePixelFormat" issue] [45:13][Close that issue and determine to fix the "UseRenderTargets Bug" issue] [46:34][handmade_opengl.cpp: Make OpenGLGetInfo() assume we don't have a framebuffer object] [47:12][Run the game and crash] [47:33][handmade_opengl.cpp: Make OpenGLRenderCommands() handle the situation in which we don't have a framebuffer object] [54:22][Run the game and see that that's okay in both cases] [55:37][Close that issue and determine to fix the "PackEntityIntoChunk linked list bug" issue] [56:56][handmade_world.cpp: Fix the linked list in PackEntityIntoChunk()] [59:46][Run the game, assume that it's fixed and close the issue] [1:00:50][Q&A][:speech] [1:02:40][@snoringtortoise][Not sure what the minimum OpenGL version the game supports, but according to OpenGL.org, the GL_MAJOR_VERSION and GL_MINOR_VERSION are only available in OpenGL 3.0 and above. On lower versions you have to parse the GL_VERSION string[ref site="OpenGL" page="Get Context Info" url="https://www.opengl.org/wiki/Get_Context_Info"]] [1:03:13][handmade_opengl.cpp: Make OpenGLGetInfo() parse the GL_VERSION string] [1:05:51][handmade_opengl.cpp: Introduce OpenGLParseNumber()] [1:08:40][Debugger: Run the game and check out our parsed OpenGL version number] [1:09:35][@danyguag][So I am designing a 3D game engine and want to first write a software renderer for it to learn more about renderers. Do you think I should go straight for OpenGL or software renderer and then OpenGL?] [1:10:28][@insofaras][sscanf(str, "%d.%d", major, minor)] [1:12:21][Wrap it up][:speech] [/video]