EduGraf Programming: Basic Concepts

Refer to Get Going for example code.

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 generic 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, you only need to add the EduGraf.OpenGL.OpenTK package directly, this adds all transitively needed packages automatically.

Composition of Graphics

Graphic programs model a scene consisting of 3D 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. The camera needs to be passed to the Window to to receive and therefore react user input. To create a new rendering, derive a sub-class from the Rendering base class. Add objects to be visualized to its Scene property.
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 your Rendering implementation to be visible.

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.