dwmkerr / dwmkerr/sharpgl

There is an OpenGL instance with its 'RenderContextProvider' unbinded in 'SceneControl'

Open
#105 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
804
Forks
294
Avg merge
3d 23h
Merged PRs (30d)
1

Description

It's about the 'SharpGL.SceneControl' class. In its 'SharpGL.SceneControl.Scene' property there is an OpenGL instance 'gl' created like this: private OpenGL gl = new OpenGL();. (let's call this 'gl' instance 'glA')
Here comes a problem when using the 'SharpGL.SceneControl'. If you use var c = this.sceneControl.Scene.OpenGL.RenderContextProvider;, the c will be null. But actually there is another OpenGL instance(let's call it 'glB') that holds a valid RenderContextProvider. And that OpenGL instance is the one we should have gotten. This 'glB' is instantiated in 'SharpGL.SceneControl''s parent class(SharpGL.OpenGLControl) like this:private readonly OpenGL gl = new OpenGL();. And it has binded to everything that should be. So I think we can force 'glA' pointing to 'glB' by updating the InitializeComponent() method in SharpGL.SceneControl class like this:



private void InitializeComponent()
{
//
// OpenGLCtrl
//
this.Name = "OpenGLCtrl";
this.scene.OpenGL = this.OpenGL;// force 'glA' pointing to 'glB'
}

And also the 'glA''s instatiation should be removed.
Sorry for my english.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.