… | |
… | |
400 | |
400 | |
401 | /* SDL should provide this, really. */ |
401 | /* SDL should provide this, really. */ |
402 | #define SDLK_MODIFIER_MIN 300 |
402 | #define SDLK_MODIFIER_MIN 300 |
403 | #define SDLK_MODIFIER_MAX 314 |
403 | #define SDLK_MODIFIER_MAX 314 |
404 | |
404 | |
|
|
405 | static AV *texture_av; |
|
|
406 | |
405 | MODULE = CFPlus PACKAGE = CFPlus |
407 | MODULE = CFPlus PACKAGE = CFPlus |
406 | |
408 | |
407 | PROTOTYPES: ENABLE |
409 | PROTOTYPES: ENABLE |
408 | |
410 | |
409 | BOOT: |
411 | BOOT: |
410 | { |
412 | { |
|
|
413 | texture_av = newAV (); |
|
|
414 | AvREAL_off (texture_av); |
|
|
415 | |
411 | HV *stash = gv_stashpv ("CFPlus", 1); |
416 | HV *stash = gv_stashpv ("CFPlus", 1); |
412 | static const struct { |
417 | static const struct { |
413 | const char *name; |
418 | const char *name; |
414 | IV iv; |
419 | IV iv; |
415 | } *civ, const_iv[] = { |
420 | } *civ, const_iv[] = { |
… | |
… | |
2370 | |
2375 | |
2371 | int glGenTexture () |
2376 | int glGenTexture () |
2372 | CODE: |
2377 | CODE: |
2373 | { |
2378 | { |
2374 | GLuint name; |
2379 | GLuint name; |
|
|
2380 | if (AvFILL (texture_av) >= 0) |
|
|
2381 | name = (GLuint)av_pop (texture_av); |
|
|
2382 | else |
2375 | glGenTextures (1, &name); |
2383 | glGenTextures (1, &name); |
2376 | RETVAL = name; |
2384 | RETVAL = name; |
2377 | } |
2385 | } |
2378 | OUTPUT: |
2386 | OUTPUT: |
2379 | RETVAL |
2387 | RETVAL |
2380 | |
2388 | |
2381 | void glDeleteTexture (int name) |
2389 | void glDeleteTexture (int name) |
2382 | CODE: |
2390 | CODE: |
2383 | { |
2391 | { |
2384 | GLuint name_ = name; |
2392 | /* make a half-assed attempt at returning the memory used by the texture */ |
|
|
2393 | /* textures are frequently being reused by cfplus anyway */ |
|
|
2394 | glBindTexture (GL_TEXTURE_2D, name); |
|
|
2395 | glTexImage2D (GL_TEXTURE_2D, 0, GL_ALPHA, 0, 0, 0, GL_ALPHA, GL_UNSIGNED_BYTE, 0); |
|
|
2396 | av_push (texture_av, (SV *)name); |
2385 | glDeleteTextures (1, &name_); |
2397 | /*glDeleteTextures (1, &name_);*/ |
2386 | } |
2398 | } |
2387 | |
2399 | |
2388 | int glGenList () |
2400 | int glGenList () |
2389 | CODE: |
2401 | CODE: |
2390 | RETVAL = glGenLists (1); |
2402 | RETVAL = glGenLists (1); |