--- deliantra/Deliantra-Client/Client.xs 2006/05/19 18:39:06 1.87 +++ deliantra/Deliantra-Client/Client.xs 2006/05/23 18:54:37 1.93 @@ -443,10 +443,10 @@ SDL_GL_SetAttribute (SDL_GL_RED_SIZE, 5); SDL_GL_SetAttribute (SDL_GL_GREEN_SIZE, 5); SDL_GL_SetAttribute (SDL_GL_BLUE_SIZE, 5); - SDL_GL_SetAttribute (SDL_GL_ALPHA_SIZE, 16); + SDL_GL_SetAttribute (SDL_GL_ALPHA_SIZE, 1); - SDL_GL_SetAttribute (SDL_GL_BUFFER_SIZE, 64); - SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, 0); + SDL_GL_SetAttribute (SDL_GL_BUFFER_SIZE, 15); + SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, 16); SDL_GL_SetAttribute (SDL_GL_ACCUM_RED_SIZE, 0); SDL_GL_SetAttribute (SDL_GL_ACCUM_GREEN_SIZE, 0); @@ -472,6 +472,9 @@ } } +char * +SDL_GetError () + int SDL_SetVideoMode (int w, int h, int fullscreen) CODE: @@ -490,6 +493,18 @@ PPCODE: { SDL_Event ev; + int i; + static int modifier; + static int modkey[] = { + SDLK_RSHIFT, KMOD_RSHIFT, + SDLK_LSHIFT, KMOD_LSHIFT, + SDLK_RCTRL, KMOD_RCTRL, + SDLK_LCTRL, KMOD_LCTRL, + SDLK_RALT, KMOD_RALT, + SDLK_LALT, KMOD_LALT, + SDLK_RMETA, KMOD_RMETA, + SDLK_LMETA, KMOD_LMETA, + }; while (SDL_PollEvent (&ev)) { @@ -500,6 +515,17 @@ { case SDL_KEYDOWN: case SDL_KEYUP: + + for (i = 0; i < sizeof (modkey) / (sizeof (int) * 2); i++) + if (modkey [i * 2] == ev.key.keysym.sym) + { + if (ev.type == SDL_KEYDOWN) + modifier |= modkey [i * 2 + 1]; + else + modifier &= ~modkey [i * 2 + 1]; + break; + } + hv_store (hv, "state", 5, newSViv (ev.key.state), 0); hv_store (hv, "sym", 3, newSViv (ev.key.keysym.sym), 0); hv_store (hv, "mod", 3, newSViv (ev.key.keysym.mod), 0); @@ -512,6 +538,8 @@ break; case SDL_MOUSEMOTION: + hv_store (hv, "mod", 3, newSViv (modifier), 0); + hv_store (hv, "state", 5, newSViv (ev.motion.state), 0); hv_store (hv, "x", 1, newSViv (ev.motion.x), 0); hv_store (hv, "y", 1, newSViv (ev.motion.y), 0); @@ -521,6 +549,8 @@ case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONUP: + hv_store (hv, "mod", 3, newSViv (modifier), 0); + hv_store (hv, "button", 6, newSViv (ev.button.button), 0); hv_store (hv, "state", 5, newSViv (ev.button.state), 0); hv_store (hv, "x", 1, newSViv (ev.button.x), 0); @@ -558,6 +588,13 @@ #endif char * +gl_vendor () + CODE: + RETVAL = (char *)glGetString (GL_VENDOR); + OUTPUT: + RETVAL + +char * gl_version () CODE: RETVAL = (char *)glGetString (GL_VERSION); @@ -1529,7 +1566,12 @@ const_iv (GL_FLAT), const_iv (GL_DITHER), const_iv (GL_BLEND), + const_iv (GL_CULL_FACE), const_iv (GL_SCISSOR_TEST), + const_iv (GL_DEPTH_TEST), + const_iv (GL_ALPHA_TEST), + const_iv (GL_NORMALIZE), + const_iv (GL_RESCALE_NORMAL), const_iv (GL_AND), const_iv (GL_ONE), const_iv (GL_ZERO), @@ -1540,6 +1582,8 @@ const_iv (GL_RGB), const_iv (GL_RGBA), const_iv (GL_UNSIGNED_BYTE), + const_iv (GL_UNSIGNED_SHORT), + const_iv (GL_UNSIGNED_INT), const_iv (GL_ALPHA), const_iv (GL_INTENSITY), const_iv (GL_LUMINANCE), @@ -1567,6 +1611,7 @@ const_iv (GL_MODULATE), const_iv (GL_DECAL), const_iv (GL_REPLACE), + const_iv (GL_DEPTH_BUFFER_BIT), const_iv (GL_COLOR_BUFFER_BIT), const_iv (GL_PROJECTION), const_iv (GL_MODELVIEW), @@ -1576,10 +1621,18 @@ const_iv (GL_CONVOLUTION_BORDER_MODE), const_iv (GL_CONSTANT_BORDER), const_iv (GL_LINES), - const_iv (GL_QUADS), const_iv (GL_LINE_LOOP), + const_iv (GL_QUADS), + const_iv (GL_QUAD_STRIP), + const_iv (GL_TRIANGLES), + const_iv (GL_TRIANGLE_STRIP), + const_iv (GL_TRIANGLE_FAN), const_iv (GL_PERSPECTIVE_CORRECTION_HINT), const_iv (GL_FASTEST), + const_iv (GL_V2F), + const_iv (GL_V3F), + const_iv (GL_T2F_V3F), + const_iv (GL_T2F_N3F_V3F), # undef const_iv }; @@ -1604,6 +1657,8 @@ void glBlendFunc (int sfactor, int dfactor) +void glDepthMask (int flag) + void glLogicOp (int opcode) void glColorMask (int red, int green, int blue, int alpha) @@ -1616,7 +1671,10 @@ void glLoadIdentity () -# near and far are due to microsofts buggy c compiler +# near_ and far_ are due to microsofts buggy "c" compiler +void glFrustum (double left, double right, double bottom, double top, double near_, double far_) + +# near_ and far_ are due to microsofts buggy "c" compiler void glOrtho (double left, double right, double bottom, double top, double near_, double far_) void glViewport (int x, int y, int width, int height) @@ -1642,11 +1700,23 @@ void glColor (float r, float g, float b, float a = 1.0) PROTOTYPE: @ CODE: + // microsoft visual "c" rounds instead of truncating... glColor4ub (MIN ((int)(r * 255.f), 255), MIN ((int)(g * 255.f), 255), MIN ((int)(b * 255.f), 255), MIN ((int)(a * 255.f), 255)); +void glInterleavedArrays (int format, int stride, char *data) + +void glDrawElements (int mode, int count, int type, char *indices) + +# 1.2 void glDrawRangeElements (int mode, int start, int end + +void glRasterPos (float x, float y, float z = 0.) + CODE: + glRasterPos3f (0, 0, z); + glBitmap (0, 0, 0, 0, x, y, 0); + void glVertex (float x, float y, float z = 0.) CODE: glVertex3f (x, y, z); @@ -1683,9 +1753,7 @@ void glCopyTexImage2D (int target, int level, int internalformat, int x, int y, int width, int height, int border) -void glRasterPos (int x, int y) - CODE: - glRasterPos2i (x, y); +void glDrawPixels (int width, int height, int format, int type, char *pixels) void glCopyPixels (int x, int y, int width, int height, int type = GL_COLOR) @@ -1722,3 +1790,4 @@ void glCallList (int list) +