Bit of a problem here, I've tried to create a class to handle things, such as setting up a window, and OpenGL rendering context, but my compiler (Visual C\+\+ 6.0) refuses to even compile without throwing up at least 15 different errors
the headers and sources follow;
vertex.h;
//Note that OpenGL uses a right handed coordinate system (z decreases into screen)
#ifndef __VERTEX_H
#define __VERTEX_H
#include <math.h>
//#include <
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
/********************************************************************************
*List of functions and variables *
*********************************************************************************
*SQR(name) * maths macro to define the square of variable 'name' *
*********************************************************************************
*sine[],cosine[], * maths tables to increase speed *
*tangent[] * *
*********************************************************************************
*POINT,PPOINT * 3d point structures. PPOINT is the pointer version *
* * *
*LINE,PLINE * 3d line structure. consists of 2 POINT structures *
* * *
*VECTOR,PVECTOR * mathematical definition of a vector *
* * *
*VERTEX,PVERTEX * vertex data structure. includes position,colour and *
* * texture coordinates *
* * *
*TRIANGLE,PTRIANGLE * defines a triangle as an array of 3 VERTEX structures *
* * *
*QUAD,PQUAD * defines a quad as an array of 4 VERTEX structures *
* * *
*POLYGON,PPOLYGON * defines a polygon with 'num_points' points, starting *
* * at address 'point' *
*********************************************************************************
#define SQR(name) (name)*(name) //To be removed and replaced with a template function
enum plane_pos{BEHIND,ON,IN_FRONT}
typedef enum plane_pos PLANE_POS ;
typedef float[4][4] MATRIX_4x4;//4x4 matrix
MATRIX_4x4 identity_matrix;
MATRIX_4x4 inv_identity_matrix;
MATRIX_4x4 test_matrix_1;// used during InitMathset to check for correct working of functions
MATRIX_4x4 test_matrix_2;// (as above)
MATRIX_4x4 add_result_matrix;// (ditto)
MATRIX_4x4 concat_result_matrix;// (get the picture yet?)
MATRIX_4x4 inv_result_matrix;//(no comment :)
int sine[360];
int cosine[360];
int tangent[360];
typedef struct{
int x,y,z;//magnitude
int dirx,diry,dirz;//direction
}VECTOR,*PVECTOR;// used in conjunction with one of the others, to move them in a set direction
typedef struct{
POINT point;//a vertex is basically a point. Just remember to access with (VERTEX vertex) vertex.point.x, etc...
int u,v;//texture coordinates
}VERTEX,*PVERTEX;
/*************************************************************************************************
**OpenGL primitives **
*************************************************************************************************/
typedef struct{
int x,y,z;//position
int r,g,b,a;//colour and alpha
}POINT,*PPOINT;//Use for particles( if poss)
typedef struct{
POINT point[2];//two points make a line
}LINE,*PLINE;//Use for ... ... ... something ...
typedef struct{
PVERTEX vertices[3] = 0;//the 3 vertices that make up a triangle
}TRIANGLE,*PTRIANGLE;
typedef struct{
PVERTEX vertices[4] = 0;//the 4 vertices that make up a quad
}QUAD,*PQUAD;
typedef struct{
int num_vertices;//number of vertices in polygon
PVERTEX vertices = 0;//pointer to vertex list. to access x,y,z of polygon 'poly'; poly.vertices->point.x
}POLYGON,*PPOLYGON;
typedef union{
POINT point;
LINE line;
TRIANGLE triangle;
QUAD quad;
POLYGON polygon;
}SET_PRIM_TYPE;
extern bool InitMathset(void); //call this before anything else. This can be ignored, but it will check that all of the functions
//work properly, and sets up the sine,cosine and tangent tables
extern PLANE_POS CheckPlane(POINT point,TRIANGLE triangle); //checks to see where point "point" is in comparison to plane "plane"
extern LINE ScaleLine(LINE line,float scale_factor); //scales a line "line" by "scale_factor"
extern TRIANGLE ScaleTriangle(TRIANGLE triangle,float scale_factor); //scales "triangle" by "scale_factor"
extern QUAD ScaleQuad(QUAD quad,float scale_factor); //scales "quad" by "scale_factor"
extern POLYGON ScalePolygon(POLYGON polygon,float scale_factor); //scales "polygon" by "scale_factor"
extern VECTOR Normalise(VECTOR vector); //Normalises the magnitude of a vector to 1.0
extern float GetMagnitude(VECTOR vector); // Gets the magnitude of a vector |U|=sqrt(Ux^2+Uy^2+Uz^2)
extern float FindDotProduct(VECTOR u,VECTOR v); //uses dot product to find the angle between2 vectors
//theta=COS^-1*((u.x*v.x+u.y*v.y+u.z*v.z)/(GetMagnitude(u)*GetMagnitude(v)))
extern VECTOR FindCrossProduct(VECTOR u, VECTOR v); //finds and returns the normal vector of vectors u and v
//<(u.y*v.z)-(u.z*v.y),(u.x*v.z)-(u.z*v.x),(u.x*v.y)-(u.y*v.x)>=<Nx,Ny,Nz>
extern MATRIX_4x4 ConcatenateMatrix(MATRIX_4x4 mat_1,MATRIX_4x4 mat_2); //performs mat_1*mat_2 and returns the result
extern MATRIX_4x4 AddMatrix(MATRIX_4x4 mat_1,MATRIX_4x4 mat_2); //adds mat1 to mat2
extern MATRIX_4x4 MultIdent(MATRIX_4x4 matrix); //multiplies the given matrix by the identity matrix. This just returns the original matrix
extern MATRIX_4x4 AddVectorToMatrix(VECTOR vector, MATRIX_4x4 matrix); //transforms a vector into a matrix and multiplies it into the supplied matrix
extern MATRIX_4x4 InvertSigns(MATRIX_4x4 matrix); //multiples the given matrix by the inverse of the identity matrix
#endif//__VERTEX_H
vertex.cpp;
#include "stdafx.h"
#include "vertex.h"
//set identity matrix
identity_matrix[0][0] = identity_matrix[1][1] = identity_matrix[2][2] = identity_matrix[3][3] = 1;
identity_matrix[0][1] = identity_matrix[0][2] = identity_matrix[0][3] = identity_matrix[1][0] =
identity_matrix[1][2] = identity_matrix[1][3] = identity_matrix[2][0] = identity_matrix[2][1] =
identity_matrix[2][3] = identity_matrix[3][0] = identity_matrix[3][1] = identity_matrix[3][2] = 0;
//set inverse identity matrix
inv_identity_matrix[0][0] = inv_identity_matrix[1][1] = inv_identity_matrix[2][2] = inv_identity_matrix[3][3] = -1;
inv_identity_matrix[0][1] = inv_identity_matrix[0][2] = inv_identity_matrix[0][3] = inv_identity_matrix[1][0] =
inv_identity_matrix[1][2] = inv_identity_matrix[1][3] = inv_identity_matrix[2][0] = inv_identity_matrix[2][1] =
inv_identity_matrix[2][3] = inv_identity_matrix[3][0] = inv_identity_matrix[3][1] = inv_identity_matrix[3][2] = 0;
bool InitMathset(void)
{
//set math tables
int i=0;
MATRIX_4x4 result = 0;
VECTOR test_vector = 0;
PLINE test_line = 0;
PTRIANGLE test_triangle = 0;
PQUAD test_quad = 0;
PPOLYGON test_polygon = 0;
for(i=0;i<360;i++)
{
sine = sin(i);
cosine = cos(i);
tangent = tan(i);
}
//set the test matrices
test_matrix_1[0][0] = 2;test_matrix_1[1][1] = 3;test_matrix_1[2][2] = 4;test_matrix_1[3][3] = 5;
test_matrix_1[0][1] = 6;test_matrix_1[0][2] = 7;test_matrix_1[0][3] = 8;test_matrix_1[1][0] = 9;
test_matrix_1[1][2] = 0;test_matrix_1[1][3] = 1;test_matrix_1[2][0] = 4;test_matrix_1[2][1] = 1;
test_matrix_1[2][3] = 1;test_matrix_1[3][0] = 1;test_matrix_1[3][1] = 8;test_matrix_1[3][2] = 1;
test_matrix_2[0][0] = 4;test_matrix_2[1][1] = 2;test_matrix_2[2][2] = 4;test_matrix_2[3][3] = 5;
test_matrix_2[0][1] = 7;test_matrix_2[0][2] = 3;test_matrix_2[0][3] = 5;test_matrix_2[1][0] = 9;
test_matrix_2[1][2] = 3;test_matrix_2[1][3] = 7;test_matrix_2[2][0] = 4;test_matrix_2[2][1] = 0;
test_matrix_2[2][3] = 4;test_matrix_2[3][0] = 1;test_matrix_2[3][1] = 8;test_matrix_2[3][2] = 1;
add_result_matrix[0][0] = 6;add_result_matrix[1][1] = 5;add_result_matrix[2][2] = 8;add_result_matrix[3][3] = 10;
add_result_matrix[0][1] = 13;add_result_matrix[0][2] = 10;add_result_matrix[0][3] = 13;add_result_matrix[1][0] = 18;
add_result_matrix[1][2] = 3;add_result_matrix[1][3] = 8;add_result_matrix[2][0] = 8;add_result_matrix[2][1] = 1;
add_result_matrix[2][3] = 5;add_result_matrix[3][0] = 2;add_result_matrix[3][1] = 16;add_result_matrix[3][2] = 2;
concat_result_matrix[0][0] = 98;concat_result_matrix[1][1] = 77;concat_result_matrix[2][2] = 29;concat_result_matrix[3][3] = 90;
concat_result_matrix[0][1] = 90;concat_result_matrix[0][2] = 248;concat_result_matrix[0][3] = 120;concat_result_matrix[1][0] = 76;
concat_result_matrix[1][2] = 49;concat_result_matrix[1][3] = 83;concat_result_matrix[2][0] = 33;concat_result_matrix[2][1] = 36;
concat_result_matrix[2][3] = 41;concat_result_matrix[3][0] = 85;concat_result_matrix[3][1] = 63;concat_result_matrix[3][2] = 36;
//test AddMatrix() function. return false if failed
result = AddMatrix(test_matrix_1,test_matrix_2);
if(result!=add_result_matrix)
return false;
//test ConcatenateMatrix() function. return false if failed
result = ConcatenateMatrix(test_matrix_1,test_matrix_2);
if(result!=concat_result_matrix)
return false;
//test MultIdent. result should hold the matrix passed to the function. if not, return false
result = MultIdent(test_matrix_1);
if(result!=test_matrix_1)
return false;
//test InvertMatrix(). result should be the inverse of all items in the matrix passed in
result = InvertMatrix(test_matrix_1);
result != inv_result_matrix ? return false : ;
return true;
}
MATRIX_4x4 AddMatrix(MATRIX_4x4 mat_1,MATRIX_4x4 mat_2)
{
int i,j;
MATRIX_4x4 result;
for(i=0;i<4;i++)
{
for(j=0;j<4;j++)
result[j]=mat_1[j]+mat_2[j];
}
return result;
}
MATRIX_4x4 ConcatenateMatrix(MATRIX_4x4 mat_1,MATRIX_4x4 mat_2)
{
int i,j,k;
MATRIX_4x4 result;
float sum;
for(i=0;i<4;i++)
{
for(j=0;j<4;j++0)
{
sum = 0;
for(k=0;k<4;k++)
{
if(mat_1[k]!=0 && mat_2[k][j]!=0)
sum += mat_1[k]*mat_2[k][j];
}
result[j] = sum;
}
}
return result;
}
MATRIX_4x4 MultIdent(MATRIX_4x4 matrix)
{
return(ConcatenateMatrix(matrix,identity_matrix));
}
MATRIX_4x4 InvertSigns(MATRIX_4x4 matrix)
{
return(ConcatenateMatrix(matrix,inv_identity_matrix);
}
float GetMagnitude(VECTOR vector)
{
float result, tempSum;
tempSum = (vector.x*vector.x)+(vector.y*vector.y)+(vector.z*vector.z);
result= sqrt(tempSum);
return result;
}
VECTOR Normalise(VECTOR vector)
{
float result;
result = GetMagnitude(vector);
vector.x = vector.x/result;
vector.y = vector.y/result;
vector.z = vector.z/result;
return vector;
}
LINE ScaleLine(LINE line, float scale_factor)
{
LINE result;
result.point[0].x = (line.point[0].x*scale_factor);
result.point[0].y = (line.point[0].y*scale_factor);
result.point[0].z = (line.point[0].z*scale_factor);
result.point[1].x = (line.point[1].x*scale_factor);
result.point[1].y = (line.point[1].y*scale_factor);
result.point[1].z = (line.point[1].z*scale_factor);
return result;
}
ScaleTriangle(TRIANGLE triangle, float scale_factor)
{
TRIANGLE result;
int loop;
for(loop=0;loop<3;loop++)
{
result.point[loop].x = (triangle.vertices[loop]->point.x*scale_factor);
result.point[loop].y = (triangle.vertices[loop]->point.y*scale_factor);
result.point[loop].z = (triangle.vertices[loop]->point.z*scale_factor);
}
return result;
}
ScaleQuad(QUAD quad, float scale_factor)
{
QUAD result;
int loop;
for(loop=0;loop<4;loop++)
{
result.point[loop].x = (quad.vertices[loop]->point.x*scale_factor);
result.point[loop].y = (quad.vertices[loop]->point.y*scale_factor);
result.point[loop].z = (quad.vertices[loop]->point.*scale_factor);
}
return result;
}
ScalePolygon(POLYGON polygon, float scale_factor)
{
POLYGON result;
int loop;
for(loop=0;loop<polygon.num_vertices;loop++)
{
result.point[loop].x = (polygon.vertices[loop]->point.x*scale_factor);
result.point[loop].y = (polygon.vertices[loop]->point.y*scale_factor);
result.point[loop].z = (polygon.vertices[loop]->point.z*scale_factor);
}
return result;
}
MATRIX_4x4 AddVectorToMatrix(VECTOR vector, MATRIX_4x4 matrix)
{
MATRIX_4x4 result = matrix;
result[0][3] +=vector.x;
result[1][3] +=vector.y;
result[2][3] +=vector.z;
return result;
}
float FindDotProduct(VECTOR u, VECTOR v)
{
float temp;
int loop;
temp = (u.x*v.x+u.y*v.y+u.z*v.z)/(GetMagnitude(u)*GetMagnitude(v));
for(loop=0;loop<360;loop++)
{
if(cosine[loop] == temp)
return loop;
}
}
VECTOR FindCrossProduct(VECTOR u, VECTOR v)
{
VECTOR result;
result.x = (u.y*v.z)-(u.z*v.y);
result.y = (u.x*v.z)-(u.z*v.x);
result.z = (u.x*v.y)-(u.y*v.x);
return result;
}
draw.h;
#include "stdafx.h"
#include "vertex.h"
#include <windows.h>
#ifndef CDS_FULLSCREEN
#define CDS_FULLSCREEN 4
#endif
enum bpp{BPP_16,BPP_24,BPP_32};// number of bits per pixel
enum errors{NOERROR,REGISTER,NOFULLSCREEN,CREATE,NODC,NOSUITPFD,NOSETPFD,NORC,NOACTIVERC,NOINIT,CANTASSIGNTEXTURE};
typedef enum bpp BPP;
typedef enum errors ERROR;
class GLscene {
public:
GLscene(char* title = 0,int width, int height, int bits, bool fullscrn); //Sets up the window and render context
~GLscene(ERROR error); //Close the window, destroy the update timer, clear the memory, return to Windows. also, return error message if required
bool Update(); //User forced 'draw everything'
bool ClrScr(float r,float g,float b,float a); //Simply calls glClearColor(r,g,b,a)
bool AddTexture(char* filename = NULL); //Adds a texture to the texture list
GLvoid ResizeScene(GLsizei width,GLsizei height); //Called by WindowProc
protected:
HWND hWindowHandle; //the window handle
HGLRC hRenderContext; //the OGL rendering context
HDC hDeviceContext; //the Windows device context
HINSTANCE hInstance; //the window instance
GLuint *texturelist = 0; //pointer to the start of the texture list
int num_textures; //the number of textures currently loaded
bool keys[256]; //array for keystrokes
bool active; //determines whether the window is active or not
bool InitGL(void); //Sets up the initial GL scene
//LoadImage textureloader; //passes the texture pointer and number of textures and sets up new textures
}
class DataPackage {
protected:
void *m_buf;
unsigned long m_size;
public:
DataPackage() {m_buf = NULL; m_size = 0;}
~DataPackage() {Free();}
void *Create(unsigned long size)
{
Free();
return(m_buf = (void *)new char[(m_size = size)]
}
void Free() {delete m_buf;m_buf = NULL;m_size = 0;}
bool Save(char *filename)
{
FILE *fp;
if(m_buf != NULL && m_size)
{
if((fp = fopen(filename,"wb")) != NULL)
{
fwrite(&m_size,1,4,fp);
fwrite(m_buf,1,m_size,fp);
fclose(fp);
return true;
}
}
return false;
}
void *Load(char *filename, unsigned long size)
{
FILE *fp;
Free();
if((fp = fopen(filename, "rb")) != NULL)
{
fread(&m_size,1,4,fp);
if((m_buf = (void*)new char[m_size]) != NULL)
fread(m_buf,1,m_size,fp);
fclose(fp);
if(size != NULL)
*size = m_size;
return m_buff;
}
return NULL;
}
};
class Object {
public:
Object();
~Object();
virtual void LoadObjectData(char *filename); //Loads a file
protected:
void* object_buf; //holds the data from LoadObjectData()
}
and finally, draw.cpp;
#include "stdafx.h"
#include <windows.h>
#include <draw.h>
#include <gl\gl.h>
#include <gl\glu.h>
#include <gl\glaux.h>
#define MSG(body,title,style) MessageBox(NULL,body,title,style)
GLscene::GLscene(char* title,int width,int height, int bits, bool fullscrn)
{
GLuint pixel_format; //holds the result
WNDCLASSEX wndclass; // the window class
DWORD dwExStyle,dwStyle; // the styles of the window
RECT WindowRect; //grabs upper left\lower right window values
WindowRect.left = (long)0;
WindowRect.right = (long) width;
WindowRect.top = (long)0;
WindowRect.bottom = (long) height;
hInstance = GetModuleHandle(NULL);
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = hInstance;
wndclass.hIcon = LoandIcon(NULL, IDI_WINLOGO);
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.hbrBackground = NULL;
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = "OpenGL";
if(!RegisterClassEx(&wndclass))
{
~GLscene(REGISTER);
return false;
}
if(fullscrn)
{
DEVMODE dmScreenSettings;
memset(&dmScreenSettings,0,sizeof(dmScreenSettings));
dmScreenSettings.dmSize=sizeof(dmScreenSettings);
dmScreenSettings.dmPelsWidth = width; // Selected Screen Width
dmScreenSettings.dmPelsHeight = height; // Selected Screen Height
dmScreenSettings.dmBitsPerPel = bits; // Selected Bits Per Pixel
dmScreenSettings.dmFields=DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;
if(ChangeDisplaySettings(&dmScreenSettings,CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL)
{
if(MessageBox(NULL,"The requested Fullscreen mode is not\nsupported by your video card.Use windowed mode instead?","error",MB_YESNO|MB_ICONQUESTION) == ID_YES)
fullscrn = false;
else
{
~GLscene(NOFULLSCREEN);
}
}
}
if(fullscrn)
{
dwExStyle = WS_EX_APPWINDOW;
dwStyle = WS_POPUP;
ShowCursor(false);
}
else
{
dwExStyle = WS_EX_APPWINDOW|WS_EX_WINDOWEDGE;
dwStyle = WS_OVERLAPPEDWINDOW;
}
AdjustWindowRectEx(&WindowRect,dwStyle,false,dwExStyle);
if(!(hWindowHandle = CreateWindowEx(dwExStyle,
"OpenGL",
title,
WS_CLIPSIBLINGS|WS_CLIPCHILDREN,
dwStyle,
0,0,
WindowRect.right-WindowRect.left,
WindowRect.bottom-WindowRect.top,
NULL,
NULL,
hInstance,
NULL))
{
~GLscene(CREATE);
}
static PIXELFORMATDESCRIPTOR pfd =
{
sizeof(PIXELFORMATDESCRIPTOR),
1,
PFD_DRAW_TO_WINDOW|PFD_SUPPORT_OPENGL|PFD_DOUBLE_BUFFER,
PFD_TYPE_RGBA,
bits,
0,0,0,0,0,0,
0,
0,
0,
0,0,0,0,
16,
0,
0,
PFD_MAIN_PLANE,
0,
0,0,0
};
if(!(hDeviceContext = GetDC(hWindowHandle)))
~GLscene(NODC);
if(!(PixelFormat = ChoosePixelFormat(hDeviceContext,&pfd)))
~GLscene(NOSUITPFD);
if(!SetPixelFormat(hDeviceContext,PixelFormat,&pfd))
~GLscene(NOSETPFD);
if(!(hRenderContext=wglCreateContext(hDeviceContext)))
~GLscene(NORC);
if(!wglMakeCurrent(hDeviceContext,hRenderContext))
~GLscene(NOACTIVERC);
ShowWindow(hWindowHandle,SW_SHOW);
SetForegroundWindow(hWindowHandle);
SetFocus(hWindowHandle);
ResizeScene(width,height);
if(!InitGL())
~GLscene(NOINIT);
}
GLscene::~GLscene(ERROR error)
{
switch(error)
{
case(REGISTER) : MSG("Unable to Register Class","Error",MB_OK|MBICONEXCLAMATION);break;
case(NOFULLSCREEN) : MSG("No Fullscreen active. Click OK to shutdown","Error",MB_OK|MB_ICONEXCLAMATION);break;
case(CREATE) : MSG("Unable to Create Window","Error",MB_OK|MB_ICONEXCLAMATION);break;
case(NODC) : MSG("Unable to assign Device Context","Error",MB_OK|MB_ICONEXCLAMATION);break;
case(NOSUITPFD) : MSG("No suitable Pixel Format available on your card","Error",MB_OK|MB_ICONEXCLAMATION);break;
case(NOSETPFD) : MSG("Unable to set Pixel Format","Error",MB_OK|MB_ICONEXCLAMATION);break;
case(NORC) : MSG("Unable to assign OpenGL Rendering Context","Error",MB_OK|MB_ICONEXCLAMATION);break;
case(NOACTIVERC) : MSG("Unable to set Render Context as active","Error",MB_OK|MB_ICONEXCLAMATION);break;
case(NOINIT) : MSG("Error in function \"InitGL()\" ","Error",MB_OK|MB_ICONEXCLAMATION);break;
case(CANTASSIGNTEXTURE) : MSG("Cannot assign texture","Error",MB_OK|MB_ICONEXCLAMATION);brea;
case(NOERROR) : break;
default : MSG("Undefined Error Message","Error in an error!",MB_OK|MB_ICONEXCLAMATION);break;
}
if(fullscrn)
{
ChangeDisplaySettings(NULL,0);
ShowCursor(true);
}
if(hRenderContext)
{
if(!wglMakeCurrent(NULL,NULL))
MSG("Release of Rendering and Device Contexts failed","Error",MB_OK|MB_ICONEXCLAMATION);
if(!wglDeleteContext(hRenderContext))
MSG("Deleting of Rendering Context failed,\nPossibility of Memory Leaks","Error",MB_OK|MB_ICONEXCLAMATION);
hRenderContext = NULL;
}
if(hDeviceContext && !ReleaseDC(hWindowHandle,hDeviceContext))
{
MSG("Unable to delete Device Context","Error",MB_OK|MB_ICONEXCLAMATION);
hDeviceContext = NULL;
}
if(hWindowHandle && !DestroyWindow(hWindowHandle))
{
MSG("Unable to Destroy Window","Error",MB_OK|MB_ICONEXCLAMATION);
hWindowHandle = NULL;
}
if(!UnregisterClass("OpenGL",hInstance))
{
MSG("Unable to Unregister Window Class","Error",MB_OK|MB_ICONEXCLAMATION);
hInstance = NULL;
}
}
GLvoid GLscene::ResizeScene(GLsizei width,GLsizei height)
{
if(height == 0)
height == 1;
glViewport(0,0,width,height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
bool GLscene::ClrScr(float r,float g,float b,float a)
{
glClearColor(r,g,b,a);
return true;
}
bool GLscene::InitGL(void)
{
glShadeModel(GL_SMOOTH);
glClearColor(0.0f,0.0f,0.0f,0.0f);
glClearDepth(1.0f);
glEnable(GL_DEPTH_TEST);
glEnable(GL_TEXTURE_2D);
glDepthFunc(GL_LEQUAL);
glHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST);
return true;
}
I know that I haven't implemented all of the methods yet, and some of the structs are already declared by windows(I'll sort them out later) but the compiler seems to have problems, first with the enums in draw.h, then with stdafx.cpp, complainng that there should be something after the semicolon. The entire stdafx.cpp file contains 1 #include line, and a load of comments!
If you've managed to read the whole of this without falling asleep, and can shed some light on the matter, I would be eternally grateful.