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

Private void Dispose(bool disposing) method in GL3x Names classes are confusing #4

Open
PlutoniumHeart opened this issue Dec 29, 2013 · 3 comments

Comments

@PlutoniumHeart
Copy link

Hi,
I am going through the code in Source/Renderer/GL3x/Names folder, and noticed that the private methods used in those classes take a bool type input 'disposing' however this input is never used in this method. Is there a particular reason why it should take a bool type input?

I am also not quite sure why in the FinalizerThreadContextGL3x class we will have to create a NtiveWindow and GraphicsContext.

Thank you!

@pjcozzi
Copy link
Member

pjcozzi commented Dec 30, 2013

The Dispose methods are part of the IDisposable interface so we have to implement both functions. See http://msdn.microsoft.com/en-us/library/system.idisposable(v=vs.110).aspx

// Dispose(bool disposing) executes in two distinct scenarios. 
// If disposing equals true, the method has been called directly 
// or indirectly by a user's code. Managed and unmanaged resources 
// can be disposed. 
// If disposing equals false, the method has been called by the 
// runtime from inside the finalizer and you should not reference 
// other objects. Only unmanaged resources can be disposed. 

Its been a few years, but I believe object destructors (like in TextureNameGL3x, for example) may be called when no GL context is current, so FinalizerThreadContextGL3x ensures a shared context is current so the GL resource can be deleted.

Also, @kring and I are not really maintaining this project other than merging the occasional pull request. If you are interested in an open-source web globe, we are working on Cesium.

@PlutoniumHeart
Copy link
Author

Thank you very much for the reply, I understand that this code is not maintained any more, I was reading the book. By the way, when I read about the Tessellation part, I thought you guys are going to talk about the tessellation shader, but then the shader was not in the 3.3 core profile, do you think tessellation discussed in chapter 4 can be achieved by using tessellation shader in GL4?

Also I took a look at Cesium, I am not quite sure if I like WebGL or programming in a browser at all... And I am most familiar with C/C++, and only has limited knowledge about C# (That's why I am asking this simple question), and has no idea about Java at all.
I followed the Cesium repository for sometime, and I can see it is very active, may be in time, I will start learning Java, and participate in it as well.

@pjcozzi
Copy link
Member

pjcozzi commented Dec 31, 2013

do you think tessellation discussed in chapter 4 can be achieved by using tessellation shader in GL4?

Definitely. Here's a good intro to tessellation shaders: http://prideout.net/blog/?p=48

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

No branches or pull requests

2 participants