Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GLWpfControl.Loaded event doesn't seem to be called, unless an additional delegate is added #125

Open
chadvandy opened this issue May 23, 2024 · 3 comments

Comments

@chadvandy
Copy link

chadvandy commented May 23, 2024

Having a strange behavior where the GLWpfControl.OnLoaded() method, which just invalidates the visual of the control once it's loaded to be properly drawn, isn't run automatically, unless I specifically assign a new delegate to GLWpfControl.Loaded.

public DrawingDemo()
{
	Debug.WriteLine("Creating the DemoControl!");
	InitializeComponent();

	DemoControl.Loaded += ControlLoaded;
	Loaded += OnLoad;
	Unloaded += OnUnload;
}

private void ControlLoaded(object sender, RoutedEventArgs e)
{
	Debug.WriteLine("DemoControl loaded by OpenGL!");
}

If I comment out DemoControl.Loaded += ControlLoaded:
image
image

  • The OpenGL Content remains grey until I manually resize the window.

If I keep it in:
image
image

  • Automatically renders the drawn content, since InvalidateVisual() is called very early.

I'm using the LearnOpenTK tutorial right now, and I do understand there are some differences between the base assumption implementation (having the GameWindow and such) versus how it works in GLWpfControl, so I'm sure I may be misunderstanding something.
 
Using OpenTK 4.8.2, GLWpfControl 4.2.3, .NET Core 8.0.4, Visual Studio 2022 17.9.6.

Thanks for your help, and thanks for this project!

@chadvandy chadvandy changed the title GLWpfControl.OnLoaded() event doesn't seem to be called, unless an additional delegate is added GLWpfControl.Loaded event doesn't seem to be called, unless an additional delegate is added May 29, 2024
@NogginBops NogginBops added this to the 4.3.0 milestone May 30, 2024
@NogginBops
Copy link
Member

Are you calling Start() anywhere? For the GLWpfControl to work you need to call Start.

@NogginBops
Copy link
Member

Did a little bit of testing and couldn't easily find a way to reproduce this. Will move it to 4.3.1 if this turns out to be a bug we need to fix.

@NogginBops NogginBops modified the milestones: 4.3.0, 4.3.1 May 30, 2024
@NogginBops NogginBops modified the milestones: 4.3.2, 4.3.3 Aug 8, 2024
@NogginBops NogginBops modified the milestones: 4.3.3, 4.3.4 Oct 31, 2024
@NogginBops
Copy link
Member

Moving this to the next version. If there are no updates on this issue I'll likely close it next version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants