An example of game with OpenGL 4

asftian wrote on Thursday, January 01, 2015:


I am a beginner and like to find a basic and yet full example of a game (2D or 3D) developed using GLFW and modern OpenGL (Shader) with full source code. May someone help me?

I have been googling a very long time, but no success, as those examples I found are either for old/dated OpenGL (Fixed) or rendering only (no interaction)…

thanks a lot,


bastiaanolij wrote on Saturday, January 03, 2015:

Hey David,

Such a sample would be thousands of lines of code. Where do you start to look?

I do feel your pain though, it took me a long time to work through all the examples that are outdated and only work for OpenGL 1/2 and fail as soon as you switch to OpenGL 3 (at least on a Mac where all fixed pipeline stuff has been deprecated).

Maybe ask something more specific and people may be able to help you better.

asftian wrote on Sunday, January 04, 2015:

Thanks, Bastiaan, for the suggestion.

I didn’t expect thousands of lines of code. For example, an example of small XNA game is probably only around 100 lines, which is able to demonstrate ‘assent loading’, ‘character moving’, ‘control with keyboard and/or mouse’, etc.

Won’t the OpenGL and GLFW be able to achieve the same? It doesn’t have to be a fancy and full-scale game.

bastiaanolij wrote on Sunday, January 11, 2015:


It would definitely be a fun project to do as a tutorial but you have to realise that GLFW “only” provide cross platform basics to get you going with OpenGL. You’d be writing loading of meshes, shaders, user interaction etc. all on top of it. Not sure if there are existing libraries that plug in nicely to GLFW.