Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » Allegro 5.0.3 Error In Tutorial Program

This thread is locked; no one can reply to it. rss feed Print
Allegro 5.0.3 Error In Tutorial Program
dougt719
Member #12,931
June 2011

Allegro 5.0.3 Fedora 13 x86_64 Tried tutorial 1 from this site:

#include <stdio.h>
#include <allegro5/allegro.h>

int main(int argc, char **argv)
{
ALLEGRO_DISPLAY *display = NULL;

if(!al_init()) {
fprintf(stderr, "failed to initialize allegro!\n");
return -1;
}

display = al_create_display(640, 480);
if(!display) {
fprintf(stderr, "failed to create display!\n");
return -1;
}

al_clear_to_color(al_map_rgb(0,0,0));

al_flip_display();

al_rest(10.0);

al_destroy_display(display);

return 0;
}

results:

[dtelford@localhost allegro-5.0.3]$ gcc tutorial1.c -o tutorial1 -lallegro
[dtelford@localhost allegro-5.0.3]$ ./tutorial1
failed to create drawable
X Error of failed request: BadDrawable (invalid Pixmap or Window parameter)
Major opcode of failed request: 55 (X_CreateGC)
Resource id in failed request: 0x4e00002
Serial number of failed request: 22
Current serial number in output stream: 24

comments?

Thomas Fjellstrom
Member #476
June 2000
avatar

Does OpenGL work on your system at all?

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

dougt719
Member #12,931
June 2011

I installed Mesa OpenGL and ran the program from

http://www.opengl.org/wiki/Tutorial:_OpenGL_3.0_Context_Creation_(GLX)

[dtelford@localhost allegro-5.0.3]$ g++ gl3.cpp -o gl3 -lGL -lX11
[dtelford@localhost allegro-5.0.3]$ ./gl3
Getting matching framebuffer configs
Found 2 matching FB configs.
Getting XVisualInfos
Matching fbconfig 0, visual ID 0x21: SAMPLE_BUFFERS = 0, SAMPLES = 0
Matching fbconfig 1, visual ID 0xf6: SAMPLE_BUFFERS = 0, SAMPLES = 0
Chosen visual ID = 0x21
Creating colormap
Creating window
Mapping window
glXCreateContextAttribsARB() not found ... using old-style GLX context
Direct GLX rendering context obtained
Making context current

The tutorial explains how to install allegro 5, but doesn't say anything about
OpenGL.

Regards,
Doug

Thomas Fjellstrom
Member #476
June 2000
avatar

dougt719 said:

The tutorial explains how to install allegro 5, but doesn't say anything about
OpenGL.

On any modern install, it should already be installed.

Can you run glxinfo | grep direct and see if it says "direct rendering: Yes" ?

That's fairly important. But I don't think it would cause the problems you saw... I'm not sure what would cause the X11 error above.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Elias
Member #358
May 2000

You can try copying allegro5.cfg and changing "config_selection" to "old" in there.

--
"Either help out or stop whining" - Evert

dougt719
Member #12,931
June 2011

[dtelford@localhost allegro-5.0.3]$ glxinfo | grep direct
direct rendering: Yes

changed allegro5.cfg
config_selection=old

program now does not produce any error messages:

[dtelford@localhost allegro-5.0.3]$ gcc tutorial1.c -o tutorial1
[dtelford@localhost allegro-5.0.3]$ ./tutorial1
[dtelford@localhost allegro-5.0.3]$

Thanks for your help
Doug

Go to: