samboycoding / opentkavalonia Goto Github PK
View Code? Open in Web Editor NEWHelper control and library to provide OpenTK-based OpenGL rendering in Avalonia apps
License: MIT License
Helper control and library to provide OpenTK-based OpenGL rendering in Avalonia apps
License: MIT License
As the question states:
Does the OpenTKAvalonia view work on Anrdoid and iOS?
Has this been tested by anyone?
The GL.Viewport() in the BaseTkOpenGlControl class should take into account the scale factor of the monitor in order to display correctly on MacOS.
In the below example, the viewport should be scaled by a factor of 2 to work fine :
With OpenTK+ImGUI the below code is used when a window is resized for instance (OpenTK propose a GameWindow.FramebufferSize in order to have the correct value versus the Client size :
// Update the opengl viewport
Vector2i fb = this.FramebufferSize;
GL.Viewport(0, 0, fb.X, fb.Y); // 2048 * 1536
// Tell ImGui of the new size
_controller.WindowResized(ClientSize.X, ClientSize.Y); // 1024 * 768
I don't know what is the equivalent for OpenTK+Avalonia, that's why I'm opening this issue
hello, hope you are not too busy there is no urgency ..
This is a minor fix to get this update to work on Windows .its working now with the latest from wannkunstbeikor:OpenTKAvalonia:master.. plus my change for windows via openGL i paste below.
Sorry im not a github expert or a collaborator , i cannot do a PR to a fork of a fork and
I cant even update my own fork because of a recent issue with sponsors (me) email leaking into the nugets or something MSFt is havign a crisis about. i get my push blocked to my own fork in my own vault. so i hoped we could get thisi one running , merged for now
mabye I'll or we can find a more general way.. since id like to support 3d graphics on all the avalonia targets, mobile and webassembly..
for now you ask for a PR from wannkunstbeikor , then take my changes?
to merge
merge from master...wannkunstbeikor:OpenTKAvalonia:master via PR
copy paste thsi below to
program.cs on both samples : and test on non windows..
using System;
using Avalonia;
using System.Collections.ObjectModel;
namespace BasicCubeSample
{
class Program
{
// Initialization code. Don't use any Avalonia, third-party APIs or any
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
// yet and stuff might break.
[STAThread]
public static void Main(string[] args) => BuildAvaloniaApp()
.StartWithClassicDesktopLifetime(args);
// Avalonia configuration, don't remove; also used by visual designer.
public static AppBuilder BuildAvaloniaApp()
{
//Add this line to set ths to UseWGL:
return AppBuilder.Configure<App>()
.UsePlatformDetect()
.With(new Win32PlatformOptions{
RenderingMode=new Collection<Win32RenderingMode> { Win32RenderingMode.Wgl }
}
).LogToTrace();
}
}
}
4. fix a warning
private OpenGlTexture? _brickTexture; <<--- in the sample to fix a waring about nullable
<<<<<
if you want to know,
why im using this: ( in case you want to advise or have similar goals)
my goal is a IDE hosting a 2d or 3d physics window with docking . Something like a game level editor, with maybe scripting , and avalonia property inspectors and such for now. for mobile and web im not sure if i need avalonai UI next to or inside the 3d graphic, i might use custom UI.. Its much like stride was.
I am testing this for now , the only reason im looking to try to to be using openTK right now , because BepuPhysicsV2 demos are using OpenTK. but that is just on desktops. he supports directx and openGl vis a shaderconductor. i support mobile , and webasssemeby i hope, for a game / scientifici simulation rig based using physics engine and visuallized wiht monogame or something like it. i need just 3d graphics wiht basics shaders, and physics heavy / simulation code/ using a lockless producer consumer pattern.
the only issue wht this demo remain seems to be.. resizing.. havent tried with dockiong yet.. wil report
there may be option im unaware of.. for now desktop mac, windows , pc might be a start...
also looking at this:
https://github.com/wieslawsoltes/AvaloniaInside.MonoGame
https://github.com/wieslawsoltes/Dock
and other avanoliaUI stuff.
or advise me if there s more to do on this...there may be other options now , avalonia does much and thers is silk and ideas from stride.. includes vulcan.. I will ask wieslawsoltes what i should do ultimately buit this might be ok for now..
thanks for making this.. and @wannkunstbeikor for updating it..
Greetings
I would like to use this project (or a fork that is more up to date respectively) in an ongoing open-source project of mine.
However, this project is missing a LICENSE.md file, thus making it copyright protected with no permissions whatsoever granted (which I assume, is not the intended purpose).
Could you clarify this, or add a LICENSE.md that grants permission (e.g. MIT, CC, GPL) or explicitly probhits use?
Video: https://streamable.com/ttapc8
For some reason, destroying and re-creating the control (as is done in the resizing sample, via a Tab control) breaks something (about the depth buffer? not sure) until the control is resized.
Not sure if the bug is in Avalonia, and I need to do a workaround, if it's in the way the base class sets itself up, or if it's in my subclass in that sample.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.