Difference between revisions of "User talk:Jgrills"

From OpenGL Wiki
Jump to: navigation, search
(Notice on OpenGL Error)
(Notice on OpenGL Error)
Line 16: Line 16:
  
 
:: Sorry, I was previously unaware of the protocol. I don't really know what the right thing to do here is. What I do know is that I followed the advice on this page and due to it I ended up with a version of the software that hangs at shutdown. My point is referencing a 15 year old post was to share the breadth of time that this has been a problem, and that there are a lot of systems out there that are potentially effected. Whether or not this falls under OpenGL specification is really irrelevant to me, I have to ship working software. To that end, if the OpenGL specification doesn't cover what this function returns without a valid context, perhaps it should take a stance in this particular case to prevent this scenario. I'm just trying to help other programmers, but I only have so much I can devote to that effort. Do with this information what you will. [[User:Jgrills|Jgrills]] ([[User talk:Jgrills|talk]]) 16:37, 29 August 2019 (UTC)
 
:: Sorry, I was previously unaware of the protocol. I don't really know what the right thing to do here is. What I do know is that I followed the advice on this page and due to it I ended up with a version of the software that hangs at shutdown. My point is referencing a 15 year old post was to share the breadth of time that this has been a problem, and that there are a lot of systems out there that are potentially effected. Whether or not this falls under OpenGL specification is really irrelevant to me, I have to ship working software. To that end, if the OpenGL specification doesn't cover what this function returns without a valid context, perhaps it should take a stance in this particular case to prevent this scenario. I'm just trying to help other programmers, but I only have so much I can devote to that effort. Do with this information what you will. [[User:Jgrills|Jgrills]] ([[User talk:Jgrills|talk]]) 16:37, 29 August 2019 (UTC)
 +
 +
::: My point is this: ''no OpenGL function'' is valid without a valid context. The page on [[OpenGL Context]]s spells this out. The particular case you encountered this (glGetError) is not special. There are dozens if not hundreds of posts dating back decades from people asking about why their OpenGL code isn't working, when the problem is that they called OpenGL functions before creating a context and making it current. I could probably track down 20 year old posts that happen to involve different functions (the {{code|glGen*}} functions are popular, due to trying to wrap OpenGL objects in global C++ objects), but they all come back to the same problem.
 +
 +
::: We can't litter this site with "this function doesn't work if no context is valid". And there is no reason to provide a special case for {{code|glGetError}} just because you happened to do the same thing as a post from 15 years ago.
 +
 +
::: It should also be noted that calling many OpenGL functions without a valid context will just straight-up crash. And whether they do or not, or which ones cause a crash, depends on a lot of circumstances: platform, OpenGL loader mechanism, etc. A simple blanket "don't call this outside of a valid context" is really the best this Wiki can hope for with regard to these errors.
 +
 +
::: I understand and appreciate that you are trying to help programmers, but the particular statement you tried to make is misleading. It implies that users should be on their guard for this case, that their error checking code should be sure to see if {{enum|GL_INVALID_OPERATION}} gets spit out a bunch of times so that they don't go into an infinite loop. What users should ''actually'' do is make sure that they don't call ''any'' OpenGL function outside of having a valid context made current. [[User:Alfonse|Alfonse]] ([[User talk:Alfonse|talk]]) 17:32, 29 August 2019 (UTC)

Revision as of 17:32, 29 August 2019

Notice on OpenGL Error

You added this notice:

Note that on some platforms in some circumstances, glGetError may return GL_INVALID_OPERATION indefinitely

Such a thing is not really allowed by the OpenGL specification. Implementations cannot indefinitely return errors, so such cases are driver bugs. On which platforms does such behavior happen? Alfonse (talk) 11:45, 28 August 2019 (UTC)

I am seeing this on Windows, in my case it's happening at shutdown. I did some research and came across this post that seems to describe my issue: https://www.gamedev.net/forums/topic/366057-gl_invalid_operation/

The OpenGL specification governs the behavior of the OpenGL system while a functioning, valid OpenGL context is current. That post's code doesn't ever create an OpenGL context, so the OpenGL specification has nothing to say about its behavior. So the circumstances described by that post are irrelevant to what's supposed to be on this site.
Now, if you want to qualify your statement with a specific notation that this happens only outside of having a valid OpenGL context made current, that might be OK. But since pretty much everything on this site starts with that assumption, it seems weird to bring it up only with regard to glGetError. But the current version of the statement suggests that the behavior you describe is permitted by the OpenGL standard or that this behavior is something users should be expect to encounter in normal operating conditions. Neither of these is true (not unless you can find more evidence than a near 15-year-old post that never actually creates an OpenGL context).
One last thing. When discussing things on a MediaWiki, there's a protocol. You're supposed to use "~~~~" to sign your posts, so that everyone can see who said what. And you're supposed to indent replies with : syntax. Alfonse (talk) 04:01, 29 August 2019 (UTC)
Sorry, I was previously unaware of the protocol. I don't really know what the right thing to do here is. What I do know is that I followed the advice on this page and due to it I ended up with a version of the software that hangs at shutdown. My point is referencing a 15 year old post was to share the breadth of time that this has been a problem, and that there are a lot of systems out there that are potentially effected. Whether or not this falls under OpenGL specification is really irrelevant to me, I have to ship working software. To that end, if the OpenGL specification doesn't cover what this function returns without a valid context, perhaps it should take a stance in this particular case to prevent this scenario. I'm just trying to help other programmers, but I only have so much I can devote to that effort. Do with this information what you will. Jgrills (talk) 16:37, 29 August 2019 (UTC)
My point is this: no OpenGL function is valid without a valid context. The page on OpenGL Contexts spells this out. The particular case you encountered this (glGetError) is not special. There are dozens if not hundreds of posts dating back decades from people asking about why their OpenGL code isn't working, when the problem is that they called OpenGL functions before creating a context and making it current. I could probably track down 20 year old posts that happen to involve different functions (the glGen* functions are popular, due to trying to wrap OpenGL objects in global C++ objects), but they all come back to the same problem.
We can't litter this site with "this function doesn't work if no context is valid". And there is no reason to provide a special case for glGetError just because you happened to do the same thing as a post from 15 years ago.
It should also be noted that calling many OpenGL functions without a valid context will just straight-up crash. And whether they do or not, or which ones cause a crash, depends on a lot of circumstances: platform, OpenGL loader mechanism, etc. A simple blanket "don't call this outside of a valid context" is really the best this Wiki can hope for with regard to these errors.
I understand and appreciate that you are trying to help programmers, but the particular statement you tried to make is misleading. It implies that users should be on their guard for this case, that their error checking code should be sure to see if GL_INVALID_OPERATION gets spit out a bunch of times so that they don't go into an infinite loop. What users should actually do is make sure that they don't call any OpenGL function outside of having a valid context made current. Alfonse (talk) 17:32, 29 August 2019 (UTC)