AllegroGL Minimize Window
Phineas

I am using Windows XP. Whenever I run my AllegroGL program in a window, minimize the window, and then restore it, the program no longer draws to the screen. Using the Visual Studio debugger, I know the drawing code is still being run in the loop.

Attached are before and after pictures to show what's happening. Thanks for your help.

1#include "allegro.h"
2#include "alleggl.h"
3 
4void main()
5{
6 allegro_init();
7 install_allegro_gl();
8 
9 allegro_gl_clear_settings();
10 allegro_gl_set(AGL_COLOR_DEPTH, 32);
11 allegro_gl_set(AGL_WINDOWED, 1);
12 allegro_gl_set(AGL_DOUBLEBUFFER, 1);
13 allegro_gl_set(AGL_RENDERMETHOD, 1);
14 
15 if (set_gfx_mode(GFX_OPENGL, 800, 600, 0, 0) < 0)
16 {
17 allegro_message("Error setting OpenGL graphics mode:\n%s\n"
18 "Allegro GL error : %s\n",
19 allegro_error, allegro_gl_error);
20 }
21 
22 install_timer();
23 install_keyboard();
24 install_mouse();
25 
26 show_mouse(screen);
27 
28 glClearColor(0.2, 0.2, 0.2, 1.0);
29 glEnable(GL_BLEND);
30 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
31 
32 glMatrixMode(GL_PROJECTION);
33 glLoadIdentity();
34 gluOrtho2D(-2.0, 2.0, -2.0, 2.0);
35 glMatrixMode(GL_MODELVIEW);
36 
37 glViewport(0, 0, 800, 600);
38 
39 float alpha = 0;
40 
41 while (!key[KEY_ESC])
42 {
43 alpha += 0.001;
44 if (alpha > 1)
45 {
46 alpha = 0;
47 }
48 
49 glClear(GL_COLOR_BUFFER_BIT);
50 glLoadIdentity();
51 
52 glScalef(0.5, 0.5, 0.5);
53 
54 glBegin(GL_QUADS);
55 glColor4f(0.3, 0.7, 0.5, 1.0);
56 glVertex2f(-1, -1);
57 glVertex2f(1, -1);
58 glVertex2f(1, 1);
59 glVertex2f(-1, 1);
60 glEnd();
61 
62 glTranslatef(-0.5, -0.5, 0);
63 
64 glBegin(GL_QUADS);
65 glColor4f(0.8, 0.4, 0.5, alpha);
66 glVertex2f(-1, -1);
67 glVertex2f(1, -1);
68 glVertex2f(1, 1);
69 glVertex2f(-1, 1);
70 glEnd();
71 
72 allegro_gl_set_allegro_mode();
73 algl_draw_mouse();
74 allegro_gl_unset_allegro_mode();
75 
76 allegro_gl_flip();
77 }
78 
79}
80END_OF_MAIN();

Arthur Kalliokoski
Phineas

Thanks for your reply. I tried every possible setting for set_display_switch_mode but to no avail. I also tried setting a display switch callback using set_display_switch_callback. Here's the code I tried inside it, separately:

  allegro_gl_clear_settings();
  allegro_gl_set(AGL_COLOR_DEPTH, 32);
  allegro_gl_set(AGL_WINDOWED, 1);
  allegro_gl_set(AGL_DOUBLEBUFFER, 1);
  allegro_gl_set(AGL_RENDERMETHOD, 1);

  if (set_gfx_mode(GFX_OPENGL, 800, 600, 0, 0) < 0)
  {
    allegro_message("Error setting OpenGL graphics mode:\n%s\n"
                    "Allegro GL error : %s\n",
                     allegro_error, allegro_gl_error);
  }

  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  gluOrtho2D(-2.0, 2.0, -2.0, 2.0);
  glMatrixMode(GL_MODELVIEW);

  glViewport(0, 0, 800, 600);

It still doesn't work. This problem with minimizing and restoring the program also happens on my computer with the examples that come with AllegroGL.

Bob

I can't reproduce this.

What version of AllegroGL are you using? What version of Allegro are you using? What compiler? What graphics card/driver do you have?

I tested this on both TOT and AGL 0.4.0-RC4 with Allegro 4.2.0 and MSVC7.1 and don't see anything wrong.

Epsi

I have exactly the same problem on my desktop PC.

