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.97 by root, Fri May 26 18:28:23 2006 UTC vs.
Revision 1.100 by root, Wed May 31 17:16:47 2006 UTC

967{ 967{
968 HV *hv = (HV *)SvRV (self); 968 HV *hv = (HV *)SvRV (self);
969 float s = SvNV (*hv_fetch (hv, "s", 1, 1)); 969 float s = SvNV (*hv_fetch (hv, "s", 1, 1));
970 float t = SvNV (*hv_fetch (hv, "t", 1, 1)); 970 float t = SvNV (*hv_fetch (hv, "t", 1, 1));
971 int name = SvIV (*hv_fetch (hv, "name", 4, 1)); 971 int name = SvIV (*hv_fetch (hv, "name", 4, 1));
972 int wrap_mode = SvIV (*hv_fetch (hv, "wrap_mode", 9, 1));
973 972
974 if (items < 5) 973 if (items < 5)
975 { 974 {
976 w = SvNV (*hv_fetch (hv, "w", 1, 1)); 975 w = SvNV (*hv_fetch (hv, "w", 1, 1));
977 h = SvNV (*hv_fetch (hv, "h", 1, 1)); 976 h = SvNV (*hv_fetch (hv, "h", 1, 1));
984 glEnable (GL_ALPHA_TEST); 983 glEnable (GL_ALPHA_TEST);
985 glAlphaFunc (GL_GREATER, 0.01f); 984 glAlphaFunc (GL_GREATER, 0.01f);
986 } 985 }
987 986
988 glBindTexture (GL_TEXTURE_2D, name); 987 glBindTexture (GL_TEXTURE_2D, name);
989
990 if (wrap_mode)
991 {
992 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
993 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
994 }
995 988
996 glBegin (GL_QUADS); 989 glBegin (GL_QUADS);
997 glTexCoord2f (0, 0); glVertex2f (x , y ); 990 glTexCoord2f (0, 0); glVertex2f (x , y );
998 glTexCoord2f (0, t); glVertex2f (x , y + h); 991 glTexCoord2f (0, t); glVertex2f (x , y + h);
999 glTexCoord2f (s, t); glVertex2f (x + w, y + h); 992 glTexCoord2f (s, t); glVertex2f (x + w, y + h);
1080 } 1073 }
1081 1074
1082 // somewhat hackish, but for textures that require it, it really 1075 // somewhat hackish, but for textures that require it, it really
1083 // improves the look, and most others don't suffer. 1076 // improves the look, and most others don't suffer.
1084 glBindTexture (GL_TEXTURE_2D, name); 1077 glBindTexture (GL_TEXTURE_2D, name);
1085 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); 1078 //glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
1086 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);
1087} 1083}
1088 1084
1089int 1085int
1090ox (CFClient::Map self) 1086ox (CFClient::Map self)
1091 ALIAS: 1087 ALIAS:
1562 const_iv (GL_TEXTURE_MAG_FILTER), 1558 const_iv (GL_TEXTURE_MAG_FILTER),
1563 const_iv (GL_TEXTURE_MIN_FILTER), 1559 const_iv (GL_TEXTURE_MIN_FILTER),
1564 const_iv (GL_TEXTURE_ENV_MODE), 1560 const_iv (GL_TEXTURE_ENV_MODE),
1565 const_iv (GL_TEXTURE_WRAP_S), 1561 const_iv (GL_TEXTURE_WRAP_S),
1566 const_iv (GL_TEXTURE_WRAP_T), 1562 const_iv (GL_TEXTURE_WRAP_T),
1563 const_iv (GL_REPEAT),
1567 const_iv (GL_CLAMP), 1564 const_iv (GL_CLAMP),
1568 const_iv (GL_REPEAT), 1565 const_iv (GL_CLAMP_TO_EDGE),
1569 const_iv (GL_NEAREST), 1566 const_iv (GL_NEAREST),
1570 const_iv (GL_LINEAR), 1567 const_iv (GL_LINEAR),
1571 const_iv (GL_NEAREST_MIPMAP_NEAREST), 1568 const_iv (GL_NEAREST_MIPMAP_NEAREST),
1572 const_iv (GL_LINEAR_MIPMAP_NEAREST), 1569 const_iv (GL_LINEAR_MIPMAP_NEAREST),
1573 const_iv (GL_NEAREST_MIPMAP_LINEAR), 1570 const_iv (GL_NEAREST_MIPMAP_LINEAR),
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