OpenGL4NET is an automatic generator for OpenGL wrapper for .NET. The solution also contains a
project that produces a library from the generated source code and a set of examples.
OpenGLSpec is the wrapper generator. It contains the main files for generator (in root directory)
and a set of supporting files.
Directories:
gloverloads - contains overloads of some opengl functions. These overloads should simplify the use of library (eg., TexImage2D(target, level, internalformat, border, filename)). Each file with overload methods must have a name corresponding to overloaded method.
glspec - contains opengl specification files from http://www.opengl.org/registry/. The files are:
Additional files
templates - contains templated classes.
These classes has a similar structure as a generic class except the fact, that the concrete classes are generated offline. The teplate rules are in the comments in the begining of file, e.g.
:::C#
// template: f float
class Vector3<t> {
T x, T y, T z;
}
Concrete class is class Vector3f { float x, float y, float z; }
The versioning is generated in the following way (major.minor.revision.build) (This is subject to change):
To build the library and run the examples, it is neccesary to do the following steps:
Build the OpenGLSpec and execute it
Set the OpenGLSpec project as a startup. The wrapper generator has several command line
arguments that can control the generation process:
-s or -separate The classes will be generated to separate files.
-d or -doc The gl function will be commented using the downloaded opengl documentation if available.
-download Automatically downloads the documentation from opengl web site if available. As the documentation to OpenGL is not very good, some functions are only commented with some generic text. Furthermore, if the help is not available, the generator is trying more possibilities and it can take quite a long time. The time of building the wrapper using the download function is approaching one hour!
-w or -wait Wait for ENTER after finished
For your first build, you can just run the project and see, what's going on.
Building the library
After the OpenGLSpec is executed, an OpenGL4Net.cs file will be created in bin\output directory. Now you can generate the OpenGL4Net.dll just by building OpenGLnet project. This project has a Pre-Build event that copies the newly generated OpenGL4Net.cs file to the source directory of OpenGLnet project and build it. (This is a subject to change)
Building SourceForge distribution
In the OpenGLSpec/bin directory run the ForgeDistrib.bat. This batch file generates both versions of OpenGL4Net.cs files (doc/no doc), compiles it in x86 and x64 a produces the doxumentation .xml. All these files are created in _sourceforge/rev no./ directory.
Copyright (c) 2013, Petr Vanecek
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
Petr Vanecek (opengl4net@gmail.com)