- Using OpenLayer latest SVN (don't know what AGL version).
- Windows XP SP2
- ATI Radeon 9800 XT with Omega drivers.

The same code works however correctly on my laptop with a GeForce and the same OL version.

Phineas

I'm using Allegro 4.2.0 (compiled myself) and AllegroGL 0.2.4 (binaries taken from Retrospec). I also tried AllegroGL 0.4.0 (compiled myself), but the problem still exists.

I'm using MSVC 7.1 and I have an ATI Radeon 9550.

Bob

AllegroGL 0.2.4 does not work correctly with Allegro 4.x where x > 0. You really need to be using AllegroGL 0.4.0 or later.

If you use AllegroGL 0.4.0, does the problem still exist for the example programs? Have you tried updating your video drivers?

Phineas

Alright, I'm using only 0.4.0 RC4 now, and I upgraded to the latest ATI driver. The problem still exists for my program and for the examples.

I also tried using the debug version of AllegroGL. Here's the head and tail of the debug output:

1'Application.exe': Loaded 'C:\home\school\cs 480\Sketch\Application\Debug\Application.exe', Symbols loaded.
2'Application.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', No symbols loaded.
3'Application.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', No symbols loaded.
4'Application.exe': Loaded 'C:\WINDOWS\system32\alld42.dll', Symbols loaded.
5'Application.exe': Loaded 'C:\WINDOWS\system32\user32.dll', No symbols loaded.
6'Application.exe': Loaded 'C:\WINDOWS\system32\gdi32.dll', No symbols loaded.
7'Application.exe': Loaded 'C:\WINDOWS\system32\ole32.dll', No symbols loaded.
8'Application.exe': Loaded 'C:\WINDOWS\system32\advapi32.dll', No symbols loaded.
9'Application.exe': Loaded 'C:\WINDOWS\system32\rpcrt4.dll', No symbols loaded.
10'Application.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll', No symbols loaded.
11'Application.exe': Loaded 'C:\WINDOWS\system32\dinput.dll', No symbols loaded.
12'Application.exe': Loaded 'C:\WINDOWS\system32\winmm.dll', No symbols loaded.
13'Application.exe': Loaded 'C:\WINDOWS\system32\ddraw.dll', No symbols loaded.
14'Application.exe': Loaded 'C:\WINDOWS\system32\dciman32.dll', No symbols loaded.
15'Application.exe': Loaded 'C:\WINDOWS\system32\dsound.dll', No symbols loaded.
16'Application.exe': Loaded 'C:\WINDOWS\system32\version.dll', No symbols loaded.
17'Application.exe': Loaded 'C:\WINDOWS\system32\msvcr71d.dll', Symbols loaded.
18'Application.exe': Loaded 'C:\WINDOWS\system32\opengl32.dll', No symbols loaded.
19'Application.exe': Loaded 'C:\WINDOWS\system32\glu32.dll', No symbols loaded.
20'Application.exe': Loaded 'C:\WINDOWS\system32\msvcr71.dll', Symbols loaded.
21'Application.exe': Loaded 'C:\WINDOWS\system32\uxtheme.dll', No symbols loaded.
22al-main INFO: Allegro initialised (instance 1)
23al-gfx INFO: Called set_gfx_mode(1330072644, 800, 600, 0, 0).
24al-gfx INFO: Firt call, remembering console state.
25* Note * default_gfx_init: Trying to set up windowed mode...
26* Note * win_init(): Requested color depth: 32 Desktop color depth: 32
27* Note * win_init(): Setting up window.
28* Note * win_init(): Driver selected fullscreen: No
29* Note * win_init(): Setting pixel format.
30* Note * select_pixel_format(): Trying to set up temporary RC
31* Note * select_pixel_format(): ChoosePixelFormat()
32'Application.exe': Loaded 'C:\WINDOWS\system32\atioglxx.dll', No symbols loaded.
33'Application.exe': Loaded 'C:\WINDOWS\system32\mcd32.dll', No symbols loaded.
34'Application.exe': Unloaded 'C:\WINDOWS\system32\mcd32.dll'
35* Note * select_pixel_format(): SetPixelFormat()
36* Note * select_pixel_format(): CreateContext()
37* Note * select_pixel_format(): MakeCurrent()
38* Note * select_pixel_format(): GetExtensionsStringARB()
39* Note * select_pixel_format(): GetProcAddress()
40* Note * get_num_pixel_formats(): Attempting to use WGL_pf.
41* Note * select_pixel_format(): 82 formats.
42* Note * select_pixel_format(): Testing pixel formats:
43Format 1:
44 ** ERROR ** describe_pixel_format_new(): wglGetPixelFormatAttrib failed!
45 The operation completed successfully.
46 (0x00000000)
47** Warning ** select_pixel_format(): Wasn't able to use WGL_PixelFormat - reverting to old WGL code.
48 Decoding:
49 Acceleration: Yes RGBA: 8.8.8.8 Accum: 0.0.0.0
50 DblBuf: 0 Zbuf: 24 Stereo: 0 Aux: 0 Stencil: 8 Shift: 16.8.0.24
51 Sample Buffers: 0 Samples: 0
52 Decoded bpp: 32
53 Score is : 1792
54
55Format 2:
56 ** ERROR ** describe_pixel_format_new(): wglGetPixelFormatAttrib failed!
57 The operation completed successfully.
58 (0x00000000)
59** Warning ** select_pixel_format(): Wasn't able to use WGL_PixelFormat - reverting to old WGL code.
60 Decoding:
61 Acceleration: Yes RGBA: 8.8.8.8 Accum: 16.16.16.16
62 DblBuf: 0 Zbuf: 24 Stereo: 0 Aux: 3 Stencil: 8 Shift: 16.8.0.24
63 Sample Buffers: 0 Samples: 0
64 Decoded bpp: 32
65 Score is : 1792

1Format 80:
2 ** ERROR ** describe_pixel_format_new(): wglGetPixelFormatAttrib failed!
3 The parameter is incorrect.
4 (0x00000057)
5** Warning ** select_pixel_format(): Wasn't able to use WGL_PixelFormat - reverting to old WGL code.
6* Warning * describe_pixel_format_old(): DescribePixelFormat() failed!
7 The parameter is incorrect.
8 (0x00000057)
9** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat.
10
11Format 81:
12 ** ERROR ** describe_pixel_format_new(): wglGetPixelFormatAttrib failed!
13 The parameter is incorrect.
14 (0x00000057)
15** Warning ** select_pixel_format(): Wasn't able to use WGL_PixelFormat - reverting to old WGL code.
16* Warning * describe_pixel_format_old(): DescribePixelFormat() failed!
17 The parameter is incorrect.
18 (0x00000057)
19** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat.
20 
21Format 82:
22 ** ERROR ** describe_pixel_format_new(): wglGetPixelFormatAttrib failed!
23 The parameter is incorrect.
24 (0x00000057)
25** Warning ** select_pixel_format(): Wasn't able to use WGL_PixelFormat - reverting to old WGL code.
26* Warning * describe_pixel_format_old(): DescribePixelFormat() failed!
27 The parameter is incorrect.
28 (0x00000057)
29** Warning ** select_pixel_format(): Unable to rely onunextended WGL to descrive this pixelformat.
30
31* Note * select_pixel_format(): Best config is: 18
32** ERROR ** describe_pixel_format_new(): wglGetPixelFormatAttrib failed!
33 The operation completed successfully.
34 (0x00000000)
35
36* Note * win_init(): GLScreen: 800x600x32
37
38OpenGL Version: 2.0.6067 WinXP Release
39Vendor: ATI Technologies Inc.
40Renderer: RADEON 9550 x86/SSE2
41
42GLU Version : 1.2.2.0 Microsoft Corporation
43
44
45al-gfx INFO: The driver will wait for vsync.
46al-gfx INFO: set_gfx_card success for 800x600x32.
47'Application.exe': Loaded 'C:\WINDOWS\system32\hid.dll', No symbols loaded.
48'Application.exe': Loaded 'C:\WINDOWS\system32\setupapi.dll', No symbols loaded.
49'Application.exe': Loaded 'C:\WINDOWS\system32\wintrust.dll', No symbols loaded.
50'Application.exe': Loaded 'C:\WINDOWS\system32\crypt32.dll', No symbols loaded.
51'Application.exe': Loaded 'C:\WINDOWS\system32\msasn1.dll', No symbols loaded.
52'Application.exe': Loaded 'C:\WINDOWS\system32\imagehlp.dll', No symbols loaded.
53* Note * make_texture_ex: flags: AGL_TEXTURE_FLIP|AGL_TEXTURE_MASKED|AGL_TEXTURE_RESCALE|, bitmap 16x16, 32 bpp. internalformat: AUTO
54* Note * make_texture_ex: Preselected texture format: 0x1908, type: 0x1401
55* Note * munge_bitmap: Need to perform depth conversion from 32 to 32 bpp.
56* Note * munge_bitmap: Flipping bitmap.
57* Note * munge_bitmap: Copying bitmap.
58* Note * munge_bitmap: Inserting alpha channel.
59* Note * make_texture_ex: Picked internalformat: 0x8058
60* Note * make_texture_ex: dest format=8058, source format=0x1908, type=0x1401
61* Note * do_texture_upload: Making texture: bpp: 32
62* Note * do_texture_upload: Unpack row length: 16.
63* Note * do_texture_upload: Uploaded texture: level 0, internalformat: 0x8058, 16x16, format: 0x1908, type: 0x1401.
64* Note * do_texture_upload: GL Error code: 0x0
65The thread 'Win32 Thread' (0x92c) has exited with code 0 (0x0).
66The thread 'Win32 Thread' (0xd08) has exited with code 0 (0x0).
67al-gfx INFO: Called set_gfx_mode(-1, 0, 0, 0, 0).
68al-gfx INFO: Closing graphics driver (004604F8) AllegroGL Windowed (Win32).
69al-gfx INFO: Closing, restoring original console state.
70al-gfx INFO: Graphic mode closed.
71The thread 'Win32 Thread' (0xdc0) has exited with code 0 (0x0).
72The program '[3380] Application.exe: Native' has exited with code 269411456 (0x100ee480).

Bob

Can anyone else repro this?

Milan Mimica

No, but this errors and warnings in the log file are expected for RC4.
Phineas, you can also try AllegroGL SVN version.

Thread #587799. Printed from Allegro.cc