Saturday, April 21, 2012

Create SharpGL/OpenGL for C# Project in windows form application

SharpGL is a C# OpenGL Class library . SharpGL 2.0 is a powerful library that allows you to use OpenGL in your managed applications. Some of the top features are:
  • Full support for all OpenGL functions up to OpenGL 4.2
  • Full support for all commonly used OpenGL extensions
  • Support for WinForms applications
  • Support for WPF applications (without resorting to WinForms hosts)
  • A powerful scene graph including polygons, shaders, NURBs and more
  • Many sample applications as starting points for your own projects.
  • Visual Studio Extension with SharpGL project templates for WPF and WinForms.
Its Class libraries are
  • SharpGL - Contains the main OpenGL object - this object wraps all OpenGL functions, enumerations and extensions.
  • SharpGL.SceneGraph - Contains all wrappers for OpenGL objects and Scene Elements - Lights, Materials, Textures, NURBs, Shaders and more.
  • SharpGL.WinForms - Contains Windows Forms Controls for your applications.
  • SharpGL.WPF - Contains WPF Controls for your applications.
  • SharpGL.Serialization - Contains classes used to load geometry and data from 3D Studio Max files, Discreet obj files and trueSpace files.

Now start you first SharpGL Application

Follow the following steps to create ShapGL Applicaton .
1.Install the SharpGL Visual Studio Extension
Download the Visual Studio Extension from here(SharpGL Extension) and extract it. Double click on the *.vsix file - the install confirmation will be shown. Choose 'Install'.
2. Run Visual Studio and create a New Project
Run Visual Studio and choose 'New Project'. You'll see that under C# there are two new templates - SharpGL Windows Forms Application and SharpGL WPF Application. Choose your preferred platform.

3. Run the Application
Hit Ctrl-F5 or press 'Run'. Your new SharpGL application runs up, showing a rotating pyramid. You have three functions by default:
OpenGLDraw - Used to do OpenGL rendering.
OpenGLInitialized - Used to perform any OpenGL initialization.
Resize - Used to create a projection transformation.
The code that comes with the template does the basic for you .


  1. SharpGL is Great! but 100times slower than freeglut.

    1. Yes but it takes more than 100times work to develop your app with freeglut

  2. Ya, It's true. Good things is it makes CAD like software design easier

    1. I have just downloaded SharpGL, I'm looking for documentation and samples? where can I get some help?