… | |
… | |
65 | #define GL_FUNC(ptr,name) ptr name; |
65 | #define GL_FUNC(ptr,name) ptr name; |
66 | #include "glfunc.h" |
66 | #include "glfunc.h" |
67 | #undef GL_FUNC |
67 | #undef GL_FUNC |
68 | } gl; |
68 | } gl; |
69 | |
69 | |
|
|
70 | static void |
70 | static void gl_BlendFuncSeparate (GLenum sa, GLenum da, GLenum saa, GLenum daa) |
71 | gl_BlendFuncSeparate (GLenum sa, GLenum da, GLenum saa, GLenum daa) |
71 | { |
72 | { |
72 | if (gl.BlendFuncSeparate) |
73 | if (gl.BlendFuncSeparate) |
73 | gl.BlendFuncSeparate (sa, da, saa, daa); |
74 | gl.BlendFuncSeparate (sa, da, saa, daa); |
74 | else if (gl.BlendFuncSeparateEXT) |
75 | else if (gl.BlendFuncSeparateEXT) |
75 | gl.BlendFuncSeparateEXT (sa, da, saa, daa); |
76 | gl.BlendFuncSeparateEXT (sa, da, saa, daa); |
76 | else |
77 | else |
77 | glBlendFunc (sa, da); |
78 | glBlendFunc (sa, da); |
|
|
79 | } |
|
|
80 | |
|
|
81 | static GLuint |
|
|
82 | gen_texture () |
|
|
83 | { |
|
|
84 | GLuint name; |
|
|
85 | |
|
|
86 | if (AvFILL (texture_av) >= 0) |
|
|
87 | name = (GLuint)(size_t)av_pop (texture_av); |
|
|
88 | else |
|
|
89 | glGenTextures (1, &name); |
|
|
90 | |
|
|
91 | return name; |
|
|
92 | } |
|
|
93 | |
|
|
94 | static void |
|
|
95 | del_texture (GLuint name) |
|
|
96 | { |
|
|
97 | /* make a half-assed attempt at returning the memory used by the texture */ |
|
|
98 | /* textures are frequently being reused by cfplus anyway */ |
|
|
99 | /*glBindTexture (GL_TEXTURE_2D, name);*/ |
|
|
100 | /*glTexImage2D (GL_TEXTURE_2D, 0, GL_ALPHA, 0, 0, 0, GL_ALPHA, GL_UNSIGNED_BYTE, 0);*/ |
|
|
101 | av_push (texture_av, (SV *)(size_t)name); |
|
|
102 | glDeleteTextures (1, &name); |
78 | } |
103 | } |
79 | |
104 | |
80 | #include "texcache.c" |
105 | #include "texcache.c" |
81 | |
106 | |
82 | #include "pango-font.c" |
107 | #include "pango-font.c" |
… | |
… | |
1740 | smooth_key *skey = (smooth_key *)HeKEY (he); |
1765 | smooth_key *skey = (smooth_key *)HeKEY (he); |
1741 | IV bits = SvIVX (HeVAL (he)); |
1766 | IV bits = SvIVX (HeVAL (he)); |
1742 | |
1767 | |
1743 | if (!(bits & 0x1000) |
1768 | if (!(bits & 0x1000) |
1744 | && skey->level == level |
1769 | && skey->level == level |
1745 | && level >= smooth_max [skey->x][skey->y]) |
1770 | && level > smooth_max [skey->x][skey->y]) |
1746 | { |
1771 | { |
1747 | maptex tex = self->tex [skey->tile]; |
1772 | maptex tex = self->tex [skey->tile]; |
1748 | int px = (((int)skey->x) - 1) * T; |
1773 | int px = (((int)skey->x) - 1) * T; |
1749 | int py = (((int)skey->y) - 1) * T; |
1774 | int py = (((int)skey->y) - 1) * T; |
1750 | int border = bits & 15; |
1775 | int border = bits & 15; |
… | |
… | |
2376 | |
2401 | |
2377 | void glCopyPixels (int x, int y, int width, int height, int type = GL_COLOR) |
2402 | void glCopyPixels (int x, int y, int width, int height, int type = GL_COLOR) |
2378 | |
2403 | |
2379 | int glGenTexture () |
2404 | int glGenTexture () |
2380 | CODE: |
2405 | CODE: |
2381 | { |
2406 | RETVAL = gen_texture (); |
2382 | GLuint name; |
|
|
2383 | if (AvFILL (texture_av) >= 0) |
|
|
2384 | name = (GLuint)av_pop (texture_av); |
|
|
2385 | else |
|
|
2386 | glGenTextures (1, &name); |
|
|
2387 | RETVAL = name; |
|
|
2388 | } |
|
|
2389 | OUTPUT: |
2407 | OUTPUT: |
2390 | RETVAL |
2408 | RETVAL |
2391 | |
2409 | |
2392 | void glDeleteTexture (int name) |
2410 | void glDeleteTexture (int name) |
2393 | CODE: |
2411 | CODE: |
2394 | { |
2412 | del_texture (name); |
2395 | /* make a half-assed attempt at returning the memory used by the texture */ |
2413 | |
2396 | /* textures are frequently being reused by cfplus anyway */ |
|
|
2397 | glBindTexture (GL_TEXTURE_2D, name); |
|
|
2398 | glTexImage2D (GL_TEXTURE_2D, 0, GL_ALPHA, 0, 0, 0, GL_ALPHA, GL_UNSIGNED_BYTE, 0); |
|
|
2399 | av_push (texture_av, (SV *)name); |
|
|
2400 | /*glDeleteTextures (1, &name_);*/ |
|
|
2401 | } |
|
|
2402 | |
|
|
2403 | int glGenList () |
2414 | int glGenList () |
2404 | CODE: |
2415 | CODE: |
2405 | RETVAL = glGenLists (1); |
2416 | RETVAL = glGenLists (1); |
2406 | OUTPUT: |
2417 | OUTPUT: |
2407 | RETVAL |
2418 | RETVAL |