Keeping Track of SharpGL
SharpGL 2.0 will be released very shortly - it provides some much needed updates such as:
- Hardware Acceleration
- OpenGL Extension Support
- 'Render Context Providers', allowing one to use DIB Sections, Native Windows, Offscreen Windows or even Framebuffer Extensions to render a scene
SharpGL is now hosted on CodePlex, at:
The CodePlex site has more information and the latest source code. I am also writing about the various challenges of creating the new version on my blog at:
Both of these sites contain up to date information on SharpGL and how it is progressing. Once SharpGL 2.0 is ready this main page will also be updated with examples and more documentation.
Use OpenGL in your C# applications with SharpGL, it's a breeze! Just drag an OpenGLControl onto your Windows Form and handle the 'OpenGLDraw' function - now just call ordinary OpenGL functions!
SharpGL provides you with two controls for designing forms. The OpenGLControl, which lets you do standard OpenGL drawing in a C# application, and the SceneControl, which does the same with added support for polygons/persistence/picking and more. The screenshot above shows the SceneControl in action, with the supplied 'SceneBuilder' application. The screenshot below shows some 'old fasioned' OpenGL drawing, with calls to 'glBegin' and 'glEnd' etc.
If you want to get OpenGL in your application quickly, there's no easier way. There are eight example applications in the download that show you how to use some common features.
Create a Windows Forms application, use the SharpGL DLL as a reference, and drop an OpenGLControl onto the form. Then handle the 'OpenGLDraw' event and you're ready to go!
Calls that in C++ would look like:
glVertex3f(1.0f, 1.0f, 1.0f); ...etc...
Will have to look like:
OpenGL gl = someForm.someOpenGLControl.OpenGL;
gl.Vertex(1, 1, 1); ...etc...
Porting over existing OpenGL code is therefore trivial. Every OpenGL and GLU library function has been imported and fully commented - no need to look through reference books for function parameters, the Code Hints will show you everything you need to see!
The Scene Graph
The Scene Graph contains classes like 'Texture' and 'Camera' to make working with certain types of object much easier. You don't have to use them, you can use certain components or you can use the whole lot. Or you can mix and match. There is an example application that shows how to do texturing with the Scene Graph.
New Code and Updates
New to SharpGL v1.83
- Five example applications in the download.
- Numerous bug fixes, updates and optimisations.
New to SharpGL v1.8
- Three new example applications.
- Significant improvements to texturing code.
- Rollup Controls in SceneBuilder keep the interface clutter free.
- A new materials editor in the Modify tab allows quick material editing.
SceneObjects in SharpGL now automatically optimise themselves to use display lists. This has made the Scene drawing extremely fast.
- An overhaul of the GDI code by Lee Davies and myself has removed the large memory leak and hugely increased the overall performace of the library and application.
- Many more minor updates and bug fixes are documented in the updates document in the project.
You can now automatically load simple 3D objects from Caligari trueSpace files. This makes creating applications a bit more simple, as you can test the polygon classes with real objects. A Polygon in the SharpGL scene graph is very powerful, they can cast real time shadows. A set of 'Builders' have been added to the SceneBuilder application, allowing you to build polygons from scratch, play around with materials etc.
SceneBuilder (the Test Application) is a simple application showing some of what SharpGL can do, and all the sourcecode is bundled with it, you can use it to build many aspects of a scene.
Points of Interest
The library is great to use, the Scene Graph 'Scene' object lets you do picking, you can control objects via the mouse, even parts of objects, such as the control points of NURBS and evaluators can be moved around. The polygons can be edited by Face, Vertex or as whole objects, and cast shadows over other objects.
Many of the 'kludgy' aspects of OpenGL such as the limits on the number of lights have been smoothed over. Using lights as an example, when the scene is created, the maximum number of lights is ascertained, and you cannot go over that limit. The extent of Mouse control is amazing, and very easy to implement in your own classes. The Persistence code is some of the best code I've ever written, you can call a function in the persistence engine, passing a type of object, and immediately a File Open / Save dialog will be shown with all the available file formats there for the user to select from, then the object will be created from the file or saved to the file. This means in the SceneBuilder app, it takes about two lines to be able to load a polygon from file, with all the possible formats automatically shown.
Keep Up To Date
Up to date information on SharpGL development is available from the CodePlex site and my own blog:
SharpGL is now hosted on CodePlex, at:
I am looking for feature requests for SharpGL 2.0 and the roadmap! Add feature requests from the CodePlex page's 'Issues' section or via the comments below.