Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » AllegroGL (or OpenGL?) set_gfx_mode crash. Hardware problem?

Credits go to GullRaDriel and Richard Phipps for helping out!
This thread is locked; no one can reply to it. rss feed Print
AllegroGL (or OpenGL?) set_gfx_mode crash. Hardware problem?
anto80
Member #3,230
February 2003
avatar

Hello all.

- I have a problem running a piece of code (Allegro+AllegroGL) on a computer although it run perfectly on another one.
- I use MSVC6 with these 2 machines.
- Allegro and AllegroGL have been compiled successfully (for MSVC6) on these 2 machines, (and I used to same method to do it).

I use the "DEBUGMODE=1" version of allegro and AGL on these 2 machines. So i can use the debugger to see where exactly it crashs, and it crashs on set_gfx_mode() call.

The allegro.log shows 42 pixel formats : all failed. Finally the message is:
* ERROR * select_pixel_format(): Didn't find any available pixel formats!

I am using 32 bpp color depth, and windowed mode on the 2 machines.
- The machine that run perfectly got an ATI Radeon graphic card (Win XP SP2).
- The machine that crashs perfectly got a graphic card integrated on the motherboard, named "Intel(R) 82845G/GL Chip" with 64MB (on Win XP SP1). Please note that i have no problem running Unreal Tournament on this one (in 800*600).

What can i do? (instead of buying another graphic card...)

The code is below. (I am not showing you the part of the code AFTER the crash. I know that some things need to be freed or cleaned before exiting...).

