RRDTOOL & Retina (high DPI) screens - rrdtool

I would like to get a 2x version of a given chart (so I can have a retina #2x friendly version) the problem is that when I render the 2x version the way the data is displayed changes slightly. Has anybody had any luck producing retina friendly charts? any hints/pointers?
Thanks

Just call rrdtool graph with the --zoom=2 option.

Related

Is there a way to limit the max size of a chart in chartjs whilst still maintaining responsiveness?

I made a responsive doughnut in chartjs. On mobile devices the size fills out the screen nicely and is as I'd like it but when I switch to desktop it also fills out the entire screen and is too big for my liking. Is there a way to set the relative size to for example, half screen when viewing on desktop and then reverting to full-screen if being viewed on mobile?
I tried the different settings on the chartjs site but can't find anything helpful.

GLFW Window on MacBook 16" displaying content only in upper left of window

I have a weird problem with GLFW on my MacBook Screen. I am creating a 1400 by 900 pixel window on my nearly 4k screen (3456 x 2234), so it should be really tiny. Instead what happens is that the window is 4 times the size (double in length and height) and my rendered content is only being displayed in the upper left of the screen.
I know that apple does some sketchy mapping stuff because of their wird aspect ratio display, but I searched for quite a while and no one has had the same problem.
What's even weirder is that if I create that window on an external monitor and drag it onto to laptop display, it works just fine. It only messes up when created on the laptop display itself.
I am using GLFW 3.3 and Vulkan 1.2.198 on macOS Monterey 12.1
Any help is appreciated.
EDIT: After trying nearly everything possible in my code and getting the same bug when using the minimal example from the GLFW getting started example, I came to the conclusion that this isn't code related as pointed out in the comments.
This appears to be an issue with how Mac displays report their resolution. Note that this is not a silver bullet but, when faced with the same issue, this worked for me.
The short of it is that the values that you're using to calculate your viewport are incorrect due to how the Mac display scales. The solution that I've found is to ask GLFW what you should set.
To get these values, just use the following function call. I am not sure what the glViewport equivalent is in vulkan, but this should theoretically work, and worked for me in OpenGL for the same problem.
int initial_framebuffer_width, initial_framebuffer_height;
glfwGetFramebufferSize(g_glfw_window, &initial_framebuffer_width,
&initial_framebuffer_height);
// Set your viewport here with the width and height.
If this didn't work, a good debugging step is to draw the window, then attempt to resize just a tiny bit, then print out the width and height values that GLFW gives in the framebuffer callback. You should notice that they might be much larger than what you set them to, this is how you know it's the scaling issue, and the above code should give you what you're looking for.

OpenGL and Windows 10 per-monitor aware DPI scaling

What's the correct way to deal with DPI scaling in an OpenGL application when the application is DPI monitor aware. aka:
SetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
I'm finding different behaviour on different devices - probably driver related, but some machines need to setup the viewport like this:
glViewport(0, 0, prc->right, prc->bottom)
while others need something like this:
glViewport(0, 0, (int)(prc->right * 96 / dpi), (int)(prc->bottom * 96 / dpi));
(where prc is the client rect and dpi is the current DPI of the window).
I've put together a simple demo program that shows the problem. The problems happen after changing the system scaling, but before signing out/back in.
Problems include:
Rendering at the wrong scale (not sure which driver is wrong)
Vertical shifting by what looks like the difference in the title bar height before changing the scaling vs after changing the scaling. (on macbook pro/bootcamp)
I've tried tearing down and recreating the wgl context on WM_DPICHANGED but to no avail and not sure what else to try.
Update: I've updated the sample program repo to include screen shots of what I'm seeing and I've included the .exe for the test program.
See here: https://bitbucket.org/toptensoftware/minimalopengl/overview
Update 2 - found a GPU that works as expected Radeon RX460. Updated screen shots in repo to show what's expected.
Update 3 - I'm now fairly confident this is caused by issues with the NVidia and Intel drivers and have logged bugs with both. I guess WHQL compliance doesn't cover OpenGL drivers.
Still... it'd be nice to have proper documentation or example program from Microsoft on how OpenGL and the per-monitor DPI support is supposed to work.
Have the same problem on gtx 1050. I've noticed that this problem only appears with SetThreadDpiAwarenessContext function.
from msdn:
SetThreadDpiAwarenessContext function.
Set the DPI awareness for the current thread to the provided value.
It means that if driver creates one or more additional threads to render OpenGL, each thread will have different dpi awareness level.
So there are three solutions:
Use old SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE) function from Windows 8.1 and call EnableNonClientDpiScaling(hWnd) in WM_NCCREATE message;
Use new SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2) from Creators Update;
Set dpi awareness level in application manifest (will be applied to whole application).
Both functions set awareness level for whole process.

A strange frame rate with actions on retina iPad only

Using actions with cocos2d v2.0 it works perfect on all iPhones and regular iPad. but when testing the same code only on iPad retina simulator ,when the button is a x2 bigger, so all actions (scale,move etc) are seems like they missing some pixels in their movement( for example a moving sprite is go 1 -3 -5 instead of 1-2-3-4-5 , seems like low frame rate or jump pixels)
There is no memory issue, its just a simple page with simple action :
id action=[CCScaleTo actionWithDuration:0.5 scaleX:0.95 scaleY:1.1];
id action1=[CCScaleTo actionWithDuration:0.5 scaleX:1 scaleY:1 ];
id seqb=[CCSequence actions:action,action1, nil];
id forever=[CCRepeatForever actionWithAction:seqb];
[play runAction:forever];
Why is it happens only in the retina display? does actions are not have the resolution for iPad retina -so they jumping on pixels ?
Do i have to enable the retina somewhere ? (it does get the -ipadhd image as retina and resize it)
EDIT EDIT
I have read that :
Slows down the iPad retina simulator 6.0
and could see that maybe the mac processor is not handle that .
Well thats strange , i have the new macbook retina ,it has a strong processor, and i am sure more than an iPad, so how is that true that iPad can handle it but not the mac ?
ignore the simulator, test on an actual device.
Note that the ipad retina simulator is really slow which is likely causing this issue.

Cocos2d-Things appear bigger in simulator

I've recently noticed that things accommodate differently on the simulator and a real device when using Cocos2d.To make sure I did the following:
1. I created a blank Cocos2d project. In the init method I created 7 sprites from Icon-72.png(which is found in the resources folder of the Cocos2d template) and added them to the screen.In the simulator only 6.5 sprites could accommodate side-by-side whereas in the iPod touch all seven sprites could accommodate easily and almost half of the screen width remained unused.
2.Then I created a project from Single View Application template. I added the same Icon-72.png to the project. Then on the storyboard I added 6 image views and set their image property to Icon-72.png. This time I had exactly the same result with both simulator and the device.
I guess there should be some tweak as to how to fix this issue with Cocos2d because it's not Apple's fault. Do you know how to handle this?
The iPod Touch could have the retina display and the simulator wont have have it. If you need the same display as of the iPod Touch You can use the iPhone Simulator with the Retina Display and you would get the same screen. Another Option you can use is Copy and paste the Same file with -hd prefix ex:(Icon-72-hd.png) with 72x72 size and you can get the same result.
There is no problem with either the version of cocos2d or with the Apple for the issue you are facing.
I guess I do have poor explanation but you would understand my explanation.
The iPod Touch will be a retina display. Cocos2d doesn't automatically double the size of images.