Coin3d

From emergent
Jump to: navigation, search
Crystal Clear app tutorials.png Developing emergent

Coin3d is the 3D scenegraph library for emergent, which provides all the display tech for the right 3D display panel.

This page contains developer-related information for coin3d.

Emergent Coin3d Resources

Due to the unreliable and unmaintained status of the official resources, we are now hosting a svn repository of the source that we maintain, and also the docs.

Subversion repositories for Coin and Quarter

Here's the command to check out the Coin source -- will check out into current directory (do mkdir coin, cd coin first to make a coin directory):

svn checkout  https://grey.colorado.edu/svn/coin3d/coin/trunk .

And for the Quarter source:

svn checkout  https://grey.colorado.edu/svn/coin3d/quarter/trunk .

Web view of the repositories (viewvc):

We would be happy to extend write access to the repository to anyone who is actively working on it.

Update

On October 4, 2017, the official Coin repository at https://bitbucket.org/Coin3D/coin has been synchronized with this repository regarding changes to the code (disregarding the build system and documentation). In particular:

  1. r15 is merged in pull request #84.
  2. r16 and r17 are incorporated through commit ac03012d7c1a and pull request #82.
  3. r47 is covered by pull request #8.

On November 6, 2017, the official Quarter repository at https://bitbucket.org/Coin3D/quarter has reintegrated the work on high DPI. Pull request #11 includes revisions r2, r3, r8 and r33.

Docs

Coin3d Official Pages

The project is currently transitioning into a community-supported open-source project, from being managed more actively by Kongsberg Oil & Gas Tech.

Compiling Quarter for Qt5

Quarter has not been updated to expect Qt5, so you have to use environment variables to get it to work:

Linux (Ubuntu), circa 12/2013

If you built and installed Qt5.2.0 (say in /usr/local/Qt5.2.0), then these are the commands in the coin svn trunk (see above) that will enable it to be compiled:

cd Quarter/build
export QTDIR=/usr/local/Qt5.2.0
export CONFIG_QTLIBS="-lQt5Core -lQt5Widgets -lQt5OpenGL -lQt5Gui -lQt5Designer -lQt5UiTools -lQt5Xml -licui18n -licuuc -licudata"
export CPPFLAGS="-I$QTDIR/include/QtCore -I$QTDIR/include/QtWidgets -I$QTDIR/include/QtOpenGL -I$QTDIR/include/QtGui -fPIC"
../configure --disable-pkgconfig --disable-debug --with-qt=$QTDIR --with-qt-designer-plugin-path=$QTDIR/plugins/designer

If this does not work, please see Coin3d compiling qt5 linux for how to get it working. Whatever you do, do NOT remove the CONFIG_QTLIBS line, because while you may end up compiling, and it may LOOK like you've built against Qt5, in fact if you do ldd libQuarter.so you'll see that it is linking against the Qt4 libraries, and this will then crash emergent at startup.

If you installed Qt5 from packages, the commands are slightly different (omit the environment vars QTDIR and CONFIG_QTLIBS):

sudo apt-get install qt5-default qttools5-dev qtlocation5-dev libqt5designer5 libqt5webkit5-dev qtdeclarative5-dev qtsensors5-dev qtlocation5-dev
sudo mv /usr/include/qt4 /usr/include/qt4_tmp
sudo mv /usr/lib/qt4 /usr/lib/qt4_tmp
cd Quarter/build
export CPPFLAGS="-I/usr/include/qt5/QtCore -I/usr/include/qt5/QtWidgets -I/usr/include/qt5/QtOpenGL -I/usr/include/qt5/QtGui -L/usr/lib/x86_64-linux-gnu/ -fPIC"
../configure --disable-pkgconfig --disable-debug --with-coin=/usr/local --with-qt-designer-plugin-path=/usr/lib/x86_64-linux-gnu/qt5/plugins/designer

Mac OS-X 10.11, 2016

export QTDIR=/usr/local/Qt5.6.1/5.6/clang_64
./configure --with-qt=/usr/local/Qt5.6.1/5.6/clang_64 CXX=clang++

Likely error - Need to be able to run 'coin-config' - if for some reason you end up with coin-config in a subdirectory under /usr/local/bin/ called coin-config, move it out of that so it lives directly in /usr/local/bin -- it doesn't work if it is in the subdir.

Windows 7, MSVS 2010, 12/2013

You can have simultaneous installations of Qt; i.e. Qt4 and Qt5. You'll also need cygwin. See Creating_a_new_release_-_Windows#Building_prerequisite_libraries for detailed instructions.

Compiling Coin

Linux (Ubuntu) circa 12/2013

./configure --disable-debug --enable-html htmldir=/usr/local/docs/coin3d  # html is for docs server -- requires oxygen -- not needed by default

if it complains about not finding opengl, then do this:

apt-get install libgl1-mesa-dev

Mac OS-X 10.8-9, clang, circa 12/2013

./configure --disable-debug CXX=clang++

Windows 7, MSVS 2010, 12/2013

See Creating_a_new_release_-_Windows#Building_prerequisite_libraries for detailed instructions.

Making a new Coin Package -- Mac

There are packaging tools in packages/* in the Coin distribution -- e.g., macosx subdir -- if you have /Developer/Applications/PackageMaker.app installed then it will enable the make target macosx-packages -- (not sure if you need ./configure --enable-maintainer-mode or just plain ./configure will work).

Also copy Coin-4.0.0a.tar.gz to ./ build dir and tar -xzf that file to make a build target within the build target, and assemble the supportlibs/lib dir for pre-staging as below:

  Coin3d/Coin-4.0.0a -- top-level unpack of tar
    Coin-4.0.0a.tar.gz
    Coin-4.0.0a/
    packages/macosx/supportlibs/lib/libfreetype.dylib, libsimage.dylib  -- current version included in our tar file..
make macosx-packages

this makes the macosx directory under the top-level. it will fail because of the supportlibs target missing:

cp -av packages/macosx/supportlibs macosx/
make macosx-packages

result should be Coin*.dmg files in macosx subdir

Making a new Quarter Package -- Mac

In emergent/install_mac_app, there is quarter.pmdoc -- open it (packagemaker will open -- need to get packagemaker from https://developer.apple.com/downloads)

Here's how to manually make a .dmg for the package:

  • create a folder with appropriate name (e.g., quarter-64bit-clang++-qt5)
  • drag package into folder
  • open DiskUtil app
  • in File menu, New/Image from Folder, select folder
  • done..

http://www.wikihow.com/Make-a-DMG-File-on-a-Mac

OpenGL 3.x Deprecated Functions Present in Coin3D

Coin unfortunately uses a fair number of deprecated functions that newer versions of the OpenGL drivers have removed from their "core" context. You have to specifically request a compatibility context to get coin to work. Most of the time, it seems that this compatibility context is created by default, but under certain situations under Linux, using a specific path for creating the context, it creates a non-compatibility context, and this exposes the limitations. In principle it would make sense to update coin to use the non-deprecated versions of things. To that end, there is a bug ticket on the coin website:

and this wiki page for creating the list: Coin3d OpenGL 3.x Deprecated Functions