Comments (9)
Hi Xenice. Yes, by default the SwapChainPanel sample creates its EGL window surface at a lower resolution than the screen. Like Visual Studio's D3D11 templates, it uses the values from the SwapChainPanel's RenderSize or ActualSize properties.
There is no harm in having the SwapChainPanel at a lower resolution than the screen, unless you are noticing aliasing when the SwapChainPanel is scaled up to the screen's resolution. It may actually help your application's performance to have a lower resolution, since your app might achieve a better framerate.
You can manually configure the SwapChainPanel size if you really want to. Instructions for this can be found in the SwapChainPanel template (in 'OpenGLESPage::CreateRenderSurface()'), or in this blog post: http://msopentech.com/blog/2014/11/06/creating-corewindow-and-swapchainpanel-window-surfaces-in-angle/
from angle.
Thanks for you reply!
Yes I can manually configure the SwapChainPanel size. But is it optimal, to recreate OpenGLES window surface (eglDestroySurface, eglCreateWindowSurface) every time SwapChainPanel size changed?
from angle.
You're correct. Recreating the window surface is expensive.
Can you clarify exactly what you're trying to achieve here, and why? This will help us to find a solution for you.
Thanks,
Austin
from angle.
I want to set a native pixel resolution of the device screen (without scaling) just by specifying glViewport(0, 0, width, height). Because I need to dynamically resize opengl viewport if a user resizes window. But SwapChainPanel's (and thus opengl windows's) dimension is in density independent pixels. How can I create opengl window in native pixels instead of dpis?
from angle.
How are you getting the "native pixel resolution of the device screen"?
The templates use "Windows::UI::Xaml::SizeChangedEventArgs" to get the width/height in DIPS of the SwapChainPanel (in "OpenGLESPage::OnSwapChainPanelSizeChanged"). It then calls glViewport() using these values. Does this not suffice for you?
from angle.
I get it using the ConvertDipsToPixels() method from the template based on ICoreWindow.
// Helper to convert a length in device-independent pixels (DIPs) to a length in physical pixels.
inline float ConvertDipsToPixels(float dips)
{
DisplayInformation^ currentDisplayInformation = DisplayInformation::GetForCurrentView();
static const float dipsPerInch = 96.0f;
return floor(dips * currentDisplayInformation->LogicalDpi / dipsPerInch + 0.5f); // Round to nearest integer.
}
I want to have the glViewport() resolution in the ISwapChainPanel based project just like in the ICoreWindow based project.
from angle.
Hey Xenice,
Okay. We don't officially support creating the SwapChainPanel in any units other than Dips.
If you really want to create the SwapChainPanel at the native resolution, then you should modify the internals of ANGLE to also call your ConvertDipsToPixels() function in the right places. I believe you'll need to do this in:
- src/common/winrt/SwapChainPanelNativeWindow.h
- call ConvertDipsToPixels() on the output of "sizeChangedEventArgs->get_NewSize(&newSize);"
- src/common/winrt/SwapChainPanelNativeWindow.cpp
- call ConvertDipsToPixels() on the result of "uiElement->get_RenderSize(&renderSize);"
I can't promise that these changes won't have any unwanted side-effects, but I can't think of any right now.
Thanks,
Austin
from angle.
Hi Xenice,
We now have an easy solution to your issue. In "OpenGLESPage::CreateRenderSurface" in OpenGLESPage.xaml.cpp, you can define mRenderSurface using something like this:
Windows::Graphics::Display::DisplayInformation^ info = Windows::Graphics::Display::DisplayInformation::GetForCurrentView();
float scale = info->LogicalDpi / 96.0f;
mRenderSurface = mOpenGLES->CreateSurface(swapChainPanel, nullptr, &scale);
This will create the window surface at the same resolution as the screen (i.e. without scaling).
Thanks,
Austin
from angle.
It works! Many thanks
from angle.
Related Issues (20)
- glPushGroupMarkerEXT is not spec-compliant HOT 2
- Compilation error for samplers.sln due to macro SHADER_SOURCE missing HOT 2
- Support 16 bit RGBA textures HOT 1
- Compile issue using MSVC 2017 HOT 6
- Missing lib HOT 2
- Question regarding shaders HOT 1
- [Feature Request] Allow feature level 10.0 to use OpenGL ES 3.0 HOT 2
- Assertion failed when call eglInitialize HOT 2
- Status Update HOT 3
- Missing ARM64 support in NuGet ANGLE.WindowsStore package HOT 2
- MRC video has shift (Hololens using HoloJS)
- Unable to launch "ms-holographic-experimental" on Hololens Emulator
- GLint Is Undefined, and More HOT 1
- D3D11On12CreateDevice HOT 1
- XAML SwapChainPanel does not resize properly HOT 1
- Support native OpenGL HOT 3
- ANGLE.WindowsStore, WinUI 3 Preview 1 and SwapChainPanel HOT 2
- Xbox One HOT 1
- glGenTextures return texture id is 0 with creating off-screen egl context on windows 10 desktop HOT 1
- This repo is missing important files HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angle.