|
This thread is locked; no one can reply to it. |
1
2
|
Allegro 5 on Mac with retina display |
topfortune2015
Member #15,944
April 2015
|
I have been playing around Allegro 5 o Mac OSX 10.10 with retina display. But I noticed Allegro does not support the retina display very well. I have a bmp image with 640x480 resolution. And I used al_create_display to create a 640x480 size display, and used al_draw_bitmap to draw the image to the display. When running the program, I noticed the image looks jagged obviously. Here is my code. ALLEGRO_DISPLAY *display = NULL; al_init(); display = al_create_display(640,480); al_clear_to_color(al_map_rgb(0, 0, 0)); I also wrote the code as following. .. The result also looks jagged. Does anyone know how to deal with Allegro 5 on Mac with retina display?? |
SiegeLord
Member #7,827
October 2006
|
Can you paste a screenshot of what you mean? "For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
Thomas Fjellstrom
Member #476
June 2000
|
Is this display opening up fullscreen? Or in a window? If full screen, the monitor is doing the scaling, and monitors are often very bad at scaling (you generally want to use an LCD's native resolution and nothing else). If windowed, I'm not sure what would cause jaggyness in that case. -- |
topfortune2015
Member #15,944
April 2015
|
Please see the attachments. hello-allegro.bmp is the original image. allegro-320x240.tiff is the screenshot of the result of the following code. display = al_create_display(320,240); |
SiegeLord
Member #7,827
October 2006
|
So you're asking for a 320x240 display, but you're actually getting a 640x480 window. Are you super sure your code corresponds to the screenshot? I have some ideas where we might make the change to fix this... but I don't have access to a retina display to actually test these ideas out. Have you compiled Allegro yourself? If so, would you be willing to help out testing some of these changes? "For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
topfortune2015
Member #15,944
April 2015
|
To SiegeLord: Yeah, I asked 320x240 display, but Allegro returns 640x480 window on retina display. I compiled allegro 5.1.9 by myself. So I can help the changes. |
SiegeLord
Member #7,827
October 2006
|
Alright, thanks. I'll try my best to get something working tomorrow. "For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
Elias
Member #358
May 2000
|
It seems with SDL2 you need to do two things: Set their SDL_WINDOW_ALLOW_HIGHDPI flag when creating a window and set the NSHighResolutionCapable property in the application's Info.plist. Just from looking at [1]. Without looking at any code, I assume we'll want something similar for Allegro. Most likely there is no way around step 2 above (modifying the Info.plist). I don't see the point of the HIGHDPI option right now - but there may be a reason why they did it like that. References-- |
topfortune2015
Member #15,944
April 2015
|
@Elias Yeah, I tried SDL. It is good, but it does not meet my requirement. It lacks some features that I need. |
beoran
Member #12,636
March 2011
|
@opfortune2015 Since the open source licenses of Allegro 5 and SDL 2 are compatible, we can just "borrow" the code from SDL 2 and integrate it into Allegro 5. Three cheers for open source development. |
SiegeLord
Member #7,827
October 2006
|
I think the way SDL does it is wrong, so I'd rather borrow from GLFW, which I think does it better . Anyway, I've started making some steps to rectify the situation on this branch: https://github.com/SiegeLord/allegro5/tree/osx_retina . So far it (probably) should create displays with the right pixel size and no scaling. Mouse coordinates are likely still wrong, however, as well as window resizing. I've been trying to activate a high DPI mode in my virtual machine OSX 10.8, but so far I've not been successful. "For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
topfortune2015
Member #15,944
April 2015
|
Thank you @SiegeLord, I will try the branch on my machine as soon as possible. As I know you need to install Graphics Tools to activate the retina display on a non-retina display. Please look at this page. |
Chris Katko
Member #1,881
January 2002
|
I thought retina was supposed to give a twice resolution display on lower resolution programs? -----sig: |
topfortune2015
Member #15,944
April 2015
|
To @SiegeLord, I have tested the branch on my mac. al_create_display is ok. But I found al_resize_display is not ok. Once al_resize_display was called, the window changes to the double size. |
Thomas Fjellstrom
Member #476
June 2000
|
Chris Katko said: I thought retina was supposed to give a twice resolution display on lower resolution programs? Probably? I bet that also causes the horrible scaling artifacts the OP is talking about -- |
SiegeLord
Member #7,827
October 2006
|
So I managed to get the high DPI mode in the VM (960x540 ) which means the support for this is now only a matter of time. Unfortunately, I am observing that I'm still not getting the high resolution OpenGL backing... topfortune2015, did you still observe the low resolution display (despite it being the right size)? "For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
topfortune2015
Member #15,944
April 2015
|
@SiegeLord al_create_display(640,480) show me the correct size window. But once I called al_resize_display(display, 640, 480) after that, the window changes to double size. I think the implement of al_resize_display is not correct. |
SiegeLord
Member #7,827
October 2006
|
Yes, I know that's broken. I mean even without resizing, do you still notice the image being jagged? "For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
topfortune2015
Member #15,944
April 2015
|
No, I cannot find the noticeable jaggy now. |
SiegeLord
Member #7,827
October 2006
|
Turns out my VM doesn't properly render high resolution OpenGL displays... anyway, check out the latest commits on that branch. Resizing and mouse should work okay now. "For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
topfortune2015
Member #15,944
April 2015
|
Hi SiegeLord, I checked out the last commit, and had a test on my machine. I notice the resizing display is still not ok. Please check the attached screenshot, which is the result of my calling al_resize_display( display, 640, 480 ); |
SiegeLord
Member #7,827
October 2006
|
Whoops, sorry. Try it again, should be good now. "For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
topfortune2015
Member #15,944
April 2015
|
Yeah, al_resize_display is ok now! |
SiegeLord
Member #7,827
October 2006
|
I've now added some handling for when the DPI changes. If the display is resizable, then it'll keep the size in points, but send a resize event to the user (i.e. if you drag a window from a low-DPI to a high-DPI screen, your display will double in size in terms of number of pixels, but the actual appearance of the window will remain the same). If the display is not resizable, then it'll keep its size in pixels, but will appear to shrink or grow depending on which way you drag it. Comments on the above semantics are welcome. I kind of think both make sense sometimes, but 1st is a slightly better end-user experience. "For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
Elias
Member #358
May 2000
|
Sounds good to me... we basically behave as if we always have the high DPI flag from sdl2 on. -- |
|
1
2
|