|
|
@@ -57,8 +57,8 @@ static void gl_handle_mouse_motion(int, int); |
|
|
|
static void gl_handle_close(void); |
|
|
|
#endif |
|
|
|
static void _display(void); |
|
|
|
void gl_generate_glyph(uint32_t c, uint32_t tid, caca_display_t *dp); |
|
|
|
void gl_generate_unicode_glyph(uint32_t c, uint32_t tid, caca_display_t *dp); |
|
|
|
static void gl_generate_glyph(uint32_t, uint32_t, caca_display_t *); |
|
|
|
static void gl_generate_unicode_glyph(uint32_t, uint32_t, caca_display_t *); |
|
|
|
|
|
|
|
struct driver_private |
|
|
|
{ |
|
|
@@ -535,36 +535,8 @@ static void _display(void) |
|
|
|
gl_display(dp); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
* Driver initialisation |
|
|
|
*/ |
|
|
|
|
|
|
|
int gl_install(caca_display_t *dp) |
|
|
|
static void gl_generate_glyph(uint32_t c, uint32_t tid, caca_display_t *dp) |
|
|
|
{ |
|
|
|
#if defined(HAVE_GETENV) && defined(GLUT_XLIB_IMPLEMENTATION) |
|
|
|
if(!getenv("DISPLAY") || !*(getenv("DISPLAY"))) |
|
|
|
return -1; |
|
|
|
#endif |
|
|
|
|
|
|
|
dp->drv.driver = CACA_DRIVER_GL; |
|
|
|
|
|
|
|
dp->drv.init_graphics = gl_init_graphics; |
|
|
|
dp->drv.end_graphics = gl_end_graphics; |
|
|
|
dp->drv.set_display_title = gl_set_display_title; |
|
|
|
dp->drv.get_display_width = gl_get_display_width; |
|
|
|
dp->drv.get_display_height = gl_get_display_height; |
|
|
|
dp->drv.display = gl_display; |
|
|
|
dp->drv.handle_resize = gl_handle_resize; |
|
|
|
dp->drv.get_event = gl_get_event; |
|
|
|
dp->drv.set_mouse = gl_set_mouse; |
|
|
|
|
|
|
|
return 0; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void gl_generate_glyph(uint32_t c, uint32_t tid, caca_display_t *dp) { |
|
|
|
int s,d; |
|
|
|
uint8_t *glyph8 = calloc(dp->drv.p->font_width*dp->drv.p->font_height, 1); |
|
|
|
uint8_t *glyph32 = calloc(16*16*4, 1); |
|
|
@@ -572,7 +544,8 @@ void gl_generate_glyph(uint32_t c, uint32_t tid, caca_display_t *dp) { |
|
|
|
cucul_render_glyph(dp->drv.p->f, c, glyph8, dp->drv.p->font_width); |
|
|
|
|
|
|
|
/* Convert resulting 8bbp glyph to 32bits, 16x16*/ |
|
|
|
for(s=0;s<(dp->drv.p->font_height<=16?dp->drv.p->font_height:16);s++) { |
|
|
|
for(s=0;s<(dp->drv.p->font_height<=16?dp->drv.p->font_height:16);s++) |
|
|
|
{ |
|
|
|
for(d=0;d<dp->drv.p->font_width;d++) |
|
|
|
{ |
|
|
|
uint32_t offset = d*4+(15-s)*16*4; |
|
|
@@ -596,7 +569,9 @@ void gl_generate_glyph(uint32_t c, uint32_t tid, caca_display_t *dp) { |
|
|
|
free(glyph32); |
|
|
|
} |
|
|
|
|
|
|
|
void gl_generate_unicode_glyph(uint32_t c, uint32_t tid, caca_display_t *dp) { |
|
|
|
static void gl_generate_unicode_glyph(uint32_t c, uint32_t tid, |
|
|
|
caca_display_t *dp) |
|
|
|
{ |
|
|
|
int s,d; |
|
|
|
uint8_t *glyph8 = calloc(dp->drv.p->font_width*dp->drv.p->font_height, 1); |
|
|
|
uint8_t *glyph32 = calloc(16*16*4, 1); |
|
|
@@ -604,7 +579,8 @@ void gl_generate_unicode_glyph(uint32_t c, uint32_t tid, caca_display_t *dp) { |
|
|
|
cucul_render_glyph(dp->drv.p->f, c, glyph8, dp->drv.p->font_width); |
|
|
|
|
|
|
|
/* Convert resulting 8bbp glyph to 32bits, 16x16*/ |
|
|
|
for(s=0;s<(dp->drv.p->font_height<=16?dp->drv.p->font_height:16);s++) { |
|
|
|
for(s=0;s<(dp->drv.p->font_height<=16?dp->drv.p->font_height:16);s++) |
|
|
|
{ |
|
|
|
for(d=0;d<(dp->drv.p->font_width<=16?dp->drv.p->font_width:16);d++) |
|
|
|
{ |
|
|
|
uint32_t offset = d*4+(15-s)*16*4; |
|
|
@@ -628,10 +604,31 @@ void gl_generate_unicode_glyph(uint32_t c, uint32_t tid, caca_display_t *dp) { |
|
|
|
free(glyph32); |
|
|
|
} |
|
|
|
|
|
|
|
/* |
|
|
|
* Driver initialisation |
|
|
|
*/ |
|
|
|
|
|
|
|
int gl_install(caca_display_t *dp) |
|
|
|
{ |
|
|
|
#if defined(HAVE_GETENV) && defined(GLUT_XLIB_IMPLEMENTATION) |
|
|
|
if(!getenv("DISPLAY") || !*(getenv("DISPLAY"))) |
|
|
|
return -1; |
|
|
|
#endif |
|
|
|
|
|
|
|
dp->drv.driver = CACA_DRIVER_GL; |
|
|
|
|
|
|
|
dp->drv.init_graphics = gl_init_graphics; |
|
|
|
dp->drv.end_graphics = gl_end_graphics; |
|
|
|
dp->drv.set_display_title = gl_set_display_title; |
|
|
|
dp->drv.get_display_width = gl_get_display_width; |
|
|
|
dp->drv.get_display_height = gl_get_display_height; |
|
|
|
dp->drv.display = gl_display; |
|
|
|
dp->drv.handle_resize = gl_handle_resize; |
|
|
|
dp->drv.get_event = gl_get_event; |
|
|
|
dp->drv.set_mouse = gl_set_mouse; |
|
|
|
|
|
|
|
return 0; |
|
|
|
} |
|
|
|
|
|
|
|
#endif /* USE_GL */ |
|
|
|
|