Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Display flickers on Windows 7 64-bit

This thread is locked; no one can reply to it. rss feed Print
Display flickers on Windows 7 64-bit
cgman24
Member #12,536
February 2011
avatar

Hello,

So I've made a game, and it runs fine on my computer (Vista 32-bit) and another computer (Windows 7 32-bit). However, on a third computer with Windows 7 64-bit the display "flickers," almost as if it is being created and destroyed many times per second (the contents of the display never appear; just the frame). After a few seconds, the program crashes, giving a windows error message dialog with this information:

Problem signature:
  Problem Event Name:	APPCRASH
  Application Name:	AirHockey.exe
  Application Version:	0.0.0.0
  Application Timestamp:	4d9a75bc
  Fault Module Name:	allegro-5.0.1-monolith-mt.dll
  Fault Module Version:	0.0.0.0
  Fault Module Timestamp:	4d7e355a
  Exception Code:	c0000005
  Exception Offset:	0008b1e6
  OS Version:	6.1.7600.2.0.0.256.48
  Locale ID:	1033
  Additional Information 1:	0a9e
  Additional Information 2:	0a9e372d3b4ad19135b953a78882e789
  Additional Information 3:	0a9e
  Additional Information 4:	0a9e372d3b4ad19135b953a78882e789

Since it mentions the .dll specifically, I tried installing Code::Blocks/MinGW on that machine, moving the project over, and compiling it from there. It compiles fine, but the same flicker problem happens. I tried linking to each library individually instead of monolith, but it still happens (IIRC the error still mentions monolith, oddly enough, but maybe my memory is mistaken).

Any thoughts?

Thank you for the help.

-cgman

kenmasters1976
Member #8,794
July 2007

Can you post some piece of code that have this problem?.

cgman24
Member #12,536
February 2011
avatar

#SelectExpand
1#include "allegro5/allegro.h" 2#include <stdio.h> 3 4ALLEGRO_DISPLAY *display = NULL; 5ALLEGRO_EVENT_QUEUE *event_queue = NULL; 6 7const int SCREEN_W = 640; 8const int SCREEN_H = 480; 9 10int main () { 11 12 if(!al_init()) { 13 fprintf(stderr, "failed to initialize allegro!\n"); 14 return -1; 15 } 16 display = al_create_display(SCREEN_W, SCREEN_H); 17 if(!display) { 18 fprintf(stderr, "failed to create display!\n"); 19 return -1; 20 } 21 event_queue = al_create_event_queue(); 22 if(!event_queue) { 23 fprintf(stderr, "failed to create event_queue!\n"); 24 al_destroy_display(display); 25 return -1; 26 } 27 28 al_clear_to_color(al_map_rgb(0,0,0)); 29 al_flip_display(); 30 al_register_event_source(event_queue, al_get_display_event_source(display)); 31 32 while (1) { 33 ALLEGRO_EVENT ev; 34 al_wait_for_event(event_queue, &ev); 35 if (ev.type == ALLEGRO_EVENT_DISPLAY_CLOSE) { 36 fprintf(stdout, "display closed\n"); 37 break; 38 } 39 } 40 al_destroy_display(display); 41 al_destroy_event_queue(event_queue); 42 return 0; 43}

Nothing is printed to the console, BTW.

-cgman

kenmasters1976
Member #8,794
July 2007

Even this simple code crashes on the Windows 7 64 bit machine?. Maybe someone with 64 bit Windows can check it, but... could it be something with the video drivers on the 64 bit machine?.

Oscar Giner
Member #2,207
April 2002
avatar

Do you have updated video drivers? I had problems with OpenGL games with some of the first W7 drivers from nvidia (the entire screen would flicker, as you describe).

cgman24
Member #12,536
February 2011
avatar

I updated the video drivers, and that fixed the flickering problem. However, it seems to have broken some other programs I need. I think there's something wrong with this graphics card and Windows 7. As such, I've installed Ubuntu. However, on both Windows and Ubuntu I now get an error like this:

Could not init sound!
Assertion failed: _al_kcm_driver, file d:\Libraries\build\allegro\src\allegro-5.
0.x\allegro-5.0.x\addons\audio\kcm_voice.c, line 81

Sound card drivers are up to date, and I can play sounds in other programs.

Maybe this computer just sucks. :\

jmasterx
Member #11,410
October 2009

For the sound don't forget:

al_install_audio();
al_init_acodec_addon();

and if you do not use your own allegro mixer:

al_reserve_samples(NUM_SAMPLES);

cgman24
Member #12,536
February 2011
avatar

This is what I have for sound:

#SelectExpand
1 2 if (!al_install_audio()) { 3 fprintf(stderr, "Could not init sound!\n"); 4 al_destroy_display(display); 5 al_destroy_timer(timer); 6 al_destroy_event_queue(event_queue); 7 } 8 al_init_acodec_addon(); 9 10 if (!al_reserve_samples(RESERVED_SAMPLES)) { 11 fprintf(stderr, "Could not set up voice and mixer.\n"); 12 al_destroy_display(display); 13 al_destroy_timer(timer); 14 al_destroy_event_queue(event_queue); 15 }

It works fine on other computers.

[Edit]

I've tried digging around the Allegro source to find why that assertion is failing, but I really have no idea what I'm doing. It would be nice if I could get the sound working. Is this a bug in Allegro? If not, what can I do to get the sound working (preferably in Ubuntu)? This seems to be the only program where audio does not work.

Thanks,

-cgman

Go to: