• Stars
    star
    720
  • Rank 62,908 (Top 2 %)
  • Language
    C#
  • License
    MIT License
  • Created about 11 years ago
  • Updated over 1 year ago

Reviews

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

Repository Details

Use OpenGL in .NET applications. SharpGL wraps all modern OpenGL features and offers a powerful scene graph to aid development.

SharpGL

main codecov GuardRails badge

Unlock the power of OpenGL in any .NET application. SharpGL wraps all modern OpenGL features, provides helpful wrappers for advanced objects like Vertex Buffer Arrays and shaders, as well as offering a powerful Scene Graph and utility library to help you build your projects.

Example of SharpGL

Check out the Samples, they're a great place to start learning how to use SharpGL.

Getting Started

SharpGL is made up of a number of packages, you can install whichever package or packages you need!

Package Link Overview
SharpGL SharpGL Core All OpenGL functions wrapped and ready to execute, as well as all OpenGL extensions.
SharpGL.SceneGraph SharpGL SceneGraph The SceneGraph library contains a full class library which models key 3D entities.
SharpGL.Serialization SharpGL Serialization The Serialization library contains utilities to load data from Discreet, Wavefront and Caligari file formats.
SharpGL.WPF SharpGL WPF SharpGL for WPF includes the Core as well as OpenGL controls to drop into your WPF app.
SharpGL.WinForms SharpGL WinForms SharpGL for WinForms includes the Core as well as OpenGL controls to drop into your WinForms app.

Install SharpGL packages with NuGet, either by using the Package Explorer or the Package Manager tool, e.g:

PM> Install-Package SharpGL

Compatibility

SharpGL has built in support for OpenGL support, newer functions can be loaded on demand as needed. The table below shows the compatibility across frameworks and platforms.

OpenGL

Currently SharpGL has built in bindings for OpenGL 4.0 - functions from later versions can be loaded at runtime as needed.

Framework Compatibility

All components support the .NET Framework 4.0 onwards, .NET Core 3.0 onwards and .NET Standard 2.1 onwards. Some components also support earlier versions.

Component .NET Framework .NET Core .NET Standard
SharpGL 4.0+ 2.0+ 2.0+
SharpGL.SceneGraph 4.0+ 2.0+ 2.0+
SharpGL.Serialization 4.0+ 2.0+ 2.0+
SharpGL.WinForms 4.0+ 3.0+ 2.1+
SharpGL.WPF 4.0+ 3.0+ 2.1+

Platform Compatibility

Compatibility across platforms is supported via framework specific components.

Platform Support
WinForms on Microsoft Windows βœ… via SharpGL.WinForms
WPF on Microsoft Windows βœ… via SharpGL.WPF
UWP on Microsoft Windows ❌ Work in Progress
Xamarin on Microsoft Windows ❌ Work in Progress
Xamarin on MacOS ❌ Work in Progress
Xamarin on Linux ❌ Work in Progress

Legacy Versions

The Visual Studio 2017 version of the codebase, which supports the .NET Framework only, is available on the release/2.x branch. However, this branch will not be maintained going forwards. The current mainline still supports the .NET Framework.

Developer Guide

To build the code, clone the repo and open the SharpGL, Samples or Tools solution. The Extensions solution is used for the Visual Studio Project Templates and requires additional components - you can find out more on the Wiki on the 'Developing SharpGL' page.

You can also use the following scripts to run the processes:

Script Notes
config.ps1 Ensure your machine can run builds by installing necessary components such as nunit. Should only need to be run once.
build.ps1 Build all solutions. Ensures that we build both 32/64 bit versions of native components.
test.ps1 Run all tests, including those in samples.
coverage.ps1 Create a coverage report. Reports are written to ./artifacts/coverage
pack.ps1 Create all of the SharpGL NuGet packages, which are copied to ./artifacts/packages.

These scripts will generate various artifacts which may be useful to review:

artifacts\
  \tests                  # NUnit Test Reports
  \coverage               # Coverage Reports
  \packages               # NuGet Packages

Build Pipelines

Test the main build pipeline with act:

# Install act. See: https://github.com/nektos/act
brew install act

# Run the main pipeline to test release please
act -j main -s GITHUB_TOKEN=<token>

Releasing

To make and publish a release:

  1. Update the *.csproj files with the new version number
  2. Create the version tag (e.g. git tag v3.2.1)
  3. Push the code and tags (e.g. git push --follow-tags)

AppVeyor will automatically push the release to NuGet and GitHub.

Sample Applications

There are a large number of sample applications that show how to use SharpGL. Check out the 'Samples' solution to see the samples that are available.

WinForms - Ducky Sample

This sample shows how to load an object file with materials, using the Serialization library. It also has great support for internationalization (thanks odalet)!

