microsoft / angle

ANGLE: OpenGL ES to DirectX translation
Other
615 stars 166 forks source link

How to use native (high dpi) resolution #68

Closed mlfarrell closed 8 years ago

mlfarrell commented 8 years ago

First off, great work. This is awesome guys!

I notice however that the OpenGL surface dimensions are pixel doubled with respect to my native surface book screen size. How do I modify the xaml template to use the native screen scale when creating my context? I'd like to use the hidpi native scale on devices that support it with a fallback to standard resolution on older machines/displays

teshca commented 8 years ago

I've resolved this with the following code:

    float scale = Windows::Graphics::Display::DisplayInformation::GetForCurrentView()->RawPixelsPerViewPixel();
    mRenderSurface = mOpenGLES->CreateSurface(swapChainPanel, nullptr, &scale);

But it looks more like a workaround for me, I think this scaling should be done on ANGLE part of the code by default.

austinkinross commented 8 years ago

Hi!

Yes, as tescha says, you can create the XAML surface at the native screen resolution if you pass the appropriate scale value into OpenGLES::CreateSurface (which sets a value for EGLRenderResolutionScaleProperty which gets passed into eglCreateWindowSurface via a PropertySet^).

On some high-DPI devices it is best to create the surface at the full screen resolution, but on other devices this isn't always optimal. For example, some phones with high-resolution displays but weaker GPUs may struggle to run a game at their full native screen resolution.

austinkinross commented 8 years ago

I believe this issue has been resolved.

Please feel free to reactivate this issue if you have further questions on this topic!