A GLFW 3.x interface for Nim
Switch branches/tags
Nothing to show
Clone or download
johnnovak Merge pull request #43 from iffy/patch-1
Update nim-glm installation command
Latest commit 4deb6b0 Aug 9, 2018



A GLFW 3.x interface for Nim.


The best way to install the latest version of the package is by using nimble:

nimble install nim-glfw


All the examples except minimal.nim and events.nim depend on nim-glm.

You can install nim-glm with the following command:

nimble install glm

Compile and run any of the examples by invoking the nim compiler like this from the examples directory:

nim c -r -d:glfwStaticLib <example>

Alternatively, you can invoke the examplesStatic nimble task from the project root directory to compile all examples:

nimble examplesStatic


This code from examples/minimal.nim displays a window for one second and then terminates:

import os, glfw

proc main =
  var c = DefaultOpenglWindowConfig
  c.title = "Minimal Nim-GLFW example"
  var w = newWindow(c)



Currently, no documentation exists, but a symbol list can be generated by invoking these commands from the root directory:

nim doc2 glfw.nim
nim doc2 glfw/wrapper.nim

Statically linking to GLFW

To link statically against GLFW, define the conditional symbol glfwStaticLib (-d:glfwStaticLib or --define:glfwStaticLib).

Version history

  • 0.3.1

    • Use recommended nimble package structure
    • Add nimble task to build all examples
  • 0.3.0

    • new and improved API
  • 0.2.1

    • fix import errors
    • fix linker errors on windows
    • update nimble metadata
    • update the README example
  • 0.2.0

    • renamed symbols

      TGL_API -> GlApi
      PWin -> Win
      geNoErr -> glerrNoError
      TGLFW_Err -> GlfwError
      TGL_ES_version -> GlEsVersion

      and so on

    • newWin has been replaced with newGlWin and newGlEsWin


johnnovak: Provided ports of some of the GLFW examples.

def-: Added support for static linking.