Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Does GlyphKeeper+OpenGL work < 32bit depth ?

This thread is locked; no one can reply to it. rss feed Print
Does GlyphKeeper+OpenGL work < 32bit depth ?
kikabo
Member #3,679
July 2003
avatar

Maybe the topic says it all, I tried my project on linux the other day under a driver that didn't support 32bit colour depths, most things worked, one of the things that didn't was any text rendered with GK.

I tried the same thing on windows in 16bit with the same results, is this a known problem?

I'm guessing I'm just doing something wrong because I assume there would be the same problem in OpenLayer?

Here's a test that doesn't work for me in < 32bit, I know I'm misusing makeacol but I don't think that matters, the alpha whould still be 255.???

1#include <allegro.h>
2#include <alleggl.h>
3#define GLYPH_TARGET GLYPH_TARGET_ALLEGGL
4#include <glyph.h>
5 
6int main()
7{
8 allegro_init();
9 install_allegro_gl();
10 install_timer();
11 install_keyboard();
12
13 allegro_gl_clear_settings();
14 allegro_gl_set(AGL_COLOR_DEPTH, 32);
15 allegro_gl_set(AGL_DOUBLEBUFFER, 1);
16 allegro_gl_set(AGL_SUGGEST, AGL_DOUBLEBUFFER | AGL_COLOR_DEPTH | AGL_WINDOWED);
17 if (set_gfx_mode(GFX_OPENGL_WINDOWED, 800, 600, 0, 0)) {
18 allegro_message("Error initializing OpenGL!\n");
19 return -1;
20 }
21 glClearColor (0, 0, 0, 0);
22 
23 char* fontfile = "Vera.TTF";
24 GLYPH_FACE* face;
25 GLYPH_REND* rend;
26 GLYPH_TEXTURE *texture;
27 
28 face = gk_load_face_from_file(fontfile,0);
29 if (!face) { allegro_message("Can't load font from \"%s\"\n",fontfile); exit(1); }
30 
31 rend = gk_create_renderer(face,0);
32 if (!rend) { allegro_message("Can't create renderer"); exit(1); }
33 
34 gk_rend_set_size_pixels(rend,30,30);
35 
36 texture = gk_create_texture( rend, 32, 96 );
37 
38 
39 while (!key[KEY_ESC])
40 {
41 glClear(GL_COLOR_BUFFER_BIT);
42 
43 gk_rend_set_text_alpha_color( rend, makeacol(0,255,255,255) ); // Note B G R A
44 gk_render_line_gl_utf8(texture, "Hello World",100,100);
45 
46 
47 gk_rend_set_text_alpha_color( rend, makeacol(0,255,0,255) ); // Note B G R A
48 gk_render_line_gl_utf8(texture, "Hello World",100,200);
49 
50 allegro_gl_flip();
51 }
52 
53 return 0;
54}
55END_OF_MAIN();

edit:
is it just that glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); can't work with no alpha channel ? that's source not dest, nevermind

Go to: