[video output=day372 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Using Strictly OpenGL Core Profile" vod_platform=youtube id=9PkR8pdDOtw annotator=Miblo]
[0:16][Run the game to recap and set the stage for the day, with a few words on using 3D APIs]
[4:44][Determine to field debug messages and conditionally disable compatibility contexts]
[10:55][glDebugMessageCallback[ref
    site="docs.GL"
    page="glDebugMessageCallback"
    url="http://docs.gl/gl4/glDebugMessageCallback"]]
[14:34][glDebugMessageControl[ref
    site="docs.GL"
    page="glDebugMessageControl"
    url="http://docs.gl/gl4/glDebugMessageControl"]]
[16:16][GL_ARB_debug_output[ref
    site="Khronos"
    page="GL_ARB_debug_output"
    url="https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_debug_output.txt"]]
[23:18][win32_handmade.cpp: Pull in GLDEBUGPROC() and glDebugMessageCallbackARB() from corearb.h[ref
    site="Khronos"
    page="glcorearb.h"
    url="https://www.khronos.org/registry/OpenGL/api/GL/glcorearb.h"]]
[29:31][handmade_opengl.cpp: Make OpenGLInit() call glDebugMessageCallbackARB()]
[30:13][Run the game to successfully receive our callback and view an error]
[32:22][handmade_opengl.cpp: Make OpenGLInit() perform the callback later]
[32:52][Run the game and receive no errors]
[33:18][win32_handmade.cpp: Switch to the OpenGL Core Profile and set WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB]
[34:42][Run the game and get an error message]
[36:16][handmade_opengl.cpp: Prevent OpenGLInit() from calling glTexEnvi()]
[36:24][Run the game to find that glAlphaFunc() has been removed]
[36:51][On why glAlphaFunc() is no longer necessary]
[38:23][handmade_opengl.cpp: Make the FragmentCode conditionally apply blending and OpenGLRenderCommands() no longer call glAlphaFunc()]
[40:40][handmade_opengl.cpp: Prevent OpenGLRenderCommands() from enabling GL_ALPHA_TEST]
[41:00][Note that depth testing doesn't occur in the shader]
[42:14][handmade_opengl.cpp: Prevent OpenGLRenderCommands() from enabling GL_TEXTURE_2D and the glMatrixMode() stuff]
[43:22][Run the game and realise that we must create and bind a vertex array object][quote 561]
[44:49][handmade_opengl.cpp: Make OpenGLInit() call glGenVertexArrays()[ref
    site=docs.GL
    page="glGenVertexArrays"
    url=http://docs.gl/gl3/glGenVertexArrays] and glBindVertexArray()[ref
    site=docs.GL
    page="glBindVertexArray"
    url=http://docs.gl/gl3/glBindVertexArray]]
[48:28][Run the game and receive apparently the opposite error from before]
[52:13][Note that we are using client-side memory and consider switching to GPU-mapped memory]
[57:33][handmade_opengl.cpp: Make OpenGLInit() call glGenBuffers()[ref
    site="docs.GL"
    page="glGenBuffers"
    url="http://docs.gl/gl3/glGenBuffers"] to store the vertex array]
[1:01:32][handmade_opengl.cpp: Make OpenGLRenderCommands() call glBufferData()[ref
    site="docs.GL"
    page="glBufferData"
    url="http://docs.gl/gl3/glBufferData"] for that GL_ARRAY_BUFFER]
[1:04:28][A few words on how this buffer has improved the rendering pipeline]
[1:07:08][handmade_opengl.cpp and win32_handmade.cpp: Pull in the necessary calls from corearb.h[ref
    site="Khronos"
    page="glcorearb.h"
    url="https://www.khronos.org/registry/OpenGL/api/GL/glcorearb.h"]]
[1:10:21][Run the game to find that we have passed the glVertexAttribPointer error, and that the final error is relating to GL_QUADS]
[1:11:57][On why there may not be a fix for this GL_QUADS error]
[1:15:08][Blackboard: Vertex Sharing]
[1:17:25][Blackboard: Specifying the vertices with an Index stream]
[1:22:31][handmade_opengl.cpp: Re-enable GL_QUADS, turn off the debug messages, and run the game to find that we're not getting a working image]
[1:23:31][win32_handmade.cpp: Turn off WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB, and run the game to find that it's now okay]
[1:24:17][Blackboard: Our options regarding the WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB bit, GL_QUADS and GL_TRIANGLE_STRIP]
[1:31:41][handmade_opengl.cpp: Change GL_QUADS to GL_TRIANGLE_STRIP in OpenGLRenderCommands(), and re-enable the debug message]
[1:32:59][Run the game to see that this is not correct because the vertex order is wrong]
[1:33:24][handmade_opengl.cpp: Re-enable the debug message and WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB]
[1:34:11][Run the game to see that we're completely compliant, but just drawing wrong]
[1:34:21][handmade_render_group.cpp: Switch PushQuad() to push the vertices in the correct order for GL_TRIANGLE_STRIP]
[1:35:18][Run the game to see that it is now correct, and note that this won't work if we had a texture atlas]
[1:38:53][Determine to get the orthographic projection back online for the debug view]
[1:43:25][handmade_math.h: Enable OrthographicProjection() to use the near and far clip planes]
[1:45:16][Run the game and note that we'll need to deal with the camera part of the transform for the debug UI]
[1:47:37][handmade_debug.cpp: Consider how the SetCameraTransform() call in DEBUGStart() is now massively wrong]
[1:49:02][handmade_debug.cpp: Make SetCameraTransform() use and scale the CameraX and CameraY]
[1:50:16][Blackboard: Mapping the extremities of the screen to -1 to 1]
[1:52:36][Run the game and assess our clip plane situation]
[1:54:14][handmade_debug.cpp: Begin to consider what else in DEBUGStart() may be problematic]
[1:55:29][Q&A][:speech]
[1:56:49][@ratchet_freak][Where's owlbot? He's not online]
[1:59:19][@macielda][About the QUAD thing, you might want to do something like this, maybe[ref
    site="The Little Grasshopper"
    page="Vertex Submission for Quad Meshes"
    url="http://github.prideout.net/quad-meshes"]]
[2:01:33][@alephant][You could avoid geometry shaders by instancing a triangle strip that is just a quad]
[2:02:21][@hguleryuz][What do you think about using a different set of program / shader for debug text, one which has no projection matrix at all? Would it be bad to switch programs for GUI text performance-wise?]
[2:05:40][@ratchetfreak][There is a third way of setting the vertex data through ARB_separate_attrib_format (went to core in 4.3). This separates the vertex format from the buffer it reads the data from which is more optimal for the driver]
[2:06:32][@robrobby][When the engine uses a deprecated function like GL_QUADS, what are the main issues that people would have to deal with playing this game, because it is running, right?]
[2:09:05][@soysaucethekid][Is OpenGL 3.0 the target version?]
[2:11:14][@rizoma80][Any idea why one can have stuttering problems using OpenGL DWM stuff related?]
[2:14:01][@macielda][What do you like better in OpenGL AZDO as opposed to Vulkan?]
[2:18:35][@pepevel][Would it be interesting to implement OpenGL on top of OpenCL?]
[2:19:54][@robrobby][Since Handmade Hero is using multithreaded processing of the game entities, how would the game even stutter when time wouldn't be enough 'til the next frame?]
[2:21:01][Shut this down][:speech]
[/video]
