Coder Social home page Coder Social logo

isncg / glfw-net Goto Github PK

View Code? Open in Web Editor NEW

This project forked from foreverzer0/glfw-net

0.0 0.0 0.0 297 KB

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

License: MIT License

C# 100.00%

glfw-net's Introduction

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

glfw-net's People

Contributors

foreverzer0 avatar larsbrubaker avatar santoro-mariano avatar isncg avatar theraot avatar abenedik avatar eouw0o83hf avatar risai avatar devvoid avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.