--- deliantra/Deliantra-Client/Client.xs 2006/04/19 21:38:04 1.53 +++ deliantra/Deliantra-Client/Client.xs 2006/04/19 23:37:48 1.54 @@ -416,6 +416,9 @@ RETVAL void +SDL_GL_SwapBuffers () + +void SDL_PollEvent () PPCODE: { @@ -1270,3 +1273,173 @@ OUTPUT: RETVAL +MODULE = CFClient PACKAGE = CFClient::OpenGL + +BOOT: +{ + HV *stash = gv_stashpv ("CFClient::OpenGL", 1); + static const struct { + const char *name; + IV iv; + } *civ, const_iv[] = { +# define const_iv(name) { # name, (IV)name } + const_iv (GL_COLOR_MATERIAL), + const_iv (GL_SMOOTH), + const_iv (GL_FLAT), + const_iv (GL_BLEND), + const_iv (GL_AND), + const_iv (GL_SRC_ALPHA), + const_iv (GL_ONE_MINUS_SRC_ALPHA), + const_iv (GL_RGB), + const_iv (GL_RGBA), + const_iv (GL_UNSIGNED_BYTE), + const_iv (GL_ALPHA4), + const_iv (GL_ALPHA), + const_iv (GL_FLOAT), + const_iv (GL_UNSIGNED_INT_8_8_8_8_REV), + const_iv (GL_COMPILE), + const_iv (GL_TEXTURE_1D), + const_iv (GL_TEXTURE_2D), + const_iv (GL_TEXTURE_ENV), + const_iv (GL_TEXTURE_MAG_FILTER), + const_iv (GL_TEXTURE_MIN_FILTER), + const_iv (GL_TEXTURE_ENV_MODE), + const_iv (GL_TEXTURE_WRAP_S), + const_iv (GL_TEXTURE_WRAP_T), + const_iv (GL_CLAMP), + const_iv (GL_REPEAT), + const_iv (GL_NEAREST), + const_iv (GL_LINEAR), + const_iv (GL_MODULATE), + const_iv (GL_REPLACE), + const_iv (GL_COLOR_BUFFER_BIT), + const_iv (GL_PROJECTION), + const_iv (GL_MODELVIEW), + const_iv (GL_COLOR_LOGIC_OP), + const_iv (GL_CONVOLUTION_2D), + const_iv (GL_CONVOLUTION_BORDER_MODE), + const_iv (GL_CONSTANT_BORDER), + const_iv (GL_LINES), + const_iv (GL_QUADS), + const_iv (GL_PERSPECTIVE_CORRECTION_HINT), + const_iv (GL_FASTEST), +# undef const_iv + }; + + for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) + newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); +} + +int glGetError () + +void glClear (int mask) + +void glClearColor (float r, float g, float b, float a = 1.0) + PROTOTYPE: @ + +void glEnable (int cap) + +void glDisable (int cap) + +void glShadeModel (int mode) + +void glHint (int target, int mode) + +void glBlendFunc (int sfactor, int dfactor) + +void glLogicOp (int opcode) + +void glMatrixMode (int mode) + +void glPushMatrix () + +void glPopMatrix () + +void glLoadIdentity () + +void glOrtho (double left, double right, double bottom, double top, double near, double far) + +void glViewport (int x, int y, int width, int height) + +void glTranslate (float x, float y, float z = 0.) + CODE: + glTranslatef (x, y, z); + +void glScale (float x, float y, float z) + CODE: + glScalef (x, y, z); + +void glRotate (float angle, float x, float y, float z) + CODE: + glRotatef (angle, x, y, z); + +void glBegin (int mode) + +void glEnd () + +void glColor (float r, float g, float b, float a = 1.0) + PROTOTYPE: @ + CODE: + glColor4f (r, g, b, a); + +void glVertex (float x, float y, float z = 0.) + CODE: + glVertex3f (x, y, z); + +void glTexCoord (float s, float t) + CODE: + glTexCoord2f (s, t); + +void glTexEnv (int target, int pname, float param) + CODE: + glTexEnvf (target, pname, param); + +void glTexParameter (int target, int pname, float param) + CODE: + glTexParameterf (target, pname, param); + +void glBindTexture (int target, int name) + +void glConvolutionParameter (int target, int pname, float params) + CODE: + glConvolutionParameterf (target, pname, params); + +void glConvolutionFilter2D (int target, int internalformat, int width, int height, int format, int type, char *data) + +void glTexImage2D (int target, int level, int internalformat, int width, int height, int border, int format, int type, char *data) + +void glCopyTexImage2D (int target, int level, int internalformat, int x, int y, int width, int height, int border) + +int glGenTexture () + CODE: +{ + GLuint name; + glGenTextures (1, &name); + RETVAL = name; +} + OUTPUT: + RETVAL + +void glDeleteTexture (int name) + CODE: +{ + GLuint name_ = name; + glDeleteTextures (1, &name_); +} + +int glGenList () + CODE: + RETVAL = glGenLists (1); + OUTPUT: + RETVAL + +void glDeleteList (int list) + CODE: + glDeleteLists (list, 1); + +void glNewList (int list, int mode = GL_COMPILE) + +void glEndList () + +void glCallList (int list) +