Reputation: 2707
I have an OpenGL library written in C++. I know that I can use ANGLE, but because of this I will need to code my whole app in C++. Is there a way to use C++ OpenGL in UWP and still use C# as a main language?
Upvotes: 3
Views: 7859
Reputation: 11
You could use my new library (https://github.com/hamarb123/hamarb123.SharpGLES) which runs OpenGL ES on UWP (and .NET Framework), it even has a GLESSwapChainPanel class for ease of use.
Upvotes: 0
Reputation: 427
I put together a small C# project that shows how to use ANGLE from C#. It includes minimal bindings to GL from C# (since OpenTK does not yet target UWP), and a part of the template application from ANGLE itself, which has all the SwapChainPanel, etc, setup. You can check it out here.
Upvotes: 0
Reputation: 10627
Is there a way to use c++ opengl in UWP and still use C# as a main language?
ANGLE is currently the only way to get the OpenGL API to run in UWP. For more details please reference this thread.
You can write your own via interop if you want to use ANGLE from c#. You can also write your low level OpenGL stuff in C++ and wrapper it. Then invoke it by C# in your logic level.
Fortunately, people who have the same requirements as you created an issue on the GitHub a few days ago, and got samples from @mattleibow. @mattleibow shared his code in this thread. For more details, please reference OpenGL surface from SwapChainPanel declared in XAML in C#.
Additionally, ANGLE is actually for translating OpenGL ES to DirectX. So I recommend you to use Win2D instead. Win2D is a new, immediate mode 2D drawing framework for XAML applications on Windows 8.1 and Windows 10. It is built on the high performance foundation of DirectX, but is designed to provide the convenience and ease of use expected by C# and .NET developers. More details you can reference this video.
Upvotes: 6