This is cool, and I'm glad to see he switched to GLFW which is the best choice IMO. If you'd like an equivalent article/sample minimal project for modern OpenGL (4.1) written in Go, I recommend:<p><a href="https://github.com/go-gl/examples/tree/master/glfw31-gl41core-cube" rel="nofollow">https://github.com/go-gl/examples/tree/master/glfw31-gl41cor...</a><p>If you already have Go installed, you can try it easily, just:<p><pre><code> go get -u github.com/go-gl/examples/glfw31-gl41core-cube
</code></pre>
It will compile and run on OS X, Linux and Windows.
Given his switch to GLFW.<p>I really don't get why the official OpenGL documentation still uses GLUT on its examples.<p>Khronos should really update those books, additionally with an helper matrix, texture and shader loading library to avoid every OpenGL beginner to re-write the same code before a triangle gets shown.<p>Yes there is the <a href="https://www.opengl.org/sdk/" rel="nofollow">https://www.opengl.org/sdk/</a>, but it is just a dump of libraries that won't help beginners easily.<p>Which is only going to get worse with Vulkan (around 600 LOC for the triangle).
It's nice to see some content for modern OpenGL -- it's been a while since I've done any raw GL programming, and I understand the newest specs are finally deprecating the mess of APIs that have accumulate. Last I saw there were many different ways to render polygons (immediate mode, display lists, vertex arrays, vertex buffer objects...) and I can only imagine it's a nightmare for people just getting started.
This uses gettimeofday() for timing purposes which has been deprecated for a few years now. I believe it's not reliable as it can be changed by other processes running alongside your application (like ntpd for example). A better alternative is clock_gettime() with a monotonic clock.
This is great! I last looked at OpenGL on the desktop a decade ago and it was tedious. GLFW looks awesome. But looking at the example code for it, I saw this:<p><pre><code> if (!glfwInit())
return -1;
</code></pre>
Why do this? Is there some kind of amazing thing in the C/C++ world that doing this unlocks? It just seems like an inconsistent, dangerous accident waiting to happen.