#SelectExpand
1int main(void) 2{ 3 int nColDepth; 4 5 nColDepth = 32; 6 7 /*--- Alleg Init ------------------------------------------------------*/ 8 allegro_init(); 9 install_allegro_gl(); 10 11 install_timer(); 12 install_keyboard(); 13 install_joystick(JOY_TYPE_AUTODETECT); 14 install_mouse(); 15 set_color_depth(nColDepth); 16 set_trans_blender(255, 255, 255, 128); 17 text_mode(-1); 18 19 // Install my timers /////////////////////////////////////////////////// 20 LOCK_VARIABLE(fps); 21 LOCK_VARIABLE(frame_count); 22 LOCK_VARIABLE(actual_tic); 23 LOCK_FUNCTION(fps_proc); 24 LOCK_FUNCTION(wait_proc); 25 install_int(fps_proc, 1000); 26 install_int(wait_proc, 4); // install_int_ex(wait_proc, BPS_TO_TIMER(120)); 27 28 /*--- Alleg GL inits --------------------------------------------------*/ 29 allegro_gl_clear_settings(); 30 allegro_gl_set(AGL_COLOR_DEPTH, nColDepth); 31 allegro_gl_set(AGL_Z_DEPTH, 8); // for 3D polygon sorting 32 allegro_gl_set(AGL_WINDOWED, true); 33 allegro_gl_set(AGL_DOUBLEBUFFER, 1); 34 allegro_gl_set(AGL_RENDERMETHOD, 1); 35 allegro_gl_set(AGL_SUGGEST, AGL_Z_DEPTH | AGL_COLOR_DEPTH); 36 allegro_gl_set(AGL_REQUIRE, AGL_DOUBLEBUFFER); 37 38 if (set_gfx_mode(GFX_OPENGL, 640, 480, 0, 0)) // <<<< CRASH HERE 39 { 40 #if _DEBUG 41 allegro_message("Error initializing\n"); 42 #endif 43 exit(1); 44 } 45 46 // ... 47 48 return 0; 49} 50END_OF_MAIN()

Here is my debug allegro.log.

#SelectExpand
1al-main INFO: Allegro initialised (instance 1) 2al-gfx INFO: Called set_gfx_mode(1330072663, 640, 480, 0, 0). 3al-gfx INFO: Firt call, remembering console state. 4* Note * win_init(): Requested color depth: 32 Desktop color depth: 32 5* Note * win_init(): Setting up window. 6* Note * win_init(): Driver selected fullscreen: No 7* Note * win_init(): Setting pixel format. 8* Note * select_pixel_format(): Trying to set up temporary RC 9* Note * select_pixel_format(): ChoosePixelFormat() 10* Note * select_pixel_format(): SetPixelFormat() 11* Note * select_pixel_format(): CreateContext() 12* Note * select_pixel_format(): MakeCurrent() 13* Note * select_pixel_format(): GetExtensionsStringARB() 14* Note * select_pixel_format(): GetProcAddress() 15* Note * get_num_pixel_formats(): Attempting to use WGL_pf. 16* Note * get_num_pixel_formats(): WGL_ARB/EXT_pixel_format use failed! 17 Données non valides. 18 19 (0xc007000d) 20* Note * get_num_pixel_formats(): Using DescribePixelFormat. 21* Warning * select_pixel_format(): WGL_ARB_pf call failed - reverted to plain old WGL. 22* Note * select_pixel_format(): 42 formats. 23* Note * select_pixel_format(): Testing pixel formats: 24Format 1: 25 * Warning * describe_pixel_format_old(): DescribePixelFormat() failed! 26 Descripteur non valide 27 28 (0x00000006) 29** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat. 30 31Format 2: 32 * Warning * describe_pixel_format_old(): DescribePixelFormat() failed! 33 Descripteur non valide 34 35 (0x00000006) 36** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat. 37 38Format 3: 39 * Warning * describe_pixel_format_old(): DescribePixelFormat() failed! 40 Descripteur non valide 41 42 (0x00000006) 43** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat. 44 45Format 4: 46 * Warning * describe_pixel_format_old(): DescribePixelFormat() failed! 47 Descripteur non valide 48 49 (0x00000006) 50** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat. 51 52Format 5: 53 * Warning * describe_pixel_format_old(): DescribePixelFormat() failed! 54 Descripteur non valide 55 56 (0x00000006) 57** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat. 58 59Format 6: 60 * Warning * describe_pixel_format_old(): DescribePixelFormat() failed! 61 Descripteur non valide 62 63 (0x00000006) 64** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat. 65 66Format 7: 67 * Warning * describe_pixel_format_old(): DescribePixelFormat() failed! 68 Descripteur non valide 69 70 (0x00000006) 71** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat. 72 73Format 8: 74 * Warning * describe_pixel_format_old(): DescribePixelFormat() failed! 75 Descripteur non valide 76 77 (0x00000006) 78** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat. 79 80Format 9: 81 * Warning * describe_pixel_format_old(): DescribePixelFormat() failed! 82 Descripteur non valide 83 84 (0x00000006) 85** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat. 86 87Format 10: 88 * Warning * describe_pixel_format_old(): DescribePixelFormat() failed! 89 Descripteur non valide 90 91 (0x00000006) 92** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat. 93 94Format 11: 95 * Warning * describe_pixel_format_old(): DescribePixelFormat() failed! 96 Descripteur non valide 97 98 (0x00000006) 99** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat. 100 101Format 12: 102 * Warning * describe_pixel_format_old(): DescribePixelFormat() failed! 103 Descripteur non valide 104 105 (0x00000006) 106** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat. 107 108Format 13: 109 * Warning * describe_pixel_format_old(): DescribePixelFormat() failed! 110 Descripteur non valide 111 112 (0x00000006) 113** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat. 114 115Format 14: 116 * Warning * describe_pixel_format_old(): DescribePixelFormat() failed! 117 Descripteur non valide 118 119 (0x00000006) 120** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat. 121 122Format 15: 123 * Warning * describe_pixel_format_old(): DescribePixelFormat() failed! 124 Descripteur non valide 125 126 (0x00000006) 127** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat. 128 129Format 16: 130 * Warning * describe_pixel_format_old(): DescribePixelFormat() failed! 131 Descripteur non valide 132 133 (0x00000006) 134** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat. 135 136Format 17: 137 * Warning * describe_pixel_format_old(): DescribePixelFormat() failed! 138 Descripteur non valide 139 140 (0x00000006) 141** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat. 142 143Format 18: 144 * Warning * describe_pixel_format_old(): DescribePixelFormat() failed! 145 Descripteur non valide 146 147 (0x00000006) 148** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat. 149 150Format 19: 151 * Warning * describe_pixel_format_old(): DescribePixelFormat() failed! 152 Descripteur non valide 153 154 (0x00000006) 155** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat. 156 157Format 20: 158 * Warning * describe_pixel_format_old(): DescribePixelFormat() failed! 159 Descripteur non valide 160 161 (0x00000006) 162** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat. 163 164Format 21: 165 * Warning * describe_pixel_format_old(): DescribePixelFormat() failed! 166 Descripteur non valide 167 168 (0x00000006) 169** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat. 170 171Format 22: 172 * Warning * describe_pixel_format_old(): DescribePixelFormat() failed! 173 Descripteur non valide 174 175 (0x00000006) 176** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat. 177 178Format 23: 179 * Warning * describe_pixel_format_old(): DescribePixelFormat() failed! 180 Descripteur non valide 181 182 (0x00000006) 183** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat. 184 185Format 24: 186 * Warning * describe_pixel_format_old(): DescribePixelFormat() failed! 187 Descripteur non valide 188 189 (0x00000006) 190** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat. 191 192Format 25: 193 * Warning * describe_pixel_format_old(): DescribePixelFormat() failed! 194 Descripteur non valide 195 196 (0x00000006) 197** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat. 198 199Format 26: 200 * Warning * describe_pixel_format_old(): DescribePixelFormat() failed! 201 Descripteur non valide 202 203 (0x00000006) 204** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat. 205 206Format 27: 207 * Warning * describe_pixel_format_old(): DescribePixelFormat() failed! 208 Descripteur non valide 209 210 (0x00000006) 211** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat. 212 213Format 28: 214 * Warning * describe_pixel_format_old(): DescribePixelFormat() failed! 215 Descripteur non valide 216 217 (0x00000006) 218** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat. 219 220Format 29: 221 * Warning * describe_pixel_format_old(): DescribePixelFormat() failed! 222 Descripteur non valide 223 224 (0x00000006) 225** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat. 226 227Format 30: 228 * Warning * describe_pixel_format_old(): DescribePixelFormat() failed! 229 Descripteur non valide 230 231 (0x00000006) 232** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat. 233 234Format 31: 235 * Warning * describe_pixel_format_old(): DescribePixelFormat() failed! 236 Descripteur non valide 237 238 (0x00000006) 239** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat. 240 241Format 32: 242 * Warning * describe_pixel_format_old(): DescribePixelFormat() failed! 243 Descripteur non valide 244 245 (0x00000006) 246** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat. 247 248Format 33: 249 * Warning * describe_pixel_format_old(): DescribePixelFormat() failed! 250 Descripteur non valide 251 252 (0x00000006) 253** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat. 254 255Format 34: 256 * Warning * describe_pixel_format_old(): DescribePixelFormat() failed! 257 Descripteur non valide 258 259 (0x00000006) 260** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat. 261 262Format 35: 263 * Warning * describe_pixel_format_old(): DescribePixelFormat() failed! 264 Descripteur non valide 265 266 (0x00000006) 267** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat. 268 269Format 36: 270 * Warning * describe_pixel_format_old(): DescribePixelFormat() failed! 271 Descripteur non valide 272 273 (0x00000006) 274** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat. 275 276Format 37: 277 * Warning * describe_pixel_format_old(): DescribePixelFormat() failed! 278 Descripteur non valide 279 280 (0x00000006) 281** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat. 282 283Format 38: 284 * Warning * describe_pixel_format_old(): DescribePixelFormat() failed! 285 Descripteur non valide 286 287 (0x00000006) 288** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat. 289 290Format 39: 291 * Warning * describe_pixel_format_old(): DescribePixelFormat() failed! 292 Descripteur non valide 293 294 (0x00000006) 295** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat. 296 297Format 40: 298 * Warning * describe_pixel_format_old(): DescribePixelFormat() failed! 299 Descripteur non valide 300 301 (0x00000006) 302** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat. 303 304Format 41: 305 * Warning * describe_pixel_format_old(): DescribePixelFormat() failed! 306 Descripteur non valide 307 308 (0x00000006) 309** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat. 310 311Format 42: 312 * Warning * describe_pixel_format_old(): DescribePixelFormat() failed! 313 Descripteur non valide 314 315 (0x00000006) 316** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat. 317 318* ERROR * select_pixel_format(): Didn't find any available pixel formats!

___________
Currently working on his action/puzzle game CIPHER PUSHER : Blocks/Vortexes/Seafood! Facebook - Twitter - webpage

Richard Phipps
Member #1,632
November 2001
avatar

Have you tried using 24 as a colour depth instead of 32, to see if you have this mode?

anto80
Member #3,230
February 2003
avatar

I tried

nColDepth = 24;
and
nColDepth = 16;

It crashes the same way with the same message in allegro.log.

___________
Currently working on his action/puzzle game CIPHER PUSHER : Blocks/Vortexes/Seafood! Facebook - Twitter - webpage

Richard Phipps
Member #1,632
November 2001
avatar

Can you run any openlayer programs in fullscreen? If you can then it is possible..

anto80
Member #3,230
February 2003
avatar

No the demo.exe from OpenLayer2.0 crashs as well.
here is the openlayer.log

OpenLayer started up succesfully
ERROR: Couldn't up the screen! (Width: 800, Height: 600, Windowed, Color depth: 32, Z Depth: 8)
Selecting a buffer
Releasing Canvas

Auto Loader: Executing 0 pending loading commands
Auto Loader: Completed

Screen set up succesfully

Loading bitmap: Gfx/Background.png
No OpenGL extensions were found.
Collecting garbage

Garbage Collector: Destroying 1 items

___________
Currently working on his action/puzzle game CIPHER PUSHER : Blocks/Vortexes/Seafood! Facebook - Twitter - webpage

Richard Phipps
Member #1,632
November 2001
avatar

Have you got the latest OpenGL drivers? Sounds like it's either your gfx card not supporting this or your drivers.

Just to check: Your OS is not running in a 16 bit screenmode is it?

GullRaDriel
Member #3,861
September 2003
avatar

Add this in your code please and show us the output:

printf("Graphics Driver: OpenGL %s (%s)\n"
       "  %s detected\n"
       "  Set %dx%d %dbpp %s mode\n",
       glGetString(GL_VERSION), glGetString(GL_VENDOR),
       glGetString(GL_RENDERER),
       SCREEN_W, SCREEN_H, bitmap_color_depth(screen),
       (gfx_driver->windowed ? "windowed" : "fullscreen"));

NB: This code was provided by Kitty Cat in an old similar thread I made. The problem was the driver.

_

"Code is like shit - it only smells if it is not yours"
Allegro Wiki, full of examples and articles !!

anto80
Member #3,230
February 2003
avatar

Quote:

Have you got the latest OpenGL drivers? Sounds like it's either your gfx card not supporting this or your drivers.

I don't know. There's a "OpenGL" tab the advanced properties of my card display settings.
here are the options (i hope the translation from French is correct)

async toggle     : NO      (can choose Y/N)
Triple buffering : Default (can choose "Yes", "No", or "Default")
toggle strategy  : Toggle  (can choose "blit")
Buffer depth bits: Default (can choose 16 or 24)
Force texture S3TC Compression: NO (can choose Y/N)
Force texture FXT1 Compression: NO (can choose Y/N)
Driver memory space: Normal (can choose Low,Normal,High)
Texture palette  : Desktop palette (can choose 16bits per texel, 32bpt)
anisotrope filtering : Application control (can choose "App control", "Yes", "No")

Quote:

Just to check: Your OS is not running in a 16 bit screenmode is it?

My desktop is 32 bpp.

Quote:

NB: This code was provided by Kitty Cat in an old similar thread I made. The problem was the driver.

You mean i have to update my graphic gard driver?? But i didn't had problem before with any OpenGL-based games like Unreal! ??? I'm confured...

___________
Currently working on his action/puzzle game CIPHER PUSHER : Blocks/Vortexes/Seafood! Facebook - Twitter - webpage

GullRaDriel
Member #3,861
September 2003
avatar

Perhaps It is using the Microsoft Driver which is not very famous.
Can you give us the output of the printf(...) I gave you before ?

"Code is like shit - it only smells if it is not yours"
Allegro Wiki, full of examples and articles !!

anto80
Member #3,230
February 2003
avatar

Quote:

Can you give us the output of the printf(...) I gave you before ?

I can't.
Even it i do this, it crashs on the glGetString line.

char  szBuf[256];
allegro_init();
install_allegro_gl();
strcpy(szBuf, (char*)glGetString(GL_VERSION));

Crash message:

---------------------------
Microsoft Visual C++
---------------------------
Unhandled exception in testalleg.exe (MSVCRTD.DLL): 0xC0000005: Access Violation.
---------------------------
OK   
---------------------------

___________
Currently working on his action/puzzle game CIPHER PUSHER : Blocks/Vortexes/Seafood! Facebook - Twitter - webpage

GullRaDriel
Member #3,861
September 2003
avatar

You do not have OpenGl properly installed on your system.

"Code is like shit - it only smells if it is not yours"
Allegro Wiki, full of examples and articles !!

anto80
Member #3,230
February 2003
avatar

What can i do?
Do i need to install something "global to OpenGL" ? or will i have to install something specific for my graphic card?

___________
Currently working on his action/puzzle game CIPHER PUSHER : Blocks/Vortexes/Seafood! Facebook - Twitter - webpage

Richard Phipps
Member #1,632
November 2001
avatar

Get the latest OpenGL drivers from your gfx card manufactorer.

Kitty Cat
Member #2,815
October 2002
avatar

What if you set AGL_RENDERMETHOD to be required? I don't think you can use the glGetString functions without being in an OpenGL mode.

--
"Do not meddle in the affairs of cats, for they are subtle and will pee on your computer." -- Bruce Graham

anto80
Member #3,230
February 2003
avatar

Ok guys you were right!! After having updated my graphic driver the OpenLayer2.0 demo runs perfectly and my program too. :)
Thank you very much for your help.

Anyway GullRaDriel's printf still crashs.
[edit] Kitty is right: afted having moved the glGetString(xxx) calls AFTER the OpenGL set_gfx_mode, the printf displays a correct string.
Thanks!

___________
Currently working on his action/puzzle game CIPHER PUSHER : Blocks/Vortexes/Seafood! Facebook - Twitter - webpage

Milan Mimica
Member #3,877
September 2003
avatar

It shouldn't crash anyway. Which version of AGL are you using?

Go to: