Git Product home page Git Product logo

pencil.gaming-glfw2's Introduction

Pencil.Gaming

Pencil.Gaming is a gaming library for C#, providing support for OpenGL, GLFW and OpenAL. It's a stable, cross-platform, open-source (some prefer the term "free") alternative to libraries like XNA, which has pretty much died now, OpenTK, which hasn't been updated for about a year, and SharpDX, which is not cross-platform. A feature that Pencil.Gaming has over most other C# gaming libraries, is that users do not need to install any redistributables!

The OpenGL implementation is based on the OpenTK source code.

A quick overview of the samples:

Functionality and stability

GLFW2

Platform OpenGL core OpenGL extensions GLFW OpenAL
Linux 64-bit Stable Stable Stable Stable
Linux 32-bit Stable Stable Stable Stable
Windows 64-bit Stable Stable Stable Stable
Windows 32-bit Stable Stable Stable Stable
Mac OS X Stable Stable Stable Stable

GLFW3

Platform OpenGL core OpenGL extensions GLFW OpenAL
Linux 64-bit Stable Stable Stable Stable
Linux 32-bit Stable Stable Broken Stable
Windows 64-bit Stable Stable Stable Stable
Windows 32-bit Stable Stable Untested Stable
Mac OS X Stable Stable Not Implemented Stable

Sample usage (OpenGL & GLFW)

This section has been removed. Please refer to the [wiki] (https://github.com/antonijn/Pencil.Gaming/wiki) for GLFW2/3 examples.

Sample usage (OpenAL)

Apart from implementing GLFW, Pencil.Gaming also has a few utilities to make your life bearable. On of the more notable of these is the Al.Utils.BufferFromWav utility, which is able to load wave files into an OpenAL buffer.

uint buffer = Al.Utils.BufferFromWav("MyWaveFile.wav");
uint source;
Al.GenSources(1, out source);

Al.Source(source, AlSourcei.Buffer, (int) buffer);
Al.Source(source, AlSourceb.Looping, true);

Al.SourcePlay(source);

// ...
// ...

// When cleaning up:
Al.DeleteSources(1, ref source);
Al.DeleteBuffers(1, ref buffer);

Sample Usage (Gl.Utils)

Gl.Utils is another utility class provided by Pencil.Gaming. It provides support for cross-platform texture loading, and will feature a model loading utility (obj files only).

This is how you use the image loading utility:

int image = Gl.Utils.LoadImage("myfile.png"); // Works with multiple file formats
Gl.BindTexture(TextureTarget.Texture2D, image);

Gl.Begin(BeginMode.TriangleStrip);
  Gl.TexCoord2(0f, 1f);
  Gl.Vertex2(0.1f, 0.9f);
  Gl.TexCoord2(0f, 0f);
  Gl.Vertex2(0.1f, 0.1f);
  Gl.TexCoord2(1f, 1f);
  Gl.Vertex2(0.9f, 0.9f);
  Gl.TexCoord2(1f, 0f);
  Gl.Vertex2(0.9f, 0.1f);
Gl.End();

pencil.gaming-glfw2's People

Contributors

andykorth avatar

Stargazers

 avatar

Watchers

 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.