Ducky Sample

This sample demonstrates:

  • Loading *.obj files and associated materials
  • Building polygons from *.obj files
  • Arcball rotation

Note that this sample uses immediate mode OpenGL, which is officially deprecated.

WinForms - Extensions Sample

This sample shows how to use OpenGL extensions. It demonstrates this by using the 'bump map' extensions.

Note that this sample uses immediate mode OpenGL, which is officially deprecated.

Extensions Sample

WinForms - Hit Test Sample

This sample shows how to use to perform hit testing with SharpGL. It uses the Scene Graph to support this.

Note that this sample uses immediate mode OpenGL, which is officially deprecated.

Extensions Sample

WinForms - Modern OpenGL Sample

This sample shows how to use modern OpenGL capabilities which are Shader based, by showing a vertex and fragment shader.

Extensions Sample

WinForms - Native Textures Sample

This sample shows how to load textures into OpenGL using pure OpenGL functions. However, the Texture object from the SceneGraph will be much easier to use!

Note that this sample uses immediate mode OpenGL, which is officially deprecated.

Native Textures Sample

WinForms - Particle Systems Sample

This sample shows how to build a simple particle system with OpenGL.

Note that this sample uses immediate mode OpenGL, which is officially deprecated.

Native Textures Sample

WinForms - Polygon Loading

This sample shows how to load polygon data with the Scene Graph and Serialization libraries.

Note that this sample uses immediate mode OpenGL, which is officially deprecated.

Native Textures Sample

WinForms - Radial Blue

This sample shows how to use a Radial Blur effect in OpenGL.

Note that this sample uses immediate mode OpenGL, which is officially deprecated.

Native Textures Sample

WinForms - Render Contexts Sample

This sample demonstrates the different types of render contexts which are available, and how they affect performance and the extensions available.

Native Textures Sample

WinForms - Render Trigger Sample

This sample shows different ways to render; either on a timer or on demand.

Native Textures Sample

WinForms - Scene Sample

This sample demonstrates the Scene Graph which can be used to manage and render geometry.

Note that this sample uses immediate mode OpenGL, which is officially deprecated.

Native Textures Sample

WinForms - SharpGL Textures Sample

This sample demonstrates how textures can be loaded using the SharpGL Textures object, which greatly simplifies texture management.

Note that this sample uses immediate mode OpenGL, which is officially deprecated.

Native Textures Sample

WinForms - Simple Drawing Sample

This sample demonstrates the most basic form of simple drawing in OpenGL.

Note that this sample uses immediate mode OpenGL, which is officially deprecated.

Native Textures Sample

WPF - Cel Shading Sample

This sample demonstrates how to use shaders to create a cel-shaing effect.

Native Textures Sample

WPF - Drawing Mechanisms Sample

This sample demonstrates how to use shaders to create a cel-shaing effect.

WPF - FastGL

This sample demonstrates how to use NV_DX_interop(2) to accelerate drawing using DirectX.

WPF - Object Loading Sample

This sample demonstrates how to load objects in a WPF OpenGL project.

WPF - Simple Shader Sample

This sample shows how to use a simple shader.

Simple Shader Sample

WPF - Tea Pot Sample

This sample shows how to quickly and easily render geometry.

Simple Shader Sample

WPF - Text Rendering Sample

This sample shows how to render 3D and 2D text.

Text Rendering Sample

WPF - Two Dimensional Rendering Sample

This sample shows how to do simple 2D render, with a visual like an old Windows Screen-Saver.

Text Rendering Sample

Documentation

All documentation is available on the Wiki.

SharpGL Visual Studio Extensions

There are project templates available for SharpGL WinForms and WPF projects - just search for SharpGL on the Visual Studio Extensions gallery, or get the extensions directly:

Please be aware that these extensions have not been maintained over time and I am looking for support in maintaining them.

Credits, Sponsorship & Thanks

SharpGL is written and maintained by me. Special thanks go to the following contributors:

  • robinsedlaczek - Code and documentation updates, tireless patience while I get through a backlog of work!
  • odalet - amazing work on internationalization and making the serialization code work in all locales

NDepend

NDepend

SharpGL is proudly sponsored by NDepend! Find out more at www.NDepend.com.

Red Gate

Red Gate

Many thanks to Red Gate who have kindly provided SharpGL with a copy of their superb .NET Developer Bundle

JetBrains

JetBrains

Thanks for JetBrains for sponsoring SharpGL with Resharper!

Built with SharpGL

If you've got a project that uses SharpGL and you'd like to show it off, just add the details here in a PR!

Open Vogel

Checkout https://sites.google.com/site/gahvogel/ to see a free, open source project which supports aerodynamics!

AgOpenGPS

