

Minimal OpenGL 3.3 Core Profile Demo - davvid
http://nullprogram.com/blog/2015/06/06/

======
shurcooL
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:

[https://github.com/go-
gl/examples/tree/master/glfw31-gl41cor...](https://github.com/go-
gl/examples/tree/master/glfw31-gl41core-cube)

If you already have Go installed, you can try it easily, just:

    
    
        go get -u github.com/go-gl/examples/glfw31-gl41core-cube
    

It will compile and run on OS X, Linux and Windows.

------
pjmlp
Given his switch to GLFW.

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/](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).

~~~
yoklov
> 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).

------
RelaxBox
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.

~~~
cechner
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...](http://seshbot.com/blog/2015/05/05/an-introduction-to-opengl-
getting-started/)

------
tdicola
Wow that's great to see the absolute bare necessities to use modern OpenGL
distilled into one nice blog post.

------
Narishma
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.

~~~
elmindreda
Since the demo now uses GLFW it could call glfwGetTime, which uses
clock_gettime where available.

------
benihana
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.

~~~
yoklov
Uh, what exactly about this is questionable?

Only think I can think you could mean is the lack of curly braces, but that's
so common it can't be it.

EDIT: Unrelated sidenote: GLFW doesn't really make OpenGL itself any less
tedious, only setting it up.

