-
Notifications
You must be signed in to change notification settings - Fork 26
HowTos
This page contains suggestions, code snippets and tips that are not elaborate enough to require their own page
If the installer fails with a permission error on OSX El Capitan try the following:
Open a Terminal type
ls /usr/local/bin
1: If the directory exists, type:
sudo chown -R $(whoami):admin /usr/local
2: If the directory does not exist type
sudo mkdir /usr/local && sudo chflags norestricted /usr/local && sudo chown -R $(whoami):admin /usr/local
After doing either 1 or 2, your permissions should be fixed: try running the installer again.
Added: 2 September 2013
On Windows and OSX, make sure you are launchng orun from the bin directory, or that you have the path to the bin directory added to your PATH environment variable.
For instance, do this:
> cd ~/omegalib/build/bin
> orun -s ~/omegalib/core/examples/python/planes.py
Instead of this:
> cd ~/omegalib/core/examples/python
> ~/omegalib/build/bin/orun -s planes.py
Added: ver. 4.1-alpha4 - 8 Jul 2013
There can be lots of reasons for this: osgEarth plugins not being in the library path, misconfigured proxies, etc. One particularly tricky reason is that osgEarth does not like to open .earth files when no graphics context is available. So, if you are running on a cluster with a headless master, your script will stall during model loading. A simple way to solve this is to modify your program or script to run only on cluster slave nodes, for instance using isMaster
in python:
if(not isMaster()):
# put osgEarth model loading code here
This trick may be helpful in other scenarios: running all your application code within a not isMaster()
block will basically set up the master instance to be just a lightweight synchronization controller for all the display nodes that will run the actual application.
Added: ver. 4.0 - 20 June 2013
doing git clone https://github.com/febret/omegalib.git omegalib --recursive
gives this in reply:
Cloning into omegalib...
error: SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed while accessing https://github.com/febret/omegalib.git/info/refs
A complete asnwer to this problem can be found here: http://stackoverflow.com/questions/3777075/ssl-certificate-rejected-trying-to-access-github-over-https-behind-firewall
A quick solution is to ignore ssl certificate verification just for this repository clone:
env GIT_SSL_NO_VERIFY=true git clone https://github/febret/omegalib.git omegalib --recursive
Added: ver. 3.2 - 20 December 2012
Cameras in omegalib (and in other VR toolkits) work a little differently compared to classic graphic engines. There are two things that influence the final camera view:
- The camera position and orientation, which infuence the view transform. They determine the conversion between the physical space in your system , and the space used your virtual world.
- The head position and orientation, which influence both the view and the projection transforms. They represent the position of the observer in the phisical space. head transform, camera transform and display geometry all contribute in determining what will appear on the screens.
"In a VR system, how do I convert my trackable object position / orientation into world coordinates?"
Added: ver. 3.2 - 20 December 2012
Tracked objects like stereo glasses, wands etc. generate events with positions and orientations in sensor space. This space usually corresponds to the physical space used to describe the VR system structure. For instance in CAVE2 both sensor space and VR system space cosider the origin as the center of the sphere (on the ground), with Z pointing forward.
When navigating within the scene, you move the camera to a different position and orientation. Consequently, tracked object positions do not make sense anymore, until you convert them to this new, "virtual world" space defined by the camera transformations. Luckily, the Camera
class comes with method that do exactly this.
Given a Vector3f trackerPosition
, you can convert it to the world reference frame doing (in C++)
Camera* cam = Engine::instance()->getDefaultCamera(); // equivalent to the getDefaultCamera python call.
cam->localToWorldPosition(Vector3f position);
// use cam->localToWorldOrientation(orientation) to convert an orientation instead.
"I'm trying to load an .obj file. The model does not show up, and the console gets spammed with a lot of CullVisitor Errors'
Added: ver. 3.7 - 29 April 2013
This is likely due to your obj model using per-vertex colors. The OpenSceneGraph obj loader does not like per-vertex colors. The typical solution is to use per-face colors instead. An easy way to do this is to open your mesh in a tool like MeshLab and use Filters > Color Creation and Processing > Vertex Colors to Face Colors When saving the new obj make sure you disable colors in the vertex attributes section.
Added: ver. 5.2 - 18 Feb 2014
Model optimization may take a long time for complex or large models. You have two solutions:
- Disable model optimizations setting the
optimize
property of ModelInfo toFalse
. This may have an impact in rendering performance for the model - Pre-optimize the model using the OpenSceneGraph osgconv tool.
"When I load and obj file with textures, the object looks textured but the texture moved in weird ways"
Added: ver. 4.3 - 02 October 2013
Make sure your .obj file contains normals. OpenSceneGraph does not like obj files without them.
"My model disappears when I get close / far from it, or it just shows up on a few tiles of my tiled display"
Updated: ver. 3.7 - 3 May 2013
This is likely a near/far clipping plane issue. It usually shows up when you are drawing big models (i.e. when using osgEarth).
Omegalib tries to set up good clipping planes for you but does not handle every situation well. You can manually specify the near and far clipping planes using the setNearFarZ
function in python (or the equivalent DisplaySystem
method in C++). A good test call is something like setNearFarZ(0.1, 1000000)
. Note that if you have a big near-to-far z ratio, you may get z fighting issues for objects close in depth. Omegalib uses a 24-bit z buffer by default.
If your application is based on OpenSceneGraph (using cyclops for instance) you can also turn on depth partitioning to handle scenes with large Z intervals (i.e drawing planetary-scale data at a distance, plus small objects close to the camera).
For example, to enable depth partitioning and create two partitions, one for near objects (z from 0.1 to 1000) and one for far objects (z from 1000 to 100000000):
# Specify the overall depth range
setNearFarZ(0.1, 100000000)
# Give a render hint to the OpenSceneGraph module (if loaded): create a depth partition at 1000.
queueCommand(`:depthpart on 1000`)
Original question from David Barnes:
Python scripts seem to be able to get a system menu that has things like stereo on/off, navigation speed scale, volume control etc. How do I create this system menu from a C++ class?
Standalone C++ applications are by default as streamlined as possible, so they do not include a widget library or the standard system menu that you see in python applications. But you can load the system menu manually if you need it.
The system menu is implemented in a python script (default_init.py
: https://github.com/uic-evl/omegalib/blob/master/default_init.py), and uses the omegaToolkit
widget library to create the menu.
To run this script from a C++ omegalib application do the following:
Link the omegaToolkit library to your executable: add omegaToolkit to the target_link_libraries
command in the executable CMakeLists.txt:
The following code is an example minimal C++ app with a system menu: If you run this it will only display the system menu. You can take the code in the initialize
method to load the system menu in your own application.
#include <omega.h>
#include <omegaToolkit.h>
using namespace omega;
class MenuApplication: public EngineModule
{
public:
virtual void initialize()
{
// Initialize the omegaToolkit python API
omegaToolkitPythonApiInit();
PythonInterpreter* pi = SystemManager::instance()->getScriptInterpreter();
// Run the system menu script
pi->runFile("default_init.py", 0);
// Call the function from the script that will setup the menu.
pi->eval("_onAppStart()");
}
};
int main(int argc, char** argv)
{
Application<MenuApplication> app("menuapp");
return omain(app, argc, argv);
}
Omegalib has been tested with OSX versions 10.7, 10.9 and 10.10. In 10.9, you may need to do some troubleshooting on multi monitor setups (see following section)
Added: ver. 5.2 - 18 February 2014
This is due to an unresolved bug in both XQuartz and Mavericks. Only known solution currently is to disable the creation of one Space per display in system settings. See this bug report for more information: https://discussions.apple.com/message/23487884#23487884
Added: ver 6.0 - 28 December 2014
Make sure you have XQuartz installed and updated to your current OSX version.