Crystal Space
Welcome, Guest. Please login or register.
October 25, 2014, 07:40:50 pm

Login with username, password and session length
Search:     Advanced search
9011 Posts in 2044 Topics by 8828 Members
Latest Member: Saikjanna
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Development
| |-+  Support
| | |-+  A problem with ODE (application crash)
« previous next »
Pages: [1] Print
Author Topic: A problem with ODE (application crash)  (Read 2461 times)
LordGordon
Newbie
*
Posts: 19


View Profile WWW
« on: February 18, 2006, 04:26:09 pm »

Hi,
I have added the physics to my demo application. I'm using ODE and i have taken the ideas from phystut tutorial.

I have the plane terrain:
Code:
...
csRef<iMeshWrapper> terrain (engine->CreateSectorWallsMesh (mainsect, "terrain"));
terrain_object = m_mesh->GetMeshObject ();
terrain_factory = terrain_object->GetFactory();
terrain_state = scfQueryInterface<iThingFactoryState> (terrain_factory);
terrain_state->AddQuad (csVector3 (0.0f,  0.0f, 0.0f), csVector3 (30.0f, 0.0f, 0.0f), csVector3 (30.0f, 0.0f, -30.0f), csVector3 (0.0f,  0.0f, -30.0f));
...
terrain_body = dynsys->CreateBody ();
terrain_body->SetPosition (csVector3 (15.0f, 0.0f, -15.0f));
terrain_body->SetMoveCallback (0);
terrain_body->MakeStatic ();
dynsys->AttachColliderMesh (terrain, csOrthoTransform (), 10.0f, 0.0f);
int i;
for (i = 0; i < terrain_state->GetPolygonCount(); i++) {
terrain_body->AttachColliderPlane (terrain_state->GetPolygonObjectPlane (i), 10.0f, 0.0f, 0.0f);
}
...

And this is the object that must fall down:
Code:
...
csVector3 meshpos (10.0f, 20.0f, -15.0f);
...
csRef<iMeshWrapper> asteroid (engine->CreateSectorWallsMesh (m_world, "asteroid"));
asteroid_object = asteroid->GetMeshObject ();
asteroid_factory = asteroid_object->GetFactory();
asteroid_state = scfQueryInterface<iThingFactoryState> (asteroid_factory);
asteroid_state->AddOutsideBox (csVector3(0.0f, 0.0f, 0.0f), csVector3(0.5f, 0.5f, 0.5f));
...
moveast = asteroid->GetMovable ();
moveast->SetPosition (meshpos);
moveast->UpdateMove ();
...
ast_body = dynsys->CreateBody ();
ast_body->SetProperties (1.0f, csVector3 (0), csMatrix3 ());
ast_body->SetPosition (meshpos);
ast_body->AttachMesh (asteroid);
ast_body->AttachColliderBox (csVector3 (0.5f, 0.5f, 0.5f), csOrthoTransform (csMatrix3 (), csVector3 (0)), 0.0f, 1.0f, 0.0f);
...

It seems to work fine but when the object collide with the terrain the application crashes.

I have seen this (on phystut):
Code:
csVector3 size (10.0f, 10.0f, 10.0f); // This should be the same size as the mesh.
t.SetOrigin(csVector3(10.0f,0.0f,0.0f));
dynSys->AttachColliderBox (size, t, 10, 0);
t.SetOrigin(csVector3(-10.0f,0.0f,0.0f));
dynSys->AttachColliderBox (size, t, 10, 0);
t.SetOrigin(csVector3(0.0f,10.0f,0.0f));
dynSys->AttachColliderBox (size, t, 10, 0);
t.SetOrigin(csVector3(0.0f,-10.0f,0.0f));
dynSys->AttachColliderBox (size, t, 10, 0);
t.SetOrigin(csVector3(0.0f,0.0f,10.0f));
dynSys->AttachColliderBox (size, t, 10, 0);
t.SetOrigin(csVector3(0.0f,0.0f,-10.0f));
dynSys->AttachColliderBox (size, t, 10, 0);

