[video output=day321 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Multiple OpenGL Render Targets" vod_platform=youtube id=kKj3wzpVrMo annotator=Miblo]
[0:32][Recap and set the stage for the day]
[2:27][Determine to enable the OpenGL renderer to work with multiple render targets like the software renderer]
[4:34][Our two tasks: 1) Talking about render targets to OpenGL; 2) Using those render targets as textures]
[6:43][Consult docs.GL in order to learn how to get multiple render targets[ref
    site="docs.GL"
    page="glGenFramebuffers"
    url="http://docs.gl/gl3/glGenFramebuffers"]]
[10:03][handmade_opengl.cpp: Make OpenGLRenderCommands() prepare the render targets, based on the software renderer's RenderCommandsToBitmap()]
[15:39][handmade_opengl.cpp: Make OpenGLRenderCommands() bind the correct framebuffer[ref
    site="docs.GL"
    page="glBindFramebuffer"
    url=http://docs.gl/gl3/glBindFramebuffer]]
[20:31][Compile and note that glGenFramebuffers() and glBindFramebuffer() are not available]
[21:24][handmade_opengl.cpp: Add GL_ARB_framebuffer_object to the opengl_info struct[ref
    site="OpenGL"
    page="ARB_framebuffer_object"
    url="https://www.opengl.org/registry/specs/ARB/framebuffer_object.txt"]]
[24:37][win32_handmade.cpp: typedef the OpenGL calls that we need[ref
    site="OpenGL"
    page="GL/glext.h"
    url="https://www.opengl.org/registry/api/GL/glext.h"]]
[27:28][win32_handmade.cpp: Load these OpenGL calls into memory]
[28:29][handmade_opengl.cpp: #define GL_FRAMEBUFFER[ref
    site="OpenGL"
    page="GL/glext.h"
    url="https://www.opengl.org/registry/api/GL/glext.h"]]
[30:25][Run the game and see that we run, but super slowly when the layered alpha blend is due to happen]
[31:14][handmade_opengl.cpp: Make OpenGLRenderCommands() check that we have glBindFramebuffer()]
[34:30][win32_handmade.cpp: Make Win32InitOpenGL() check whether it ought to load the OpenGL extensions]
[35:23][handmade_opengl.cpp: Make OpenGLRenderCommands() call glFramebufferTexture2D() to attach a texture image to our framebuffer object[ref
    site="OpenGL"
    page="ARB_framebuffer_object"
    url=https://www.opengl.org/registry/specs/ARB/framebuffer_object.txt]]
[39:04][handmade_opengl.cpp: Make OpenGLRenderCommands() generate our textures]
[43:36][handmade_opengl.cpp: #define GL_COLOR_ATTACHMENT0[ref
    site="OpenGL"
    page="GL/glext.h"
    url="https://www.opengl.org/registry/api/GL/glext.h"]]
[44:20][Run the game and see what we're doing]
[44:56][handmade_opengl.cpp: Make OpenGLRenderCommands() blend the render targets in the RenderGroupEntryType_render_entry_blend_render_target case]
[48:16][handmade_opengl.cpp: Make glBlendFunc() use non-premultiplied alpha[ref
    site="Handmade Hero Episode Guide"
    page="Premultipled Alpha"
    url=https://hero.handmade.network/episode/code/day083]]
[49:12][Run the game, see that we are blending with white and investigate why]
[52:45][handmade_opengl.cpp: Make OpenGLRenderCommands() call glCheckFramebufferStatus()]
[55:29][Debugger: Run the game to see if we are getting a valid framebuffer, and investigate what's happening]
[57:56][handmade_opengl.cpp: Make OpenGLRenderCommands() store the TextureHandle]
[58:27][Run the game and see that the alpha blending now works beautifully]
[58:46][Q&A][:speech]
[1:02:22][@the_any_key][What are the biggest challenges you have faced with the game thus far?]
[1:04:12][@pragmascrypt][Does AZDO work across NVIDIA, AMD and Intel]
[1:05:42][@roam00010011][Compare the Handmade Hero engine complexity vs 1935]
[1:06:08][@eltrufas][For catching up to the previous episodes, do you recommend going through all the videos, or to try to understand the current codebase?]
[1:09:02][That's the end of it][:speech]
[/video]
