The thing is an actual monitor has a certain size : aspect ratio. So you could have a widescreen monitor or something else other than 3 : 4 and still set a 3 : 4 fullscreen display eg 640 : 480 etc..

The code you show wouldn't actually give the size of the physical screen.

The reason I'm bothered about this is because I've written my game at 640 by 480 but on a screen which isn't in these proportions, the graphics will all get stretched.

This could be avoided by drawing black rectangles on the left and right of the screen and resizing the 640 480 bitmap to fit in the middle but I need to know what the proportions of the screen are to do this.

“Throughout history, poverty is the normal condition of man. Advances which permit this norm to be exceeded — here and there, now and then — are the work of an extremely small minority, frequently despised, often condemned, and almost always opposed by all right-thinking people. Whenever this tiny minority is kept from creating, or (as sometimes happens) is driven out of a society, the people then slip back into abject poverty. This is known as "bad luck.”

This could be avoided by drawing black rectangles on the left and right of the screen and resizing the 640 480 bitmap to fit in the middle but I need to know what the proportions of the screen are to do this.

In each line, "width" and "height" refer to the resolution of that particular screen mode, not how many pixels your monitor is capable of.

“Throughout history, poverty is the normal condition of man. Advances which permit this norm to be exceeded — here and there, now and then — are the work of an extremely small minority, frequently despised, often condemned, and almost always opposed by all right-thinking people. Whenever this tiny minority is kept from creating, or (as sometimes happens) is driven out of a society, the people then slip back into abject poverty. This is known as "bad luck.”

I'd suppose that everybody runs their desktop at the native resolution, so I'd guess passing ALLEGRO_FULLSCREEN_WINDOW to a screen mode set, then using al_get_display_height() and al_get_display_width(), then setting the actual open gl mode you want would work.

“Throughout history, poverty is the normal condition of man. Advances which permit this norm to be exceeded — here and there, now and then — are the work of an extremely small minority, frequently despised, often condemned, and almost always opposed by all right-thinking people. Whenever this tiny minority is kept from creating, or (as sometimes happens) is driven out of a society, the people then slip back into abject poverty. This is known as "bad luck.”

Yea I imagine it is possible. You can get the vendor id and device id from the OS and then compare that to a database to know which one it is. However making this cross platform might require some work.

That's certainly not in the scope of something Allegro would do... and I suspect there are probably ways to find an lcds native resolution without a giant database. Seems probably, but I don't know. I think a database is extreme overkill in any case, and you'd never get every monitor into it so it wouldn't be any better than the guesses you can make already, IMO.

I isolated the code down to a simple program and now all the values are 21 which makes sense. Not sure why I'm getting that value in my game code. I'll keep fiddling and see if I can reproduce it without posting my entire project.

hmm this sort of reminded me that with OpenGL you can't actually set or get a specific pixel format, which means the "format" field is meaningless. If that's the case then it should just be removed. When I run that program I get "0" for each of them. Could just be uninitialized memory, which happens to be some strange value for you but 0 is pretty likely...

I'd suppose that everybody runs their desktop at the native resolution, so I'd guess passing ALLEGRO_FULLSCREEN_WINDOW to a screen mode set, then using al_get_display_height() and al_get_display_width(), then setting the actual open gl mode you want would work.

I'd suggest that solution as well. The desktop usually will be set to the native size so there's little reason not to use it. Best is probably to make it a user option though so someone with a very low-end system could configure the game to use a lower resolution.