Skip to content
Complete, cross-platform, managed wrapper around the GLFW library for creating native windows with an OpenGL context.
Branch: master
Clone or download
ForeverZer0 - Updated library name to Unix-like style
- Actually removed .vscode folder this time
Latest commit 6da8eda Apr 30, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
GLFW.NET - Updated library name to Unix-like style Apr 29, 2019
.gitattributes Add .gitignore and .gitattributes. Jun 12, 2018
.gitignore - Updated library name to Unix-like style Apr 29, 2019
GLFW.NET.sln - Implemented remaining GLFW 3.3 functions Apr 29, 2019
HISTORY.md - Updated library name to Unix-like style Apr 29, 2019
LICENSE.md Added license Jun 12, 2018
README.md - Updated README Apr 29, 2019
favicons.png

README.md

GLFW.NET

Complete, cross-platform, managed wrapper around the GLFW library for creating native windows with an OpenGL context.

Features

  • Wraps 100% of the GLFW library (3.3), including Vulkan
  • Cross-platform
  • Built upon the .NET Standard 2.0, for full compatibility with .NET Framework, .NET Core, and Mono
  • Detailed XML documentation for full IntelliSense in Visual Studio, etc.
  • Included "GameWindow" class, to simplify window management by emulating a WinForm with similar properties, events, etc.

Dependencies

  • A .NET Standard 2.0 compatible framework such as:
    • .NET Framework 4.6.1
    • .NET Core 2.0
    • Mono 5.4
  • The GLFW library, which can be found here: http://www.glfw.org/download.html
    • Windows 32 and 64 bit binaries available

Getting Started

The recommended way to use this library is to download the source and include directly within your application, as this offers the highest amount of control over dependency loading. It was build upon .NET Standard 2.0 to target the largest number of platforms and frameworks, and thus you will need to fine-tune the dependency loading to your specific needs (see below).

.NET Core

In all platforms utilizing .NET Core, the AssemblyLoadContext can be used to resolve native dependencies at runtime, based on platform, architecture, etc.

Microsoft Windows

Windows users need only grab the pre-built binaries from the the GLFW. There are x86 and x64 versions available, and you will need the appropriate one for your target architecture. These need placed in a place where they can be loaded by your application (i.e. side-by-side) or edit the Glfw.LIBRARY constant.

Unix

Unix users need only have GLFW built and installed on the system globally, and need not distribute any binaries along with the application.

IMPORTANT!

The Windows and Unix library name differ. On Windows, the library name is glfw3 (always exclude file extensions), and on Unix systems, it is only glfw without the major version suffix. By default, the Glfw.LIBRARY constant is hard-coded in the Windows format, so this will either need changed, or require you to resolve the dependencies manually.

Native Window Creation

Once you have your dependencies taken care of, creating a window is simple.

using (var window = new NativeWindow(800, 600, "MyWindowTitle"))
{
    // Main application loop
    while (!window.IsClosing)
    {
        // OpenGL rendering
        // Implement any timing for flow control, etc (see Glfw.GetTime())
        
        // Swap the front/back buffers
        window.SwapBuffers();
        
        // Poll native operating system events (must be called or OS will think application is hanging)
        Glfw.PollEvents();
    }
}

Source Code

Source code can be found at GitHub: https://github.com/ForeverZer0/glfw-net

You can’t perform that action at this time.