Hi Chris,

If the get string is null, then it suggests that you don't have a
valid graphics context, so the error code you'd get would be complete
nonsense.  Hiding this crash does nothing to help you.

Robert.

On Fri, Sep 19, 2008 at 5:35 PM, Chris Denham <[EMAIL PROTECTED]> wrote:
> Hi Robert,
> Surely the purpose of the code that reports the GL error is intended to help
> users fix the problem.
> It it not helpful if the application crashes while it is merely trying to
> output the "pretty string" version of the error code.
> My suggested change does NOT hide the bug. On the contary, it helps you find
> the bug because it tells you the error code rather than bombing out trying
> to display the error.
> Chris.
>
> ----- Original Message ----- From: "Robert Osfield"
> <[EMAIL PROTECTED]>
> To: "Chris Denham" <[EMAIL PROTECTED]>
> Cc: "OpenSceneGraph Submissions" <[email protected]>
> Sent: Friday, September 19, 2008 5:14 PM
> Subject: Re: [osg-submissions] SceneView OpenGL error trap succeptable to
> null pointer exception in OSG2.6.
>
>
>> Hi Chris,
>>
>> The submission isn't problematic, but the suggestion that it might fix
>> a crash is, as the app is broken and is likely just to crash somewhere
>> else that access OpenGL.  The crash you have is symptom of problem
>> elsewhere, the fix really is not really a fix, it's just a recording
>> to hide a bug elsewhere.
>>
>> Robert.
>>
>> On Fri, Sep 19, 2008 at 5:06 PM, Chris Denham <[EMAIL PROTECTED]>
>> wrote:
>>>
>>> Hi Robert,
>>> You may be right about the cause of the GL error as I am currently doing
>>> horrible things experimenting with code to try and support an SVI
>>> display.
>>> However, I stand by this submission, as it was not really about the cause
>>> of
>>> the GL error, more about how it is reported and the re-use of the GL
>>> error
>>> reporting code in State.cpp.
>>> Basically, <<gluErrorString(errorNo)<<" goes bang! if there is no error
>>> string for the code passed in.
>>> It seemed to me that the original code makes an assumption the return
>>> value
>>> of gluErrorString(errorCode) being non NULL.
>>> An assumption that is not made by the code in State::checkGLErrors(), so
>>> it
>>> makes sense to reuse that code in any case.
>>>
>>> Hope that explains my reasoning for submitting this trivial little
>>> change.
>>> And it might stop an app crashing unnecessarily when it gets a GLerror
>>> for
>>> which there is no 'pretty string' available..
>>>
>>> Chris.
>>>
>>> ----- Original Message ----- From: "Robert Osfield"
>>> <[EMAIL PROTECTED]>
>>> To: "Chris Denham" <[EMAIL PROTECTED]>; "OpenSceneGraph Submissions"
>>> <[email protected]>
>>> Sent: Friday, September 19, 2008 4:43 PM
>>> Subject: Re: [osg-submissions] SceneView OpenGL error trap succeptable to
>>> null pointer exception in OSG2.6.
>>>
>>>
>>>> Hi Chris,
>>>>
>>>> If glGetError() is crashing then it suggests that you are calling this
>>>> code from a thread that doesn't have valid graphics context, which is
>>>> a bug at the application level, rather than SceneView itself.
>>>>
>>>> Robert.
>>>>
>>>> On Fri, Sep 19, 2008 at 4:09 PM, Chris Denham <[EMAIL PROTECTED]>
>>>> wrote:
>>>>>
>>>>> Just found a little problem with SceneView.cpp crashing with NULL
>>>>> pointer
>>>>> exception because it tried to use a NULL returned by gluErrorString().
>>>>> I noticed that there is GL error reporting code in State.cpp that
>>>>> probably
>>>>> should have be used here.
>>>>> Mods shown below, and I have attached modified osg2.6 SceneView.cpp
>>>>>
>>>>> //////////////////BEFORE//////////////////////
>>>>>    GLenum errorNo = glGetError();
>>>>>     if (errorNo!=GL_NO_ERROR)
>>>>>     {
>>>>>         osg::notify(WARN)<<"Warning: detected OpenGL error
>>>>> '"<<gluErrorString(errorNo)<<"'"<< std::endl;
>>>>>
>>>>>         // go into debug mode of OGL error in a fine grained way to
>>>>> help
>>>>>         // track down OpenGL errors.
>>>>>         state->setCheckForGLErrors(osg::State::ONCE_PER_ATTRIBUTE);
>>>>>     }
>>>>>  }
>>>>> /////////////AFTER////////////////////////////
>>>>>     if (state->checkGLErrors("end of SceneView::draw()"))
>>>>>     {
>>>>>         // go into debug mode of OGL error in a fine grained way to
>>>>> help
>>>>>         // track down OpenGL errors.
>>>>>         state->setCheckForGLErrors(osg::State::ONCE_PER_ATTRIBUTE);
>>>>>     }
>>>>> //////////////////////////////////////////////////////
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> osg-submissions mailing list
>>>>> [email protected]
>>>>>
>>>>>
>>>>> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
>>>>>
>>>>>
>>>
>>>
>
>
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to