Closed bitzhuwei closed 1 year ago
bruh can you update this fork please. This shit is bitting me badly where I was like WTF why the fuck is the model not rendering on my form even when I call draw on a scene myself.
This is a monster PR. OK I'll take it commit by commit and see what I can do
@bitzhuwei @AraHaan try v2.4.5
which should fix this. (I.e. the duplicate instance). The other elements of this PR I'll have to pull in separately
@dwmkerr thanks, so everything from this pr is now part of the library?
Yes I believe so we can close this one now @AraHaan !
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;
, thec
will benull
. But actually there is another OpenGL instance(let's call it 'glB') that holds a validRenderContextProvider
. And 'glB' 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 theInitializeComponent()
method inSharpGL.SceneControl
class like this:And also the 'glA''s instatiation should be removed.
Sorry for my english.