… | |
… | |
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 | |
570 | char * |
|
|
571 | gl_vendor () |
|
|
572 | CODE: |
|
|
573 | RETVAL = (char *)glGetString (GL_VENDOR); |
|
|
574 | OUTPUT: |
|
|
575 | RETVAL |
|
|
576 | |
|
|
577 | char * |
|
|
578 | gl_version () |
|
|
579 | CODE: |
|
|
580 | RETVAL = (char *)glGetString (GL_VERSION); |
|
|
581 | OUTPUT: |
|
|
582 | RETVAL |
|
|
583 | |
|
|
584 | char * |
|
|
585 | gl_extensions () |
|
|
586 | CODE: |
|
|
587 | RETVAL = (char *)glGetString (GL_EXTENSIONS); |
|
|
588 | OUTPUT: |
|
|
589 | RETVAL |
|
|
590 | |
|
|
591 | void |
570 | void |
592 | add_font (char *file) |
571 | add_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 | |
1110 | int |
1085 | int |
1111 | ox (CFClient::Map self) |
1086 | ox (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 | |
|
|
1605 | char * |
|
|
1606 | gl_vendor () |
|
|
1607 | CODE: |
|
|
1608 | RETVAL = (char *)glGetString (GL_VENDOR); |
|
|
1609 | OUTPUT: |
|
|
1610 | RETVAL |
|
|
1611 | |
|
|
1612 | char * |
|
|
1613 | gl_version () |
|
|
1614 | CODE: |
|
|
1615 | RETVAL = (char *)glGetString (GL_VERSION); |
|
|
1616 | OUTPUT: |
|
|
1617 | RETVAL |
|
|
1618 | |
|
|
1619 | char * |
|
|
1620 | gl_extensions () |
|
|
1621 | CODE: |
|
|
1622 | RETVAL = (char *)glGetString (GL_EXTENSIONS); |
|
|
1623 | OUTPUT: |
|
|
1624 | RETVAL |
|
|
1625 | |
1629 | int glGetError () |
1626 | int glGetError () |
1630 | |
1627 | |
1631 | void glClear (int mask) |
1628 | void glClear (int mask) |
1632 | |
1629 | |
1633 | void glClearColor (float r, float g, float b, float a = 1.0) |
1630 | void glClearColor (float r, float g, float b, float a = 1.0) |