ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/Client.xs
(Generate patch)

Comparing deliantra/Deliantra-Client/Client.xs (file contents):
Revision 1.96 by root, Wed May 24 22:28:43 2006 UTC vs.
Revision 1.100 by root, Wed May 31 17:16:47 2006 UTC

565 CODE: 565 CODE:
566#ifndef _WIN32 566#ifndef _WIN32
567 setsockopt (fd, IPPROTO_TCP, TCP_NODELAY, &val, sizeof (val)); 567 setsockopt (fd, IPPROTO_TCP, TCP_NODELAY, &val, sizeof (val));
568#endif 568#endif
569 569
570char *
571gl_vendor ()
572 CODE:
573 RETVAL = (char *)glGetString (GL_VENDOR);
574 OUTPUT:
575 RETVAL
576
577char *
578gl_version ()
579 CODE:
580 RETVAL = (char *)glGetString (GL_VERSION);
581 OUTPUT:
582 RETVAL
583
584char *
585gl_extensions ()
586 CODE:
587 RETVAL = (char *)glGetString (GL_EXTENSIONS);
588 OUTPUT:
589 RETVAL
590
591void 570void
592add_font (char *file) 571add_font (char *file)
593 CODE: 572 CODE:
594 FcConfigAppFontAddFile (0, (const FcChar8 *)file); /* no idea wether this is required */ 573 FcConfigAppFontAddFile (0, (const FcChar8 *)file); /* no idea wether this is required */
595#ifdef _WIN32 574#ifdef _WIN32
988{ 967{
989 HV *hv = (HV *)SvRV (self); 968 HV *hv = (HV *)SvRV (self);
990 float s = SvNV (*hv_fetch (hv, "s", 1, 1)); 969 float s = SvNV (*hv_fetch (hv, "s", 1, 1));
991 float t = SvNV (*hv_fetch (hv, "t", 1, 1)); 970 float t = SvNV (*hv_fetch (hv, "t", 1, 1));
992 int name = SvIV (*hv_fetch (hv, "name", 4, 1)); 971 int name = SvIV (*hv_fetch (hv, "name", 4, 1));
993 int wrap_mode = SvIV (*hv_fetch (hv, "wrap_mode", 9, 1));
994 972
995 if (items < 5) 973 if (items < 5)
996 { 974 {
997 w = SvNV (*hv_fetch (hv, "w", 1, 1)); 975 w = SvNV (*hv_fetch (hv, "w", 1, 1));
998 h = SvNV (*hv_fetch (hv, "h", 1, 1)); 976 h = SvNV (*hv_fetch (hv, "h", 1, 1));
1005 glEnable (GL_ALPHA_TEST); 983 glEnable (GL_ALPHA_TEST);
1006 glAlphaFunc (GL_GREATER, 0.01f); 984 glAlphaFunc (GL_GREATER, 0.01f);
1007 } 985 }
1008 986
1009 glBindTexture (GL_TEXTURE_2D, name); 987 glBindTexture (GL_TEXTURE_2D, name);
1010
1011 if (wrap_mode)
1012 {
1013 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
1014 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
1015 }
1016 988
1017 glBegin (GL_QUADS); 989 glBegin (GL_QUADS);
1018 glTexCoord2f (0, 0); glVertex2f (x , y ); 990 glTexCoord2f (0, 0); glVertex2f (x , y );
1019 glTexCoord2f (0, t); glVertex2f (x , y + h); 991 glTexCoord2f (0, t); glVertex2f (x , y + h);
1020 glTexCoord2f (s, t); glVertex2f (x + w, y + h); 992 glTexCoord2f (s, t); glVertex2f (x + w, y + h);
1101 } 1073 }
1102 1074
1103 // somewhat hackish, but for textures that require it, it really 1075 // somewhat hackish, but for textures that require it, it really
1104 // improves the look, and most others don't suffer. 1076 // improves the look, and most others don't suffer.
1105 glBindTexture (GL_TEXTURE_2D, name); 1077 glBindTexture (GL_TEXTURE_2D, name);
1106 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); 1078 //glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
1107 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); 1079 //glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
1080 // use uglier nearest interpolation because linear suffers
1081 // from transparent color bleeding and ugly wrapping effects.
1082 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1108} 1083}
1109 1084
1110int 1085int
1111ox (CFClient::Map self) 1086ox (CFClient::Map self)
1112 ALIAS: 1087 ALIAS:
1583 const_iv (GL_TEXTURE_MAG_FILTER), 1558 const_iv (GL_TEXTURE_MAG_FILTER),
1584 const_iv (GL_TEXTURE_MIN_FILTER), 1559 const_iv (GL_TEXTURE_MIN_FILTER),
1585 const_iv (GL_TEXTURE_ENV_MODE), 1560 const_iv (GL_TEXTURE_ENV_MODE),
1586 const_iv (GL_TEXTURE_WRAP_S), 1561 const_iv (GL_TEXTURE_WRAP_S),
1587 const_iv (GL_TEXTURE_WRAP_T), 1562 const_iv (GL_TEXTURE_WRAP_T),
1563 const_iv (GL_REPEAT),
1588 const_iv (GL_CLAMP), 1564 const_iv (GL_CLAMP),
1589 const_iv (GL_REPEAT), 1565 const_iv (GL_CLAMP_TO_EDGE),
1590 const_iv (GL_NEAREST), 1566 const_iv (GL_NEAREST),
1591 const_iv (GL_LINEAR), 1567 const_iv (GL_LINEAR),
1592 const_iv (GL_NEAREST_MIPMAP_NEAREST), 1568 const_iv (GL_NEAREST_MIPMAP_NEAREST),
1593 const_iv (GL_LINEAR_MIPMAP_NEAREST), 1569 const_iv (GL_LINEAR_MIPMAP_NEAREST),
1594 const_iv (GL_NEAREST_MIPMAP_LINEAR), 1570 const_iv (GL_NEAREST_MIPMAP_LINEAR),
1624 1600
1625 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) 1601 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; )
1626 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); 1602 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv));
1627} 1603}
1628 1604
1605char *
1606gl_vendor ()
1607 CODE:
1608 RETVAL = (char *)glGetString (GL_VENDOR);
1609 OUTPUT:
1610 RETVAL
1611
1612char *
1613gl_version ()
1614 CODE:
1615 RETVAL = (char *)glGetString (GL_VERSION);
1616 OUTPUT:
1617 RETVAL
1618
1619char *
1620gl_extensions ()
1621 CODE:
1622 RETVAL = (char *)glGetString (GL_EXTENSIONS);
1623 OUTPUT:
1624 RETVAL
1625
1629int glGetError () 1626int glGetError ()
1630 1627
1631void glClear (int mask) 1628void glClear (int mask)
1632 1629
1633void glClearColor (float r, float g, float b, float a = 1.0) 1630void glClearColor (float r, float g, float b, float a = 1.0)
1685 1682
1686void glColor (float r, float g, float b, float a = 1.0) 1683void glColor (float r, float g, float b, float a = 1.0)
1687 PROTOTYPE: @ 1684 PROTOTYPE: @
1688 CODE: 1685 CODE:
1689 // microsoft visual "c" rounds instead of truncating... 1686 // microsoft visual "c" rounds instead of truncating...
1690 glColor4ub (MIN ((int)(r * 255.f), 255), 1687 glColor4ub (MIN ((int)(r * 256.f), 255),
1691 MIN ((int)(g * 255.f), 255), 1688 MIN ((int)(g * 256.f), 255),
1692 MIN ((int)(b * 255.f), 255), 1689 MIN ((int)(b * 256.f), 255),
1693 MIN ((int)(a * 255.f), 255)); 1690 MIN ((int)(a * 256.f), 255));
1694 1691
1695void glInterleavedArrays (int format, int stride, char *data) 1692void glInterleavedArrays (int format, int stride, char *data)
1696 1693
1697void glDrawElements (int mode, int count, int type, char *indices) 1694void glDrawElements (int mode, int count, int type, char *indices)
1698 1695

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines