… | |
… | |
33 | typedef signed char int8_t; |
33 | typedef signed char int8_t; |
34 | typedef signed short int16_t; |
34 | typedef signed short int16_t; |
35 | typedef signed int int32_t; |
35 | typedef signed int int32_t; |
36 | #endif |
36 | #endif |
37 | |
37 | |
|
|
38 | #include "glext.h" |
|
|
39 | |
38 | #define FOW_DARKNESS 32 |
40 | #define FOW_DARKNESS 32 |
39 | |
41 | |
40 | #define MAP_EXTEND_X 32 |
42 | #define MAP_EXTEND_X 32 |
41 | #define MAP_EXTEND_Y 512 |
43 | #define MAP_EXTEND_Y 512 |
42 | |
44 | |
|
|
45 | #define MIN_FONT_HEIGHT 8 |
|
|
46 | |
43 | typedef Mix_Chunk *CFClient__MixChunk; |
47 | typedef Mix_Chunk *CFClient__MixChunk; |
44 | typedef Mix_Music *CFClient__MixMusic; |
48 | typedef Mix_Music *CFClient__MixMusic; |
45 | |
49 | |
46 | static PangoContext *context; |
50 | typedef PangoFontDescription *CFClient__Font; |
47 | static PangoFontMap *fontmap; |
|
|
48 | |
51 | |
49 | typedef struct cf_layout { |
52 | typedef struct cf_layout { |
50 | PangoLayout *pl; |
53 | PangoLayout *pl; |
51 | int base_height; |
54 | int base_height; |
|
|
55 | CFClient__Font font; |
52 | } *CFClient__Layout; |
56 | } *CFClient__Layout; |
|
|
57 | |
|
|
58 | static CFClient__Font default_font; |
|
|
59 | static PangoContext *context; |
|
|
60 | static PangoFontMap *fontmap; |
53 | |
61 | |
54 | static void |
62 | static void |
55 | substitute_func (FcPattern *pattern, gpointer data) |
63 | substitute_func (FcPattern *pattern, gpointer data) |
56 | { |
64 | { |
57 | FcPatternAddBool (pattern, FC_HINTING , 1); |
65 | FcPatternAddBool (pattern, FC_HINTING , 1); |
58 | FcPatternAddBool (pattern, FC_AUTOHINT, 0); |
66 | FcPatternAddBool (pattern, FC_AUTOHINT, 0); |
59 | } |
67 | } |
60 | |
68 | |
61 | static void |
69 | static void |
62 | layout_update (CFClient__Layout self) |
70 | layout_update_font (CFClient__Layout self) |
63 | { |
71 | { |
64 | /* use a random scale factor to account for unknown descenders, 0.8 works |
72 | /* use a random scale factor to account for unknown descenders, 0.8 works |
65 | * reasonably well with bitstream vera |
73 | * reasonably well with bitstream vera |
66 | */ |
74 | */ |
67 | PangoFontDescription *font = pango_context_get_font_description (context); |
75 | PangoFontDescription *font = self->font ? self->font : default_font; |
68 | |
76 | |
69 | int height = self->base_height * (PANGO_SCALE * 8 / 10); |
|
|
70 | |
|
|
71 | if (pango_font_description_get_size (font) != height) |
|
|
72 | { |
|
|
73 | pango_font_description_set_absolute_size (font, height); |
77 | pango_font_description_set_absolute_size (font, |
74 | pango_layout_context_changed (self->pl); |
78 | MAX (MIN_FONT_HEIGHT, self->base_height) * (PANGO_SCALE * 8 / 10)); |
75 | } |
79 | |
|
|
80 | pango_layout_set_font_description (self->pl, font); |
76 | } |
81 | } |
77 | |
82 | |
78 | static void |
83 | static void |
79 | layout_get_pixel_size (CFClient__Layout self, int *w, int *h) |
84 | layout_get_pixel_size (CFClient__Layout self, int *w, int *h) |
80 | { |
85 | { |
81 | layout_update (self); |
|
|
82 | |
|
|
83 | pango_layout_get_pixel_size (self->pl, w, h); |
86 | pango_layout_get_pixel_size (self->pl, w, h); |
84 | |
87 | |
85 | *w = (*w + 3) & ~3; |
88 | *w = (*w + 3) & ~3; |
86 | if (!*w) *w = 1; |
89 | if (!*w) *w = 1; |
87 | if (!*h) *h = 1; |
90 | if (!*h) *h = 1; |
… | |
… | |
237 | break; |
240 | break; |
238 | |
241 | |
239 | row->col[x - row->c0].darkness = -1; |
242 | row->col[x - row->c0].darkness = -1; |
240 | } |
243 | } |
241 | } |
244 | } |
|
|
245 | } |
|
|
246 | |
|
|
247 | static void |
|
|
248 | music_finished () |
|
|
249 | { |
|
|
250 | SDL_UserEvent ev; |
|
|
251 | |
|
|
252 | ev.type = SDL_USEREVENT; |
|
|
253 | ev.code = 0; |
|
|
254 | ev.data1 = 0; |
|
|
255 | ev.data2 = 0; |
|
|
256 | |
|
|
257 | SDL_PushEvent ((SDL_Event *)&ev); |
242 | } |
258 | } |
243 | |
259 | |
244 | MODULE = CFClient PACKAGE = CFClient |
260 | MODULE = CFClient PACKAGE = CFClient |
245 | |
261 | |
246 | PROTOTYPES: ENABLE |
262 | PROTOTYPES: ENABLE |
… | |
… | |
414 | SDL_WM_SetCaption ("Crossfire+ Client " VERSION, "Crossfire+"); |
430 | SDL_WM_SetCaption ("Crossfire+ Client " VERSION, "Crossfire+"); |
415 | OUTPUT: |
431 | OUTPUT: |
416 | RETVAL |
432 | RETVAL |
417 | |
433 | |
418 | void |
434 | void |
|
|
435 | SDL_GL_SwapBuffers () |
|
|
436 | |
|
|
437 | void |
419 | SDL_PollEvent () |
438 | SDL_PollEvent () |
420 | PPCODE: |
439 | PPCODE: |
421 | { |
440 | { |
422 | SDL_Event ev; |
441 | SDL_Event ev; |
423 | |
442 | |
… | |
… | |
460 | } |
479 | } |
461 | } |
480 | } |
462 | |
481 | |
463 | int |
482 | int |
464 | Mix_OpenAudio (int frequency = 22050, int format = MIX_DEFAULT_FORMAT, int channels = 1, int chunksize = 512) |
483 | Mix_OpenAudio (int frequency = 22050, int format = MIX_DEFAULT_FORMAT, int channels = 1, int chunksize = 512) |
|
|
484 | POSTCALL: |
|
|
485 | Mix_HookMusicFinished (music_finished); |
465 | |
486 | |
466 | void |
487 | void |
467 | Mix_CloseAudio () |
488 | Mix_CloseAudio () |
468 | |
489 | |
469 | int |
490 | int |
… | |
… | |
492 | |
513 | |
493 | void |
514 | void |
494 | add_font (char *file) |
515 | add_font (char *file) |
495 | CODE: |
516 | CODE: |
496 | FcConfigAppFontAddFile (0, (const FcChar8 *)file); /* no idea wether this is required */ |
517 | FcConfigAppFontAddFile (0, (const FcChar8 *)file); /* no idea wether this is required */ |
497 | |
|
|
498 | void |
|
|
499 | set_font (char *file) |
|
|
500 | CODE: |
|
|
501 | { |
|
|
502 | int count; |
|
|
503 | FcPattern *pattern = FcFreeTypeQuery ((const FcChar8 *)file, 0, 0, &count); |
|
|
504 | PangoFontDescription *font = pango_fc_font_description_from_pattern (pattern, 0); |
|
|
505 | FcPatternDestroy (pattern); |
|
|
506 | pango_context_set_font_description (context, font); |
|
|
507 | } |
|
|
508 | |
518 | |
509 | void |
519 | void |
510 | load_image_inline (SV *image_) |
520 | load_image_inline (SV *image_) |
511 | ALIAS: |
521 | ALIAS: |
512 | load_image_file = 1 |
522 | load_image_file = 1 |
… | |
… | |
603 | #else |
613 | #else |
604 | fprintf (stderr, "FATAL: %s\n", message); |
614 | fprintf (stderr, "FATAL: %s\n", message); |
605 | #endif |
615 | #endif |
606 | exit (1); |
616 | exit (1); |
607 | |
617 | |
|
|
618 | MODULE = CFClient PACKAGE = CFClient::Font |
|
|
619 | |
|
|
620 | CFClient::Font |
|
|
621 | new_from_file (SV *class, char *path) |
|
|
622 | CODE: |
|
|
623 | { |
|
|
624 | int count; |
|
|
625 | FcPattern *pattern = FcFreeTypeQuery ((const FcChar8 *)path, 0, 0, &count); |
|
|
626 | RETVAL = pango_fc_font_description_from_pattern (pattern, 0); |
|
|
627 | FcPatternDestroy (pattern); |
|
|
628 | } |
|
|
629 | OUTPUT: |
|
|
630 | RETVAL |
|
|
631 | |
|
|
632 | void |
|
|
633 | DESTROY (CFClient::Font self) |
|
|
634 | CODE: |
|
|
635 | pango_font_description_free (self); |
|
|
636 | |
|
|
637 | void |
|
|
638 | make_default (CFClient::Font self) |
|
|
639 | CODE: |
|
|
640 | default_font = self; |
|
|
641 | |
608 | MODULE = CFClient PACKAGE = CFClient::Layout |
642 | MODULE = CFClient PACKAGE = CFClient::Layout |
609 | |
643 | |
610 | CFClient::Layout |
644 | CFClient::Layout |
611 | new (SV *class, int base_height = 10) |
645 | new (SV *class, int base_height = MIN_FONT_HEIGHT) |
612 | CODE: |
646 | CODE: |
613 | New (0, RETVAL, 1, struct cf_layout); |
647 | New (0, RETVAL, 1, struct cf_layout); |
|
|
648 | RETVAL->pl = pango_layout_new (context); |
614 | RETVAL->base_height = base_height; |
649 | RETVAL->base_height = base_height; |
615 | RETVAL->pl = pango_layout_new (context); |
650 | RETVAL->font = 0; |
616 | pango_layout_set_wrap (RETVAL->pl, PANGO_WRAP_WORD_CHAR); |
651 | pango_layout_set_wrap (RETVAL->pl, PANGO_WRAP_WORD_CHAR); |
|
|
652 | pango_layout_set_font_description (RETVAL->pl, default_font); |
617 | OUTPUT: |
653 | OUTPUT: |
618 | RETVAL |
654 | RETVAL |
619 | |
655 | |
620 | void |
656 | void |
621 | DESTROY (CFClient::Layout self) |
657 | DESTROY (CFClient::Layout self) |
… | |
… | |
650 | SvUTF8_on (RETVAL); |
686 | SvUTF8_on (RETVAL); |
651 | OUTPUT: |
687 | OUTPUT: |
652 | RETVAL |
688 | RETVAL |
653 | |
689 | |
654 | void |
690 | void |
|
|
691 | set_font (CFClient::Layout self, CFClient::Font font = 0) |
|
|
692 | CODE: |
|
|
693 | if (self->font != font) |
|
|
694 | { |
|
|
695 | self->font = font; |
|
|
696 | layout_update_font (self); |
|
|
697 | } |
|
|
698 | |
|
|
699 | void |
655 | set_height (CFClient::Layout self, int base_height) |
700 | set_height (CFClient::Layout self, int base_height) |
656 | CODE: |
701 | CODE: |
|
|
702 | if (self->base_height != base_height) |
|
|
703 | { |
657 | self->base_height = base_height; |
704 | self->base_height = base_height; |
|
|
705 | layout_update_font (self); |
|
|
706 | } |
658 | |
707 | |
659 | void |
708 | void |
660 | set_width (CFClient::Layout self, int max_width = -1) |
709 | set_width (CFClient::Layout self, int max_width = -1) |
661 | CODE: |
710 | CODE: |
662 | pango_layout_set_width (self->pl, max_width < 0 ? max_width : max_width * PANGO_SCALE); |
711 | pango_layout_set_width (self->pl, max_width < 0 ? max_width : max_width * PANGO_SCALE); |
… | |
… | |
665 | size (CFClient::Layout self) |
714 | size (CFClient::Layout self) |
666 | PPCODE: |
715 | PPCODE: |
667 | { |
716 | { |
668 | int w, h; |
717 | int w, h; |
669 | |
718 | |
670 | layout_update (self); |
|
|
671 | layout_get_pixel_size (self, &w, &h); |
719 | layout_get_pixel_size (self, &w, &h); |
672 | |
720 | |
673 | EXTEND (SP, 2); |
721 | EXTEND (SP, 2); |
674 | PUSHs (sv_2mortal (newSViv (w))); |
722 | PUSHs (sv_2mortal (newSViv (w))); |
675 | PUSHs (sv_2mortal (newSViv (h))); |
723 | PUSHs (sv_2mortal (newSViv (h))); |
… | |
… | |
678 | int |
726 | int |
679 | xy_to_index (CFClient::Layout self, int x, int y) |
727 | xy_to_index (CFClient::Layout self, int x, int y) |
680 | CODE: |
728 | CODE: |
681 | { |
729 | { |
682 | int index, trailing; |
730 | int index, trailing; |
683 | |
|
|
684 | layout_update (self); |
|
|
685 | pango_layout_xy_to_index (self->pl, x * PANGO_SCALE, y * PANGO_SCALE, &index, &trailing); |
731 | pango_layout_xy_to_index (self->pl, x * PANGO_SCALE, y * PANGO_SCALE, &index, &trailing); |
686 | |
|
|
687 | RETVAL = index; |
732 | RETVAL = index; |
688 | } |
733 | } |
689 | OUTPUT: |
734 | OUTPUT: |
690 | RETVAL |
735 | RETVAL |
691 | |
736 | |
692 | void |
737 | void |
693 | cursor_pos (CFClient::Layout self, int index) |
738 | cursor_pos (CFClient::Layout self, int index) |
694 | PPCODE: |
739 | PPCODE: |
695 | { |
740 | { |
696 | PangoRectangle strong_pos; |
741 | PangoRectangle strong_pos; |
697 | layout_update (self); |
|
|
698 | pango_layout_get_cursor_pos (self->pl, index, &strong_pos, 0); |
742 | pango_layout_get_cursor_pos (self->pl, index, &strong_pos, 0); |
699 | |
743 | |
700 | EXTEND (SP, 3); |
744 | EXTEND (SP, 3); |
701 | PUSHs (sv_2mortal (newSViv (strong_pos.x / PANGO_SCALE))); |
745 | PUSHs (sv_2mortal (newSViv (strong_pos.x / PANGO_SCALE))); |
702 | PUSHs (sv_2mortal (newSViv (strong_pos.y / PANGO_SCALE))); |
746 | PUSHs (sv_2mortal (newSViv (strong_pos.y / PANGO_SCALE))); |
… | |
… | |
709 | { |
753 | { |
710 | SV *retval; |
754 | SV *retval; |
711 | int w, h; |
755 | int w, h; |
712 | FT_Bitmap bitmap; |
756 | FT_Bitmap bitmap; |
713 | |
757 | |
714 | layout_update (self); |
|
|
715 | layout_get_pixel_size (self, &w, &h); |
758 | layout_get_pixel_size (self, &w, &h); |
716 | |
759 | |
717 | retval = newSV (w * h); |
760 | retval = newSV (w * h); |
718 | SvPOK_only (retval); |
761 | SvPOK_only (retval); |
719 | SvCUR_set (retval, w * h); |
762 | SvCUR_set (retval, w * h); |
… | |
… | |
930 | cell->darkness = -1; |
973 | cell->darkness = -1; |
931 | } |
974 | } |
932 | } |
975 | } |
933 | |
976 | |
934 | SV * |
977 | SV * |
935 | mapmap (CFClient::Map self, int w, int h) |
978 | mapmap (CFClient::Map self, int x0, int y0, int w, int h) |
936 | CODE: |
979 | CODE: |
937 | { |
980 | { |
938 | int x0, x1, x; |
981 | int x1, x; |
939 | int y0, y1, y; |
982 | int y1, y; |
940 | int z; |
983 | int z; |
941 | SV *map_sv = newSV (w * h * sizeof (uint32_t)); |
984 | SV *map_sv = newSV (w * h * sizeof (uint32_t)); |
942 | uint32_t *map = (uint32_t *)SvPVX (map_sv); |
985 | uint32_t *map = (uint32_t *)SvPVX (map_sv); |
943 | |
986 | |
944 | SvPOK_only (map_sv); |
987 | SvPOK_only (map_sv); |
945 | SvCUR_set (map_sv, w * h * sizeof (uint32_t)); |
988 | SvCUR_set (map_sv, w * h * sizeof (uint32_t)); |
946 | |
989 | |
947 | x0 = self->x - w / 2; x1 = x0 + w; |
990 | x0 += self->x; x1 = x0 + w; |
948 | y0 = self->y - h / 2; y1 = y0 + h; |
991 | y0 += self->y; y1 = y0 + h; |
949 | |
992 | |
950 | for (y = y0; y < y1; y++) |
993 | for (y = y0; y < y1; y++) |
951 | { |
994 | { |
952 | maprow *row = 0 <= y && y < self->rows |
995 | maprow *row = 0 <= y && y < self->rows |
953 | ? self->row + y |
996 | ? self->row + y |
… | |
… | |
1093 | *data++ = 0; /* version 0 format */ |
1136 | *data++ = 0; /* version 0 format */ |
1094 | *data++ = w >> 8; *data++ = w; |
1137 | *data++ = w >> 8; *data++ = w; |
1095 | *data++ = h >> 8; *data++ = h; |
1138 | *data++ = h >> 8; *data++ = h; |
1096 | |
1139 | |
1097 | // we need to do this 'cause we don't keep an absolute coord system for rows |
1140 | // we need to do this 'cause we don't keep an absolute coord system for rows |
1098 | // TODO: treat rows as we treat |
1141 | // TODO: treat rows as we treat columns |
1099 | map_get_row (self, y0 + self->y - self->oy);//D |
1142 | map_get_row (self, y0 + self->y - self->oy);//D |
1100 | map_get_row (self, y0 + self->y - self->oy + h - 1);//D |
1143 | map_get_row (self, y0 + self->y - self->oy + h - 1);//D |
1101 | |
1144 | |
1102 | x0 += self->x - self->ox; |
1145 | x0 += self->x - self->ox; |
1103 | y0 += self->y - self->oy; |
1146 | y0 += self->y - self->oy; |
… | |
… | |
1167 | |
1210 | |
1168 | w = *data++ << 8; w |= *data++; |
1211 | w = *data++ << 8; w |= *data++; |
1169 | h = *data++ << 8; h |= *data++; |
1212 | h = *data++ << 8; h |= *data++; |
1170 | |
1213 | |
1171 | // we need to do this 'cause we don't keep an absolute coord system for rows |
1214 | // we need to do this 'cause we don't keep an absolute coord system for rows |
1172 | // TODO: treat rows as we treat |
1215 | // TODO: treat rows as we treat columns |
1173 | map_get_row (self, y0 + self->y - self->oy);//D |
1216 | map_get_row (self, y0 + self->y - self->oy);//D |
1174 | map_get_row (self, y0 + self->y - self->oy + h - 1);//D |
1217 | map_get_row (self, y0 + self->y - self->oy + h - 1);//D |
1175 | |
1218 | |
1176 | x0 += self->x - self->ox; |
1219 | x0 += self->x - self->ox; |
1177 | y0 += self->y - self->oy; |
1220 | y0 += self->y - self->oy; |
… | |
… | |
1268 | CODE: |
1311 | CODE: |
1269 | RETVAL = Mix_PlayMusic (self, loops); |
1312 | RETVAL = Mix_PlayMusic (self, loops); |
1270 | OUTPUT: |
1313 | OUTPUT: |
1271 | RETVAL |
1314 | RETVAL |
1272 | |
1315 | |
|
|
1316 | MODULE = CFClient PACKAGE = CFClient::OpenGL |
|
|
1317 | |
|
|
1318 | BOOT: |
|
|
1319 | { |
|
|
1320 | HV *stash = gv_stashpv ("CFClient::OpenGL", 1); |
|
|
1321 | static const struct { |
|
|
1322 | const char *name; |
|
|
1323 | IV iv; |
|
|
1324 | } *civ, const_iv[] = { |
|
|
1325 | # define const_iv(name) { # name, (IV)name } |
|
|
1326 | const_iv (GL_COLOR_MATERIAL), |
|
|
1327 | const_iv (GL_SMOOTH), |
|
|
1328 | const_iv (GL_FLAT), |
|
|
1329 | const_iv (GL_BLEND), |
|
|
1330 | const_iv (GL_AND), |
|
|
1331 | const_iv (GL_SRC_ALPHA), |
|
|
1332 | const_iv (GL_ONE_MINUS_SRC_ALPHA), |
|
|
1333 | const_iv (GL_RGB), |
|
|
1334 | const_iv (GL_RGBA), |
|
|
1335 | const_iv (GL_UNSIGNED_BYTE), |
|
|
1336 | const_iv (GL_ALPHA4), |
|
|
1337 | const_iv (GL_ALPHA), |
|
|
1338 | const_iv (GL_FLOAT), |
|
|
1339 | const_iv (GL_UNSIGNED_INT_8_8_8_8_REV), |
|
|
1340 | const_iv (GL_COMPILE), |
|
|
1341 | const_iv (GL_TEXTURE_1D), |
|
|
1342 | const_iv (GL_TEXTURE_2D), |
|
|
1343 | const_iv (GL_TEXTURE_ENV), |
|
|
1344 | const_iv (GL_TEXTURE_MAG_FILTER), |
|
|
1345 | const_iv (GL_TEXTURE_MIN_FILTER), |
|
|
1346 | const_iv (GL_TEXTURE_ENV_MODE), |
|
|
1347 | const_iv (GL_TEXTURE_WRAP_S), |
|
|
1348 | const_iv (GL_TEXTURE_WRAP_T), |
|
|
1349 | const_iv (GL_CLAMP), |
|
|
1350 | const_iv (GL_REPEAT), |
|
|
1351 | const_iv (GL_NEAREST), |
|
|
1352 | const_iv (GL_LINEAR), |
|
|
1353 | const_iv (GL_NEAREST_MIPMAP_NEAREST), |
|
|
1354 | const_iv (GL_LINEAR_MIPMAP_NEAREST), |
|
|
1355 | const_iv (GL_NEAREST_MIPMAP_LINEAR), |
|
|
1356 | const_iv (GL_LINEAR_MIPMAP_LINEAR), |
|
|
1357 | const_iv (GL_GENERATE_MIPMAP), |
|
|
1358 | const_iv (GL_LINEAR), |
|
|
1359 | const_iv (GL_MODULATE), |
|
|
1360 | const_iv (GL_REPLACE), |
|
|
1361 | const_iv (GL_COLOR_BUFFER_BIT), |
|
|
1362 | const_iv (GL_PROJECTION), |
|
|
1363 | const_iv (GL_MODELVIEW), |
|
|
1364 | const_iv (GL_COLOR_LOGIC_OP), |
|
|
1365 | const_iv (GL_CONVOLUTION_2D), |
|
|
1366 | const_iv (GL_CONVOLUTION_BORDER_MODE), |
|
|
1367 | const_iv (GL_CONSTANT_BORDER), |
|
|
1368 | const_iv (GL_LINES), |
|
|
1369 | const_iv (GL_QUADS), |
|
|
1370 | const_iv (GL_LINE_LOOP), |
|
|
1371 | const_iv (GL_PERSPECTIVE_CORRECTION_HINT), |
|
|
1372 | const_iv (GL_FASTEST), |
|
|
1373 | # undef const_iv |
|
|
1374 | }; |
|
|
1375 | |
|
|
1376 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
|
|
1377 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
|
|
1378 | } |
|
|
1379 | |
|
|
1380 | int glGetError () |
|
|
1381 | |
|
|
1382 | void glClear (int mask) |
|
|
1383 | |
|
|
1384 | void glClearColor (float r, float g, float b, float a = 1.0) |
|
|
1385 | PROTOTYPE: @ |
|
|
1386 | |
|
|
1387 | void glEnable (int cap) |
|
|
1388 | |
|
|
1389 | void glDisable (int cap) |
|
|
1390 | |
|
|
1391 | void glShadeModel (int mode) |
|
|
1392 | |
|
|
1393 | void glHint (int target, int mode) |
|
|
1394 | |
|
|
1395 | void glBlendFunc (int sfactor, int dfactor) |
|
|
1396 | |
|
|
1397 | void glLogicOp (int opcode) |
|
|
1398 | |
|
|
1399 | void glMatrixMode (int mode) |
|
|
1400 | |
|
|
1401 | void glPushMatrix () |
|
|
1402 | |
|
|
1403 | void glPopMatrix () |
|
|
1404 | |
|
|
1405 | void glLoadIdentity () |
|
|
1406 | |
|
|
1407 | void glOrtho (double left, double right, double bottom, double top, double near, double far) |
|
|
1408 | |
|
|
1409 | void glViewport (int x, int y, int width, int height) |
|
|
1410 | |
|
|
1411 | void glTranslate (float x, float y, float z = 0.) |
|
|
1412 | CODE: |
|
|
1413 | glTranslatef (x, y, z); |
|
|
1414 | |
|
|
1415 | void glScale (float x, float y, float z = 1.) |
|
|
1416 | CODE: |
|
|
1417 | glScalef (x, y, z); |
|
|
1418 | |
|
|
1419 | void glRotate (float angle, float x, float y, float z) |
|
|
1420 | CODE: |
|
|
1421 | glRotatef (angle, x, y, z); |
|
|
1422 | |
|
|
1423 | void glBegin (int mode) |
|
|
1424 | |
|
|
1425 | void glEnd () |
|
|
1426 | |
|
|
1427 | void glColor (float r, float g, float b, float a = 1.0) |
|
|
1428 | PROTOTYPE: @ |
|
|
1429 | CODE: |
|
|
1430 | glColor4f (r, g, b, a); |
|
|
1431 | |
|
|
1432 | void glVertex (float x, float y, float z = 0.) |
|
|
1433 | CODE: |
|
|
1434 | glVertex3f (x, y, z); |
|
|
1435 | |
|
|
1436 | void glTexCoord (float s, float t) |
|
|
1437 | CODE: |
|
|
1438 | glTexCoord2f (s, t); |
|
|
1439 | |
|
|
1440 | void glTexEnv (int target, int pname, float param) |
|
|
1441 | CODE: |
|
|
1442 | glTexEnvf (target, pname, param); |
|
|
1443 | |
|
|
1444 | void glTexParameter (int target, int pname, float param) |
|
|
1445 | CODE: |
|
|
1446 | glTexParameterf (target, pname, param); |
|
|
1447 | |
|
|
1448 | void glBindTexture (int target, int name) |
|
|
1449 | |
|
|
1450 | void glConvolutionParameter (int target, int pname, float params) |
|
|
1451 | CODE: |
|
|
1452 | glConvolutionParameterf (target, pname, params); |
|
|
1453 | |
|
|
1454 | void glConvolutionFilter2D (int target, int internalformat, int width, int height, int format, int type, char *data) |
|
|
1455 | |
|
|
1456 | void glTexImage2D (int target, int level, int internalformat, int width, int height, int border, int format, int type, char *data) |
|
|
1457 | |
|
|
1458 | void glCopyTexImage2D (int target, int level, int internalformat, int x, int y, int width, int height, int border) |
|
|
1459 | |
|
|
1460 | int glGenTexture () |
|
|
1461 | CODE: |
|
|
1462 | { |
|
|
1463 | GLuint name; |
|
|
1464 | glGenTextures (1, &name); |
|
|
1465 | RETVAL = name; |
|
|
1466 | } |
|
|
1467 | OUTPUT: |
|
|
1468 | RETVAL |
|
|
1469 | |
|
|
1470 | void glDeleteTexture (int name) |
|
|
1471 | CODE: |
|
|
1472 | { |
|
|
1473 | GLuint name_ = name; |
|
|
1474 | glDeleteTextures (1, &name_); |
|
|
1475 | } |
|
|
1476 | |
|
|
1477 | int glGenList () |
|
|
1478 | CODE: |
|
|
1479 | RETVAL = glGenLists (1); |
|
|
1480 | OUTPUT: |
|
|
1481 | RETVAL |
|
|
1482 | |
|
|
1483 | void glDeleteList (int list) |
|
|
1484 | CODE: |
|
|
1485 | glDeleteLists (list, 1); |
|
|
1486 | |
|
|
1487 | void glNewList (int list, int mode = GL_COMPILE) |
|
|
1488 | |
|
|
1489 | void glEndList () |
|
|
1490 | |
|
|
1491 | void glCallList (int list) |
|
|
1492 | |