Download DIPLOMA THESIS - IIS Windows Server

Transcript
8 Solution
This class provides a reference to the current RC that is used for parameter checking. This
reference is exposed in a form of static field (CurrentRC) and it is intended only for
internal use (i.e., it has Assembly accessibility permission; see subsection 2.1.10).
Similar to current RC reference, it also contains reference to internal data structures
(classes) used by OpenGL/GLU implementation. Naming convention of these references is
XData where X is name of owner class, i.e., class that owns these data. Even thought
reference to them is stored in RC class, their allocation (i.e., instance creation) is not
handled by the RC class.
The allocation of internal data structures is handled by classes that own these structures.
The advantage of this is that it increases performance of RC class initialization and saves
memory due to internal data structures of classes that are not used by the application are
not allocated. Internal data structures and their references are intended for internal use only
and therefore they are not exposed to the user, i.e., they have Assembly accessibility
permission.
8.1.2
OpenGL Classes
OpenGL classes are classes that handle OpenGL functions calls, i.e., they encapsulates
functions and constants (see subsection 8.1.6) of particular OpenGL version. Opposite of
original OpenGL or CsGL, single OpenGL class instance belongs to exactly one instance
of RC (in following text this instance will be reference as an owner), i.e., it is not possible
to use similar OpenGL class instance with multiple instances of RC (owners).
The reason for that is that some OpenGL functions may needs internal data that are valid
only for specific instance of RC. Reference to owner of OpenGL class instance is stored in
protected field named rc and is used for parameter checking purposes.
Each version of OpenGL is encapsulated into separate class that is derived from class of
previous OpenGL version. Exception to this is GL11 class that contains OpenGL
version 1.1 and that is a root of inheritance relations between OpenGL classes.
Naming convention of class that contains new version of OpenGL is then GLMm where M is
major version number and m is minor version number, e.g., class GL11 implements
OpenGL version 1.1. The reason for this is to allow separation of different OpenGL
version in order to make possible for the user to use exactly the version that suits user’s
needs.
Every class may need internal data structures. These are used to store references to
arrays or objects that are passed inside of OpenGL library and are stored there for later use,
e.g., function glVertexPointer. Storing references (in managed meaning) shall
prevent the array or the object from being garbage collected because the only reference
passed inside OpenGL library is non-managed pointer (see section 6.2.1). These internal
data structures also allow retrieving of managed references to arrays or objects that were
passed inside the library.
Internal data structures are implemented in form of managed classes because non-managed
class cannot have class members of managed types. Their name shall have form of
XInternalData where X is a name of class that uses them, e.g.,
GL11InternalData contains internal data structures of GL11 class. They are intended
for internal use only. Therefore, they have Assembly access permission and are not visible
for the user. There may exist only one instance per each RC instance.
Even thought these classes contain data for classes that inherit from a newer version,
internal data classes are derived only from System.Object class similar to any other
50