This is the very first open source Precision Agricultural App! Built by Brian Tischler, you can see the discussions and excitement on this project with farmers across the world!

More Repositories

1

hacker-laws

πŸ’»πŸ“– Laws, Theories, Principles and Patterns that developers will find useful. #hackerlaws
Shell
25,245
star
2

sharpshell

SharpShell makes it easy to create Windows Shell Extensions using the .NET Framework.
C#
1,478
star
3

consolecontrol

ConsoleControl is a C# class library that lets you embed a console in a WinForms or WPF application.
C#
672
star
4

effective-shell

Text, samples and website for my 'Effective Shell' series.
JavaScript
649
star
5

angular-modal-service

Modal service for AngularJS - supports creating popups and modals via a service.
JavaScript
629
star
6

app-icon

Icon management for Mobile Apps. Create icons, generate all required sizes, label and annotate. Supports Native, Cordova, React Native, Xamarin and more. Inspired by cordova-icon.
Java
563
star
7

wait-port

Simple binary to wait for a port to open. Useful for docker-compose and general server side activities.
JavaScript
321
star
8

docker-dynamodb

It's DynamoDB - in Docker!
Shell
230
star
9

spaceinvaders

Classic Space Invaders game written in JavaScript as a learning exercise.
JavaScript
189
star
10

terraform-aws-openshift

Create infrastructure with Terraform and AWS, install OpenShift. Party!
HCL
170
star
11

node-docker-microservice

Demonstrates how to build a testable, deployable, scalable microservice with NodeJS and Docker.
JavaScript
166
star
12

dotfiles

My personal setup. Vim, Tmux, Shells, etc.
Shell
77
star
13

mongo-monitor

CLI to monitor the status of a MongoDB cluster real-time πŸ“ˆ
JavaScript
77
star
14

crosswords-js

Tiny, lightweight crossword control for the web.
JavaScript
57
star
15

terraform-consul-cluster

Demonstrates how to create a resilient Consul cluster on AWS, using Terraform. Companion to my article on dwmkerr.com.
HCL
56
star
16

glmnet

GlmNet is a .NET version of the excellent OpenGL Mathematics library (GLM).
C++
52
star
17

starfield

A nice starfield background using built using HTML and vanilla JavaScript as a learning exercise.
HTML
49
star
18

architecture-as-code

A project to help define architecture logically as code, and generate living, interactive diagrams.
JavaScript
47
star
19

linux-kernel-module

A simple Linux Kernel Module, written as a learning exercise.
C
30
star
20

app-splash

Automatic splash screen generation and resizing for Mobile Apps. Supports Native, React Native, Cordova, Xamarin and more. The little brother of 'app-icon'.
Java
29
star
21

angular-memory-leaks

A small and leaky AngularJS application used to demonstrate how to identify, analyse and resolve memory leaks in JavaScript applications. A companion to the write-up at www.dwmkerr.com/fixing-memory-leaks-in-angularjs-applications
JavaScript
28
star
22

gacmanager

GAC Manager is an open source project that comes in two parts - a fully functional application to manage the Global Assembly Cache on your computer, and a C# API to allow you to manage the GAC yourself.
C#
25
star
23

langtonsant

Langton's Ant implemented in Javascript
JavaScript
23
star
24

sil

Sil is an application and addin for Visual Studio that lets you disassemble your C# code.
C#
21
star
25

file-format-wavefront

A simple .NET library to load data from Wavefront *.obj and *.mlb files.
C#
20
star
26

java-maven-standard-version-sample

This simple module demos how to use Conventional Commits, Git Hooks to enforce Conventional Commits and Semantic Versioning in a Java project built with Maven.
Shell
18
star
27

beautifully-simple-app-ci

This repository demonstrates some beautifully simple techniques for handling CI and CI for mobile apps. These techniques are appliclable to many mobile technologies and development platforms and compliment many different CI/CD toolchains.
Makefile
17
star
28

google-it

Command line tool to quickly look something up on Google!
Go
16
star
29

docker-terraform-ci

A base image for working with Terraform in CI scenarios. Provides Terraform, tflint, AWS CLI, etc.
Dockerfile
14
star
30

learn-a-language

A set of ideas and projects to work on that are great to help you learn a programming language.
14
star
31

dotnet-windows-registry

A simple, unit and integration test friendly wrapper around the Windows Registry, which is 100% compliant with the existing Microsoft.Win32.Registry package.
C#
12
star
32

react-es6-starter

A simple starter template for a React ES6 web app
JavaScript
12
star
33

lex-starter-kit

A starter kit for building chatbots using AWS Lex and Lambda.
Shell
11
star
34

switch

Switch is an Addin for Visual Studio that lets you quickly switch between related files, such as *.cpp and *.h or XAML and code-behind.
C#
9
star
35

