Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: glCheck() not available in window module  (Read 4723 times)

0 Members and 1 Guest are viewing this topic.

Jonny

  • Full Member
  • ***
  • Posts: 114
    • View Profile
    • Email
glCheck() not available in window module
« on: August 15, 2018, 04:49:50 pm »
While trying to debug https://github.com/SFML/SFML/issues/1471 I noticed that none of the gl functions in the windows module are wrapped by glCheck(). As it's defined in the graphics module this makes sense, because the window module doesn't (and shouldn't) depend on the graphics module. But I was wondering if there was a reason this couldn't be moved into the window module, so that we can error check all the gl functions there as well?

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: glCheck() not available in window module
« Reply #1 on: August 15, 2018, 11:33:46 pm »
Well... look at it this way, glCheck is normally not needed in the window module since OpenGL calls are not made there. The fact that this is not the case in the EaglContext.mm is clearly an exception to the rule. If you want glCheck in there you will need to build it in yourself. Don't get your hopes up though, the bug you are trying to fix isn't the result of any OpenGL calls going wrong.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

Jonny

  • Full Member
  • ***
  • Posts: 114
    • View Profile
    • Email
Re: glCheck() not available in window module
« Reply #2 on: August 16, 2018, 08:10:38 am »
So is there any reason that it couldn't/shouldn't be in the Windows module? What's the "rule" that EAGLContext is an exception to? Just that openGL isn't "normally needed"? Is the argument just that it makes more sense to be in the graphics module? Would you accept if it was duplicated in the windows module? or just defined in EAGLContext.mm?

Regardless of that specific issue (I only mentioned it for context), would it not be an advantage to have gl error checking wherever possible?

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: glCheck() not available in window module
« Reply #3 on: August 16, 2018, 05:30:49 pm »
The glCheck macro is only active in non-release builds anyway. It's sole purpose is to help debug problems that might arise from wrong usage of OpenGL. This is significantly more likely to happen in sfml-graphics than in sfml-window because OpenGL is used to actually draw stuff there. There is almost no risk of anything going wrong with regards to that little bit of OpenGL in EaglContext.mm, so other than for pure development/debugging purposes (such as in your case now), glCheck isn't really needed there. With the exception of running on a broken system, there isn't really any way a user could even deliberately cause an OpenGL error in there.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).