ravidavi / openframes Goto Github PK
View Code? Open in Web Editor NEWRealtime interactive scientific visualization API
License: Apache License 2.0
Realtime interactive scientific visualization API
License: Apache License 2.0
Any plans to Integrate this with WebGL such that the 3d views are renderable in a web browser?
The SWIG-produced Python interface doesn't work on a Mac with an Anaconda distribution of Python.
A workaround is to add -undefined dynamic_lookup
to the linker properties in swig/CMakelists.txt
like so:
Replace:
SWIG_LINK_LIBRARIES(PyOFInterfaceC ${PYTHON_LIBRARY} OpenFrames_Interface_C)
with:
if(APPLE)
# for anaconda
SWIG_LINK_LIBRARIES(PyOFInterfaceC OpenFrames_Interface_C)
SET_TARGET_PROPERTIES(${SWIG_MODULE_PyOFInterfaceC_REAL_NAME} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
else()
SWIG_LINK_LIBRARIES(PyOFInterfaceC ${PYTHON_LIBRARY} OpenFrames_Interface_C)
endif()
And this:
SWIG_LINK_LIBRARIES(PyOFInterfaceIFORT ${PYTHON_LIBRARY} OpenFrames_Interface_IFORT)
with this:
if(APPLE)
# for anaconda
SWIG_LINK_LIBRARIES(PyOFInterfaceIFORT OpenFrames_Interface_IFORT)
SET_TARGET_PROPERTIES(${SWIG_MODULE_PyOFInterfaceIFORT_REAL_NAME} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
else()
SWIG_LINK_LIBRARIES(PyOFInterfaceIFORT ${PYTHON_LIBRARY} OpenFrames_Interface_IFORT)
endif()
I think this breaks linking with the Python.org distribution though. Ideally, it should work for both.
For the build script I show in Issue #5, if I update the SWIG version to 4.1.1 (which is the latest), the build fails. I get errors like this:
[46/80] Swig compile PyOF.i for python
FAILED: swig/CMakeFiles/_PyOF.dir/PyOFPYTHON_wrap.cxx swig/PyOF.py /OpenFrames/build/swig/CMakeFiles/_PyOF.dir/PyOFPYTHON_wrap.cxx /OpenFrames/build/swig/PyOF.py
cd /OpenFrames/build/swig && /OpenFrames/build/osgenv/bin/cmake -E make_directory /OpenFrames/build/swig/CMakeFiles/_PyOF.dir /OpenFrames/build/swig /OpenFrames/build/swig/CMakeFiles/_PyOF.dir && /OpenFrames/build/osgenv/bin/cmake -E env SWIG_LIB=/OpenFrames/build/osgenv/share/swig/4.1.1 /OpenFrames/build/osgenv/bin/swig -python -I/OpenFrames/build/osgenv/include/python3.9 -I/OpenFrames/include -I/OpenFrames/build/osgenv/include -D_WIN64 -DOF_EXPORT -outdir /OpenFrames/build/swig -c++ -interface _PyOF -o /OpenFrames/build/swig/CMakeFiles/_PyOF.dir/PyOFPYTHON_wrap.cxx /OpenFrames/swig/PyOF.i
/OpenFrames/include/OpenFrames/FrameTransform.hpp:37: Error: Syntax error in input(1).
[55/80] Building CXX object Demos/CPP/oflighting/CMakeFiles/oflighting.dir/oflighting.cpp.o
ninja: build stopped: subcommand failed.
[9/27] Swig compile /OpenFrames/build/swig/PyOFInterfaceC.i for python
FAILED: swig/CMakeFiles/_PyOFInterfaceC.dir/PyOFInterfaceCPYTHON_wrap.cxx swig/PyOFInterfaceC.py /OpenFrames/build/swig/CMakeFiles/_PyOFInterfaceC.dir/PyOFInterfaceCPYTHON_wrap.cxx /OpenFrames/build/swig/PyOFInterfaceC.py
cd /OpenFrames/build/swig && /OpenFrames/build/osgenv/bin/cmake -E make_directory /OpenFrames/build/swig/CMakeFiles/_PyOFInterfaceC.dir /OpenFrames/build/swig /OpenFrames/build/swig/CMakeFiles/_PyOFInterfaceC.dir && /OpenFrames/build/osgenv/bin/cmake -E env SWIG_LIB=/OpenFrames/build/osgenv/share/swig/4.1.1 /OpenFrames/build/osgenv/bin/swig -python -I/OpenFrames/build/osgenv/include/python3.9 -I/OpenFrames/include -D_WIN64 -DOF_EXPORT -outdir /OpenFrames/build/swig -c++ -interface _PyOFInterfaceC -o /OpenFrames/build/swig/CMakeFiles/_PyOFInterfaceC.dir/PyOFInterfaceCPYTHON_wrap.cxx /OpenFrames/build/swig/PyOFInterfaceC.i
/OpenFrames/include/OpenFrames/OF_Interface.h:85: Error: Syntax error in input(1).
[10/27] Swig compile PyOF.i for python
FAILED: swig/CMakeFiles/_PyOF.dir/PyOFPYTHON_wrap.cxx swig/PyOF.py /OpenFrames/build/swig/CMakeFiles/_PyOF.dir/PyOFPYTHON_wrap.cxx /OpenFrames/build/swig/PyOF.py
cd /OpenFrames/build/swig && /OpenFrames/build/osgenv/bin/cmake -E make_directory /OpenFrames/build/swig/CMakeFiles/_PyOF.dir /OpenFrames/build/swig /OpenFrames/build/swig/CMakeFiles/_PyOF.dir && /OpenFrames/build/osgenv/bin/cmake -E env SWIG_LIB=/OpenFrames/build/osgenv/share/swig/4.1.1 /OpenFrames/build/osgenv/bin/swig -python -I/OpenFrames/build/osgenv/include/python3.9 -I/OpenFrames/include -I/OpenFrames/build/osgenv/include -D_WIN64 -DOF_EXPORT -outdir /OpenFrames/build/swig -c++ -interface _PyOF -o /OpenFrames/build/swig/CMakeFiles/_PyOF.dir/PyOFPYTHON_wrap.cxx /OpenFrames/swig/PyOF.i
/OpenFrames/include/OpenFrames/FrameTransform.hpp:37: Error: Syntax error in input(1).
Again, this is on an M1 Mac, latest develop OpenFrames commit (67cce87).
When i read .earth,FollowingTrackball is different to use.
So maybe we can add a function to selecet a Manipulator for Class View.
Maybe we can add a funciton like(setCameraManipulator) to View?
Hi Ravi,
I have built openframes with openvr and osgearth successfully.
I ran ofviewer --vr .earth file . it runs successfully but vive controllers are not working ?? any manual towards that?
thanks
Jai
On an Apple M1 Mac (MacOS Ventura 13.1, clang 14.0.0), I can't get the examples to work.
For example, when running ofcones
I get:
2023-02-28 15:33:31.630 ofcones[56746:18375509] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSWindow drag regions should only be invalidated on the Main Thread!'
*** First throw call stack:
(
0 CoreFoundation 0x00000001874fb3f8 __exceptionPreprocess + 176
1 libobjc.A.dylib 0x0000000187046ea8 objc_exception_throw + 60
2 CoreFoundation 0x0000000187524810 _CFBundleGetValueForInfoKey + 0
3 AppKit 0x000000018a722a18 -[NSWindow(NSWindow_Theme) _postWindowNeedsToResetDragMarginsUnlessPostingDisabled] + 320
4 AppKit 0x000000018a711524 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 816
5 AppKit 0x000000018a7111e8 -[NSWindow initWithContentRect:styleMask:backing:defer:] + 48
6 libosgViewer.3.6.5.dylib 0x0000000102cfe1f0 _ZN9osgViewer19GraphicsWindowCocoa21realizeImplementationEv + 1120
7 libosgViewer.3.6.5.dylib 0x0000000102ca64b8 _ZN9osgViewer15CompositeViewer7realizeEv + 908
8 libosgViewer.3.6.5.dylib 0x0000000102cf1acc _ZN9osgViewer10ViewerBase5frameEd + 108
9 libOpenFrames.dylib 0x000000010259d9e0 _ZN10OpenFrames11WindowProxy5frameEv + 356
10 libOpenFrames.dylib 0x000000010259d84c _ZN10OpenFrames11WindowProxy3runEv + 312
11 libOpenThreads.3.3.1.dylib 0x0000000102499acc _ZN11OpenThreads20ThreadPrivateActions11StartThreadEPv + 236
12 libsystem_pthread.dylib 0x00000001873a106c _pthread_start + 148
13 libsystem_pthread.dylib 0x000000018739be2c thread_start + 8
)
libc++abi: terminating with uncaught exception of type NSException
zsh: abort ./ofcones
If I run ofqt_demo.py
I get a similar error (-[NSOpenGLContext setView:] must be called from the main thread.
)
I'm compiling it with the following script (using conda for all the dependencies):
#!/bin/bash
# version numbers of dev tools:
export PYTHON_VERSION=3.9
export OSG_VERSION=3.6.5
export CMAKE_VERSION=3.25
export SWIG_VERSION=4.0
export NUMPY_VERSION=1.24
export PYQT_VERSION=5.15
export NINJA_VERSION=1.11
# magic to make conda work:
eval "$(conda shell.bash hook)"
# set up directories:
rm -rf ./build
mkdir ./build
# create the conda environment and activate it:
conda create --channel nodefaults --channel conda-forge --prefix ./build/osgenv --solver libmamba python=$PYTHON_VERSION openscenegraph=$OSG_VERSION cmake=$CMAKE_VERSION swig=$SWIG_VERSION numpy=$NUMPY_VERSION PYQT=$PYQT_VERSION ninja=$NINJA_VERSION
cd build
conda activate ./osgenv
# configure:
cmake -G Ninja \
-D CMAKE_BUILD_TYPE=Release \
-D OSG_DIR=./osgenv \
-D OF_BUILD_DEMOS=ON \
-D OF_PYTHON_MODULE=ON \
-D SWIG_EXECUTABLE=./osgenv/bin/swig \
..
# build:
ninja
ninja install
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.