|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
|
Announcements
Chapters
Services
Feature Zones
|
IntroductionSharpGL provides you with two controls for designing forms. The OpenGLControl lets you do standard OpenGL drawing in a C# application and the SceneControl 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, glEnd, etc.
If you want to get OpenGL in your application quickly, there's no easier way. There are four example applications that show you how to use some common features and my website has a tutorials section that is regularly updated. Getting startedFirst, 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 this: glBegin(GL_LINES);
glVertex3f(1.0f, 1.0f, 1.0f); //etc...
Will have to look like this: OpenGL gl = someForm.someOpenGLControl.OpenGL;
gl.Begin(OpenGL.LINES);
gl.Vertex(1, 1, 1); //etc...
Porting over existing OpenGL code is therefore pretty easy. Also, all of the OpenGL functions have full comments on parameters, etc., so it's very easy to find information on a certain function you might need. The library also wraps GLU, the OpenGL utility library. Scene GraphThe Scene Graph contains classes like Texture and Camera to make working with certain types of objects much easier. You don't have to use them. You can use certain components, the whole lot or you can mix and match. There is an example application that shows how to do texturing with the Scene Graph. Until now, the SharpGL code hadn't been updated for a good two years. I have updated it recently to make it more simple, so that people can do old fashioned OpenGL style drawing nice and quickly. Much of the Scene Graph code could do with a tidying up, but I am expecting to be able to play with it over the next few months. So, check back soon for details. New code and updatesNew to SharpGL v1.8:
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; it can cast real-time shadows. A set of Builders have been added to the SceneBuilder application, allowing you to build polygons from scratch and play around with materials. SceneBuilder, the test application, is a simple application showing some of what SharpGL can do. All of the source code is bundled with it, so you can use it to build many aspects of a scene. Points of interestThe library is great to use. The Scene Graph 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 are for the user to select from. Then the object will be created from the file or saved to the file. This means that in the SceneBuilder application it takes about 2 lines to be able to load a polygon from file, with all of the possible formats automatically shown. History
|
||||||||||||||||||||||