### Compile Coin3D example programs Source: https://github.com/coin3d/coin/wiki/How to build Coin3D and SIM Voleon Set the installation directory's bin path, navigate to the SoGuiExamples build directory, configure with the desired GUI toolkit (e.g., --with-sowin), and then build the examples. Examples are not installed and must be run from their build directories. ```shell $ export PATH=[installdir]/bin:$PATH $ cd [builddir]/SoGuiExamples-SoWin $ [srcdir]/SoGuiExamples/configure --with-sowin $ make ``` -------------------------------- ### Configure, build, and install Coin3D library Source: https://github.com/coin3d/coin/wiki/How to build Coin3D and SIM Voleon Navigate to the Coin-2 build directory, configure the build with the specified installation prefix, and then compile and install the library. Root privileges may be required for installation. ```shell $ cd [builddir]/Coin-2 $ [srcdir]/Coin-2/configure --prefix=[installdir] $ make install ``` -------------------------------- ### Install Coin Library (Make) Source: https://github.com/coin3d/coin/wiki/BuildWithCMake Install the Coin library using the 'make install' command within the build directory. ```bash make install ``` -------------------------------- ### Configure, build, and install SoWin GUI binding Source: https://github.com/coin3d/coin/wiki/How to build Coin3D and SIM Voleon Navigate to the SoWin build directory, configure the build with the specified installation prefix, and then compile and install the GUI binding library. Root privileges may be required for installation. ```shell $ cd [builddir]/SoWin $ [srcdir]/SoWin/configure --prefix=[installdir] $ make install ``` -------------------------------- ### Configure, build, and install SIM Voleon Source: https://github.com/coin3d/coin/wiki/How to build Coin3D and SIM Voleon Navigate to the simage build directory, configure the build with the specified installation prefix, and then compile and install the library. Root privileges may be required for installation. ```shell $ cd [builddir]/simage $ [srcdir]/simage/configure --prefix=[installdir] $ make install ``` -------------------------------- ### Compile Coin3D Example with CoinTools Source: https://github.com/coin3d/coin/wiki/Using Coin3D Compile a Coin3D example using the coin-config utility. Ensure CoinTools is installed and necessary frameworks are linked. ```bash $ LDFLAGS="-framework GLUT -lobjc" coin-config --build-app glutiv glutiv.cpp ``` -------------------------------- ### Standard Coin Installation Procedure Source: https://github.com/coin3d/coin/wiki/BuildWithAutotools Follow these steps for a standard installation of the Coin library. Ensure you are in a suitable build directory. ```bash cd /tmp git clone --recurse-submodules https://github.com/coin3d/coin coin mkdir coin-build ``` ```bash cd coin-build ../coin/configure ``` ```bash make ``` ```bash make install ``` ```bash cd .. rm -rf coin-build coin ``` -------------------------------- ### Create macOS Installation Packages (Method 1) Source: https://github.com/coin3d/coin/wiki/BuildWithCMake Generates DMG and PKG installation packages for the Coin3D framework using CPack, after building and installing. ```bash cd cpack.d cpack --config darwin-dmg.cmake cpack --config darwin-pkg.cmake ``` -------------------------------- ### Build and Install Coin3D (Method 1) Source: https://github.com/coin3d/coin/wiki/BuildWithCMake Builds and installs the Coin3D framework using Make after configuration. Assumes the build directory is `coin_build`. ```bash cd coin_build make sudo make install ``` -------------------------------- ### Configure Release Build of Coin Source: https://github.com/coin3d/coin/wiki/Building from the command line Configure the Coin source code for a release build. This example specifies options for the Microsoft Visual C++ runtime, installation prefix, disabling sound, enabling thread safety, and disabling debug symbols. It also links against a specific GLU release library. ```bash ../Coin_Git/configure --with-msvcrt=md --prefix=/cygdrive/c/Coin3D/Coin --disable-sound --enable-threadsafe --disable-debug --disable-symbols --with-glu=/cygdrive/c/Coin3D/GLU_DLLs/GLU_Release_msvc9/Release ``` -------------------------------- ### Create macOS Installation Packages (Method 2) Source: https://github.com/coin3d/coin/wiki/BuildWithCMake Generates DMG and PKG installation packages for the Coin3D framework using CPack, after building and installing. Assumes the build directory is `coin_build`. ```bash cd coin_build/cpack.d cpack --config darwin-dmg.cmake cpack --config darwin-pkg.cmake ``` -------------------------------- ### Install Coin Library with MSBuild Source: https://github.com/coin3d/coin/wiki/BuildWithCMake Install the Coin library using MSBuild. This command targets the INSTALL project in the generated solution file. ```bash MSBuild /p:Configuration=Release /t:INSTALL Coin.sln /nologo /verbosity:minimal /maxcpucount ``` -------------------------------- ### Install SoQt (Windows) Source: https://github.com/coin3d/coin/wiki/BuildWithCMake Installs the SoQt project using CMake on Windows with Visual Studio, suppressing verbose output and using multiple CPU cores. ```bash cmake --build soqt_build --target INSTALL --config Release -- /nologo /verbosity:minimal /maxcpucount ``` -------------------------------- ### Install SoQt (Linux) Source: https://github.com/coin3d/coin/wiki/BuildWithCMake Installs the SoQt project using CMake on Linux with parallel compilation. ```bash cmake --build soqt_build --target install --config Release -- -j4 ``` -------------------------------- ### Build and Install Coin (Debug) Source: https://github.com/coin3d/coin/wiki/Building from the command line Compile and install the Coin library after it has been configured for a debug build. These commands are executed from the build directory. ```bash make make install ``` -------------------------------- ### Install Export and Config Files Source: https://github.com/coin3d/coin/blob/master/src/CMakeLists.txt Installs the generated `coin-config.cmake`, `coin-config-version.cmake`, and the export file (`coin-export.cmake`) to the installation directory. These files are crucial for consumers of the Coin3D library. ```cmake install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${COIN_CONFIG_PACKAGE_BASENAME}-config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/${COIN_CONFIG_PACKAGE_BASENAME}-config-version.cmake" DESTINATION ${COIN_CONFIG_PACKAGE_LOCATION} COMPONENT development ) install(EXPORT ${PROJECT_NAME} DESTINATION ${COIN_CONFIG_PACKAGE_LOCATION} NAMESPACE ${PROJECT_NAME}:: FILE ${COIN_CONFIG_PACKAGE_BASENAME}-export.cmake COMPONENT development ) ``` -------------------------------- ### Configure Prefix Option Source: https://github.com/coin3d/coin/wiki/BuildWithAutotools Specify the installation path for the Coin library. Defaults to /usr/local. ```bash --prefix= ``` -------------------------------- ### Configure Coin for X11 and Unix-style Install Source: https://github.com/coin3d/coin/wiki/Is it possible to get Coin to use X11 instead of Quartz Use this configuration command to build Coin with X11 support and disable macOS frameworks for a Unix-style .dylib installation. ```bash Coin/configure --enable-darwin-x11 --without-framework ``` -------------------------------- ### Install Framework Target Source: https://github.com/coin3d/coin/blob/master/src/CMakeLists.txt Installs the main Coin3D target as a framework, intended for development components. ```cmake install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME} FRAMEWORK DESTINATION . COMPONENT development ) ``` -------------------------------- ### Configure and Install Package Config Files Source: https://github.com/coin3d/coin/blob/master/src/CMakeLists.txt Configures and installs package configuration files (like `coin-config.cmake` and `.pc` files) and the `coin-config` script. This is essential for enabling `find_package(Coin)` and pkg-config support. ```cmake configure_file("${PROJECT_SOURCE_DIR}/${PROJECT_NAME}.pc.cmake.in" "${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc" @ONLY) install(FILES "${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") install(PROGRAMS "${PROJECT_SOURCE_DIR}/bin/coin-config" DESTINATION ${CMAKE_INSTALL_BINDIR}) configure_file("${PROJECT_SOURCE_DIR}/coin.cfg.cmake.in" "${CMAKE_BINARY_DIR}/${PROJECT_NAME_LOWER}-default.cfg" @ONLY) install(FILES "${CMAKE_BINARY_DIR}/${PROJECT_NAME_LOWER}-default.cfg" DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/Coin/conf) ``` -------------------------------- ### Install Coin3D using CMake Build Tool Mode (Method 2) Source: https://github.com/coin3d/coin/wiki/BuildWithCMake Installs the Coin3D framework using CMake's build tool mode, specifying the build directory, target, configuration, and parallel jobs. Requires sudo for system locations. ```bash sudo cmake --build coin_build --target install --config Release -- -j4 ``` -------------------------------- ### Build Fedora Package Source: https://github.com/coin3d/coin/wiki/BuildWithCMake Build a Fedora installation package for Coin using CPack. ```bash cpack --config fedora.cmake ``` -------------------------------- ### Install Coin Library (CMake Build Tool Mode) Source: https://github.com/coin3d/coin/wiki/BuildWithCMake Install the Coin library using CMake's build tool mode, specifying the build directory, target, configuration, and parallel jobs. ```bash cmake --build coin_build --target install --config Release -- -j4 ``` -------------------------------- ### Configure Mandir Option Source: https://github.com/coin3d/coin/wiki/BuildWithAutotools Specify the installation directory for man pages. Defaults to ${prefix}/man. ```bash --mandir=DIR ``` -------------------------------- ### Main Application Entry Point Source: https://github.com/coin3d/coin/blob/master/docs/driver-bugs/2002-09-25--nvidia-glx.txt Sets up the X11 display connection, registers a custom error handler, creates the main window and GLX context, maps the window, makes the context current, enters the event loop, and then cleans up resources. ```c int main(int argc, char *argv[]) { Display *dpy; WindowData winData; dpy = XOpenDisplay(NULL); if (!dpy) { printf("Error: couldn't open default display.\n"); return -1; } XSynchronize(dpy, True); systemerrhndler = XSetErrorHandler(X11Errorhandler); MakeWindow(dpy, "simple glx", 0, 0, 300, 300, &winData); XMapWindow(dpy, winData.window); glXMakeCurrent(dpy, winData.window, winData.context); EventLoop(&winData); glXDestroyContext(dpy, winData.context); XDestroyWindow(dpy, winData.window); XCloseDisplay(dpy); return 0; } ``` -------------------------------- ### Configure Debug Build of Coin Source: https://github.com/coin3d/coin/wiki/Building from the command line Configure the Coin source code for a debug build. This example specifies options for the Microsoft Visual C++ runtime, installation prefix, disabling sound, enabling thread safety, and linking against a specific GLU debug library. ```bash ../Coin_Git/configure --with-msvcrt=mdd --prefix=/cygdrive/c/Coin3D/Coin --disable-sound --enable-threadsafe --with-alternate=debug --with-suffix=d --with-glu=/cygdrive/c/Coin3D/GLU_DLLs/GLU_Debug_msvc9/Debug ``` -------------------------------- ### Build NSIS Installation Packages Source: https://github.com/coin3d/coin/wiki/BuildWithCMake Build NSIS installation packages for the Coin library after installation. This step is optional. ```bash cd coin_build/cpack.d cpack --config windows.cmake ``` -------------------------------- ### Set up build directories Source: https://github.com/coin3d/coin/wiki/How to build Coin3D and SIM Voleon Create necessary subdirectories within your chosen build directory for different Coin3D components. ```shell $ cd [builddir] $ mkdir simage $ mkdir Coin-2 $ mkdir SoWin $ mkdir SoGuiExamples-SoWin $ [...] ``` -------------------------------- ### Install Coin to a Staged Root Directory Source: https://github.com/coin3d/coin/wiki/BuildWithAutotools Install Coin to a specific destination directory, useful for creating staged installations or custom root file systems. The DESTDIR variable specifies the base path for the installation. ```bash make DESTDIR=/mnt/newrootfs install ``` -------------------------------- ### Initialize SoWin and create a viewer Source: https://github.com/coin3d/coin/wiki/A simple 3D viewer with Coin and SoWin Initializes SoWin and Coin, creates a viewer window, and sets up the scene graph with a cone. ```cpp #include #include #include #include int main(int, char ** argv) { HWND window = SoWin::init(argv[0]); if (window==NULL) exit(1); SoWinExaminerViewer * viewer = new SoWinExaminerViewer(window); SoSeparator * root = new SoSeparator; SoCone * cone = new SoCone; root->ref(); root->addChild(cone); viewer->setSceneGraph(root); viewer->show(); SoWin::show(window); SoWin::mainLoop(); delete viewer; root->unref(); return 0; } ``` -------------------------------- ### Install Data Files Source: https://github.com/coin3d/coin/blob/master/src/CMakeLists.txt Installs Coin3D data files, including XML, IV, and GLSL files, into the installation's data directory for development components. ```cmake install(DIRECTORY ${PROJECT_SOURCE_DIR}/data/ DESTINATION ${CMAKE_INSTALL_DATADIR} COMPONENT development FILES_MATCHING PATTERN [cep]*.xml PATTERN *.iv PATTERN *.glsl) ``` -------------------------------- ### Configure Help Option Source: https://github.com/coin3d/coin/wiki/BuildWithAutotools Display all available command-line options for the configure script. ```bash --help ``` -------------------------------- ### Install Headers Source: https://github.com/coin3d/coin/blob/master/src/CMakeLists.txt Installs Coin3D header files into the development include directory. It installs headers from both the source and binary directories, and also specific SoWin and SoDebug headers. ```cmake install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/Inventor/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Inventor COMPONENT development FILES_MATCHING PATTERN "*.h") install(DIRECTORY ${CMAKE_BINARY_DIR}/include/Inventor/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Inventor COMPONENT development FILES_MATCHING PATTERN "*.h") install(FILES ${PROJECT_SOURCE_DIR}/include/SoWinEnterScope.h ${PROJECT_SOURCE_DIR}/include/SoWinLeaveScope.h ${PROJECT_SOURCE_DIR}/include/SoDebug.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT development) ``` -------------------------------- ### Install Superglu Library with CMake Source: https://github.com/coin3d/coin/wiki/BuildWithCMake Install the superglu library using CMake's build tool mode. This command builds the INSTALL target for the Release configuration. ```bash cmake --build superglu_build --target INSTALL --config Release -- /nologo /verbosity:minimal /maxcpucount ``` -------------------------------- ### Install Coin Library with CMake Source: https://github.com/coin3d/coin/wiki/BuildWithCMake Install the Coin library using CMake's build tool mode. This command builds the INSTALL target for the Release configuration. ```bash cmake --build coin_build --target INSTALL --config Release -- /nologo /verbosity:minimal /maxcpucount ``` -------------------------------- ### Build Coin Library (Make) Source: https://github.com/coin3d/coin/wiki/BuildWithCMake Build the Coin library using the 'make' command within the build directory. ```bash cd coin_build make ``` -------------------------------- ### Install SoXt for macOS Source: https://github.com/coin3d/coin/wiki/BuildWithCMake Installs the SoXt project for macOS using CMake and parallel compilation. ```bash cmake --build soxt_build --target install --config Release -- -j4 ``` -------------------------------- ### Configure and Build Simage Library Source: https://github.com/coin3d/coin/blob/master/packaging/macosx/checklist.txt Configures and builds the simage library with specific options for universal binary support, QuickTime integration, and optimizations. The installation prefix is set to a local supportlibs directory. ```bash mkdir simage-config cd simage-config $SRCDIR/simage/configure --prefix=$PWD/../macosx/supportlibs/install --enable-universal --enable-quicktime --enable-optimization --disable-debug --disable-symbols --without-oggvorbis --without-libsndfile --libdir=$PWD/../macosx/supportlibs/lib make install cd .. ``` -------------------------------- ### Build application bundle with coin-config Source: https://github.com/coin3d/coin/wiki/Events not passed Use the `coin-config` utility to build your program and automatically create the necessary application bundle structure for correct event dispatching. ```bash $soqt-config --build-app foo foo.cpp ``` -------------------------------- ### Change Install Name for Coin Framework Source: https://github.com/coin3d/coin/wiki/How can I install Coin as part of my application Use this command to update the install name of your application to point to the Coin framework when it's bundled within the application's framework directory. This is necessary because the framework's install name is hard-coded. ```bash install_name_tool -change Inventor.framework/Versions/B/Inventor \ @executable_path/../Frameworks/Inventor.framework/Versions/B/Inventor \ yourapplication.app/Contents/MacOS/yourapplication ``` -------------------------------- ### Initialize SoWin and Coin Source: https://github.com/coin3d/coin/wiki/Using Coin with MFC and VisualC++ Call SoWin::init("") as the first line in CMFCViewerApp::InitInstance() to initialize SoWin and Coin libraries before any Coin or SoWin usage. ```cpp #include // ... inside CMFCViewerApp::InitInstance() SoWin::init(""); ``` -------------------------------- ### VRML97 File Example Source: https://github.com/coin3d/coin/blob/master/docs/BUGS.txt An example of an Inventor V2.1 ascii file demonstrating the use of TextureScalePolicy with the FRACTURE policy and a Texture2 node. ```Inventor #Inventor V2.1 ascii Separator { DirectionalLight { direction 1 -1 -10 } PerspectiveCamera { position -0.47643667 0.5896858 6 nearDistance 0.1 farDistance 100 } Separator { TextureScalePolicy { policy FRACTURE } Texture2 { filename "/tmp/M245-m040904.png" } Cube { } } } ``` -------------------------------- ### Invalid File Content Example Source: https://github.com/coin3d/coin/blob/master/docs/bugs/low_priority/io/20041105--incorrect_error_message_on_invalid_file.txt This is an example of a file content that triggers the incorrect error message due to a control character within brackets. ```text begin 644 rotdisc.iv L(TEN=F5N=&]R(%8R+C$@87-C:6D*"E)O=&%T941I $1.app/Contents/PkgInfo exit 0 ``` -------------------------------- ### Configure Coin Build with CMake (Visual Studio) Source: https://github.com/coin3d/coin/wiki/BuildWithCMake Configure the Coin build using CMake for Visual Studio. Specify installation prefix, Boost root, documentation build, and CPack. ```bash cmake -Hcoin -Bcoin_build -G "Visual Studio 14 2015" -A x64 -DCMAKE_INSTALL_PREFIX=C:\Coin3D -DBOOST_ROOT=C:\Data\Boost-1.56.0 -DCOIN_BUILD_DOCUMENTATION=OFF -DCOIN_USE_CPACK=ON ``` -------------------------------- ### Circular Field Connection Example Source: https://github.com/coin3d/coin/blob/master/docs/bugs/low_priority/insignificant/20021016--circular-field-connections.txt This C++ example demonstrates a scenario with circular field connections that causes issues. It requires building and running to observe the failure. ```cpp #include #include #include #include #include #include #include int main(int argc, char *argv[]) { SoDB::init(); SoSeparator *root = new SoSeparator; root->ref(); SoSeparator *test = new SoSeparator; SoTranslation *redball = new SoTranslation; test->addChild(redball); SoSeparator *scene = new SoSeparator; SoMaterial *mat = new SoMaterial; scene->addChild(mat); root->addChild(test); root->addChild(scene); SoDecomposeVec3f *dv = NULL; SoComposeVec3f *cv = NULL; SoInterpolateVec3f *interpred = NULL; dv = new SoDecomposeVec3f; interpred = new SoInterpolateVec3f; interpred->input0.setValue(0.0, -0.5, 0.0); interpred->input1.setValue(0.0, 0.5, 0.0); interpred->alpha.connectFrom(&dv->x); redball->translation.connectFrom(&interpred->output); cv = new SoComposeVec3f; cv->ref(); cv->x.connectFrom(&dv->x); cv->y.connectFrom(&dv->y); cv->z.connectFrom(&dv->z); dv->vector.connectFrom(&mat->diffuseColor); mat->diffuseColor.connectFrom(&cv->vector); root->unref(); return 0; } ```