EduGraf Programming: Basic Concepts

Refer to Get Going for an example.

Assemblies

.NET programs consist of a number of assemblies, the .NET specific term for compilation units. EduGraf is split up into the following assemblies:
  • EduGraf is the core abstraction.
  • EduGraf.OpenGL is the abstract OpenGL implementation.
  • EduGraf.OpenGL.OpenTK is the OpenGL implementation using the OpenTK, which is a bare OpenGL API for C#.
All programming concepts you need to know are defined in the EduGraf assembly. But, in your C# project, only install the EduGraf.OpenGL.OpenTK package, the packages it depends on are installed implicitly.

Composition of 3D Graphics

3D graphic programs model a scene consisting of objects and a Camera projecting the scene onto a screen. A coordinate system represents the virtual space of the scene. Place, rotate, and scale objects and the camera (all but scaling) freely in this system. The camera defines a projection of the objects onto the screen. To create a new rendering, derive a sub-class from the Rendering base class. Populate its property Scene with objects. Create the camera outside of the Rendering sub-class, but pass it to its constructor, if the rendering needs information about the camera - which it usually does.
Create an object's geometry by calling a method of the static Geometry class. EduGraf only supports triangle meshes. It supports both the index-based triangle/vertex and the plane vertex list OpenGL triangle mesh formats.
Define the color and brightness of objects in a rendering, called shading, by either using a high-level approach based on Material and Light, or by writing low-level GLSL code using the EduGraf.OpenGL assembly.
Object geometry and shading together define the Surface of a particular type of object defining all its visual properties. Finally, a particular type of object can appear at distinct positions in the virtual world, each represented by an instance of Visual. Finally, remember to add all visuals to the Scene property of the Rendering sub-class to be visible.

2D Graphics

EduGraf also supports 2D graphics using a subset of the concepts. There is however less emphasis on this possibility. Consult the API documentation for details.

Graphic Pipeline dependent and independent Programming

This text understands the term graphic pipeline as the combination of API implementation, graphic driver and hardware. EduGraf is designed to support graphic pipeline independent programming. To leave this possibility open for your application, use the library only through the classes and interfaces of the EduGraf assembly. Invoking a particular class-member of another assembly is inherently pipeline dependent. The main class for pipeline independent programming is Grapic.

Initializing and Displaying Graphics

Initialize and display graphics with the following steps:
  • Choose a particular pipeline by referencing the corresponding assembly.
  • Create an instance of Graphic from the assembly.
  • Create a Camera.
  • Create a Rendering.
  • Create a Window from the assembly.
  • Show the rendering in the window.