Index: Include/abgl.ab
===================================================================
--- Include/abgl.ab	(revision 157)
+++ Include/abgl.ab	(revision 287)
@@ -2,23 +2,73 @@
 #define _INC_ABGL
 
-#include <GL/gl.sbp>
-#include <GL/glu.sbp>
-
-Class PositionOnly
-	x As GLfloat
-	y As GLfloat
-	z As GLfloat
+#require <GL/gl.sbp>
+#require <GL/glu.sbp>
+
+Enum VertexFormatsf
+	PositionOnly
+	PositionColoered
+End Enum
+
+Enum VertexFormatsd
+	PositionOnly
+	PositionColoered
+End Enum
+
+NameSpace CustomVertexf
+	Type PositionOnly
+		x As GLfloat
+		y As GLfloat
+		z As GLfloat
+	Public
+	End Type
+
+	Type PositionColoered
+	Public
+		x As GLfloat
+		y As GLfloat
+		z As GLfloat
+		r As GLfloat
+		g As GLfloat
+		b As GLfloat
+		a As GLfloat
+	End Type
+End NameSpace
+
+NameSpace CustomVertexd
+	Type PositionOnly
+	Public
+		x As GLdouble
+		y As GLdouble
+		z As GLdouble
+	End Type
+
+	Type PositionColoered
+	Public
+		x As GLdouble
+		y As GLdouble
+		z As GLdouble
+		r As GLdouble
+		g As GLdouble
+		b As GLdouble
+		a As GLdouble
+	End Type
+End NameSpace
+
+Class VertexBuffer
 Public
-End Class
-
-Class PositionColoered
-	x As GLfloat
-	y As GLfloat
-	z As GLfloat
-	r As GLfloat
-	g As GLfloat
-	b As GLfloat
-	a As GLfloat
+	Sub VertexBuffer()
+	End Sub
+	Sub ~VertexBuffer()
+	End Sub
+
 Public
+	Function Size() As GLuint
+		Return 0
+	End Function
+	Function Lock() As VoidPtr
+		Return NULL
+	End Function
+	Sub Unlock()
+	End Sub
 End Class
 
@@ -77,5 +127,5 @@
 		Return Substract(This,SrcVec)
 	End Function
-/*	Function Operator * (SrcVec As Vector2f) As Vector2f
+/*	Function Operator * (SrcVec As Vector2f) As GLfloat
 		Return Dot(This,SrcVec)
 	End Function*/
@@ -124,5 +174,8 @@
 	End Function
 	Function Dot(SrcVec1 As Vector2f, SrcVec2 As Vector2f) As GLfloat
-		Return SrcVec1.X*SrcVec2.X+SrcVec1.Y*SrcVec2.Y
+		Return (SrcVec1.X*SrcVec2.X)+(SrcVec1.Y*SrcVec2.Y)
+	End Function
+	Function Empty() As Vector2f
+		Return New Vector2f()
 	End Function
 	Function Magnitude() As GLfloat
@@ -150,5 +203,17 @@
 	End Function
 
-Protected
+Public /* Object Class Override */
+	Override Function Equals( object As Object ) As Boolean
+		If This.GetHashCode() = object.GetHashCode() Then
+			Return True
+		Else
+			Return False
+		End If
+	End Function
+	Override Function ToString() As String
+		Return GetType().Name
+	End Function
+
+Protected /* Data */
 	xy As XY_FLOAT
 End Class
@@ -198,5 +263,5 @@
 		Return Substract(This,SrcVec)
 	End Function
-/*	Function Operator * (SrcVec As Vector2d) As Vector2d
+/*	Function Operator * (SrcVec As Vector2d) As GLdouble
 		Return Dot(This,SrcVec)
 	End Function*/
@@ -248,4 +313,7 @@
 		Return SrcVec1.X*SrcVec2.X+SrcVec1.Y*SrcVec2.Y
 	End Function
+	Function Empty() As Vector2d
+		Return New Vector2d()
+	End Function
 	Function Magnitude() As GLdouble
 		Return Math.Sqrt(This.X^2+This.Y^2) As GLdouble
@@ -272,5 +340,17 @@
 	End Function
 
-Public
+Public /* Object Class Override */
+	Override Function Equals( object As Object ) As Boolean
+		If This.GetHashCode() = object.GetHashCode() Then
+			Return True
+		Else
+			Return False
+		End If
+	End Function
+	Override Function ToString() As String
+		Return GetType().Name
+	End Function
+
+Public /* Data */
 	xz As XY_DOUBLE
 End Class