But i don't understand how it works.  (I have understood that can be the solution to my problem)

Many thanks for you help!!
Logged
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #1 on: February 18, 2006, 07:30:41 pm »

Can you run your app in a debugger (make sure CS+your app are compiled in debug mode) and then you can tell us where it crashes. Give us the full stack backtrace.

Greetings,
Logged
LordGordon
Newbie
*
Posts: 19


View Profile WWW
« Reply #2 on: February 19, 2006, 12:02:17 pm »

The error:
Quote
Exception first-chance a 0x6fef48e5 (libode-cs.dll) in CS_demoapp_debug.exe: 0xC00000FD: Stack overflow.
Exception not managed a 0x6fef48e5 (libode-cs.dll) in CS_demoapp_debug.exe: 0xC00000FD: Stack overflow.

The application crashes at this point:
File: chkstk.asm
Code:
...
probepages:
        sub     ecx,_PAGESIZE_          ; yes, move down a page
        sub     eax,_PAGESIZE_          ; adjust request and...

        test    dword ptr [ecx],eax     ; ...probe it  <= THIS is the crash point.

        cmp     eax,_PAGESIZE_          ; more than one page requested?
        jae     short probepages        ; no
...

Registers state:
Quote
EAX = 00003510 EBX = 0000015E ECX = 000322C4 EDX = 00000000
ESI = 0001E140 EDI = 0012C338 EIP = 6FEF48E5 ESP = 000A72BC
EBP = 000A7308 EFL = 00000202

000322C4 = 00000000

Calls stack:
Quote
>libode-cs.dll!_chkstk()  Riga 91   Asm
 libode-cs.dll!dInternalStepIsland_x2(dxWorld * world=0x3cbaae2a, dxBody * const * body=0x3cbf0251, int nb=1035430810, dxJoint * const * _joint=0xbd28f984, int nj=1018076078, float stepsize=0.080142036)  Riga 1586   C++
 libode-cs.dll!dxProcessIslands(dxWorld * world=0x00d66f10, float stepsize=0.0099999998, void (dxWorld *, dxBody * const *, int, dxJoint * const *, int, float)* stepper=0x6fecb960)  Riga 242 + 0x15   C++
 libode-cs.dll!dWorldStep(dxWorld * w=0x00d66f10, float stepsize=0.0099999998)  Riga 1309 + 0x10   C++
 odedynam.dll!csODEDynamicSystem::Step(float elapsed_time=0.0099999998)  Riga 716 + 0xc   C++
 CS_demoapp_debug.exe!cMainProgram::ProcessFrame()  Riga 182 + 0x2e   C++
 CS_demoapp_debug.exe!csBaseEventHandler::HandleEvent(iEvent & event={...})  Riga 118   C++
 CS_demoapp_debug.exe!csBaseEventHandler::EventHandlerImpl::HandleEvent(iEvent & event={...})  Riga 88   C++
 CS_demoapp_debug.exe!csEventTree::Dispatch(iEvent & e={...})  Riga 558 + 0xe   C++
 CS_demoapp_debug.exe!csEventTree::Notify()  Riga 529   C++
 CS_demoapp_debug.exe!csEventQueue::Notify(const unsigned long & name=5)  Riga 272   C++
 CS_demoapp_debug.exe!csEventQueue::iTypedFrameEventDispatcher::HandleEvent(iEvent & __formal={...})  Riga 261   C++
 CS_demoapp_debug.exe!csEventTree::Dispatch(iEvent & e={...})  Riga 558 + 0xe   C++
 CS_demoapp_debug.exe!csEventTree::Notify()  Riga 529   C++
 CS_demoapp_debug.exe!csEventQueue::Notify(const unsigned long & name=1)  Riga 272   C++
 CS_demoapp_debug.exe!csEventQueue::Process()  Riga 292   C++
 CS_demoapp_debug.exe!csDefaultRunLoop(iObjectRegistry * r=0x00a4ff50)  Riga 91   C++
 CS_demoapp_debug.exe!csApplicationFramework::Run()  Riga 322 + 0xb   C++
 CS_demoapp_debug.exe!cMainProgram::Application()  Riga 388   C++
 CS_demoapp_debug.exe!csApplicationFramework::Start()  Riga 72   C++
 CS_demoapp_debug.exe!csApplicationFramework::Main(int argc=1, char * * argv=0x00a23f78)  Riga 124 + 0x7   C++
 CS_demoapp_debug.exe!csApplicationRunner<cMainProgram>::Run(int argc=1, char * * argv=0x00a23f78)  Riga 433 + 0x13   C++
 CS_demoapp_debug.exe!main(int argc=1, char * * argv=0x00a23f78)  Riga 489 + 0xd   C++
 CS_demoapp_debug.exe!mainCRTStartup()  Riga 398 + 0x11   C
 kernel32.dll!7c816d4f()    
 ntdll.dll!7c925b4f()    
 kernel32.dll!7c8399f3()    

