• Stars
    star
    214
  • Rank 184,678 (Top 4 %)
  • Language
    C#
  • License
    MIT License
  • Created over 6 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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 Unix format. On Windows, you will need to account for name change while resolving dependencies, or rename the binary.

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

More Repositories

1

SharpNBT

A pure CLS-compliant C# implementation of the Named Binary Tag (NBT) format specification commonly used with Minecraft applications, allowing easy reading/writing streams and serialization to other formats.
C#
13
star
2

glfw

Ruby bindings for the excellent GLFW library, implemented as a high-performance C extension, using common Ruby idioms and object-oriented API opposed to a direct analog.
C
13
star
3

Iso639

Defines the ISO-639 language standard, with support for all parts, with conversion to/from cultures.
C#
5
star
4

fmod

Ruby wrapper around the high performance, cross-platform FMOD low-level sound library. You get all the benefits of the FMOD library, but in the object-oriented Ruby way!
Ruby
5
star
5

craftbook-nbt

Feature-rich Ruby implementation of the Named Binary Tag (NBT) specification.
Ruby
3
star
6

ruqqus

A Ruby API implementation for Ruqqus, an open-source platform for online communities, free of censorship and moderator abuse by design.
Ruby
3
star
7

Anvil

A collection of modular and optimized libraries for low-level cross-platform game development.
C#
2
star
8

libtmx

Dependency-free TMX (Tiled Map Format) reading library, both XML and JSON, written in pure C99, including support for Zstd, Gzip, and Zlib compression formats.
C
2
star
9

opengl-registry

OpenGL Registry parser for generating API specifications
Ruby
1
star
10

open-image

Cross-platform and dependency-free Ruby C-extension for basic reading/writing common image formats using one uniform interface.
C
1
star
11

open_rpg

[WIP] Ruby 2D game framework modeled after Enterbrain's RPG Maker XP/VXA.
C
1
star
12

glad-net

A port of the famous OpenGL loader generator for C#, allowing you to generate OpenGL bindings for your specific needs and add directly into your project without the hassle.
C#
1
star
13

libclang

Ruby gem wrapping the modern latest version of Clang.
C
1
star