Hi Ralf,

Perhaps the HardwareSubmeshDrawable isn't thread safe, beyond this I
can't really help, its not OSG code.

Robert.

On Wed, May 14, 2008 at 1:56 PM, Ralf Stokholm <[EMAIL PROTECTED]> wrote:
> Hi All
>
> Im getting a chrash when using a hardwaremesh defined in the open source
> engine delta3d, I have postet this question on thir forum as well but so far
> no one has answered and since this might be relatet to osg or opengl ill try
> posting it here.
>
> My application makes use of two windows window a shows a head down view of a
> cockpit and window b shows a view of the outside. In the cockpit view I have
> a MFD (multi function display) that are linked to a targeting pod camera.
> This camera also renders the outside as seen through the targeting pod.
>
> I resently started experimenting with AI and characters and my problem
> showed up the first time the character was shown in both views at the same
> time, it chrashes with an exception that (as far as I can see) originates in
> the graphics driver. The problem is shown both on nvidia and ati graphics
> cards.
>
> The last point in the call stack that i have code for is this function.
>
> void HardwareSubmeshDrawable::drawImplementation(osg::RenderInfo&
> renderInfo) const
> {
>    //select the appropriate mesh
>    mHardwareModel->selectHardwareMesh(mMeshID);
>    osg::State & state = *renderInfo.getState();
>    //bind the VBO's
>    state.disableAllVertexArrays();
>    const Extensions* glExt = getExtensions(state.getContextID(),true);
>    glExt->glBindBuffer(GL_ARRAY_BUFFER_ARB, mVertexVBO);
>    unsigned stride = 18 * sizeof(float);
>    #define BUFFER_OFFSET(x)((GLvoid*) (0 + ((x) * sizeof(float))))
>    state.setVertexPointer(3, GL_FLOAT, stride, BUFFER_OFFSET(0));
>    state.setNormalPointer(GL_FLOAT, stride, BUFFER_OFFSET(3));
>    state.setTexCoordPointer(0, 2, GL_FLOAT, stride, BUFFER_OFFSET(6));
>    state.setTexCoordPointer(1, 2, GL_FLOAT, stride, BUFFER_OFFSET(8));
>    state.setTexCoordPointer(2, 4, GL_FLOAT, stride, BUFFER_OFFSET(10));
>    state.setTexCoordPointer(3, 4, GL_FLOAT, stride, BUFFER_OFFSET(14));
>    //make the call to render
>    glExt->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB, mIndexVBO);
>    glDrawElements(GL_TRIANGLES,  mHardwareModel->getFaceCount() * 3,
> (sizeof(CalIndex) < 4) ?
>          GL_UNSIGNED_SHORT: GL_UNSIGNED_INT, (void*)(sizeof(CalIndex) *
> mHardwareModel->getStartIndex()));
>    glExt->glBindBuffer(GL_ARRAY_BUFFER_ARB, 0);
>    glExt->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
>
>    // This data could potential cause problems
>    // so we clear it out here (i.e CEGUI incompatible)
>    state.setVertexPointer(NULL);
>    state.setNormalPointer(NULL);
>    state.setTexCoordPointer(0, NULL);
>    state.setTexCoordPointer(1, NULL);
>    state.setTexCoordPointer(2, NULL);
>    state.setTexCoordPointer(3, NULL);
> }
>
> From chat i can see the function is calle 3 times for each window to draw
> the character and the only difference is in the GLContextId and other
> context related members of state.
>
> The chrash comes from this line.
>
>    glDrawElements(GL_TRIANGLES,  mHardwareModel->getFaceCount() * 3,
> (sizeof(CalIndex) < 4) ?
>          GL_UNSIGNED_SHORT: GL_UNSIGNED_INT, (void*)(sizeof(CalIndex) *
> mHardwareModel->getStartIndex()));
>
> Can any of you see anything wrong with this code or give me a hint where to
> look, there is no problem as long as im only rendering the character in one
> window, I teste the behavior in a delta3d sample and if the character is
> rendered in 2 windows at the same time it chrashes, if it is rendered in two
> view's in the same window it works fine.
>
> Brgs.
>
> Ralf Stokholm
>
>
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to