The output using "-verbose=-scf":
Quote
CS_demoapp_debug.exe -verbose=-scf
VFS_NOTIFY: loaded configuration file: C:\Programmi\crystalspace\vfs.cfg
NOTIFY: Could not get sound loader
NOTIFY: Could not get sound loader (v2)
NOTIFY: Could not get sound driver
NOTIFY: Could not get sound driver (v2)

crystalspace.graphics3d.opengl:
  Texture LOD bias -0.3
csDetectDriver: monitor name is '\\.\DISPLAY1'
csDetectDriver: driver name is 'ATI2DVAG'
csDetectDriver: found DLL 'atioglxx.dll'

crystalspace.canvas.openglwin:
  GL driver: atioglxx.dll 6.14.10.5396

crystalspace.canvas.openglcommon.driverdb:
  Applied: Work around broken ATI point sprites
  Applied: ATI: Can't handle GL_BLEND texenv for GL_INTENSITY textures
  Applied: ATI: Can't handle compressed formats for RECT textures
  Applied: ATI: RECT texture extension support apparently sucks
  Applied: ATI: Use AFP for some 2D drawing

crystalspace.canvas.openglcommon:
  OpenGL renderer: RADEON 9000 DDR x86/SSE2 (vendor: ATI Technologies Inc.)
  version 1.3.1014 WinXP Release
  Using windowed mode at resolution 640x480.
  Pixel format: Color: 32 Alpha: 8 Depth: 24 Stencil: 8 AccumColor: 0
  AccumAlpha: 0 MultiSamples: 0

crystalspace.canvas.opengl.extmgr:
  GL Extension 'GL_ARB_multitexture' found and used.
  GL Extension 'GL_ARB_texture_env_combine' found and used.
  GL Extension 'GL_ARB_multisample' not found.
  GL Extension 'GL_ARB_fragment_program' not found.

crystalspace.canvas.openglcommon.fontcache:
  Text drawing method: Multitexturing

crystalspace.canvas.opengl.extmgr:
  WGL Extension 'WGL_ARB_extensions_string' found and used.
  WGL Extension 'WGL_EXT_swap_control' found and used.

crystalspace.canvas.openglwin:
  VSync is disabled.

crystalspace.canvas.opengl.extmgr:
  GL Extension 'GL_version_1_2' found and used.
  GL Extension 'GL_ARB_texture_cube_map' found and used.
  GL Extension 'GL_EXT_texture3D' found and used.
  GL Extension 'GL_ARB_vertex_buffer_object' found and used.
  GL Extension 'GL_SGIS_generate_mipmap' found and used.
  GL Extension 'GL_EXT_texture_filter_anisotropic' found and used.
  GL Extension 'GL_EXT_texture_lod_bias' found and used.
  GL Extension 'GL_ARB_point_parameters' found and used.
  GL Extension 'GL_ARB_point_sprite' not found.
  GL Extension 'GL_EXT_framebuffer_object' not found.
  GL Extension 'GL_ARB_texture_rectangle' not found.
  GL Extension 'GL_EXT_texture_rectangle' found, but not used.
  GL Extension 'GL_NV_texture_rectangle' not found.
  GL Extension 'GL_ARB_vertex_program' found and used.
  GL Extension 'GL_EXT_secondary_color' found and used.

