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:
I really don't get why the official OpenGL documentation still uses GLUT on its examples.
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.
Yes there is the https://www.opengl.org/sdk/, but it is just a dump of libraries that won't help beginners easily.
Which is only going to get worse with Vulkan (around 600 LOC for the triangle).
> Which is only going to get worse with Vulkan (around 600 LOC for the triangle)
Does this really matter? Vulkan isn't meant for beginners, nor should it be. Beginners would be much better off served using OpenGL, or on a higher level API that sits on top of Vulkan/DX12/Metal (actually, Metal is probably friendly enough for a beginner to use... but that's neither here nor there).
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.
I spent the last few months struggling with modern OpenGL myself - using GL ES2 which doesnt even provide access to the deprecated OpenGL 1 stuff. I wrote about it here to help others trying to pick it up from scratch: http://seshbot.com/blog/2015/05/05/an-introduction-to-opengl...
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:
if (!glfwInit())
return -1;
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.
https://github.com/go-gl/examples/tree/master/glfw31-gl41cor...
If you already have Go installed, you can try it easily, just:
It will compile and run on OS X, Linux and Windows.