Softbody support - New bindings

thios

02-10-2011 14:45:10

I believe that the easiest way to add softbody support to python-ogre is to get bindings working for btogre together with code from here. Has anyone tried this before? Or could someone provide maybe a comprehensible pyplusplus howto about generating new bindings?

dermont

04-10-2011 05:49:17

I believe that the easiest way to add softbody support to python-ogre is to get bindings working for btogre together with code from here. Has anyone tried this before? Or could someone provide maybe a comprehensible pyplusplus howto about generating new bindings?

Interesting link, unfortunately the btOgre implementation will not help since the softbody demo appears to use softbody code directly from the bullet API; for some reason softbody support isn't included in the current bullet module.

Are you building python-ogre from source?

I'll take a look at updating the bullet module ( it will be bullet 2.59) to include softbody support and wrapping the version of btOgre from the link you provided.

dermont

04-10-2011 08:54:42

1) OK updated bullet (2.79) for Linux to include softbody support.

a) Missing classes
- Problem with btTrixIndex (btHashMap /btAlignedObjectArray) and no default ctor/ copty ctor(?):
btSoftBodyConcaveCollisionAlgorithm
btSoftBodyTriangleCallback

- symbol not found loading module on Linux
RayFromToCaster

2) Added btogre module based on code from your link:

a) copy btOgreSoftbodyDemo/demo/data to python-ogre/demos/btogre
b) run demo btogre/test01.py (no input handler - so close as normal linux window)

3) Updated environment.py / PythonOgreConfig_*.py; haven't tested the right version of bullet is downloaded etc., so if there is a problem you may have to modify these files.

Edit:
Let me know how it goes so I can upload a patch for the bullet part to the tracker.

thios

04-10-2011 12:04:20

This is fantastic. The level of support in this forum is the highest I've ever actually seen. Thanks very much! I'll try it and let you know how it goes.

EDIT: I made a fresh build of everything just to keep things neat. I followed linux build v.4 from the wiki and used a gccxml checkout from 01May2011. I tested bullet versions 2.77, 2.78 and 2.79-rev2440.

On ubuntu 11.04 64-bit, compilation of the bullet wrappers fails with:

10-04 22:14 PythonOgre.BuildModule DEBUG
scons: warning: BuildDir() and the build_dir keyword have been deprecated;
use VariantDir() and the variant_dir keyword instead.
File "/home/.../development/python-ogre/SConstruct", line 228, in <module>
/usr/bin/ld: /home/.../development/root/usr/lib/libBulletCollision.a(btAxisSweep3.o): relocation R_X86$
/home/.../development/root/usr/lib/libBulletCollision.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
scons: *** [build_dir_2.7/bullet_2.79-rev2440/bullet.so] Error 1


I'm able to compile the wrappers successfully if I build bullet with -fPIC, by manually adding the following to the root bullet CMakeLists.txt:

SET(CMAKE_C_FLAGS "-fPIC")
SET(CMAKE_CXX_FLAGS "-fPIC")


The bullet wrapper demos work as expected.

The BtOgre wrapper builds fine but then I get an undefined symbol when I try to import it:

Traceback (most recent call last):
File "test01.py", line 14, in <module>
import ogre.physics.btogre as btogre
File "/home/poulos/development/root/usr/lib/python2.7/site-packages/ogre/physics/btogre/__init__.py", line 1, in <module>
from btogre import *
ImportError: /home/poulos/development/root/usr/lib/python2.7/site-packages/ogre/physics/btogre/btogre.so: undefined symbol: _ZN6btDbvtC1Ev


I tried your suggestions in this thread but with no success yet.

I'll investigate this further (although I suspect you'll beat me to it :)).

dermont

05-10-2011 10:08:28

Not sure how much help I can be here, I've always build the python-ogre module using the bullet shared libraries.

I had another stab at building with the bullet static libs and the following changes to environment.py works for me, it should be a simple case of re-linking the modules when you recompile the module, so you can test quickly.

bullet:

libs=[boost.lib]
LINKFLAGS ='-L<your_path_to_lib> -Wl,-Bstatic -Wl,--whole-archive -lBulletWorldImporter -lBulletSoftBody -lBulletDynamics -lBulletCollision -lBulletMultiThreaded -lConvexDecomposition -lGIMPACTUtils -Wl,--no-whole-archive -lLinearMath -lBulletFileLoader -Wl,-Bdynamic'


btogre:

libs = [boost.lib, 'OgreMain']
LINKFLAGS ='-L<your_path_to_lib> -Wl,-Bstatic -Wl,--whole-archive -lBulletSoftBody -lBulletDynamics -lBulletCollision -lBulletMultiThreaded -lConvexDecomposition -lGIMPACTUtils -Wl,--no-whole-archive -lLinearMath -Wl,-Bdynamic'


Other than that you could maybe consider building against the bullet shared libs.

thios

06-10-2011 00:02:11

Either suggestion works... Thanks again!

This time however the demo fails on:

meshutils.meshBuffersToArrays(myMesh, MyMeshData.vertices, ctypes.addressof(indices))

The app gets this far:

...@ADYTON:~/development/python-ogre/demos/btogre$ python test01.py
Creating resource group General
Creating resource group Internal
Creating resource group Autodetect
SceneManagerFactory for type 'DefaultSceneManager' registered.
Registering ResourceManager for type Material
Registering ResourceManager for type Mesh
Registering ResourceManager for type Skeleton
MovableObjectFactory for type 'ParticleSystem' registered.
OverlayElementFactory for type Panel registered.
OverlayElementFactory for type BorderPanel registered.
OverlayElementFactory for type TextArea registered.
Registering ResourceManager for type Font
ArchiveFactory for archive type FileSystem registered.
ArchiveFactory for archive type Zip registered.
DDS codec registering
FreeImage version: 3.13.1
This program uses FreeImage, a free, open source image library supporting all common bitmap formats. See http://freeimage.sourceforge.net for details
Supported formats: bmp,ico,jpg,jif,jpeg,jpe,jng,koa,iff,lbm,mng,pbm,pbm,pcd,pcx,pgm,pgm,png,ppm,ppm,ras,tga,targa,tif,tiff,wap,wbmp,wbm,psd,cut,xbm,xpm,gif,hdr,g3,sgi,exr,j2k,j2c,jp2,pfm,pct,pict,pic,bay,bmq,cr2,crw,cs1,dc2,dcr,dng,erf,fff,hdr,k25,kdc,mdc,mos,mrw,nef,orf,pef,pxn,raf,raw,rdc,sr2,srf,arw,3fr,cine,ia,kc2,mef,nrw,qtk,rw2,sti,drf,dsc,ptx,cap,iiq,rwz
Registering ResourceManager for type HighLevelGpuProgram
Registering ResourceManager for type Compositor
MovableObjectFactory for type 'Entity' registered.
MovableObjectFactory for type 'Light' registered.
MovableObjectFactory for type 'BillboardSet' registered.
MovableObjectFactory for type 'ManualObject' registered.
MovableObjectFactory for type 'BillboardChain' registered.
MovableObjectFactory for type 'RibbonTrail' registered.
Loading library /home/.../development/root/usr/lib/OGRE/RenderSystem_GL
Installing plugin: GL RenderSystem
OpenGL Rendering Subsystem created.
Plugin successfully installed
Loading library /home/.../development/root/usr/lib/OGRE/Plugin_ParticleFX
Installing plugin: ParticleFX
Particle Emitter Type 'Point' registered
Particle Emitter Type 'Box' registered
Particle Emitter Type 'Ellipsoid' registered
Particle Emitter Type 'Cylinder' registered
Particle Emitter Type 'Ring' registered
Particle Emitter Type 'HollowEllipsoid' registered
Particle Affector Type 'LinearForce' registered
Particle Affector Type 'ColourFader' registered
Particle Affector Type 'ColourFader2' registered
Particle Affector Type 'ColourImage' registered
Particle Affector Type 'ColourInterpolator' registered
Particle Affector Type 'Scaler' registered
Particle Affector Type 'Rotator' registered
Particle Affector Type 'DirectionRandomiser' registered
Particle Affector Type 'DeflectorPlane' registered
Plugin successfully installed
Loading library /home/.../development/root/usr/lib/OGRE/Plugin_BSPSceneManager
Installing plugin: BSP Scene Manager
Plugin successfully installed
Loading library /home/.../development/root/usr/lib/OGRE/Plugin_OctreeSceneManager
Installing plugin: Octree & Terrain Scene Manager
Plugin successfully installed
Loading library /home/.../development/root/usr/lib/OGRE/Plugin_CgProgramManager
Installing plugin: Cg Program Manager
Plugin successfully installed
*-*-* OGRE Initialising
*-*-* Version 1.7.2 (Cthugha)
Creating resource group Bootstrap
Added resource location './data/OgreCore.zip' of type 'Zip' to resource group 'Bootstrap'
Added resource location './data' of type 'FileSystem' to resource group 'General'
Added resource location './data/Meshes' of type 'FileSystem' to resource group 'General'
Added resource location './data/Textures' of type 'FileSystem' to resource group 'General'
Added resource location '../ogreode/media' of type 'FileSystem' to resource group 'General'
Added resource location '../ogreode/media/materials' of type 'FileSystem' to resource group 'General'
Added resource location '../ogreode/media/materials/scripts' of type 'FileSystem' to resource group 'General'
Added resource location '../ogreode/media/materials/textures' of type 'FileSystem' to resource group 'General'
Added resource location '../ogreode/media/models' of type 'FileSystem' to resource group 'General'
CPU Identifier & Features
-------------------------
* CPU ID: GenuineIntel: Intel(R) Core(TM) i3 CPU 540 @ 3.07GHz
* SSE: yes
* SSE2: yes
* SSE3: yes
* MMX: yes
* MMXEXT: yes
* 3DNOW: no
* 3DNOWEXT: no
* CMOV: yes
* TSC: yes
* FPU: yes
* PRO: yes
* HT: no
-------------------------
******************************
*** Starting GLX Subsystem ***
******************************
GLRenderSystem::_createRenderWindow "OGRE Render Window", 800x600 windowed miscParams: FSAA=0 displayFrequency=60 MHz gamma=No vsync=No
GLXWindow::create used FBConfigID = 39
GL_VERSION = 4.1.10665 Compatibility Profile Context
GL_VENDOR = ATI Technologies Inc.
GL_RENDERER = AMD Radeon HD 6900 Series
GL_EXTENSIONS = GL_AMDX_debug_output GL_AMDX_vertex_shader_tessellator GL_AMD_blend_minmax_factor GL_AMD_conservative_depth GL_AMD_debug_output GL_AMD_depth_clamp_separate GL_AMD_draw_buffers_blend GL_AMD_name_gen_delete GL_AMD_performance_monitor GL_AMD_sample_positions GL_AMD_seamless_cubemap_per_texture GL_AMD_shader_stencil_export GL_AMD_shader_trace GL_AMD_texture_cube_map_array GL_AMD_texture_texture4 GL_AMD_transform_feedback3_lines_triangles GL_AMD_vertex_shader_tessellator GL_ARB_ES2_compatibility GL_ARB_blend_func_extended GL_ARB_color_buffer_float GL_ARB_copy_buffer GL_ARB_depth_buffer_float GL_ARB_depth_clamp GL_ARB_depth_texture GL_ARB_draw_buffers GL_ARB_draw_buffers_blend GL_ARB_draw_elements_base_vertex GL_ARB_draw_indirect GL_ARB_draw_instanced GL_ARB_explicit_attrib_location GL_ARB_fragment_coord_conventions GL_ARB_fragment_program GL_ARB_fragment_program_shadow GL_ARB_fragment_shader GL_ARB_framebuffer_object GL_ARB_framebuffer_sRGB GL_ARB_geometry_shader4 GL_ARB_get_program_binary GL_ARB_gpu_shader5 GL_ARB_gpu_shader_fp64 GL_ARB_half_float_pixel GL_ARB_half_float_vertex GL_ARB_imaging GL_ARB_instanced_arrays GL_ARB_map_buffer_range GL_ARB_multisample GL_ARB_multitexture GL_ARB_occlusion_query GL_ARB_occlusion_query2 GL_ARB_pixel_buffer_object GL_ARB_point_parameters GL_ARB_point_sprite GL_ARB_provoking_vertex GL_ARB_sample_shading GL_ARB_sampler_objects GL_ARB_seamless_cube_map GL_ARB_separate_shader_objects GL_ARB_shader_bit_encoding GL_ARB_shader_objects GL_ARB_shader_precision GL_ARB_shader_stencil_export GL_ARB_shader_subroutine GL_ARB_shader_texture_lod GL_ARB_shading_language_100 GL_ARB_shadow GL_ARB_shadow_ambient GL_ARB_sync GL_ARB_tessellation_shader GL_ARB_texture_border_clamp GL_ARB_texture_buffer_object GL_ARB_texture_buffer_object_rgb32 GL_ARB_texture_compression GL_ARB_texture_compression_bptc GL_ARB_texture_compression_rgtc GL_ARB_texture_cube_map GL_ARB_texture_cube_map_array GL_ARB_texture_env_add GL_ARB_texture_env_combine GL_ARB_texture_env_crossbar GL_ARB_texture_env_dot3 GL_ARB_texture_float GL_ARB_texture_gather GL_ARB_texture_mirrored_repeat GL_ARB_texture_multisample GL_ARB_texture_non_power_of_two GL_ARB_texture_query_lod GL_ARB_texture_rectangle GL_ARB_texture_rg GL_ARB_texture_rgb10_a2ui GL_ARB_texture_snorm GL_ARB_timer_query GL_ARB_transform_feedback2 GL_ARB_transform_feedback3 GL_ARB_transpose_matrix GL_ARB_uniform_buffer_object GL_ARB_vertex_array_bgra GL_ARB_vertex_array_object GL_ARB_vertex_attrib_64bit GL_ARB_vertex_buffer_object GL_ARB_vertex_program GL_ARB_vertex_shader GL_ARB_vertex_type_2_10_10_10_rev GL_ARB_viewport_array GL_ARB_window_pos GL_ATI_draw_buffers GL_ATI_envmap_bumpmap GL_ATI_fragment_shader GL_ATI_meminfo GL_ATI_separate_stencil GL_ATI_texture_compression_3dc GL_ATI_texture_env_combine3 GL_ATI_texture_float GL_ATI_texture_mirror_once GL_EXT_abgr GL_EXT_bgra GL_EXT_bindable_uniform GL_EXT_blend_color GL_EXT_blend_equation_separate GL_EXT_blend_func_separate GL_EXT_blend_minmax GL_EXT_blend_subtract GL_EXT_compiled_vertex_array GL_EXT_copy_buffer GL_EXT_copy_texture GL_EXT_direct_state_access GL_EXT_draw_buffers2 GL_EXT_draw_instanced GL_EXT_draw_range_elements GL_EXT_fog_coord GL_EXT_framebuffer_blit GL_EXT_framebuffer_multisample GL_EXT_framebuffer_object GL_EXT_framebuffer_sRGB GL_EXT_geometry_shader4 GL_EXT_gpu_program_parameters GL_EXT_gpu_shader4 GL_EXT_histogram GL_EXT_multi_draw_arrays GL_EXT_packed_depth_stencil GL_EXT_packed_float GL_EXT_packed_pixels GL_EXT_pixel_buffer_object GL_EXT_point_parameters GL_EXT_provoking_vertex GL_EXT_rescale_normal GL_EXT_secondary_color GL_EXT_separate_specular_color GL_EXT_shader_image_load_store GL_EXT_shadow_funcs GL_EXT_stencil_wrap GL_EXT_subtexture GL_EXT_texgen_reflection GL_EXT_texture3D GL_EXT_texture_array GL_EXT_texture_buffer_object GL_EXT_texture_compression_bptc GL_EXT_texture_compression_latc GL_EXT_texture_compression_rgtc GL_EXT_texture_compression_s3tc GL_EXT_texture_cube_map GL_EXT_texture_edge_clamp GL_EXT_texture_env_add GL_EXT_texture_env_combine GL_EXT_texture_env_dot3 GL_EXT_texture_filter_anisotropic GL_EXT_texture_integer GL_EXT_texture_lod GL_EXT_texture_lod_bias GL_EXT_texture_mirror_clamp GL_EXT_texture_object GL_EXT_texture_rectangle GL_EXT_texture_sRGB GL_EXT_texture_shared_exponent GL_EXT_texture_snorm GL_EXT_texture_swizzle GL_EXT_timer_query GL_EXT_transform_feedback GL_EXT_vertex_array GL_EXT_vertex_array_bgra GL_EXT_vertex_attrib_64bit GL_IBM_texture_mirrored_repeat GL_KTX_buffer_region GL_NV_blend_square GL_NV_conditional_render GL_NV_copy_depth_to_color GL_NV_explicit_multisample GL_NV_float_buffer GL_NV_half_float GL_NV_primitive_restart GL_NV_texgen_reflection GL_NV_texture_barrier GL_SGIS_generate_mipmap GL_SGIS_texture_edge_clamp GL_SGIS_texture_lod GL_SUN_multi_draw_arrays GL_WIN_swap_hint WGL_EXT_swap_control
Supported GLX extensions: GLX_ARB_create_context GLX_ARB_create_context_profile GLX_ARB_get_proc_address GLX_ARB_multisample GLX_EXT_import_context GLX_EXT_visual_info GLX_EXT_visual_rating GLX_MESA_swap_control GLX_NV_swap_group GLX_OML_swap_method GLX_SGI_make_current_read GLX_SGI_swap_control GLX_SGI_video_sync GLX_SGIS_multisample GLX_SGIX_fbconfig GLX_SGIX_pbuffer GLX_SGIX_swap_barrier GLX_SGIX_swap_group GLX_SGIX_visual_select_group GLX_EXT_texture_from_pixmap
***************************
*** GL Renderer Started ***
***************************
Registering ResourceManager for type GpuProgram
GLSL support detected
GL: Using GL_EXT_framebuffer_object for rendering to textures (best)
FBO PF_UNKNOWN depth/stencil support: D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
FBO PF_L8 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
FBO PF_L16 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
FBO PF_A8 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
FBO PF_A4L4 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
FBO PF_BYTE_LA depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
FBO PF_R5G6B5 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
FBO PF_B5G6R5 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
FBO PF_A4R4G4B4 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
FBO PF_A1R5G5B5 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
FBO PF_R8G8B8 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
FBO PF_B8G8R8 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
FBO PF_A8R8G8B8 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
FBO PF_B8G8R8A8 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
FBO PF_A2R10G10B10 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
FBO PF_A2B10G10R10 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
FBO PF_FLOAT16_RGB depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
FBO PF_FLOAT16_RGBA depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
FBO PF_FLOAT32_RGB depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
FBO PF_FLOAT32_RGBA depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
FBO PF_X8R8G8B8 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
FBO PF_X8B8G8R8 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
FBO PF_SHORT_RGBA depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
FBO PF_R3G3B2 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
FBO PF_FLOAT16_R depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
FBO PF_FLOAT32_R depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
FBO PF_SHORT_GR depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
FBO PF_FLOAT16_GR depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
FBO PF_FLOAT32_GR depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
FBO PF_SHORT_RGB depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
[GL] : Valid FBO targets PF_UNKNOWN PF_L8 PF_L16 PF_A8 PF_A4L4 PF_BYTE_LA PF_R5G6B5 PF_B5G6R5 PF_A4R4G4B4 PF_A1R5G5B5 PF_R8G8B8 PF_B8G8R8 PF_A8R8G8B8 PF_B8G8R8A8 PF_A2R10G10B10 PF_A2B10G10R10 PF_FLOAT16_RGB PF_FLOAT16_RGBA PF_FLOAT32_RGB PF_FLOAT32_RGBA PF_X8R8G8B8 PF_X8B8G8R8 PF_SHORT_RGBA PF_R3G3B2 PF_FLOAT16_R PF_FLOAT32_R PF_SHORT_GR PF_FLOAT16_GR PF_FLOAT32_GR PF_SHORT_RGB
RenderSystem capabilities
-------------------------
RenderSystem Name: OpenGL Rendering Subsystem
GPU Vendor: ati
Device Name: AMD Radeon HD 6900 Series
Driver Version: 4.1.10665.0
* Fixed function pipeline: yes
* Hardware generation of mipmaps: no
* Texture blending: yes
* Anisotropic texture filtering: yes
* Dot product texture operation: yes
* Cube mapping: yes
* Hardware stencil buffer: yes
- Stencil depth: 8
- Two sided stencil support: yes
- Wrap stencil values: yes
* Hardware vertex / index buffers: yes
* Vertex programs: yes
* Number of floating-point constants for vertex programs: 256
* Number of integer constants for vertex programs: 0
* Number of boolean constants for vertex programs: 0
* Fragment programs: yes
* Number of floating-point constants for fragment programs: 256
* Number of integer constants for fragment programs: 0
* Number of boolean constants for fragment programs: 0
* Geometry programs: yes
* Number of floating-point constants for geometry programs: 256
* Number of integer constants for geometry programs: 0
* Number of boolean constants for geometry programs: 0
* Supported Shader Profiles: arbfp1 arbvp1 glsl gp4gp gpu_gp nvgp4 ps_1_1 ps_1_2 ps_1_3 ps_1_4
* Texture Compression: yes
- DXT: yes
- VTC: no
- PVRTC: no
* Scissor Rectangle: yes
* Hardware Occlusion Query: yes
* User clip planes: yes
* VET_UBYTE4 vertex element type: yes
* Infinite far plane projection: yes
* Hardware render-to-texture: yes
* Floating point textures: yes
* Non-power-of-two textures: yes
* Volume textures: yes
* Multiple Render Targets: 8
- With different bit depths: yes
* Point Sprites: yes
* Extended point parameters: yes
* Max Point Size: 8192
* Vertex texture fetch: yes
* Number of world matrices: 0
* Number of texture units: 16
* Stencil buffer depth: 8
* Number of vertex blend matrices: 0
- Max vertex textures: 16
- Vertex textures shared: yes
* Render to Vertex Buffer : no
* GL 1.5 without VBO workaround: no
* Frame Buffer objects: yes
* Frame Buffer objects (ARB extension): no
* Frame Buffer objects (ATI extension): no
* PBuffer support: yes
* GL 1.5 without HW-occlusion workaround: no
Registering ResourceManager for type Texture
DefaultWorkQueue('Root') initialising on thread 0x2934ac0.
DefaultWorkQueue('Root')::WorkerFunc - thread 0x2f698c0 starting.
DefaultWorkQueue('Root')::WorkerFunc - thread 0x2f6a2d0 starting.
DefaultWorkQueue('Root')::WorkerFunc - thread 0x7f76cc0008b0 starting.
DefaultWorkQueue('Root')::WorkerFunc - thread 0x7f76cc000b70 starting.
Particle Renderer Type 'billboard' registered
SceneManagerFactory for type 'BspSceneManager' registered.
Registering ResourceManager for type BspLevel
SceneManagerFactory for type 'OctreeSceneManager' registered.
SceneManagerFactory for type 'TerrainSceneManager' registered.
Parsing scripts for resource group Autodetect
Finished parsing scripts for resource group Autodetect
Parsing scripts for resource group Bootstrap
Parsing script OgreCore.material
Parsing script OgreProfiler.material
Parsing script Ogre.fontdef
Parsing script OgreDebugPanel.overlay
Texture: New_Ogre_Border_Center.png: Loading 1 faces(PF_A8R8G8B8,256x128x1) with 5 generated mipmaps from Image. Internal format is PF_A8R8G8B8,256x128x1.
Texture: New_Ogre_Border.png: Loading 1 faces(PF_A8R8G8B8,256x256x1) with 5 generated mipmaps from Image. Internal format is PF_A8R8G8B8,256x256x1.
Texture: New_Ogre_Border_Break.png: Loading 1 faces(PF_A8R8G8B8,32x32x1) with 5 generated mipmaps from Image. Internal format is PF_A8R8G8B8,32x32x1.
Texture: ogretext.png: Loading 1 faces(PF_A8R8G8B8,256x128x1) with 5 generated mipmaps from Image. Internal format is PF_A8R8G8B8,256x128x1.
Parsing script OgreLoadingPanel.overlay
Finished parsing scripts for resource group Bootstrap
Parsing scripts for resource group General
Parsing script Objects.material
Parsing script TestLevel.material
Parsing script Tuch.material
Parsing script racingcircuit.material
Parsing script tail_rotor.material
Parsing script zombie.material
Compiler error: reference to a non existing object in zombie.material(9)
Compiler error: reference to a non existing object in zombie.material(21)
Parsing script target.material
Parsing script kk3d.material
Parsing script jeep_body.material
Parsing script gun.material
Parsing script main_rotor.material
Parsing script door.material
Parsing script capsule.material
Parsing script landscape.material
Parsing script ball.material
Parsing script scooby_wheel.material
Parsing script apache_body.material
Parsing script autoterraintexture.material
Compiler error: number expected in autoterraintexture.material(43): incorrect float constant declaration
Parsing script scooby_body.material
Parsing script plane.material
Parsing script jeep_wheell.material
Parsing script crate.material
Parsing script jeep_wheelr.material
Parsing script ogreodedemos.particle
Parsing script myExplosion.particle
Parsing script ogreodedemos.overlay
Texture: target.png: Loading 1 faces(PF_A8R8G8B8,45x45x1) with 5 generated mipmaps from Image. Internal format is PF_A8R8G8B8,45x45x1.
Finished parsing scripts for resource group General
Parsing scripts for resource group Internal
Finished parsing scripts for resource group Internal
Creating resource group BtOgre
Mesh: Loading TestLevel_b0.mesh.
WARNING: TestLevel_b0.mesh is an older format ([MeshSerializer_v1.40]); you should upgrade it as soon as possible using the OgreMeshUpgrade tool.
Texture: Soil.jpg: Loading 1 faces(PF_R8G8B8,512x512x1) with 5 generated mipmaps from Image. Internal format is PF_X8R8G8B8,512x512x1.
Mesh: Loading Tuch.mesh.
WARNING: Tuch.mesh is an older format ([MeshSerializer_v1.40]); you should upgrade it as soon as possible using the OgreMeshUpgrade tool.
Texture: ist2_225083-texture-towel.jpg: Loading 1 faces(PF_R8G8B8,380x285x1) with 5 generated mipmaps from Image. Internal format is PF_X8R8G8B8,380x285x1.