svg-smile

Procedurally animated smiley face with SVG and pure JavaScript πŸ˜€πŸ™‚πŸ˜πŸ™β˜ΉοΈ
HTML
8
star
36

node-imagemagick-cli

Access the ImageMagick CLI tools from Node. No dependencies, cross-platform, with support for ImageMagick 6 and 7.
JavaScript
8
star
37

effective-container-engineering

Practical tips and patterns for building good container citizens
JavaScript
7
star
38

terraform-aws-vpc-example

An example terraform module to create an AWS VPC with a cluster of web servers.
HCL
7
star
39

chatgpt-diagrams-extension

A Chrome browser extension that renders diagrams in the ChatGPT website inline.
HTML
7
star
40

lex-chat

A simple CLI for chatting to AWS Lex ChatBots. Great for development!
JavaScript
6
star
41

jsonclient

JsonClient .NET is a lightweight .NET class library that lets you access Json web services
C#
6
star
42

git-speed

Speed up your git flow with these advanced techniques.
Shell
6
star
43

docs

Useful guides, documents, snippets for working with tech.
Shell
5
star
44

firekeys

FireKeys is a Windows Application that lets you assign hotkeys to your favourite programs, URLs or actions.
C#
5
star
45

java-gradle-standard-version-sample

This simple module demos how to use Conventional Commits, Git Hooks to enforce Conventional Commits and Semantic Versioning in a Java project built with Maven.
Java
5
star
46

mongo-connection-string

Handle mongodb connection strings with ease.
JavaScript
4
star
47

makefile-help

A simple snippet that allows you to quickly add a 'help' command to a Makefile to show command documentation.
Shell
4
star
48

better-specs

Great specs can be in markdown.
4
star
49

microservices-playground

☁️🐳 Spin up microservice platforms on the cloud in seconds - use it to evaluate them or try new technologies!
JavaScript
4
star
50

apex

C#
3
star
51

ContentEditableMvc

ContentEditableMvc is a small library for ASP MVC 4 web pages that lets you use the power of the HTML5 contenteditable attribute and Ajax to update content from the client.
C#
3
star
52

docker-shells

A Debian Image will the most popular shells pre-installed. Useful for comparing features between shells.
Makefile
3
star
53

dwmkerr.com

The 'dwmkerr.com' website content and setup. Static site managed with Hugo.
JavaScript
3
star
54

vsix-tools

A set of Powershell functions to help with vsix files.
PowerShell
3
star
55

effective-shell-installer

This is the install script for the https://effective-shell.com samples. This repo hosts the https://effective.sh installer.
Shell
3
star
56

QuickAccent

Windows utility to allow quick selection of accents and symbols to the clipboard.
C#
3
star
57

effective-nodejs-debugging

Presentation, code samples and notes for a talk at JSChannel 2016
HTML
3
star
58

html5base

My personal preferences for a base HTML5 page - includes a css reset and some minor typography tweaks, as well as hyperlink styling.
CSS
2
star
59

terraform-aws-ecs-cluster

Build an Amazon Elastic Container Services Cluster with Terraform.
HCL
2
star
60

dotnet-com-admin

The COM Admin library provides APIs to manage the installation and registration of .NET Framework and .NET Core COM Servers and Shell Extensions
C#
2
star
61

terraform-aws-kubernetes

Create infrastructure with Terraform and AWS, install Kubernetes. Party! http://www.dwmkerr.com/get-up-and-run…
HCL
2
star
62

microservice-zapp

A super simple microservice I often use when demoing docker. Spits out quotes from Zapp Brannigan!
Python
1
star
63

deusnovum

Deus Novum is an HTML5/JS game that lets you take control of a Universe - manipulate time, space and physics to complete challenges.
JavaScript
1
star
64

pythonexperiments

A set of experiments in Python, good for learning.
Python
1
star
65

fsharpexperiments

A general repo for F# projects as learning exercises.
F#
1
star
66

puzlog

Hobby project. Track crossword progress.
HTML
1
star
67

node-configuration

Simple configuration for Node applications, load from files, environment variables or parameters.
1
star
68

template-nodejs-module

A template for a Node.js module that has basic standards for linting, testing, build pipelines, NPM deployment, documentation and contributors.
Shell
1
star
69

seed-node

Starter project for Node.js.
JavaScript
1
star
70

on

A simple tool which helps when working with environment variables, devops and 12 factor apps.
JavaScript
1
star
71

homebrew-tools

A Homebrew Tap for tools which I maintain and publish.
1
star
72

slack-backend

A demo repository showing how Slack can be useful when building backend systems
1
star
73

app-version

Version management for Mobile Apps. Simple tool to set version for Native, React Native, Cordova, Xamarin and more.
JavaScript
1
star