It is currently Sat Aug 22, 2020 1:34 pm


All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Building polyvox for python
PostPosted: Mon Oct 08, 2012 11:05 am 

Joined: Mon Oct 08, 2012 10:56 am
Posts: 3
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 :)


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Building polyvox for python
PostPosted: Mon Oct 08, 2012 12:59 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
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.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Building polyvox for python
PostPosted: Mon Oct 08, 2012 1:35 pm 

Joined: Mon Oct 08, 2012 10:56 am
Posts: 3
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)


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Building polyvox for python
PostPosted: Mon Oct 08, 2012 2:50 pm 
Developer
User avatar

Joined: Sun May 11, 2008 4:29 pm
Posts: 198
Location: UK
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.

_________________
Matt Williams
Linux/CMake guy


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Building polyvox for python
PostPosted: Mon Oct 08, 2012 8:12 pm 

Joined: Mon Oct 08, 2012 10:56 am
Posts: 3
--
-- 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


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Building polyvox for python
PostPosted: Wed Oct 10, 2012 10:03 am 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
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.


Top
Offline Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme created StylerBB.net