Hi,

On Thu, 2009-04-30 at 15:12 +0200, Marcus Lindblom wrote:
> Hi,
> 
> After re-loading a scene, we get a std::bad_alloc (with 3 gigs) from the 
> following place (line 601 in OSGShaderProgram.cpp):
> 
>           if(iStatus == 0)
>              {
>                  Char8 *szDebug;
>                  GLint  iDebugLength;
> 
>                  osgGlGetShaderiv( uiShader,
>                                    GL_INFO_LOG_LENGTH,
>                                   &iDebugLength);
> 
>                  szDebug = new Char8[iDebugLength];
>                                       ^^^^^^^^
> 
> Looking at the values in a debugger, iDebugLength is stupidly large 
> (1768036544) so I think the glgetshaderiv fails and never writes to this 
> value. (Is it guaranteed to do that always?)
> 

hmm that is strange, the function should either return a useful value or
0 if not log is available. I admit that we don't check the length 0 case
but as this is the compilation failed path I would expect the log buffer
to contain something. The only thing I could think of is that there is 
an OpenGL error. You could add a gl error check after/before the 
osgGlGetShaderiv call to see if this is happening. AFAIK this could only
happen if uiShader is not a valid OpenGL shader object or shaders are
not supported at all. 

In general initializing szDebug and iDebugLength is always a good idea,
don't know why I missing those. I will change that.

kind regards,
  gerrit




------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to