crystalspace.graphics3d.opengl:
  Maximum texture size is 2048x2048

crystalspace.graphics3d.opengl.vbo:
  Setting up VBO buffers, VB: 32 MB IB: 16 MB

crystalspace.graphics3d.opengl:
  Stencil clipping is used for objects >= 50 triangles.
  Clearing Z buffer when stencil clear is needed enabled

crystalspace.graphics3d.shadermgr:
  Loaded compiler plugin crystalspace.graphics3d.shadercompiler.xmlshader,
  compiler: XMLShader

crystalspace.canvas.opengl.extmgr:
  GL Extension 'GL_ARB_texture_compression' found and used.
  GL Extension 'GL_EXT_texture_compression_s3tc' found and used.

crystalspace.graphics3d.opengl:
  Render-to-texture backend: framebuffer
  Delayed buffer swapping: disabled
  AFP DrawPixmap() workaround: disabled

crystalspace.graphics3d.shadercompiler.xmlshader:
  Shader std_lighting_fixed: 8 variations
  Shader std_lighting: 12 variations
  Shader std_lighting_portal: unvarying

crystalspace.mesh.object.thing:
  Lightmap quality=3
  Lightmapping enabled=1

crystalspace.engine.notify:
  Lightmaps are not up to date (no 'lm_precalc_info' found in cache).
  Recalculation of lightmaps forced.
  Initializing lighting (2 meshes).
  Shining lights (0 lights).
  Time taken: 0.0000 seconds.
CS_demoapp DEBUG mode start

crystalspace.canvas.opengl.extmgr:
  GL Extension 'GL_ATI_fragment_shader' found and used.

crystalspace.graphics3d.shader.glcg:
  Routing Cg fragment programs to Pixel Shader plugin ON (default).

crystalspace.canvas.opengl.extmgr:
  GL Extension 'GL_NV_texture_shader' not found.
  GL Extension 'GL_NV_texture_shader2' not found.

crystalspace.graphics3d.shader.glcg:
  CG ERROR : The compile returned an error.
  (39) : warning C7006: uninitialized variable "A2F.surface.texture"
  used
(169) : fatal error C9999: sampler parameter to texture function not a
  uniform sampler

crystalspace.graphics3d.shadercompiler.xmlshader:
  Shader 'std_lighting'<2>: Technique with priority 150 fails. Reason:
  fragment program failed to load.
  No technique validated for shader 'std_lighting'<2>: using fallback

crystalspace.canvas.opengl.extmgr:
  GL Extension 'GL_EXT_separate_specular_color' found and used.
  GL Extension 'GL_ARB_texture_env_dot3' found and used.

crystalspace.graphics3d.shader.fixed:
  Multitexture units: acceptable 6

crystalspace.graphics3d.shadercompiler.xmlshader:
  Shader 'std_lighting_fixed'<2>: Technique with priority 200 succeeds!

If needed i can give to you the source code (is not long).

My computer:
Micosoft Windows XP Home SP2
ATI Radeon 9000
Crystal Space: latest Pseudo Stable Release (0.99 from 27 January 2006)
build with Microsoft Visual Studio 7.1
Logged
LordGordon
Newbie
*
Posts: 19


View Profile WWW
« Reply #3 on: February 20, 2006, 09:34:50 pm »

I have rewritten my data structure and the bug seems to be resolved.
I think that the bug was caused by a pointer error (probably was a dangling reference).

Tomorrow i will do an accurate test to confirm that is not a bug of Crystal Space.
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 7.334 seconds with 16 queries.