glut abstraction

Hi,

I noticed that you’ve tried to abstract GLUT out of the framework, but on Windows it still requires the DLL because of the reference in ofSetupOpenGL().
If I comment it out, it removes the GLUT reference, and the DLL is no longer required.

Perhaps we need another define to exclude GLUT altogether?

thanks!

Hey,

I’ve haven’t tried it but looking at the code you should be able to remove GLUT completely.

You just need to extend the ofAppBaseWindow class and include your own setupOpenGL(), as well as the other virtual functions in that class. Setting up OpenGL is usual specific to the windowing system you use, which is why it is there and not part of the core.

[quote author=“grimus”]
You just need to extend the ofAppBaseWindow class and include your own setupOpenGL()[/quote]

Yeah, I’ve done that, but unfortunately the problem is in ofAppRunner.cpp itself, within the ofSetupOpenGL(int w, int h, int screenMode) function.

I can see the reasoning there though, since you need *a* window to exist… but as a design thing, I’d simply deprecate that function and keep the one that accepts an ofAppBaseWindow*.

:slight_smile:

Aaah yes now I see what you mean…I was only looking at the first function.

Yes you are totally right…and this looks like some iPhone wickedness!
Yes, GLUT must be fully removable…linking to libraries you aren’t using is a bad thing and can potentially cause problems (polluted namespaces for starters) so should be avoided if possible…of course OF links to a whole range of things that you don’t always use, but I think GLUT should definitely not be a requirement.

yes, we needed to do that to not break code with previous releases. so by default glut is chosen if no windowing system is passed as a parameter to ofSetupOpenGL

Wouldn’t this just involve people editing their main.cpp? The Api was broken in an earlier release when the ofRunApp( new testApp()) was introduced…
I guess I would prefer to iron out these things early while the library is still pre-release, so I’m happy to absorb the odd api change if it’s for the greater good :slight_smile:

If you add in an option, everyone who doesn’t care for the new API, doesn’t need to know it’s changed?

  
  
#ifndef PLEASE_NO_GLUT  
   window = new ofAppGlutWindow();  
#else  
   throw "This is deprecated. Please use the other ofSetupOpenGL()."  
#endif  
  

…and for everyone else… 8)

Except the above is kind of messy, but it does keep backwards compatibility.