@@ -342,5 +422,5 @@
 		Return Substract(This,SrcVec)
 	End Function
-/*	Function Operator * (SrcVec As Vector3f) As Vector3f
+/*	Function Operator * (SrcVec As Vector3f) As GLfloat
 		Return Dot(This,SrcVec)
 	End Function*/
@@ -384,5 +464,5 @@
 Public /* method */
 	Function Add(SrcVec1 As Vector3f, SrcVec2 As Vector3f) As Vector3f
-		Dim ret As Vector3f(SrcVec1.X+SrcVec2.X,SrcVec1.Y+SrcVec2.Y,SrcVec1.Z-SrcVec2.Z)
+		Dim ret As Vector3f(SrcVec1.X+SrcVec2.X,SrcVec1.Y+SrcVec2.Y,SrcVec1.Z+SrcVec2.Z)
 		Return ret
 	End Function
@@ -399,4 +479,7 @@
 		Return SrcVec1.X*SrcVec2.X+SrcVec1.Y*SrcVec2.Y+SrcVec1.Z*SrcVec2.Z
 	End Function
+	Function Empty() As Vector3f
+		Return New Vector3f()
+	End Function
 	Function Magnitude() As GLfloat
 		Return Math.Sqrt(This.X^2+This.Y^2+This.Z^2) As GLfloat
@@ -423,5 +506,17 @@
 	End Function
 
-Public
+Public /* Object Class Override */
+	Override Function Equals( object As Object ) As Boolean
+		If This.GetHashCode() = object.GetHashCode() Then
+			Return True
+		Else
+			Return False
+		End If
+	End Function
+	Override Function ToString() As String
+		Return GetType().Name
+	End Function
+
+Public /* Data */
 	xyz As XYZ_FLOAT
 End Class
@@ -482,5 +577,5 @@
 		Return Substract(This,SrcVec)
 	End Function
-/*	Function Operator * (SrcVec As Vector3d) As Vector3d
+/*	Function Operator * (SrcVec As Vector3d) As GLdouble
 		Return Dot(This,SrcVec)
 	End Function*/
@@ -525,5 +620,5 @@
 Public /* method */
 	Function Add(SrcVec1 As Vector3d, SrcVec2 As Vector3d) As Vector3d
-		Dim ret As Vector3d(SrcVec1.X+SrcVec2.X,SrcVec1.Y+SrcVec2.Y,SrcVec1.Z-SrcVec2.Z)
+		Dim ret As Vector3d(SrcVec1.X+SrcVec2.X,SrcVec1.Y+SrcVec2.Y,SrcVec1.Z+SrcVec2.Z)
 		Return ret
 	End Function
@@ -540,4 +635,8 @@
 		Return SrcVec1.X*SrcVec2.X+SrcVec1.Y*SrcVec2.Y+SrcVec1.Z*SrcVec2.Z
 	End Function
+	Function Empty() As Vector3d
+		Dim ret As Vector3d()
+		Return ret
+	End Function
 	Function Magnitude() As GLdouble
 		Return Math.Sqrt(This.X^2+This.Y^2+This.Z^2) As GLdouble
@@ -564,8 +663,33 @@
 	End Function
 
-Public
+Public /* Object Class Override */
+	Override Function Equals( object As Object ) As Boolean
+		If This.GetHashCode() = object.GetHashCode() Then
+			Return True
+		Else
+			Return False
+		End If
+	End Function
+	Override Function ToString() As String
+		Return GetType().Name
+	End Function
+
+Public /* Data */
 	xyz As XYZ_DOUBLE
 End Class
 
+NameSpace Matrix
+	Class Matrix3x3f
+	End Class
+
+	Class Matrix3x3d
+	End Class
+
+	Class Matrix4x4f
+	End Class
+
+	Class Matrix4x4d
+	End Class
+End NameSpace
 
 Type RGB_FLOAT
@@ -949,5 +1073,4 @@
 		Dim g As GLfloat
 		Dim b As GLfloat
-		Dim a As GLfloat
 		If h<0 Then h+=360.0
 		If h>360.0 Then h-=360.0
@@ -1226,5 +1349,12 @@
 End Class
 
-Class Material
+Class LightsCollection
+Public
+	Function Item() As Light
+		Return 
+	End Function
+End Class
+
+Class MaterialManager
 Public
 	Sub Ambient(red As GLfloat, green As GLfloat, blue As GLfloat, alpha As GLfloat)
