Volumes Of Fun
http://www.volumesoffun.com/phpBB3/

Building polyvox for python
http://www.volumesoffun.com/phpBB3/viewtopic.php?f=14&t=448
Page 1 of 1

Author:  ttouch [ Mon Oct 08, 2012 11:05 am ]
Post subject:  Building polyvox for python

Hello,

I have no idea of swig and i want to build polyvox with python bindings. :roll:
I have archlinux x64 with:
cmake 2.8.9
boost 1.50.0
swig 2.0.8

what should I do?
I don't know C++ so, a diff would be really useful (because i saw that some code changes have to be made)

thank you in advance :)

Author:  David Williams [ Mon Oct 08, 2012 12:59 pm ]
Post subject:  Re: Building polyvox for python

I have to say that the Python bindings are not in very good shape, so you probably won't be able to get them working unless you are proficient with both C++ and SWIG. Many of the wrappers are missing so you need to implement the SWIG code for those, and you'll need to understand (and probably modify) the C++ as well. It's not really a task for someone who is new to PolyVox.

That said, there is a basic Python test which proves that it is at least possible. This is not included in the last stable release but is in the Git master, so that is the version you will need. If your working on Linux and have all the required libraries installed then the bindings should be created automatically as part of the build.

Author:  ttouch [ Mon Oct 08, 2012 1:35 pm ]
Post subject:  Re: Building polyvox for python

hmm, ok thank you.
If anyone is kind enough to provide me these, (swing & C++ code) I would appreciate it. :)
I have no idea of C++ & SWING (I don't even know what this is)

Author:  milliams [ Mon Oct 08, 2012 2:50 pm ]
Post subject:  Re: Building polyvox for python

I'm the one responsible for the SWIG bindings and as Dave says, they're currently only in an experimental state so I can't guarantee that they work. Firstly, are you running the latest version from Git (and if not, which version are you running? You'll need a recent version). Then, the thing to check is that the build system is working to create the bindings. In the CMake output, you should see something like
Quote:
-- Build bindings: ON
near the end. Do you?


If you do then run 'make && make test'. The first test that gets run should be called PythonSurfaceExtractorTest and hopefully it will pass. If it doesn't then let me know.

If it works, then look in tests/TestSurfaceExtractor.py and have a look at how it works. I copy it here:
Code:
import PolyVoxCore

#Create a small volume
r = PolyVoxCore.Region(PolyVoxCore.Vector3DInt32(0,0,0), PolyVoxCore.Vector3DInt32(31,31,31))
vol = PolyVoxCore.SimpleVolumeDensity8(r)
#Set one single voxel to have a reasonably high density
vol.setVoxelAt(PolyVoxCore.Vector3DInt32(5, 5, 5), PolyVoxCore.Density8(200))
mesh = PolyVoxCore.SurfaceMeshPositionMaterialNormal()
extractor = PolyVoxCore.SurfaceExtractorSimpleVolumeDensity8(vol, r, mesh)
extractor.execute()
mesh now contains the vertices and edges you need to pass to OpenGL to render the volume.

Author:  ttouch [ Mon Oct 08, 2012 8:12 pm ]
Post subject:  Re: Building polyvox for python

--
-- Summary
-- -------
-- Library type: DYNAMIC
-- Build examples: ON
-- Build tests: ON
-- Build bindings: ON
-- API Docs available: NO
-- - Qt Help bundling: OFF
-- Build manual: OFF
--
-- Configuring done
-- Generating done

this is a part of the AUR package polyvox-git output
here is all the output: http://pastebin.com/HJT06Det

Author:  David Williams [ Wed Oct 10, 2012 10:03 am ]
Post subject:  Re: Building polyvox for python

It looks like it built the bindings, so what happens if you now run 'make tests'? Hopefully it will execture the Python test along with the others.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/