Table of Contents

Class OpenGlCustomize

Namespace
CADability
Assembly
CADability.dll

This class defines static events that can be used to customize the OpenGL implementation

public class OpenGlCustomize
Inheritance
OpenGlCustomize
Inherited Members

Constructors

OpenGlCustomize()

public OpenGlCustomize()

Methods

PaintToBitmap(GeoObjectList, GeoVector, int, int, BoundingCube?)

Paint the provided IGeoObjects onto a bitmap with the help form OpenGL. The viewDirection specifies in which direction the objects are projected (e.g. (0,0,-1) is from top) the objects fill the bitmap and leave a 10% empty frame.

public static Bitmap PaintToBitmap(GeoObjectList list, GeoVector viewDirection, int width, int height, BoundingCube? extent = null)

Parameters

list GeoObjectList

objects to paint

viewDirection GeoVector

direction of view

width int

of the bitmap

height int

of the bitmap

extent BoundingCube?

the extent to show in the bitmap; if null, the extent of the objects is used

Returns

Bitmap

Events

SetProjectionEvent

Event that is raised when the projection of the OpenGL view was changed. You can modify the light sources and direction. The original code for setting the light model is:

Gl.glLightModeli(Gl.GL_LIGHT_MODEL_TWO_SIDE, Gl.GL_TRUE);
Gl.glEnable(Gl.GL_LIGHTING);
Gl.glLightfv(Gl.GL_LIGHT0, Gl.GL_POSITION, new float[] { (float)v.x, (float)v.y, (float)v.z, 0.0f });
Gl.glLightfv(Gl.GL_LIGHT0, Gl.GL_AMBIENT, new float[] { 0.2f, 0.2f, 0.2f, 1.0f });
Gl.glLightfv(Gl.GL_LIGHT0, Gl.GL_DIFFUSE, new float[] { 1.0f, 1.0f, 1.0f, 1.0f });
Gl.glLightfv(Gl.GL_LIGHT0, Gl.GL_SPECULAR, new float[] { 1.0f, 1.0f, 1.0f, 1.0f });
Gl.glEnable(Gl.GL_LIGHT0);
public static event OpenGlCustomize.SetProjectionDelegate SetProjectionEvent

Event Type

OpenGlCustomize.SetProjectionDelegate