… | |
… | |
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 |
… | |
… | |
731 | |
710 | |
732 | CFClient::Layout |
711 | CFClient::Layout |
733 | new (SV *class, int rgba = 0) |
712 | new (SV *class, int rgba = 0) |
734 | CODE: |
713 | CODE: |
735 | #if _WIN32 |
714 | #if _WIN32 |
736 | rgba = 0;//D |
715 | //rgba = 0;//D make stext nicer, breaks TextView |
737 | #endif |
716 | #endif |
738 | New (0, RETVAL, 1, struct cf_layout); |
717 | New (0, RETVAL, 1, struct cf_layout); |
739 | |
718 | |
740 | RETVAL->pl = pango_layout_new (rgba ? cairo_context : ft2_context); |
719 | RETVAL->pl = pango_layout_new (rgba ? cairo_context : ft2_context); |
741 | RETVAL->rgba = rgba; |
720 | RETVAL->rgba = rgba; |
… | |
… | |
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); |
… | |
… | |
1097 | tex->r = r; |
1069 | tex->r = r; |
1098 | tex->g = g; |
1070 | tex->g = g; |
1099 | tex->b = b; |
1071 | tex->b = b; |
1100 | tex->a = a; |
1072 | tex->a = a; |
1101 | } |
1073 | } |
|
|
1074 | |
|
|
1075 | // somewhat hackish, but for textures that require it, it really |
|
|
1076 | // improves the look, and most others don't suffer. |
|
|
1077 | glBindTexture (GL_TEXTURE_2D, name); |
|
|
1078 | //glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
|
|
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); |
1102 | } |
1083 | } |
1103 | |
1084 | |
1104 | int |
1085 | int |
1105 | ox (CFClient::Map self) |
1086 | ox (CFClient::Map self) |
1106 | ALIAS: |
1087 | ALIAS: |
1107 | oy = 1 |
1088 | oy = 1 |
|
|
1089 | x = 2 |
|
|
1090 | y = 3 |
1108 | CODE: |
1091 | CODE: |
1109 | switch (ix) |
1092 | switch (ix) |
1110 | { |
1093 | { |
1111 | case 0: RETVAL = self->ox; break; |
1094 | case 0: RETVAL = self->ox; break; |
1112 | case 1: RETVAL = self->oy; break; |
1095 | case 1: RETVAL = self->oy; break; |
|
|
1096 | case 2: RETVAL = self->x; break; |
|
|
1097 | case 3: RETVAL = self->y; break; |
1113 | } |
1098 | } |
1114 | OUTPUT: |
1099 | OUTPUT: |
1115 | RETVAL |
1100 | RETVAL |
1116 | |
1101 | |
1117 | void |
1102 | void |
… | |
… | |
1577 | const_iv (GL_TEXTURE_MAG_FILTER), |
1562 | const_iv (GL_TEXTURE_MAG_FILTER), |
1578 | const_iv (GL_TEXTURE_MIN_FILTER), |
1563 | const_iv (GL_TEXTURE_MIN_FILTER), |
1579 | const_iv (GL_TEXTURE_ENV_MODE), |
1564 | const_iv (GL_TEXTURE_ENV_MODE), |
1580 | const_iv (GL_TEXTURE_WRAP_S), |
1565 | const_iv (GL_TEXTURE_WRAP_S), |
1581 | const_iv (GL_TEXTURE_WRAP_T), |
1566 | const_iv (GL_TEXTURE_WRAP_T), |
|
|
1567 | const_iv (GL_REPEAT), |
1582 | const_iv (GL_CLAMP), |
1568 | const_iv (GL_CLAMP), |
1583 | const_iv (GL_REPEAT), |
1569 | const_iv (GL_CLAMP_TO_EDGE), |
1584 | const_iv (GL_NEAREST), |
1570 | const_iv (GL_NEAREST), |
1585 | const_iv (GL_LINEAR), |
1571 | const_iv (GL_LINEAR), |
1586 | const_iv (GL_NEAREST_MIPMAP_NEAREST), |
1572 | const_iv (GL_NEAREST_MIPMAP_NEAREST), |
1587 | const_iv (GL_LINEAR_MIPMAP_NEAREST), |
1573 | const_iv (GL_LINEAR_MIPMAP_NEAREST), |
1588 | const_iv (GL_NEAREST_MIPMAP_LINEAR), |
1574 | const_iv (GL_NEAREST_MIPMAP_LINEAR), |
… | |
… | |
1618 | |
1604 | |
1619 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
1605 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
1620 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
1606 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
1621 | } |
1607 | } |
1622 | |
1608 | |
|
|
1609 | char * |
|
|
1610 | gl_vendor () |
|
|
1611 | CODE: |
|
|
1612 | RETVAL = (char *)glGetString (GL_VENDOR); |
|
|
1613 | OUTPUT: |
|
|
1614 | RETVAL |
|
|
1615 | |
|
|
1616 | char * |
|
|
1617 | gl_version () |
|
|
1618 | CODE: |
|
|
1619 | RETVAL = (char *)glGetString (GL_VERSION); |
|
|
1620 | OUTPUT: |
|
|
1621 | RETVAL |
|
|
1622 | |
|
|
1623 | char * |
|
|
1624 | gl_extensions () |
|
|
1625 | CODE: |
|
|
1626 | RETVAL = (char *)glGetString (GL_EXTENSIONS); |
|
|
1627 | OUTPUT: |
|
|
1628 | RETVAL |
|
|
1629 | |
1623 | int glGetError () |
1630 | int glGetError () |
1624 | |
1631 | |
1625 | void glClear (int mask) |
1632 | void glClear (int mask) |
1626 | |
1633 | |
1627 | void glClearColor (float r, float g, float b, float a = 1.0) |
1634 | void glClearColor (float r, float g, float b, float a = 1.0) |
… | |
… | |
1679 | |
1686 | |
1680 | void glColor (float r, float g, float b, float a = 1.0) |
1687 | void glColor (float r, float g, float b, float a = 1.0) |
1681 | PROTOTYPE: @ |
1688 | PROTOTYPE: @ |
1682 | CODE: |
1689 | CODE: |
1683 | // microsoft visual "c" rounds instead of truncating... |
1690 | // microsoft visual "c" rounds instead of truncating... |
1684 | glColor4ub (MIN ((int)(r * 255.f), 255), |
1691 | glColor4ub (MIN ((int)(r * 256.f), 255), |
1685 | MIN ((int)(g * 255.f), 255), |
1692 | MIN ((int)(g * 256.f), 255), |
1686 | MIN ((int)(b * 255.f), 255), |
1693 | MIN ((int)(b * 256.f), 255), |
1687 | MIN ((int)(a * 255.f), 255)); |
1694 | MIN ((int)(a * 256.f), 255)); |
1688 | |
1695 | |
1689 | void glInterleavedArrays (int format, int stride, char *data) |
1696 | void glInterleavedArrays (int format, int stride, char *data) |
1690 | |
1697 | |
1691 | void glDrawElements (int mode, int count, int type, char *indices) |
1698 | void glDrawElements (int mode, int count, int type, char *indices) |
1692 | |
1699 | |