Page 9/36 In GLScene a lot of calculations is done with vectors. Vector is an universal type that can describe almost anything from object's position, rotation, speed even color. There are different types of vectors: Vector3f, Vector4f, AffineVector. But vector generally is an array of three singles [X,Y,Z]. Some vectors have the mysterious fourth member called W. W is used for describing rotations or alpha value of the color. Many GLScene functions are overloaded and you can supply most of the vector types as a parameter. OpenGL internally does not operate on vectors but on matrices. Matrix is a two dimensional array of 4 x 4 singles. Matrix transformations take care about useful things like vector rotations, scaling etc. You do not really need to know about matrix transformations because GLScene has functions to do the job for you. These functions are in VectorGeometry unit. Detailed description of vector  geometry functions  is far beyond  the  scope of this  book but  there is  a good article  at www.flipcode.com about vector math. Rendering Every object in 3D graphics is composed of polygons. Even curved surfaces are made up of polygons only very small ones. Polygon is a triangular face delimited by three vertices. Vertex is a point in space. Each polygon has front and back sides defined by face normal. Normal is a vector pointing in front direction of the face. Another information stored by face is connectivity with other faces. Polygon knows which surrounding polygons are attached to which side of it. This is used for smoothing   edges   between   two   adjacent   polygons.   Polygon   also   stores   information   about   how texture is stretched over its surface. Texture coordinates of every vertex are defined by two numbers in range from 0 to 1. These are called U and V coordinates and specify exact position of the vertex on texture. When   the   polygon   gets   rendered   possible   surrounding   lights   are   considered,   the   angle between face normal and direction to camera and lights is considered and the polygon is lit and textured according to shading  model. Different shades  of polygon  along curved surface create illusion of plasticity. To render whole object which is made up of polygons the object has to be first transformed in position, rotation and scale. Every rendered pixel is stored in Z buffer. Z buffer is memory allocated for all pixels on the screen together with Z depth – distance from the camera. Every time a new polygon is rendered the resulting pixels overwrite possible existing ones only if the Z depth is smaller than the one stored in Z buffer for that particular pixel. More understandably new polygon is rendered only if it is closer than other polygons. OpenGL This is a wide topic, too complicated for this book. You don't necessarily need to know much about OpenGL to use GLScene but it is certainly better to have some understanding of it. GLScene beginner's guide, Jan Zizka, 2005