...and then crashes with either of the following:

Creating softbody 0
dupVerticesCount 36
newVertexCount 40
python: malloc.c:3096: sYSMALLOc: Assertion `(old_top == (((mbinptr) (((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size) >= (unsigned long)((((__builtin_offsetof (struct malloc_chunk, fd_nextsize))+((2 * (sizeof(size_t))) - 1)) & ~((2 * (sizeof(size_t))) - 1))) && ((old_top)->size & 0x1) && ((unsigned long)old_end & pagemask) == 0)' failed.
Aborted


... or:

*** glibc detected *** python: malloc(): memory corruption: 0x0000000003fa52e0 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x79d7a)[0x7fa659095d7a]
/lib/x86_64-linux-gnu/libc.so.6(__libc_malloc+0x6e)[0x7fa65909831e]
/usr/lib/x86_64-linux-gnu/libstdc++.so.6(_Znwm+0x1d)[0x7fa652907e0d]
/usr/lib/x86_64-linux-gnu/libstdc++.so.6(_Znam+0x9)[0x7fa652907f29]
/home/.../development/root/usr/lib/libboost_python.so.1.42.0(+0x2f016)[0x7fa65262e016]
/home/.../development/root/usr/lib/libboost_python.so.1.42.0(+0x2f9d8)[0x7fa65262e9d8]
/home/.../development/root/usr/lib/python2.7/site-packages/ogre/physics/btogre/_btogre_.so(_ZN5boost6python7objects12value_holderI22BtOgreSoftBody_wrapperE5holdsENS0_9type_infoEb+0xa1)[0x7fa64a7ffaa1]
/home/.../development/root/usr/lib/libboost_python.so.1.42.0(_ZN5boost6python7objects18find_instance_implEP7_objectNS0_9type_infoEb+0x71)[0x7fa652625bc1]
/home/.../development/root/usr/lib/libboost_python.so.1.42.0(_ZN5boost6python9converter22get_lvalue_from_pythonEP7_objectRKNS1_12registrationE+0x23)[0x7fa652620cf3]
/home/.../development/root/usr/lib/python2.7/site-packages/ogre/physics/btogre/_btogre_.so(_ZN5boost6python9converter25reference_arg_from_pythonIRN6BtOgre14BtOgreSoftBodyEEC2EP7_object+0x16)[0x7fa64a7ffef6]
/home/.../development/root/usr/lib/python2.7/site-packages/ogre/physics/btogre/_btogre_.so(_ZN5boost6python6detail12caller_arityILj6EE4implIPFNS0_3api6objectERN6BtOgre14BtOgreSoftBodyEPN4Ogre6EntityEjPKNSA_7Vector3EjjENS0_21default_call_policiesENS_3mpl7vector7IS6_S9_SC_jSF_jjEEEclEP7_objectSO_+0x47)[0x7fa64a8006b7]
/home/.../development/root/usr/lib/libboost_python.so.1.42.0(_ZNK5boost6python7objects8function4callEP7_objectS4_+0x2be)[0x7fa65262962e]
/home/.../development/root/usr/lib/libboost_python.so.1.42.0(+0x2a888)[0x7fa652629888]
/home/.../development/root/usr/lib/libboost_python.so.1.42.0(_ZNK5boost6python6detail17exception_handlerclERKNS_9function0IvEE+0x43)[0x7fa652632d73]
/home/.../development/root/usr/lib/python2.7/site-packages/ogre/renderer/OGRE/_ogre_.so(_ZN5boost6detail8function21function_obj_invoker2INS_3_bi6bind_tIbNS_6python6detail19translate_exceptionIN4Ogre22UnimplementedExceptionEPFvRKS9_EEENS3_5list3INS_3argILi1EEENSG_ILi2EEENS3_5valueISD_EEEEEEbRKNS6_17exception_handlerERKNS_9function0IvEEE6invokeERNS1_15function_bufferESP_ST_+0x13)[0x7fa6573a8c23]
/home/.../development/root/usr/lib/libboost_python.so.1.42.0(_ZNK5boost6python6detail17exception_handlerclERKNS_9function0IvEE+0x23)[0x7fa652632d53]
/home/.../development/root/usr/lib/python2.7/site-packages/ogre/renderer/OGRE/_ogre_.so(_ZN5boost6detail8function21function_obj_invoker2INS_3_bi6bind_tIbNS_6python6detail19translate_exceptionIN4Ogre25RuntimeAssertionExceptionEPFvRKS9_EEENS3_5list3INS_3argILi1EEENSG_ILi2EEENS3_5valueISD_EEEEEEbRKNS6_17exception_handlerERKNS_9function0IvEEE6invokeERNS1_15function_bufferESP_ST_+0x13)[0x7fa65728c333]
/home/.../development/root/usr/lib/libboost_python.so.1.42.0(_ZNK5boost6python6detail17exception_handlerclERKNS_9function0IvEE+0x23)[0x7fa652632d53]
/home/.../development/root/usr/lib/python2.7/site-packages/ogre/renderer/OGRE/_ogre_.so(_ZN5boost6detail8function21function_obj_invoker2INS_3_bi6bind_tIbNS_6python6detail19translate_exceptionIN4Ogre21RenderingAPIExceptionEPFvRKS9_EEENS3_5list3INS_3argILi1EEENSG_ILi2EEENS3_5valueISD_EEEEEEbRKNS6_17exception_handlerERKNS_9function0IvEEE6invokeERNS1_15function_bufferESP_ST_+0x13)[0x7fa657288053]
/home/.../development/root/usr/lib/libboost_python.so.1.42.0(_ZNK5boost6python6detail17exception_handlerclERKNS_9function0IvEE+0x23)[0x7fa652632d53]
/home/.../development/root/usr/lib/python2.7/site-packages/ogre/renderer/OGRE/_ogre_.so(_ZN5boost6detail8function21function_obj_invoker2INS_3_bi6bind_tIbNS_6python6detail19translate_exceptionIN4Ogre21ItemIdentityExceptionEPFvRKS9_EEENS3_5list3INS_3argILi1EEENSG_ILi2EEENS3_5valueISD_EEEEEEbRKNS6_17exception_handlerERKNS_9function0IvEEE6invokeERNS1_15function_bufferESP_ST_+0x13)[0x7fa657130cf3]
/home/.../development/root/usr/lib/libboost_python.so.1.42.0(_ZNK5boost6python6detail17exception_handlerclERKNS_9function0IvEE+0x23)[0x7fa652632d53]
/home/.../development/root/usr/lib/python2.7/site-packages/ogre/renderer/OGRE/_ogre_.so(_ZN5boost6detail8function21function_obj_invoker2INS_3_bi6bind_tIbNS_6python6detail19translate_exceptionIN4Ogre21InvalidStateExceptionEPFvRKS9_EEENS3_5list3INS_3argILi1EEENSG_ILi2EEENS3_5valueISD_EEEEEEbRKNS6_17exception_handlerERKNS_9function0IvEEE6invokeERNS1_15function_bufferESP_ST_+0x13)[0x7fa65712ca13]
/home/.../development/root/usr/lib/libboost_python.so.1.42.0(_ZNK5boost6python6detail17exception_handlerclERKNS_9function0IvEE+0x23)[0x7fa652632d53]
/home/.../development/root/usr/lib/python2.7/site-packages/ogre/renderer/OGRE/_ogre_.so(_ZN5boost6detail8function21function_obj_invoker2INS_3_bi6bind_tIbNS_6python6detail19translate_exceptionIN4Ogre26InvalidParametersExceptionEPFvRKS9_EEENS3_5list3INS_3argILi1EEENSG_ILi2EEENS3_5valueISD_EEEEEEbRKNS6_17exception_handlerERKNS_9function0IvEEE6invokeERNS1_15function_bufferESP_ST_+0x13)[0x7fa657128733]
/home/.../development/root/usr/lib/libboost_python.so.1.42.0(_ZNK5boost6python6detail17exception_handlerclERKNS_9function0IvEE+0x23)[0x7fa652632d53]
/home/.../development/root/usr/lib/python2.7/site-packages/ogre/renderer/OGRE/_ogre_.so(_ZN5boost6detail8function21function_obj_invoker2INS_3_bi6bind_tIbNS_6python6detail19translate_exceptionIN4Ogre22InternalErrorExceptionEPFvRKS9_EEENS3_5list3INS_3argILi1EEENSG_ILi2EEENS3_5valueISD_EEEEEEbRKNS6_17exception_handlerERKNS_9function0IvEEE6invokeERNS1_15function_bufferESP_ST_+0x13)[0x7fa657124453]
/home/.../development/root/usr/lib/libboost_python.so.1.42.0(_ZNK5boost6python6detail17exception_handlerclERKNS_9function0IvEE+0x23)[0x7fa652632d53]
/home/.../development/root/usr/lib/python2.7/site-packages/ogre/renderer/OGRE/_ogre_.so(_ZN5boost6detail8function21function_obj_invoker2INS_3_bi6bind_tIbNS_6python6detail19translate_exceptionIN4Ogre11IOExceptionEPFvRKS9_EEENS3_5list3INS_3argILi1EEENSG_ILi2EEENS3_5valueISD_EEEEEEbRKNS6_17exception_handlerERKNS_9function0IvEEE6invokeERNS1_15function_bufferESP_ST_+0x13)[0x7fa657120173]
/home/.../development/root/usr/lib/libboost_python.so.1.42.0(_ZNK5boost6python6detail17exception_handlerclERKNS_9function0IvEE+0x23)[0x7fa652632d53]
/home/.../development/root/usr/lib/python2.7/site-packages/ogre/renderer/OGRE/_ogre_.so(_ZN5boost6detail8function21function_obj_invoker2INS_3_bi6bind_tIbNS_6python6detail19translate_exceptionIN4Ogre21FileNotFoundExceptionEPFvRKS9_EEENS3_5list3INS_3argILi1EEENSG_ILi2EEENS3_5valueISD_EEEEEEbRKNS6_17exception_handlerERKNS_9function0IvEEE6invokeERNS1_15function_bufferESP_ST_+0x13)[0x7fa6570ed0b3]
/home/.../development/root/usr/lib/libboost_python.so.1.42.0(_ZNK5boost6python6detail17exception_handlerclERKNS_9function0IvEE+0x23)[0x7fa652632d53]
/home/.../development/root/usr/lib/python2.7/site-packages/ogre/renderer/OGRE/_ogre_.so(_ZN5boost6detail8function21function_obj_invoker2INS_3_bi6bind_tIbNS_6python6detail19translate_exceptionIN4Ogre9ExceptionEPFvRKS9_EEENS3_5list3INS_3argILi1EEENSG_ILi2EEENS3_5valueISD_EEEEEEbRKNS6_17exception_handlerERKNS_9function0IvEEE6invokeERNS1_15function_bufferESP_ST_+0x13)[0x7fa6570e7b03]
/home/.../development/root/usr/lib/libboost_python.so.1.42.0(_ZN5boost6python21handle_exception_implENS_9function0IvEE+0x29)[0x7fa652632b19]
/home/.../development/root/usr/lib/libboost_python.so.1.42.0(+0x2bd84)[0x7fa65262ad84]
python(PyObject_Call+0x44)[0x45d864]
python(PyEval_EvalFrameEx+0x9be)[0x496c4e]
python(PyEval_EvalFrameEx+0xb2f)[0x496dbf]
python(PyEval_EvalCodeEx+0x145)[0x49d325]
python[0x4c4526]
python(PyObject_Call+0x44)[0x45d864]
python[0x45f43f]
python(PyObject_Call+0x44)[0x45d864]
python[0x48ae3f]
python[0x48928d]
python(PyObject_Call+0x44)[0x45d864]
python(PyEval_EvalFrameEx+0x9be)[0x496c4e]
python(PyEval_EvalFrameEx+0xb2f)[0x496dbf]
python(PyEval_EvalCodeEx+0x145)[0x49d325]
python(PyEval_EvalCode+0x32)[0x4ecb02]
python[0x4fdc74]
python(PyRun_StringFlags+0x65)[0x4fdeb5]
python(PyEval_EvalFrameEx+0x566c)[0x49b8fc]
python(PyEval_EvalCodeEx+0x145)[0x49d325]
python(PyEval_EvalFrameEx+0x802)[0x496a92]
python(PyEval_EvalCodeEx+0x145)[0x49d325]
python(PyEval_EvalFrameEx+0x802)[0x496a92]
python(PyEval_EvalCodeEx+0x145)[0x49d325]
python(PyEval_EvalCode+0x32)[0x4ecb02]
python[0x4fdc74]
python(PyRun_InteractiveOneFlags+0x1e2)[0x42cd9e]
python(PyRun_InteractiveLoopFlags+0xc0)[0x42cebd]
python(PyRun_AnyFileExFlags+0x39)[0x42d2e1]
======= Memory map: ========
00400000-0062f000 r-xp 00000000 08:01 17040174 /usr/bin/python2.7
0082e000-0082f000 r--p 0022e000 08:01 17040174 /usr/bin/python2.7
0082f000-00897000 rw-p 0022f000 08:01 17040174 /usr/bin/python2.7
00897000-008a9000 rw-p 00000000 00:00 0
01d28000-040e8000 rw-p 00000000 00:00 0 [heap]
7fa63652f000-7fa63be00000 rw-p 00000000 00:00 0
7fa63be00000-7fa63c000000 rw-s ea477000 00:05 10252 /dev/ati/card0
7fa63c000000-7fa63c021000 rw-p 00000000 00:00 0
7fa63c021000-7fa640000000 ---p 00000000 00:00 0
7fa6400ec000-7fa6401ec000 rw-p 00000000 00:00 0
7fa6401ec000-7fa6401ed000 ---p 00000000 00:00 0
7fa6401ed000-7fa6409ed000 rw-p 00000000 00:00 0
7fa6409ed000-7fa6409ee000 ---p 00000000 00:00 0
7fa6409ee000-7fa6411ee000 rw-p 00000000 00:00 0
7fa6411ee000-7fa6411ef000 ---p 00000000 00:00 0
7fa6411ef000-7fa6419ef000 rw-p 00000000 00:00 0
7fa6419ef000-7fa6419f0000 ---p 00000000 00:00 0
7fa6419f0000-7fa6422f1000 rw-p 00000000 00:00 0
7fa6449d4000-7fa6449f3000 r-xp 00000000 08:01 17176874 /usr/lib/python2.7/lib-dynload/_ctypes.so
7fa6449f3000-7fa644bf2000 ---p 0001f000 08:01 17176874 /usr/lib/python2.7/lib-dynload/_ctypes.so
7fa644bf2000-7fa644bf3000 r--p 0001e000 08:01 17176874 /usr/lib/python2.7/lib-dynload/_ctypes.so
7fa644bf3000-7fa644bf7000 rw-p 0001f000 08:01 17176874 /usr/lib/python2.7/lib-dynload/_ctypes.so
7fa644bf7000-7fa644cf8000 rw-p 00000000 00:00 0
7fa644cf8000-7fa645555000 r-xp 00000000 00:16 12460027 /home/.../development/root/usr/lib/libCg.so
7fa645555000-7fa645655000 ---p 0085d000 00:16 12460027 /home/.../development/root/usr/lib/libCg.so
7fa645655000-7fa645a47000 rw-p 0085d000 00:16 12460027 /home/.../development/root/usr/lib/libCg.so
7fa645a47000-7fa645a4e000 rw-p 00000000 00:00 0
7fa645a4e000-7fa645a85000 r-xp 00000000 00:16 12845085 /home/.../development/root/usr/lib/OGRE/Plugin_CgProgramManager.so
7fa645a85000-7fa645c85000 ---p 00037000 00:16 12845085 /home/.../development/root/usr/lib/OGRE/Plugin_CgProgramManager.so
7fa645c85000-7fa645c89000 r--p 00037000 00:16 12845085 /home/.../development/root/usr/lib/OGRE/Plugin_CgProgramManager.so
7fa645c89000-7fa645c8a000 rw-p 0003b000 00:16 12845085 /home/.../development/root/usr/lib/OGRE/Plugin_CgProgramManager.so
7fa645c8a000-7fa645ce5000 r-xp 00000000 00:16 12845086 /home/.../development/root/usr/lib/OGRE/Plugin_OctreeSceneManager.so
7fa645ce5000-7fa645ee5000 ---p 0005b000 00:16 12845086 /home/.../development/root/usr/lib/OGRE/Plugin_OctreeSceneManager.so
7fa645ee5000-7fa645eea000 r--p 0005b000 00:16 12845086 /home/.../development/root/usr/lib/OGRE/Plugin_OctreeSceneManager.so
7fa645eea000-7fa645eeb000 rw-p 00060000 00:16 12845086 /home/.../development/root/usr/lib/OGRE/Plugin_OctreeSceneManager.so
7fa645eeb000-7fa645f2e000 r-xp 00000000 00:16 12845084 /home/.../development/root/usr/lib/OGRE/Plugin_BSPSceneManager.so
7fa645f2e000-7fa64612e000 ---p 00043000 00:16 12845084 /home/.../development/root/usr/lib/OGRE/Plugin_BSPSceneManager.so
7fa64612e000-7fa646131000 r--p 00043000 00:16 12845084 /home/.../development/root/usr/lib/OGRE/Plugin_BSPSceneManager.so
7fa646131000-7fa646132000 rw-p 00046000 00:16 12845084 /home/.../development/root/usr/lib/OGRE/Plugin_BSPSceneManager.soAborted


I'm going to set up a 32 bit linux system and a win32 to test this there as well.

The non-softbody part of btogre works fine so far.

dermont

06-10-2011 04:47:31

1) The cytpes indices implementation should be c_ulong not c_int, not too sure if this will resolve your problem.


import ctypes
_type = ctypes.c_ulong
face_count = 3*MyMeshData.triangleCount
indices = (_type*face_count)(0)
ptr = ctypes.addressof(indices)

print ctypes.sizeof(_type)
print type(ptr), ptr.bit_length()

## -----------------------------
## MeshUtils.* meshBuffersToArrays
## -----------------------------
## a) wrapper
## unsigned int indices
## reinterpret_cast< long unsigned int * >( indices )
## b) c++
## unsigned long* indices

meshutils.meshBuffersToArrays(myMesh, MyMeshData.vertices, ptr)

index = 0
faces=(_type * (face_count)).from_address(ptr)
for j in range(0,len(faces),3):

print '(%d,%d,%d) ' %(faces[index], faces[index+1], faces[index+2])
index+=3

## -----------------------------
## BtOgreSoftBody.* create(..)
## -----------------------------
# a) wrapper
# unsigned int indexBuffer
# reinterpret_cast< unsigned int const * >( indexBuffer )
# b) c++
# const unsigned int* indexBuffer

psb = self.softBody.create(entity,MyMeshData.vertexCount, MyMeshData.vertices,face_count,ptr)



2) There appear to be a number of 64bit issues with python-ogre:
viewtopic.php?f=3&t=14510

3) Does the C++ demo run on your 64bit machine. If you need makefile etc. to build let me know.

4) I've seen similar errors to this before with libraries out of sync - but since the rest of the lib works OK I doubt this is the problem; more likely something wrong with my code.

If the demo works as expected on your machine as a temp workaround I will add some handwrapped code to encapsulate the meshBuffersToArrays/softBody->create and return a softbody (unless of course you want to have a go).

thios

06-10-2011 16:35:34

Suggestion #1 worked fine. Everything else I've tested is looking good so far!

dermont

09-10-2011 10:03:55

Ok glad you got it working, the btogre module probably still needs some work.

I've made some minor updates to the bullet softbody code generators and after I finish building I'll upload to sourceforge tracker. Anything else you have come across or any nice demos you want to share for testing?


btSoftBodyData
- added following missing classes:
SoftBodyMaterialData
SoftBodyNodeData
SoftBodyLinkData
SoftBodyTetraData
SoftRigidAnchorData
SoftBodyConfigData
SoftBodyPoseData
SoftBodyClusterData

btSoftBodyHelpers
- added convenience funtion CreateSBFromConvexHullByList
vertices = [bullet.btVector3(v0,v1,v2),
bullet.btVector3(v3,v4,v5),
.. ]

softbody=bullet.CreateSBFromConvexHullByList(
m_softBodyWorldInfo,
vertices,
len(vertices),
True)

btSoftRigidCollisionAlgorithm
- following classes now included (both non copyable resolves btTriIndex issue)
btSoftBodyConcaveCollisionAlgorithm
btSoftBodyTriangleCallback

btSoftBodyFloatData
- btSoftBodyFloatData::m_materials now wrapped as getMaterials
b = btSoftBodyFloatData()
matList = b.getMaterials()

btAlignedObjectArray
- following now included:
btAlignedObjectArray<btHashKey<btTriIndex>,btTriIndex>

btAlignedObjectArray<btHashKey<btTriIndex>>

btAlignedObjectArray<btTriIndex>

thios

09-10-2011 22:23:00

I've been working on converting my own projects from ogrebullet to btogre as a means of testing it (I'm mainly using collisions), and it's all going smoothly. Thanks again!

I also found out that it's apparently very easy to get blender models to play nice with the softbody part. You can use this exporter, and manually set use32bitindexes="True" in the .mesh.xml file.

I'll post snippets as I proceed!

EDIT: OK, I'm still not comfortable enough with softbodies to write demos about it, but here's a little something that shows some stuff about bullet and your new bindings:
-moving/scaling both physics bodies and ogre nodes with BtOgre.RigidBodyState
-raycasting with btogre/bullet

It's basically the python-ogre wiki Intermediate Tutorial #3 converted to use btogre/bullet. While I'm not using dynamics, I'm still initialising a dynamicsworld, as there's no debug drawer for btCollisionWorld. I'm also using the "official" PyCEGUI bindings instead of the ones generated with the python-ogre build system.

I hope it'll be of help to someone!

Quick question: Have you tried to build the bullet wrapper from source on windows? (So as to take advantage of the softbody support you kindly provided.)

On XP 32-bit using MSVC2008 I'm getting the following while building the bindings:

cl /FoC:\temp\build_dir_2.7\bullet_rev2440\btSparseSdf_3.pypp.obj /c generated\bullet_rev2440\btSparseSdf_3.pypp.cpp /nologo /DBOOST_PYTHON_MAX_ARITY=19 /DBOOST_PYTHON_NO_PY_SIGNATURES /nologo -Zm200 /W3 /wd4675 /TP /MD /Zc:forScope /EHs /c /Ob2 /Oi /O2 /Ot /Oy /GS- /GR /Ox -IC:\development\python-ogre\generated\bullet_rev2440 -D"NDEBUG" -D"_CONSOLE" -D"WIN32" -D"_MBCS" /fp:fast /Gy /GF -Iinclude /TP /nologo /DBOOST_PYTHON_MAX_ARITY=19 /DBOOST_PYTHON_NO_PY_SIGNATURES /nologo -Zm200 /W3 /wd4675 /TP /MD /Zc:forScope /EHs /c /Ob2 /Oi /O2 /Ot /Oy /GS- /GR /Ox -IC:\development\python-ogre\generated\bullet_rev2440 -D"NDEBUG" -D"_CONSOLE" -D"WIN32" -D"_MBCS" /fp:fast /Gy /GF -Iinclude /IC:\development\boost_1_45_0 /IC:\development\bullet-2.79\src /IC:\development\bullet-2.79 /IC:\Python27\include /IC:\development\boost_1_45_0
btSparseSdf_3.pypp.cpp
C:\development\boost_1_45_0\boost/python/class.hpp(543) : error C2664: 'boost::mpl::vector2<T0,T1> boost::python::detail::get_signature<btSparseSdf<CELLSIZE>::IntFrac,btScalar>(RT (__cdecl *)(float),void *)' : cannot convert parameter 1 from 'btSparseSdf<CELLSIZE>::IntFrac ' to 'btSparseSdf<CELLSIZE>::IntFrac (__cdecl *)(T0)'
with
[
T0=btSparseSdf<3>::IntFrac,
T1=btScalar,
CELLSIZE=3,
RT=btSparseSdf<3>::IntFrac
]
and
[
CELLSIZE=3
]
and
[
CELLSIZE=3,
T0=btScalar
]
Incompatible calling conventions for UDT return value
C:\development\boost_1_45_0\boost/python/class.hpp(614) : see reference to function template instantiation 'void boost::python::class_<W>::def_impl<btSparseSdf<CELLSIZE>,btSparseSdf<CELLSIZE>::IntFrac(__cdecl *)(btScalar),boost::python::detail::def_helper<T1>>(T *,const char *,Fn,const Helper &,...)' being compiled
with
[
W=btSparseSdf<3>,
CELLSIZE=3,
T1=boost::python::detail::keywords<1>,
T=btSparseSdf<3>,
Fn=btSparseSdf<3>::IntFrac (__cdecl *)(btScalar),
Helper=boost::python::detail::def_helper<boost::python::detail::keywords<1>>
]
C:\development\boost_1_45_0\boost/python/class.hpp(244) : see reference to function template instantiation 'void boost::python::class_<W>::def_maybe_overloads<btSparseSdf<CELLSIZE>::IntFrac(__cdecl *)(btScalar),A2>(const char *,Fn,const A1 &,...)' being compiled
with
[
W=btSparseSdf<3>,
CELLSIZE=3,
A2=boost::python::detail::keywords<1>,
Fn=btSparseSdf<3>::IntFrac (__cdecl *)(btScalar),
A1=boost::python::detail::keywords<1>
]
generated\bullet_rev2440\btSparseSdf_3.pypp.cpp(34) : see reference to function template instantiation 'boost::python::class_<W> &boost::python::class_<W>::def<btSparseSdf<CELLSIZE>::IntFrac(__cdecl *)(btScalar),boost::python::detail::keywords<1>>(const char *,A1,const A2 &)' being compiled
with
[
W=btSparseSdf<3>,
CELLSIZE=3,
A1=btSparseSdf<3>::IntFrac (__cdecl *)(btScalar),
A2=boost::python::detail::keywords<1>
]
C:\development\boost_1_45_0\boost/python/class.hpp(544) : error C2780: 'boost::python::api::object boost::python::make_function(F,const CallPolicies &,const KeywordsOrSignature &)' : expects 3 arguments - 4 provided
C:\development\boost_1_45_0\boost/python/make_function.hpp(115) : see declaration of 'boost::python::make_function'
C:\development\boost_1_45_0\boost/python/class.hpp(544) : error C2780: 'boost::python::api::object boost::python::make_function(F,const CallPolicies &)' : expects 2 arguments - 4 provided
C:\development\boost_1_45_0\boost/python/make_function.hpp(108) : see declaration of 'boost::python::make_function'
C:\development\boost_1_45_0\boost/python/class.hpp(544) : error C2780: 'boost::python::api::object boost::python::make_function(F)' : expects 1 arguments - 4 provided
C:\development\boost_1_45_0\boost/python/make_function.hpp(101) : see declaration of 'boost::python::make_function'
scons: building terminated because of errors.

10-12 17:56 PythonOgre.BuildModule DEBUG scons: *** [C:\temp\build_dir_2.7\bullet_rev2440\btSparseSdf_3.pypp.obj] Error 2


Any insight? :)

dermont

13-10-2011 14:22:00

Hi you "post a reply" rather than editing your old post, otherwise people may miss your additional comments.


I've been working on converting my own projects from ogrebullet to btogre as a means of testing it (I'm mainly using collisions), and it's all going smoothly. Thanks again!

I also found out that it's apparently very easy to get blender models to play nice with the softbody part. You can use this exporter, and manually set use32bitindexes="True" in the .mesh.xml file.

I'll post snippets as I proceed!

EDIT: OK, I'm still not comfortable enough with softbodies to write demos about it, but here's a little something that shows some stuff about bullet and your new bindings:
-moving/scaling both physics bodies and ogre nodes with BtOgre.RigidBodyState
-raycasting with btogre/bullet

It's basically the python-ogre wiki Intermediate Tutorial #3 converted to use btogre/bullet. While I'm not using dynamics, I'm still initialising a dynamicsworld, as there's no debug drawer for btCollisionWorld. I'm also using the "official" PyCEGUI bindings instead of the ones generated with the python-ogre build system.

I hope it'll be of help to someone!


Thanks I'll take a look at your demo. At the moment I'm still testing the updates using the bullet SoftBody demo, I've attached the tests and latest code_generators (full directory zipped up) - you will to back up your code_generators/bullet directory first.


Quick question: Have you tried to build the bullet wrapper from source on windows? (So as to take advantage of the softbody support you kindly provided.)

On XP 32-bit using MSVC2008 I'm getting the following while building the bindings:

cl /FoC:\temp\build_dir_2.7\bullet_rev2440\btSparseSdf_3.pypp.obj /c generated\bullet_rev2440\btSparseSdf_3.pypp.cpp /nologo /DBOOST_PYTHON_MAX_ARITY=19 /DBOOST_PYTHON_NO_PY_SIGNATURES /nologo -Zm200 /W3 /wd4675 /TP /MD /Zc:forScope /EHs /c /Ob2 /Oi /O2 /Ot /Oy /GS- /GR /Ox -IC:\development\python-ogre\generated\bullet_rev2440 -D"NDEBUG" -D"_CONSOLE" -D"WIN32" -D"_MBCS" /fp:fast /Gy /GF -Iinclude /TP /nologo /DBOOST_PYTHON_MAX_ARITY=19 /DBOOST_PYTHON_NO_PY_SIGNATURES /nologo -Zm200 /W3 /wd4675 /TP /MD /Zc:forScope /EHs /c /Ob2 /Oi /O2 /Ot /Oy /GS- /GR /Ox -IC:\development\python-ogre\generated\bullet_rev2440 -D"NDEBUG" -D"_CONSOLE" -D"WIN32" -D"_MBCS" /fp:fast /Gy /GF -Iinclude /IC:\development\boost_1_45_0 /IC:\development\bullet-2.79\src /IC:\development\bullet-2.79 /IC:\Python27\include /IC:\development\boost_1_45_0
btSparseSdf_3.pypp.cpp
C:\development\boost_1_45_0\boost/python/class.hpp(543) : error C2664: 'boost::mpl::vector2<T0,T1> boost::python::detail::get_signature<btSparseSdf<CELLSIZE>::IntFrac,btScalar>(RT (__cdecl *)(float),void *)' : cannot convert parameter 1 from 'btSparseSdf<CELLSIZE>::IntFrac ' to 'btSparseSdf<CELLSIZE>::IntFrac (__cdecl *)(T0)'
with
[
T0=btSparseSdf<3>::IntFrac,
T1=btScalar,
CELLSIZE=3,
RT=btSparseSdf<3>::IntFrac
]
and
[
CELLSIZE=3
]
and
[
CELLSIZE=3,
T0=btScalar
]
Incompatible calling conventions for UDT return value
C:\development\boost_1_45_0\boost/python/class.hpp(614) : see reference to function template instantiation 'void boost::python::class_<W>::def_impl<btSparseSdf<CELLSIZE>,btSparseSdf<CELLSIZE>::IntFrac(__cdecl *)(btScalar),boost::python::detail::def_helper<T1>>(T *,const char *,Fn,const Helper &,...)' being compiled
with
[
W=btSparseSdf<3>,
CELLSIZE=3,
T1=boost::python::detail::keywords<1>,
T=btSparseSdf<3>,
Fn=btSparseSdf<3>::IntFrac (__cdecl *)(btScalar),
Helper=boost::python::detail::def_helper<boost::python::detail::keywords<1>>
]
C:\development\boost_1_45_0\boost/python/class.hpp(244) : see reference to function template instantiation 'void boost::python::class_<W>::def_maybe_overloads<btSparseSdf<CELLSIZE>::IntFrac(__cdecl *)(btScalar),A2>(const char *,Fn,const A1 &,...)' being compiled
with
[
W=btSparseSdf<3>,
CELLSIZE=3,
A2=boost::python::detail::keywords<1>,
Fn=btSparseSdf<3>::IntFrac (__cdecl *)(btScalar),
A1=boost::python::detail::keywords<1>
]
generated\bullet_rev2440\btSparseSdf_3.pypp.cpp(34) : see reference to function template instantiation 'boost::python::class_<W> &boost::python::class_<W>::def<btSparseSdf<CELLSIZE>::IntFrac(__cdecl *)(btScalar),boost::python::detail::keywords<1>>(const char *,A1,const A2 &)' being compiled
with
[
W=btSparseSdf<3>,
CELLSIZE=3,
A1=btSparseSdf<3>::IntFrac (__cdecl *)(btScalar),
A2=boost::python::detail::keywords<1>
]
C:\development\boost_1_45_0\boost/python/class.hpp(544) : error C2780: 'boost::python::api::object boost::python::make_function(F,const CallPolicies &,const KeywordsOrSignature &)' : expects 3 arguments - 4 provided
C:\development\boost_1_45_0\boost/python/make_function.hpp(115) : see declaration of 'boost::python::make_function'
C:\development\boost_1_45_0\boost/python/class.hpp(544) : error C2780: 'boost::python::api::object boost::python::make_function(F,const CallPolicies &)' : expects 2 arguments - 4 provided
C:\development\boost_1_45_0\boost/python/make_function.hpp(108) : see declaration of 'boost::python::make_function'
C:\development\boost_1_45_0\boost/python/class.hpp(544) : error C2780: 'boost::python::api::object boost::python::make_function(F)' : expects 1 arguments - 4 provided
C:\development\boost_1_45_0\boost/python/make_function.hpp(101) : see declaration of 'boost::python::make_function'
scons: building terminated because of errors.

10-12 17:56 PythonOgre.BuildModule DEBUG scons: *** [C:\temp\build_dir_2.7\bullet_rev2440\btSparseSdf_3.pypp.obj] Error 2


Any insight? :)


Sorry it's been some time since I've built on Windows, you may have to wait for Andy to do his next round of updates. I'll try and take a look this weekend, the above updates will not resolve your problem.

dermont

13-10-2011 14:49:02

Ok uploaded the patch/tests to sourceforge, seemingly I've exceeded my Ogre forum upload quota.
https://sourceforge.net/tracker/?func=d ... tid=916690
https://sourceforge.net/tracker/?func=d ... tid=916690

dermont

13-10-2011 15:34:11

For your Windows build problem try excluding btSparseSdf, edit bullet/generate_code.py:


def ManualExclude ( mb ):

excludes = [
#'btAlignedAllocator< btSoftBody::ePSolver::_, 16u >',
...
,'btSparseSdf< 3 >' <-----------------
]


It means that you can't use m_softBodyWorldInfo.m_sparsesdf but at the present moment it can't be called fully from python anyway.

Edit:
Sorry just tried the above and whilst it builds m_softBodyWorldInfo.m_sparsesdf is needed to run the demo. I'll take a look at building it at the weekend on Windows.

dermont

13-10-2011 16:24:52

For your Windows build problem try excluding btSparseSdf, edit bullet/generate_code.py:


def ManualExclude ( mb ):

excludes = [
#'btAlignedAllocator< btSoftBody::ePSolver::_, 16u >',
...
,'btSparseSdf< 3 >' <-----------------
]


It means that you can't use m_softBodyWorldInfo.m_sparsesdf but at the present moment it can't be called fully from python anyway.

Edit:
Sorry just tried the above and whilst it builds m_softBodyWorldInfo.m_sparsesdf is needed to run the demo. I'll take a look at building it at the weekend on Windows.


OK as a temp workaround try adding the following to the end of ManualExclude in bullet/generate_code.py:

main_ns.class_('btSparseSdf< 3 >').member_functions('Decompose').exclude()

thios

14-10-2011 08:02:42

Bullet/btogre now builds and runs fine on both platforms. You're amazing.. Thanks again!

igrok

16-10-2011 02:24:51

I would also like to register my gratitude. Using dermont's patch I was able to build Bullet 2.79 (rev2440) and run the bullet demos. This was particularly helpful as the stock bullet (r2243) was reporting symbol errors while loading.

dermont

22-10-2011 19:13:04

Some more updates for bullet:
https://sourceforge.net/tracker/downloa ... id=3422961

a) Number fixes for btAlignedObjectArray classes
b) Update bullet.makeSoftBody so it works properly (??)

### ---------------------------------
class CTypeOgreMesh():
### ---------------------------------
def __init__(self, numtriangles, numvertices, gVertices, gTriangles ):
''' Create ctypes bullet trimesh '''
self.NUM_TRIANGLES = numtriangles
self.NUM_INDICES = numtriangles*3
self.NUM_VERTICES = numvertices*3

storageclass2 = ctypes.c_ulong * self.NUM_INDICES
indices=storageclass2(0)
ctypes.memset ( indices, 0, self.NUM_INDICES )

ind = 0
for f in gTriangles:
indices[ind] = f[0]
indices[ind+1] = f[1]
indices[ind+2] = f[2]
print f[0],f[1],f[2]
ind+=3

storageclass = ctypes.c_float * self.NUM_VERTICES
vertices=storageclass(0.0)
ctypes.memset ( vertices, 0, self.NUM_VERTICES )
ind=0
for v in gVertices:
vertices[ind]=v[0]
vertices[ind+1]=v[1]
vertices[ind+2]=v[2]
ind+=3

''' Need to store mesh indices/vertices whilst being used by bullet '''
self.indices = indices
self.vertices = vertices

def __del__(self):
del self.indices
del self.vertices

.....

def _convertVerticesToBullet(self, vertices, remove_duplicates=False):
'''Convert flat float vertex array into array of bullet vectors'''
v = vertices
if remove_duplicates:
v = list(set(vertices))

return[ bullet.btVector3(v[i][0],v[i][1],v[i][2] )
for i in range(len(v)) ]

def createTriMeshSBFromHelper(self, m_softBodyWorldInfo):
unqv = list(set(self.vertices))

def lookup_index(tri_ind):
return unqv.index(self.vertices[tri_ind])

tris = []
for tr in self.triangles:
i1 = lookup_index(tr[0])
i2 = lookup_index(tr[1])
i3 = lookup_index(tr[2])
tris.append((i1,i2,i3))

c = CTypeOgreMesh(
len(tris),
len(unqv),
unqv,
tris )
self.ctypesmeshes.append(c)
psb=bullet.btSoftBodyHelpers.CreateFromTriMesh(
m_softBodyWorldInfo,
ctypes.addressof(c.vertices),
ctypes.addressof(c.indices),
c.NUM_TRIANGLES,True)
return psb

def createTriMeshSBManual(self, m_softBodyWorldInfo):
''' Manually add faces to soft body'''
v = self._convertVerticesToBullet(self.vertices)
unqv = list(set(self.vertices))
psb = bullet.makeSoftBody(m_softBodyWorldInfo,len(unqv), self._convertVerticesToBullet(unqv), [])

def lookup_index(tri_ind):
return unqv.index(self.vertices[tri_ind])

#tris = []
for tr in self.triangles:
i1 = lookup_index(tr[0])
i2 = lookup_index(tr[1])
i3 = lookup_index(tr[2])
psb.appendFace(i1,i2,i3)
psb.appendLink(i1,i2)
psb.appendLink(i2,i3)
psb.appendLink(i3,i1)
return psb


c) Renamed tArray<class_name> classes to btAlignedObjectArray_<classname> as
per rest of Array classes
d) Added bullet.HullLibrary and makeHullDesc convenience function,e.g:
bullet.makeHullDesc(bullet.QF_DEFAULT ,len(newverts), newverts, sizeof_btVector3)

import sys
sys.path.insert(0,'..')
import PythonOgreConfig

import ogre.renderer.OGRE as ogre
import SampleFramework as sf

import ogre.sound.ogreoggsound as sound
import ogre.physics.bullet as bullet
import ogre.physics.btogre as btogre
import ogre.io.OIS as OIS

import os
import time
import random
import ctypes

def GetIndices ( indexData ) :
outbuff = []
numTris = indexData.indexCount
if numTris == 0 : return outbuff
else : numTris /= 3

ibuf = indexData.indexBuffer
if ibuf.getType() == ogre.HardwareIndexBuffer.IT_32BIT:
Use32Bit = True
else: Use32Bit = False

buffer = ibuf.lock(ogre.HardwareBuffer.HBL_READ_ONLY)
address = ogre.castAsInt ( buffer )

for i in range( numTris ):
if Use32Bit:
l = ogre.getUint32 ( ogre.castAsVoidPtr ( address ), 3 )
address += ibuf.getIndexSize() * 3
else:
l = ogre.getUint16 ( ogre.castAsVoidPtr ( address ), 3 )
address += ibuf.getIndexSize() * 3
#outbuff.append(tuple(l))
outbuff.append((l[0],l[1],l[2]))
ibuf.unlock()
return outbuff


def GetVertices ( vertex_data, transform ) :
outbuff = []
# get the start of the element
posElem = vertex_data.vertexDeclaration.findElementBySemantic(ogre.VertexElementSemantic.VES_POSITION)
vbuf = vertex_data.vertexBufferBinding.getBuffer(posElem.getSource())

# get the start of the actual buffer
vertex = vbuf.lock(ogre.HardwareBuffer.HBL_READ_ONLY)
# what we need is the actual address of the buffer, so we have to check if there's an offset as well
# the is basically what baseVertexPointerToElement does
newaddress = posElem.getOffset() + ogre.castAsInt(vertex) # note the cast to int to get the address
for i in range (vertex_data.vertexCount):
points = ogre.getFloat( ogre.castAsVoidPtr ( newaddress), 3 ) # note the getFloat and Cast back to a pointer :)

#_transform
vec = transform * ogre.Vector3(points[0],points[1],points[2])
outbuff.append(tuple((vec.x,vec.y,vec.z)))
#self.boundingbox.merge(vec)
newaddress += vbuf.getVertexSize()
vbuf.unlock()
return outbuff


## -----------------------------------------------------------------
class DebugObject(ogre.ManualObject):
## -----------------------------------------------------------------
def __init__(self, name, entity):
ogre.ManualObject.__init__(self,name)
self.setRenderQueueGroup(ogre.RENDER_QUEUE_6 )

renderop = ogre.RenderOperation.OT_LINE_LIST
## ogre.RenderOperation.OT_POINT_LIST,
## ogre.RenderOperation.OT_TRIANGLE_LIST]

groupsubMesh = True

### create debug materials
mat = ogre.MaterialManager.getSingleton().create('debug',"General")
r,g,b = (1,0,0)
mat.setReceiveShadows(False)
mat.getTechnique(0).setLightingEnabled(True)
mat.getTechnique(0).getPass(0).setSelfIllumination(r,g,b)
mat.getTechnique(0).getPass(0).setDiffuse(r,g,b,1.0)
mat.getTechnique(0).getPass(0).setAmbient(r,g,b)
mat.getTechnique(0).getPass(0).setShininess(110)
mat.getTechnique(0).getPass(0).setDepthBias(1.0)

sizeof_btVector3=16
vertices=[]
triangles=[]
for i in range(entity.getMesh().numSubMeshes):
sm = entity.getMesh().getSubMesh(i)
## retrieve vertex and index data
vertices+= GetVertices (
sm.vertexData,
entity.getParentSceneNode()._getFullTransform())
triangles+= GetIndices (
sm.indexData)

newverts = []
for t in triangles:
v1 = vertices[t[0]]
v2 = vertices[t[1]]
v3 = vertices[t[2]]
newverts.append( bullet.btVector3( v1[0], v1[1], v1[2]) )
newverts.append( bullet.btVector3( v2[0], v2[1], v2[2]) )
newverts.append( bullet.btVector3( v3[0], v3[1], v3[2]) )

hdsc = bullet.makeHullDesc(bullet.QF_DEFAULT ,len(newverts), newverts, sizeof_btVector3)

## manually create our convex hull
hlib = bullet.HullLibrary()
hdsc.mMaxVertices=len(newverts) #100 - set to your own value to reduce vertices
hres = bullet.HullResult()
hlib.CreateConvexHull(hdsc,hres)
print dir(hlib)
print "Number Hull Faces " , hres.mNumFaces
print "Number Hull Vertices " , hres.mNumOutputVertices
print "Vertex Stride " , hdsc.mVertexStride
print "Num Input Vertices " , hdsc.mVcount
print "Max Num Vertices Considered" , hdsc.mMaxVertices
print "Max Num Faces Considered" , hdsc.mMaxFaces
print "Duplicate Epsilon" , hdsc.mNormalEpsilon

self.begin(mat.getName() , renderop )

if renderop == ogre.RenderOperation.OT_TRIANGLE_LIST:
for i in range(hres.m_OutputVertices.size()):
v = hres.m_OutputVertices[i]
self.position(v.x(), v.y(), v.z())
for i in range(hres.mNumFaces):
self.triangle(
hres.m_Indices[i*3+0],
hres.m_Indices[i*3+1],
hres.m_Indices[i*3+2] )
elif renderop == ogre.RenderOperation.OT_LINE_LIST:
## retrieve face vertices
for i in range(hres.mNumFaces):
v1 = hres.m_OutputVertices[hres.m_Indices[i*3+ 0]]
v2 = hres.m_OutputVertices[hres.m_Indices[i*3+ 1]]
v3 = hres.m_OutputVertices[hres.m_Indices[i*3+ 2]]

self.position(v1.x(), v1.y(), v1.z())
self.position(v2.x(), v2.y(), v2.z())

self.position(v2.x(), v2.y(), v2.z())
self.position(v3.x(), v3.y(), v3.z())

self.position(v3.x(), v3.y(), v3.z())
self.position(v1.x(), v1.y(), v1.z())
self.end()

## cleanup
hlib.ReleaseResult(hres)
del hres
del hlib
del hdsc
del vertices
del triangles
del newverts

def __del__(self):
n = self.getParentSceneNode()
n.detachObject(self)
#ogre.ManualObject.__del__(self)

class EdgesApplication(sf.Application):
def __init__(self):
sf.Application.__init__(self)
self.debugObject = None

def __del__(self):
del self.debugObject
sf.Application.__del__(self)

def _createScene(self):
sceneManager = self.sceneManager
camera = self.camera
ogre.Animation.setDefaultInterpolationMode(ogre.Animation.IM_SPLINE)
sceneManager.AmbientLight = ogre.ColourValue(0.9, 0.9, 0.9)

entity = sceneManager.createEntity('head', 'ogrehead.mesh')
node = sceneManager.getRootSceneNode().createChildSceneNode(ogre.Vector3(-30, 0, 0))
node.attachObject(entity)
node.scale(10.7,10.7,10.7)
self.entity = entity
#self.entity.setVisible(False)

light = sceneManager.createLight('BlueLight')
light.setPosition (-200, -80, -100)
light.setDiffuseColour (ogre.ColourValue(0.5, 0.5, 1.0) )

light = sceneManager.createLight('GreenLight')
light.setPosition (0, 0, -100)
light.setDiffuseColour (0.5, 1.0, 0.5)

self.debugObject = DebugObject("TEST", entity)
n = self.sceneManager.getRootSceneNode().createChildSceneNode()
n.attachObject(self.debugObject)
n.scale(1.01,1.01,1.01)

def _createFrameListener(self):
self.frameListener = SkeletalAnimationFrameListener(self.renderWindow, self.camera)
self.root.addFrameListener(self.frameListener)

class SkeletalAnimationFrameListener(sf.FrameListener):
def __init__(self, renderWindow, camera):
sf.FrameListener.__init__(self, renderWindow, camera)

def frameStarted(self, frameEvent):
return sf.FrameListener.frameStarted(self, frameEvent)

if __name__ == '__main__':
try:
application = EdgesApplication()
application.go()
except ogre.OgreException, e:
print e

thios

24-10-2011 08:50:28

Thank you!

dermont

29-03-2012 07:35:47

For anyone still using python-ogre/bullet some minor updates for latest version bullet-2.80-rev2527.

Replace code_generators/bullet with contents of bullet-2.80-rev2527.tar.bz2, update bullet module in environment.py (version = "2.80") and generate/compile etc. Also update, if soft body support required, packages_2.7/physics/bullet/__init__.py (example included) for some soft body variables:

packages_2.7/physics/bullet/__init__.py

from _bullet_ import *
import sys
SIMD_2_PI =6.283185307179586232
SIMD_PI = SIMD_2_PI * 0.5
SIMD_HALF_PI = SIMD_2_PI * 0.25
SIMD_RADS_PER_DEG = SIMD_2_PI / 360.0
SIMD_DEGS_PER_RAD = 360.0 / SIMD_2_PI
SIMDSQRT12 = 0.7071067811865475244008443621048490
def btRecipSqrt(x):
return (float((float(1.0)/_bullet_.btSqrt(float(x)))) )
SIMD_EPSILON=sys.float_info.epsilon
SIMD_INFINITY=sys.float_info.max


No new functionality added so if something is missing or broken let me know.

<Edit>
Apparently the board quota for uploads is exceeded (??) so I've uploaded to sourceforge instead.
https://sourceforge.net/tracker/downloa ... id=3422961

igrok

29-03-2012 16:03:33

For anyone still using python-ogre/bullet

Thank you! I'm certainly still using Bullet.

Just out of curiosity, is there a different package the majority of developers have switched to?

thios

30-03-2012 08:00:30

I'm also still interested in bullet, so the update is certainly welcome! Thanks!

I'd also like to ask, do you have any plans to use these with python3 linux/windows?

dermont

04-04-2012 06:18:00

@igrok

Hi, not sure what you mean by "different package". I currently use svn trunk modified to build against the latest 1.8 branch of Ogre from Mercurial. There is a patch here for Ogre core modules, only tested on Linux (stiil a couple of problems to iron out).

http://sourceforge.net/tracker/?func=de ... tid=916690

There has also been discussions on the python-ogre developers group regarding switching to Git/Mercurial and other discussions regarding switching from py++ to other forms of code generation.

http://groups.google.com/group/python-o ... f830972891

I don't know the status of the above discussions or when the next updates will take place i.e. maybe when Ogre 1.8 is released??? I know there may be issues with gccxml and VS2010/tr1 which may not be as easily resolved as the fudge to disable tr1 on Linux.

Normally Andy will move to the latest versions of the underlying libs when doing a round of updates but last I heard he didn't have the time to devote to python-ogre.

Hopefully one of the developers can better answer your question.

@thios
No plans to use on Windows, there is a branch for building python-ogre for python3 which requires some updates for the logging module.

http://python-ogre.svn.sourceforge.net/ ... ython-3.x/

http://groups.google.com/group/python-o ... 5f186eb6fc

viewtopic.php?f=3&t=14338

It should be fairly straightforward to convert the bullet module to run under python3 for both Windows and Linux.

thios

05-04-2012 08:10:11

Ah, I see you're using python2 to run the scripts...

Thanks Dermont, I'll see what I can come up with, at least on linux.

Otherwise, let's hope Andy will find the time to support python3 after 1.8 is released.

thios

06-04-2012 22:46:50

I'd just like to report that the 2.80-rev2527 updates work like a charm on x64 linux, but fail while generating the bindings under XP/VS9:

04-06 23:39 PythonOgre.BuildModule DEBUG INFO Creating xml file "C:\development\python-ogre\code_generators\cache\bullet_rev2527_cache.xml" from source file "C:\development\python-ogre\code_generators\bullet\python_bullet.h" ...

INFO gccxml cmd: ""C:\development\gccxml\bin\release\gccxml.exe" -D"_HAS_TR1=0" -I"C:\development\python-ogre" -I"C:\development\boost_1_45_0" -I"C:\development\bullet-2.80-rev2527\src" -I"C:\development\bullet-2.80-rev2527" -D"BULLET_EXPORTS" -D"__GCCXML__" -D"_MSC_VER" -D"__MINGW32__" -D"VERSION_rev2527" "C:\development\python-ogre\code_generators\bullet\python_bullet.h" -fxml="C:\development\python-ogre\code_generators\cache\bullet_rev2527_cache.xml""

INFO Parsing xml file "C:\development\python-ogre\code_generators\cache\bullet_rev2527_cache.xml" ...

INFO GCCXML version - 0.9( 1.128 )

Traceback (most recent call last):

File "generate_code.py", line 1037, in <module>

generate_code()

File "generate_code.py", line 947, in generate_code

ManualExclude ( mb )

File "generate_code.py", line 593, in ManualExclude

main_ns.class_(c).noncopyable = True

File "c:\python27\lib\site-packages\pygccxml\declarations\scopedef.py", line 409, in class_

, recursive=recursive)

File "c:\python27\lib\site-packages\pygccxml\declarations\scopedef.py", line 357, in _find_single

found = matcher_module.matcher.get_single( matcher, decls, False )

File "c:\python27\lib\site-packages\pygccxml\declarations\matcher.py", line 82, in get_single

raise matcher.declaration_not_found_t( decl_matcher )

pygccxml.declarations.matcher.declaration_not_found_t: Unable to find declaration. matcher: [(decl type==class_t) and (name==btThreadSupportInterface)]


Removing the btThreadSupportInterface line from generate_code.py passes the generation stage, but results in a compilation error:

cl /FoC:\temp\build_dir_2.7\bullet_rev2527\bt32BitAxisSweep3.pypp.obj /c generated\bullet_rev2527\bt32BitAxisSweep3.pypp.cpp /nologo /DBOOST_PYTHON_MAX_ARITY=19 /DBOOST_PYTHON_NO_PY_SIGNATURES /nologo -Zm200 /W3 /wd4675 /TP /MD /Zc:forScope /EHs /c /Ob2 /Oi /O2 /Ot /Oy /GS- /GR /Ox -IC:\development\python-ogre\generated\bullet_rev2527 -D"NDEBUG" -D"_CONSOLE" -D"WIN32" -D"_MBCS" /fp:fast /Gy /GF -Iinclude /TP /nologo /DBOOST_PYTHON_MAX_ARITY=19 /DBOOST_PYTHON_NO_PY_SIGNATURES /nologo -Zm200 /W3 /wd4675 /TP /MD /Zc:forScope /EHs /c /Ob2 /Oi /O2 /Ot /Oy /GS- /GR /Ox -IC:\development\python-ogre\generated\bullet_rev2527 -D"NDEBUG" -D"_CONSOLE" -D"WIN32" -D"_MBCS" /fp:fast /Gy /GF -Iinclude /IC:\development\boost_1_45_0 /IC:\development\bullet-2.80-rev2527\src /IC:\development\bullet-2.80-rev2527 /IC:\Python27\include /IC:\development\boost_1_45_0

bt32BitAxisSweep3.pypp.cpp

C:\development\boost_1_45_0\boost/python/converter/as_to_python_function.hpp(21) : error C2719: 'unnamed-parameter': formal parameter with __declspec(align('16')) won't be aligned

C:\development\boost_1_45_0\boost/python/to_python_converter.hpp(88) : see reference to class template instantiation 'boost::python::converter::as_to_python_function<T,ToPython>' being compiled

with

[

T=bt32BitAxisSweep3,

ToPython=boost::python::objects::class_cref_wrapper<bt32BitAxisSweep3,boost::python::objects::make_instance<bt32BitAxisSweep3,boost::python::objects::value_holder<bt32BitAxisSweep3_wrapper>>>

]

C:\development\boost_1_45_0\boost/python/to_python_converter.hpp(82) : while compiling class template member function 'boost::python::to_python_converter<T,Conversion,has_get_pytype>::to_python_converter(void)'

with

[

T=bt32BitAxisSweep3,

Conversion=boost::python::objects::class_cref_wrapper<bt32BitAxisSweep3,boost::python::objects::make_instance<bt32BitAxisSweep3,boost::python::objects::value_holder<bt32BitAxisSweep3_wrapper>>>,

has_get_pytype=true

]

C:\development\boost_1_45_0\boost/python/object/class_wrapper.hpp(26) : see reference to class template instantiation 'boost::python::to_python_converter<T,Conversion,has_get_pytype>' being compiled

with

[

T=bt32BitAxisSweep3,

Conversion=boost::python::objects::class_cref_wrapper<bt32BitAxisSweep3,boost::python::objects::make_instance<bt32BitAxisSweep3,boost::python::objects::value_holder<bt32BitAxisSweep3_wrapper>>>,

has_get_pytype=true

]

C:\development\boost_1_45_0\boost/python/object/class_metadata.hpp(272) : see reference to class template instantiation 'boost::python::objects::class_cref_wrapper<Src,MakeInstance>' being compiled

with

[

Src=bt32BitAxisSweep3,

MakeInstance=boost::python::objects::make_instance<bt32BitAxisSweep3,boost::python::objects::value_holder<bt32BitAxisSweep3_wrapper>>

]

C:\development\boost_1_45_0\boost/python/object/class_metadata.hpp(229) : see reference to function template instantiation 'void boost::python::objects::class_metadata<T,X1,X2,X3>::maybe_register_class_to_python<T2>(T2 *,boost::mpl::false_)' being compiled

with

[

T=bt32BitAxisSweep3_wrapper,

X1=boost::python::bases<btAxisSweep3Internal<unsigned int>>,

X2=boost::python::detail::not_specified,

X3=boost::python::detail::not_specified,

T2=bt32BitAxisSweep3

]

C:\development\boost_1_45_0\boost/python/object/class_metadata.hpp(213) : see reference to function template instantiation 'void boost::python::objects::class_metadata<T,X1,X2,X3>::register_aux2<T2,boost::mpl::bool_<C_>>(T2 *,Callback)' being compiled

with

[

T=bt32BitAxisSweep3_wrapper,

X1=boost::python::bases<btAxisSweep3Internal<unsigned int>>,

X2=boost::python::detail::not_specified,

X3=boost::python::detail::not_specified,

T2=bt32BitAxisSweep3,

C_=true,

Callback=boost::mpl::bool_<true>

]

C:\development\boost_1_45_0\boost/python/object/class_metadata.hpp(205) : see reference to function template instantiation 'void boost::python::objects::class_metadata<T,X1,X2,X3>::register_aux<bt32BitAxisSweep3>(boost::python::wrapper<bt32BitAxisSweep3> *)' being compiled

with

[

T=bt32BitAxisSweep3_wrapper,

X1=boost::python::bases<btAxisSweep3Internal<unsigned int>>,

X2=boost::python::detail::not_specified,

X3=boost::python::detail::not_specified

]

C:\development\boost_1_45_0\boost/python/object/class_metadata.hpp(204) : while compiling class template member function 'void boost::python::objects::class_metadata<T,X1,X2,X3>::register_(void)'

with

[

T=bt32BitAxisSweep3_wrapper,

X1=boost::python::bases<btAxisSweep3Internal<unsigned int>>,

X2=boost::python::detail::not_specified,

X3=boost::python::detail::not_specified

]

C:\development\boost_1_45_0\boost/python/class.hpp(174) : see reference to class template instantiation 'boost::python::objects::class_metadata<T,X1,X2,X3>' being compiled

with

[

T=bt32BitAxisSweep3_wrapper,

X1=boost::python::bases<btAxisSweep3Internal<unsigned int>>,

X2=boost::python::detail::not_specified,

X3=boost::python::detail::not_specified

]

C:\development\boost_1_45_0\boost/python/class.hpp(213) : see reference to class template instantiation 'boost::python::class_<W,X1>::id_vector' being compiled

with

[

W=bt32BitAxisSweep3_wrapper,

X1=boost::python::bases<btAxisSweep3Internal<unsigned int>>

]

generated\bullet_rev2527\bt32BitAxisSweep3.pypp.cpp(191) : see reference to function template instantiation 'boost::python::class_<W,X1>::class_<boost::python::init<T0,T1,T2>>(const char *,const char *,const boost::python::init_base<DerivedT> &)' being compiled

with

[

W=bt32BitAxisSweep3_wrapper,

X1=boost::python::bases<btAxisSweep3Internal<unsigned int>>,

T0=const btVector3 &,

T1=const btVector3 &,

T2=boost::python::optional<unsigned int,btOverlappingPairCache *,bool>,

DerivedT=boost::python::init<const btVector3 &,const btVector3 &,boost::python::optional<unsigned int,btOverlappingPairCache *,bool>>

]

scons: building terminated because of errors.


04-06 23:33 PythonOgre.BuildModule DEBUG scons: *** [C:\temp\build_dir_2.7\bullet_rev2527\bt32BitAxisSweep3.pypp.obj] Error 2

dermont

09-04-2012 04:29:31

I'll try and take a look on Windows in the next couple of days.

dermont

10-04-2012 01:09:55

@thios
Did you manually patch btScalar.h, as suggested by Andy, in environment.py Windows Build Notes?


class bullet(pymodule):
""" Windows Build Notes: --
patch src/LinearMath/btScaler.h -- around line 39 (removes the align 16 issues) to look like:
#ifdef WIN32

#if 1 || defined(__MINGW32__) || defined(__CYGWIN__) || (defined (_MSC_VER) && _MSC_VER < 1300)

build ReleaseDLL and copy generated libs into a single directory ie (PATH_Bullet, 'out/release_dll8/libs')

thios

11-04-2012 09:17:11

Um... I'd forgotten about that, as it wasn't previously necessary...

Bullet once again builds fine... Thanks again!

dermont

03-07-2012 05:24:42

Updates for bullet 2.80 rev 2531 code generators and simple convex demo to test latest changes, only tested on Linux.

Updates:

btConvexHullShape
-----------------
- Constructor btConvexHullShape (const btScalar *points=0, int numPoints=0, int stride=sizeof(btVector3))
first argument is not wrapped.

Previously to add points (where verts is a list of btVector3) you need to specify the following:
shape = bullet.btConvexHullShape()
for n in verts:
shape.addPoint(n)

New :
shape = bullet.makeConvexHullShape(verts,len(verts))

- getUnscaledPoints (return btVector3 *) updated to return returns list of btVector3s
- getPoints (return btVector3 *) updated to return returns list of btVector3s

btHullShape
-----------------
- getVertexPointer
removed (returns const btVector3 *)
replaced by getVertices() (returns list of btVector3)
- getIndexPointer
- removed (returns unsigned int *)
replaced by getIndices() (returns list of ints)

btCollisionShape
----------------
- getUserData(getUserPointer) typo in handwrapped ::btCollisionObject should be ::btCollisionShape

enums
-----
- Added missing enums:
'ICHullError',
'eStatus',
'SolverTypes',
'eGIMPACT_SHAPE_TYPE',
'HullError',
'BroadphaseNativeTypes',
'CollisionFlags',
'CollisionObjectTypes',
'sStatus',
'eBT_PLANE_INTERSECTION_TYPE',
'CollisionFilterGroups',
'BufferTypes',
'DebugDrawModes',
'HullFlag'
'EFlags',
'DispatchFunc'

HACD
--------
Wrapped no testing.


In environment.py you need to add HACD to your link flags.

LINKFLAGS ='''-L/usr/local/lib -Wl,-Bstatic -Wl,--whole-archive -lBulletWorldImporter -lHACD -lBulletSoftBody -lBulletDynamics -lBulletCollision -lBulletMultiThreaded -lConvexDecomposition -lGIMPACTUtils -Wl,--no-whole-archive -lLinearMath -lBulletFileLoader -Wl,-Bdynamic'''

pradhoom

27-11-2012 05:03:43

I have used OGRE in C++ a little and know the basics. I recently decided to try the python binding. I just successfully built and tested python-ogre from svn trunk with ogre 1.7.4. I followed discussion on this thread and sucessfully built bullet-2.80-rev2527 and tested the demos. I sincerely want to thank dermont & thios for such valuable infos and your works.

As I have been following, I see you guys mentioning btOgre module for python-ogre, if I am not mistaken, but I can't seem to find any further info or download link to that. I would greatly appreciate if you could give me some info regarding that.

dermont

30-11-2012 15:53:38

I have used OGRE in C++ a little and know the basics. I recently decided to try the python binding. I just successfully built and tested python-ogre from svn trunk with ogre 1.7.4. I followed discussion on this thread and sucessfully built bullet-2.80-rev2527 and tested the demos. I sincerely want to thank dermont & thios for such valuable infos and your works.

As I have been following, I see you guys mentioning btOgre module for python-ogre, if I am not mistaken, but I can't seem to find any further info or download link to that. I would greatly appreciate if you could give me some info regarding that.

Yeah the btOgre module was pretty much a one-off based on the link supplied by thois ie. a demo that showed bullet softbody support with ogre. The build files AFAIR was uploaded to the forum but removed due to a problem with the forum and exceeded quota upload limit.

Unfortunately other than very simple meshes bullet softbody and updating ogre meshes is just too slow.

The python demos that I did were based on the bullet ones, creating a softbody from an ogre mesh and displaying the softbody debug data; that was as far as I took it.

If you really want that version of btogre I'll try and dig it out and build it against the later version of bullet or if you want to use softbody support with python-ogre I'll try and help.

pradhoom

30-11-2012 16:52:44

Hey dermont,
Actually, at the moment I am just trying to learn bullet physics with ogre. BtOgre seemed to be the most current and flexible choice. I am not yet at the skill level for SoftBody physics in bullet+ogre, so I am just looking to play around with RigidBody physics. It would certainly be nice to have BtOgre module for python-ogre consistent with the C++ version. As I want to use python/python-ogre as a quick prototyping tool for learning purposes, I could later apply it to C++ with little effort.

I figured that BtOgre module would be difficult to find, so I am actually trying to write my own wrapper for bullet resembling Nikki's BtOgre. I have not got much time to give for it at the moment and as I am new to python, I don't know how will it go :D

It would really be nice if you could find that BtOgre module. It would save me from the trouble of rewriting (lazy me :D) something that is already freely available. But either way, it's fun experience with python, ogre and bullet. Thanks.

igrok

30-11-2012 17:17:28

I had RigidBody working fairly well earlier this year. Have a look at my code.

OGRE/Bullet glue code:
http://code.google.com/p/battlestar-tux ... 96588aa5c5

Initializing OGRE and Bullet:
http://code.google.com/p/battlestar-tux ... 327935905d

pradhoom

30-11-2012 17:46:10

Thanks igrok. Just had a quick look, that will help me learn a lot. :)

dermont

30-11-2012 18:06:37

@pradhoom

I'll look at creating a btogre module based on the official (Niki's) btogre source tomorrow.

pradhoom

30-11-2012 18:43:02

Thanks dermont, that would be great.

dermont

01-12-2012 05:35:02

viewtopic.php?f=3&t=29749