[video output=day367 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Enabling OpenGL Multisampling" vod_platform=youtube id=imW4sX3vVwY annotator=Miblo]
[0:03][Recap and set the stage for the day]
[2:24][Run the game to demo the Z-fighting and fringing that we need to eliminate]
[4:51][Consider switching to a different computer with a newer graphics card]
[6:50][Determine to enable multisampled antialiasing]
[7:54][handmade_opengl.cpp: Disable the cube texturing and colour the sides of the cubes in a gradient]
[12:47][Run the game to see our visually parsable cubes]
[19:04][Run the game to see our green cubes]
[19:18][Blackboard: Fake Cube Lighting]
[25:53][Run the game to illustrate areas requiring better lighting]
[28:53][Blackboard: MSAA (Multisample Antialiasing) + ATC (Alpha to Coverage)]
[30:04][Blackboard: Aliasing and Apparent Error in Discretizing]
[34:25][Blackboard: Our current implementation of antialiasing]
[37:30][Blackboard: Multisample antialiasing on graphics cards]
[44:09][Blackboard: Typical MSAA pipeline in GPU APIs]
[49:02][Blackboard: Alpha to Coverage]
[50:43][Blackboard: Where are the samples?]
[55:55][Blackboard: Alpha to Coverage continued]
[57:20][Research OpenGL's specification alpha to coverage]
[1:05:29][Research glSampleCoverage[ref
    site="Khronos"
    page="glSampleCoverage"
    url="https://www.khronos.org/registry/OpenGL-Refpages/es1.1/xhtml/glSampleCoverage.xml"]]
[1:08:16][handmade_opengl.cpp: Make OpenGLRenderCommands() enable GL_SAMPLE_ALPHA_TO_COVERAGE, GL_SAMPLE_ALPHA_TO_ONE and GL_MULTISAMPLE]
[1:10:32][Blackboard: Screen Door Transparency]
[1:11:57][Research how to set up a buffer suitable for multisampling[ref
    site="docs.GL"
    page="glTexImage2DMultisample"
    url="http://docs.gl/gl3/glTexImage2DMultisample"]]
[1:23:37][A few words on GPU programming]
[1:26:41][handmade_opengl.cpp: Make OpenGLRenderCommands() call glTexImage2DMultisample()]
[1:34:07][handmade_opengl.cpp: Set up for multisampling, based on glcorearb.h[ref
    site="Khronos"
    page="glcorearb.h"
    url="https://www.khronos.org/registry/OpenGL/api/GL/glcorearb.h"]]
[1:42:20][Step in to OpenGLRenderCommands() to find that our graphics card may not support multisampling[ref
    site="Khronos Wiki"
    page="Multisampling"
    url="https://www.khronos.org/opengl/wiki/Multisampling"]]
[1:50:46][handmade_opengl.cpp: Make OpenGLRenderCommands() pass MaxSampleCount - 1 to glTexImage2DMultisample(), and step in to find that we have 8x multisampling, but that it is not working properly]
[2:01:34][handmade_opengl.cpp: Try passing MaxSampleCount to glTexImage2DMultisample(), and run the game to find that it works]
[2:02:30][Q&A][:speech]
[2:03:27][@sahfortv][Can you check if the status has changed after updating bind texture?]
[2:03:53][@randdalf][Did you remember to prefix your glTexImageMultisample2D with a WINAPI) (aka __stdcall prefix)? That's usually the cause of access violations for me]
[2:05:20][win32_handmade.cpp: Make Win32InitOpenGL call glTexImage2DMultisample()]
[2:06:37][@macielda][Your glTexParameteri needs to use GL_TEXTURE_2D_MULTISAMPLE instead of GL_TEXTURE_2D]
[2:08:36][@general1337][Is there a way to debug or have a visual example of the multisampling process?]
[2:09:03][@mathk_][Maybe we should use glDebugMessageCallback and glEnable(GL_DEBUG_SYNCHRONOUS) sometime, then we can assert in the callback and are able to see just where we gl error in the debugger]
[2:10:07][@snoringtortoise][You mentioned in a previous episode that one of the reasons for moving to 3D was due to performance concerns with the sorting. Would it have been a viable alternative to keep the sorting results in permanent storage and then each frame only re-sort the entities that have moved? Just considering that many entities like trees and traversables don't move]
[2:12:29][@macielda][Casey, I have started working on Handmade Vulkan port earlier today, is that okay? I got it to initialize properly and have done some groundwork for outputting rects. My current plan is to work on it this week]
[2:15:33][@macielda][So Alpha to Coverage does order-independent transparency just like that? Any serious limitations you can think of?]
[2:17:50][@snoringtortoise][For those of us who are very interested in engine development, what are some of the more advanced platform features that you would recommend investigating?]
[2:20:17]["The only reason that we ever did it is because Won insisted that we do it"][quote 552]
[2:21:26][@snoringtortoise][On the platform side like any debugging features, you mentioned a while ago that 1935's engine was light years ahead in that it is far more advanced]
[2:24:51][@thesizik]["Problem exists between Khronos and Casey"?]
[2:25:19][Close everything down with a glimpse into the future][:speech]
[/video]
