Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » al_create_display not working!

This thread is locked; no one can reply to it. rss feed Print
al_create_display not working!
TripleG
Member #16,431
July 2016

So all of a sudden i can't create a display anymore. The display flickers a bunch of times and returns null on the display variable every time.

Also i am using visual studio 2017
Have the allegro packages installed from NuGet

#SelectExpand
1#include "allegro5\allegro.h" 2#include "allegro5\allegro_image.h" 3#include "allegro5\allegro_native_dialog.h" 4#include "allegro5\allegro_font.h" 5#include "allegro5\allegro_ttf.h" 6#include "allegro5\allegro_audio.h" 7#include "allegro5\allegro_acodec.h" 8 9#include "State.h" 10 11//******************************************* 12// PROJECT FUNCTIONS 13//******************************************* 14 15void InitAllegro(); // Used to inialize everything for Allegro 16 17int main() 18{ 19 ALLEGRO_DISPLAY *display = NULL; 20 21 if (!al_init()) 22 { 23 exit(1); 24 } 25 26 display = al_create_display(1280, 720); 27 if (display == NULL) 28 { 29 al_show_native_message_box(NULL, "Error!", "Allegro has failed to initialize.", 0, 0, ALLEGRO_MESSAGEBOX_ERROR); 30 exit(1); 31 } 32}

SiegeLord
Member #7,827
October 2006
avatar

Try linking the debug version of Allegro (in the project options), running it and then seeing if the allegro.log file contains anything useful. The log file will be generated somewhere in your project directory.

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

NiteHackr
Member #2,229
April 2002

It sounds to me like your display is not able to use the resolution you selected. Try a different resolution, does it do the same thing? 800x600? 640x480? Perhaps a higher resolution, one that matches your display?

Also, try different display modes to see which one works...

al_set_new_display_flags(ALLEGRO_WINDOWED);
// al_set_new_display_flags(ALLEGRO_FULLSCREEN_WINDOW);
// al_set_new_display_flags(ALLEGRO_FULLSCREEN);

display = al_create_display(1280, 720);  
if (display == NULL) {  
   al_show_native_message_box(NULL, "Error!", "Allegro has failed to initialize.", 0, 0, ALLEGRO_MESSAGEBOX_ERROR);  
   exit(1);  
}

...try those three modes out, see what works and with different resolutions.

TripleG
Member #16,431
July 2016

So i noticed that it was an installed program that is causing that function call to bug out.

The program is called Duet Display which allows duel screen using an ipad. When this program is installed that function call no longer works

I would like to report this somehow but don't know how to go about it

SiegeLord
Member #7,827
October 2006
avatar

In the project options, there'll be an Allegro tab where you can select the library type. Just select the debug version there.

TripleG said:

The program is called Duet Display which allows duel screen using an ipad. When this program is installed that function call no longer works

That's pretty interesting... could you still do the debug + log thing, maybe it'll be something useful. For Allegro bugs, you can report them here: https://github.com/liballeg/allegro5/issues

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Go to: