
//
// opengl.h
//

		/* 4x4 MATRIX INDECIES */
enum
{
	M00	= 0,
	M10,
	M20,
	M30,
	M01,
	M11,
	M21,
	M31,
	M02,
	M12,
	M22,
	M32,
	M03,
	M13,
	M23,
	M33
};

		/* 3x3 MATRIX INDECIES */
enum
{
	N00	= 0,
	N10,
	N20,
	N01,
	N11,
	N21,
	N02,
	N12,
	N22
};



typedef struct
{
	GLfloat	x,y,z;
}OGLPoint3D;

typedef struct
{
	GLfloat	x,y;
}OGLPoint2D;

typedef struct
{
	GLfloat	x,y,z;
}OGLVector3D;

typedef struct
{
	GLfloat	x,y;
}OGLVector2D;

typedef struct
{
	GLfloat	u,v;
}OGLTextureCoord;

typedef struct
{
	GLfloat	r,g,b;
}OGLColorRGB;

typedef struct
{
	GLubyte	r,g,b,a;
}OGLColorRGBA_Byte;

typedef struct
{
	GLfloat	r,g,b,a;
}OGLColorRGBA;


typedef union
{
	GLfloat	value[16];
	vector float v[4];
}OGLMatrix4x4;

typedef struct
{
	GLfloat	value[9];
}OGLMatrix3x3;


typedef struct
{
	OGLPoint3D 			min;
	OGLPoint3D 			max;
	Boolean 			isEmpty;
}OGLBoundingBox;


		/* OPENGL.H */
		
void OGL_CreateDrawContext(void);
void OGL_DisposeDrawContext(void);
void OGL_DrawScene(void);

void OGL_InitFont(void);
void OGL_DrawString(Str255 s, GLint x, GLint y);
void OGL_DrawInt(int f, GLint x, GLint y);

void OGL_PushState(void);
void OGL_PopState(void);
void OGL_EnableLighting(void);
void OGL_DisableLighting(void);
void OGL_EnableDepthTest(void);
void OGL_DisableDepthTest(void);
void OGL_EnableNormalize(void);
void OGL_DisableNormalize(void);
void OGL_EnableBlend(void);
void OGL_DisableBlend(void);
void OGL_EnableTexture2D(void);
void OGL_DisableTexture2D(void);
void OGL_ActiveTextureUnit(u_long texUnit);
void OGL_SetColor4fv(OGLColorRGBA *color);
void OGL_SetColor4f(float r, float g, float b, float a);
void OGL_EnableCullFace(void);
void OGL_DisableCullFace(void);
void OGL_EnableFog(void);
void OGL_DisableFog(void);
void OGL_BlendFunc(GLenum sfactor, GLenum dfactor);
void OGL_DepthMask(Boolean useZbuffer);

void OGLMatrix4x4_Multiply(const OGLMatrix4x4	*mA, const OGLMatrix4x4 *mB, OGLMatrix4x4	*result);
void OGLVector3D_NormalizeFast(float x, float y, float z, OGLVector3D *outV);
float OGLVector3D_Length(OGLVector3D *v);
void OGLVector3D_Cross(const OGLVector3D *v1, const OGLVector3D	*v2, OGLVector3D *result);
void OGLVector3D_Normalize(const OGLVector3D *vector3D, OGLVector3D	*result);
void OGLMatrix4x4_SetRotateAboutPoint(OGLMatrix4x4 *matrix4x4, const OGLPoint3D	*origin,
									float xAngle, float yAngle, float zAngle);
void OGLMatrix4x4_SetRotate_Z(OGLMatrix4x4	*m, float angle);
void OGLMatrix4x4_SetRotate_Y(OGLMatrix4x4	*m, float angle);
void OGLMatrix4x4_SetRotate_X(OGLMatrix4x4	*m, float angle);
void OGLMatrix4x4_SetScale(OGLMatrix4x4 *m, float x, float y, float z);
void OGLMatrix4x4_SetIdentity(OGLMatrix4x4 *m);
void OGLMatrix4x4_SetRotate_XYZ(OGLMatrix4x4 *m, float rx, float ry, float rz);
void OGLMatrix4x4_SetTranslate(OGLMatrix4x4 *m, float x, float y, float z);


GLuint OGL_TextureMap_Load(void *imageMemory, int width, int height, Boolean textureInRAM);
void OGL_Texture_SetOpenGLTexture(GLuint textureName);




		/* VERTEX ARRAY RANGE */
		
void OGL_InitVertexArrayRanges(void);
void OGL_AssignVertexArrayRangeMemory(long size, void *data, Byte whichVAR);
void OGL_UpdateVertexArrayRange(void);