@@ -1318,5 +1448,5 @@
 End Class
 
-Class ModelView
+Class ModelViewMatrix
 Public
 	Sub LoadIdentity()
@@ -1392,5 +1522,5 @@
 	Sub Translate(x As GLdouble, y As GLdouble, z As GLdouble)
 		Dim mode As GLenum
-		glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode))
+		glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode) As *GLint)
 		If mode<>GL_MODELVIEW Then glMatrixMode(GL_MODELVIEW)
 		glTranslated(x, y, z)
@@ -1406,5 +1536,5 @@
 End Class
 
-Class Projection
+Class ProjectionMatrix
 Public
 	Sub LoadIdentity()
@@ -1417,5 +1547,5 @@
 	Sub Ortho2D(left As GLdouble, right As GLdouble, bottom As GLdouble, top As GLdouble)
 		Dim mode As GLenum
-		glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode))
+		glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode) As *Long)
 		If mode<>GL_PROJECTION Then glMatrixMode(GL_PROJECTION)
 		gluOrtho2D(left, right, bottom, top)
@@ -1445,11 +1575,17 @@
 End Class
 
-Class Transform
+Class TransformMatrix
 Public
-	Projection As Projection
-	ModelView As ModelView
+	Projection As ProjectionMatrix
+	ModelView As ModelViewMatrix
+
+Public
+	Sub Transform()
+		Projection=New ProjectionMatrix
+		ModelView=New ModelViewMatrix
+	End Sub
 End Class
 
-Class LightModel
+Class LightModelManager
 Public
 	Function Ambient () As Color4f
@@ -1491,7 +1627,10 @@
 Class RenderStateManager
 Public /* Composiotion */
-	LightModel As LightModel
+	LightModel As LightModelManager
 
 Public
+	Sub RenderStateManager()
+		LightModel = New LightModelManager()
+	End Sub
 	Function AlphaTestEnable() As GLboolean
 		Dim alpha As GLboolean
@@ -1810,8 +1949,8 @@
 Class RenderingContext
 Public /* Composiotion */
-	Material As Material
+	Material As MaterialManager
 	RenderState As RenderStateManager
-	Transform As Transform
-	Lights[ELM(8)] As Light
+	Transform As TransformMatrix
+	Lights As LightsCollection
 
 Public /* Constructor */
@@ -1824,12 +1963,8 @@
 		End If
 
-		Lights[0].Light(GL_LIGHT0)
-		Lights[1].Light(GL_LIGHT1)
-		Lights[2].Light(GL_LIGHT2)
-		Lights[3].Light(GL_LIGHT3)
-		Lights[4].Light(GL_LIGHT4)
-		Lights[5].Light(GL_LIGHT5)
-		Lights[6].Light(GL_LIGHT6)
-		Lights[7].Light(GL_LIGHT7)
+		Material = New MaterialManager()
+		RenderState = New RenderStateManager()
+		Transform = New TransformMatrix()
+		Lights = New LightsCollection()
 	End Sub
 	Sub RenderingContext(hdc As HDC, ByRef pfd As PIXELFORMATDESCRIPTOR)
@@ -1851,5 +1986,5 @@
 		wglMakeCurrent(hdc,hrc)
 	End Sub
-	Sub RenderingContext(hdc As HDC, ByRef ctype As ColorType, ByRef btype As BufferType)
+	Sub RenderingContext(hdc As HDC, ctype As ColorType, btype As BufferType)
 		RenderingContext()
 
@@ -1857,10 +1992,10 @@
 		pfd.nSize=SizeOf(PIXELFORMATDESCRIPTOR) As Word
 		pfd.nVersion=GL_VERSION_1_1
-		If btype=BufferType.DoubleBuffer As Long Then
+		If btype=BufferType.DoubleBuffer Then
 			pfd.dwFlags or=PFD_DRAW_TO_WINDOW or PFD_SUPPORT_OPENGL or PFD_DOUBLEBUFFER
 		Else
 			pfd.dwFlags or=PFD_DRAW_TO_WINDOW or PFD_SUPPORT_OPENGL
 		End If
-		If ctype=ColorType.RgbColor As Long Then
+		If ctype=ColorType.RgbColor Then
 			pfd.iPixelType=PFD_TYPE_RGBA
 		Else
@@ -2025,5 +2160,3 @@
 End Class
 
-
-
 #endif
