- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

# C:/Documents and Settings/jegan/Desktop/projectX/glfuncs.h

Go to the documentation of this file.

    00001 #ifndef GLFUNCS_H
    00002 #define GLFUNCS_H
    00003
    00004 #include <stdio.h>
    00005 #include <stdlib.h>
    00006 #include <string>
    00007
    00008 #include "SDL.h"
    00009 #include "SDL_image.h"
    00010 #include "SDL_opengl.h"
    00011 #include "SDL_syswm.h"
    00012
    00013 class glfuncs
    00014 {
    00015 public:
    00016         static glfuncs* instance();
    00017
    00018         void(APIENTRY*glBegin)(GLenum);
    00019         void(APIENTRY*glEnd)();
    00020         void(APIENTRY*glVertex3f)(GLfloat, GLfloat, GLfloat);
    00021         void(APIENTRY*glClearColor)(GLfloat, GLfloat, GLfloat, GLfloat);
    00022         void(APIENTRY*glClear)(GLbitfield);
    00023         void(APIENTRY*glDisable)(GLenum);
    00024         void(APIENTRY*glEnable)(GLenum);
    00025         void(APIENTRY*glColor4ub)(GLubyte,GLubyte,GLubyte,GLubyte);
    00026         void(APIENTRY*glPointSize)(GLfloat);
    00027         void(APIENTRY*glHint)(GLenum,GLenum);
    00028         void(APIENTRY*glBlendFunc)(GLenum,GLenum);
    00029         void(APIENTRY*glMatrixMode)(GLenum);
    00030         void(APIENTRY*glLoadIdentity)();
    00031         void(APIENTRY*glOrtho)(GLdouble,GLdouble,GLdouble,GLdouble,GLdouble,GLdouble);
    00032         void(APIENTRY*glRotatef)(GLfloat,GLfloat,GLfloat,GLfloat);
    00033         void(APIENTRY*glViewport)(GLint,GLint,GLsizei,GLsizei);
    00034         void(APIENTRY*glFogf)(GLenum,GLfloat);
    00035         void(APIENTRY*glGenTextures)(GLsizei,GLuint*);
    00036         void(APIENTRY*glBindTexture)(GLenum,GLuint);
    00037         void(APIENTRY*glTexParameteri)(GLenum,GLenum,GLint);
    00038         void(APIENTRY*glTexImage2D)(GLenum,GLint,GLint,GLsizei,GLsizei,GLint,GLenum,GLenum,const GLvoid *);
    00039         void(APIENTRY*glColor3f)(GLfloat,GLfloat,GLfloat);
    00040         void(APIENTRY*glVertex2f)(GLfloat,GLfloat);
    00041         void(APIENTRY*glTexCoord2f)(GLfloat,GLfloat);
    00042         void(APIENTRY*glTexEnvf)(GLenum,GLenum,GLfloat);
    00043         void(APIENTRY*glColor4f)(GLfloat,GLfloat,GLfloat,GLfloat);
    00044         void(APIENTRY*glDepthMask)(GLboolean);
    00045         void(APIENTRY*glClearDepth)(GLclampd);
    00046         void(APIENTRY*glDepthFunc)(GLenum);
    00047         void(APIENTRY*glShadeModel)(GLenum);
    00048         void(APIENTRY*glFinish)();
    00049         GLuint(APIENTRY*glGenLists)(GLsizei);
    00050         void(APIENTRY*glDeleteLists)(GLuint,GLsizei);
    00051         void(APIENTRY*glPopAttrib)();
    00052         void(APIENTRY*glCallLists)(GLsizei,GLenum,const GLvoid*);
    00053         void(APIENTRY*glListBase)(GLuint);
    00054         void(APIENTRY*glPushAttrib)(GLbitfield);
    00055         void(APIENTRY*glRasterPos2f)(GLfloat,GLfloat);
    00056         void(APIENTRY*glGetBooleanv)(GLenum, GLboolean *);
    00057         void(APIENTRY*glEndList)();
    00058         void(APIENTRY*glTranslated)(GLdouble,GLdouble,GLdouble);
    00059         void(APIENTRY*glNewList)(GLuint,GLenum);
    00060         void(APIENTRY*glVertex2i)(GLint,GLint);
    00061         void(APIENTRY*glPopMatrix)();
    00062         void(APIENTRY*glPushMatrix)();
    00063         void(APIENTRY*glDeleteTextures)(GLsizei, const GLuint *);
    00064
    00065         void(APIENTRY*wglUseFontBitmapsA)(HDC,long,long,long);
    00066
    00067         GLuint buildFont(double scale, double width, double height, int fontTexture);
    00068         GLvoid killFont();
    00069         GLvoid glPrint(GLint x, GLint y, std::string text, bool small=false);
    00070
    00071
    00072         GLuint SDL_GL_LoadTexture(SDL_Surface *surface, GLfloat *texcoord);
    00073         int loadTexture(std::string filename, GLfloat coords[4], SDL_Rect & rect);
    00074
    00075         static SDL_Surface *load_image( std::string filename );
    00076         static int power_of_two(int input);
    00077         static bool intersect(SDL_Rect &A, SDL_Rect &B, int*x = NULL , int*y = NULL);
    00078         static bool intersectX(SDL_Rect &A, SDL_Rect &B, int* x = NULL);
    00079         static bool intersectY(SDL_Rect &A, SDL_Rect &B, int* y = NULL);
    00080
    00081 private:
    00082         GLuint _bigBase;
    00083         GLuint _smallBase;
    00084         GLuint _bigFont;
    00085         GLuint _smallFont;
    00086
    00087         glfuncs();
    00088         static glfuncs* _instance;
    00089         void* get_funcaddr(const char* p);
    00090         void init_glfuncs();
    00091
    00092 };
    00093
    00094 #endif