Please disable Adblockers and enable JavaScript for domain CEWebS.cs.univie.ac.at! We have NO ADS, but they may interfere with some of our course material.
[Tutorial]
Tutorial
This page will give you useful information on the libraries and tools used within this class. Only MacOSX and Windows will be described as reference platforms, as in most cases Linux behaves similar to MacOSX. In addition, for most of the tutorials described on this page, there is plenty of information available on the «internet». In case you still have unanswered questions, do not hesitate to contact «Christopher Helf». I also greatly appreciate feedback on this tutorial page or any errors or problems you encounter.
Setting Up OGRE3d
Setting up your first Ogre Application should not be too difficult, and the «Ogre3D wiki» is always your friend in case you encounter any problems. There is also a «Tutorial Framework» to get you started with code examples.
On the «Downloads» Page example code is provided to get you started.
Windows (VS2010)
There is a pretty extensive «tutorial page» explaining how to install and setup Ogre with Visual Studio (or other IDEs). I recommend going through the tutorial in order to better understand some of the Visual Studio settings.
If you get an error relating to a missing OgreOverlaySystem.h header, edit the SDKTrays.h file in the OGRESDK include directory
#include "Overlay/OgreOverlaySystem.h"
instead of
#include "OgreOverlaySystem.h"
Also check out the «Troubleshooting Page».
MacOSX (XCode)
- Go to «SDK Download», download a stable OGRE SDK prebuilt binary (1.8 or 1.9 currently) for MacOSX and install to a folder of your choice (i.e. /AMTLibs/OgreSDK), with XCode it is not recommended to use spaces in your directory path to the OgreSDK root, so just create a root directory like mentioned before
- Go to «MacOSX Ogre Dependencies» and download the Ogre Dependencies for OSX. Extract the archive and move the entire Dependencies folder to the root of the Ogre SDK folder (i.e. /AMTLibs/OgreSDK)
- Go to «NVIDIA CG», download and install the NVIDIA CG framework. This is a necessary requirement for Ogre. Make sure you find Cg.framework in /Library/Frameworks after the install
- Go to «MacOSX XCode Templates», download and install the MacOSX Xcode Templates.
- Open XCode, create a new Ogre project (an Ogre category with "Mac OS X Application" that has the Ogre head logo should appear)
- Select the project, go to the Build Settings and then click Editor/Add Build Setting/Add User-Defined Setting, name it OGRE_SDK_ROOT and set the value to wherever you have installed the OgreSDK (i.e. /AMTLibs/OgreSDK)
- Finally, under XCode Build settings, set the C++ Standard Library (under Apple LLVM 5.0 - Language - C++) to libstdc++ (GNU C++ standard library).
- You should be able to build the Application in both 32 and 64 bit. In case XCode tells you that the application could not be run after a successful build when you switched from one architecture to another, simply restart XCode.
Note that in 32bit you can use either carbon or cocoa (in the macAPI setting of the Ogre config dialog), while in 64bit only cocoa is supported. If you encounter problems with the mouse pointer (known issue) on 64bit using cocoa, the only workaround I found is to Cmd+Tab out of the OgreWindow, move the mouse to the position where the OgreWindow was before tabbing out, and then Cmd+Tab back into the window. Generally I recommend working in 64bit.
If you prefer to manually build Ogre and its dependencies according to your needs, please refer to «this site». In case you want to build the Samples provided in the XCode project that comes with the OgreSDK, I redirect you to this «tutorial». You will need to install Cmake and modify a few Xcode Settings.
FFMpeg and Video Libraries
Binaries
Windows
There are plenty of precompiled binaries available on the internet. Refer to «this site» for instance for both 32 and 64bit precompiled versions, download both the Dev and Shared Versions. These builds already come with x264, x265, xvid and vpx as well as other libraries activated, so feel free to experiment with these codecs.
Extract the Dev archive for instance into a subdirectory dev of your Visual Studio project, then extract the Shared archive into a temporary directory and copy the *.dll files from the bin directory into the folder of your binary (i.e. directory of YourApp.exe from the Visual Studio Build, can either be Debug or Release depending on what you are building).
Next, add dev\include to the Directory Include path. You should then be able to include the FFMpeg headers
extern "C"
{
#include "dev\include\libavcodec\avcodec.h"
}
now. Then add dev\lib to your Library include path and successfully build the project. In case you get any inttypes.h error messages, go to «this site», download the archive and extract the inttypes.h file into the include dev\include directory.
In case you directly want to use any of the video libraries (not via FFMpeg), you will need to manually compile most of the libraries. See the following links:
Or find your own way through «google».
MacOSX
For MacOSX, we have precompiled binaries for 32 and 64bit in for both Debug and Release mode. As the Ogre prebuilt package is universal, we recommend using the 64bit libraries due to enabled dissambler optimizations. Below you can find the links for both versions:
The dynamic libraries have an absolute reference path to dependencies, so make sure you have the right folder structure starting from root / :
/AMTLibs/i386
or
/AMTLibs/x86_64
Otherwise XCode will not be able to load the dynamic libraries at runtime. In case you miss dependencies for any of the libraries (should not be the case), simply install them using MacPorts with the +universal tag.
In order to add and use the libraries in XCode, go the Build Settings and then click Editor/Add Build Setting/Add User-Defined Setting, name it VIDEO_SDK_ROOT and set it to either /AMTLibs/i386/Release/, /AMTLibs/i386/Debug/, /AMTLibs/x86_64/Release/ or /AMTLibs/x86_64/Debug/ accordingly.
Next, under Build Settings, go to Header Search Paths and add
"$(VIDEO_SDK_ROOT)/include"
Then under Library Search Paths add
"$(VIDEO_SDK_ROOT)/lib"
Finally, under Other Linker Flags add the following entries
-lavfilter
-lavcodec
-lavformat
-lavutil
-lavdevice
-lswscale
-lx264
-lpostproc
-lswresample
-lxvidcore
-lvpx
-lx265
in order to correctly link the libraries to your executable. Then select the respective architecture in build settings you have downloaded previously (i.e. 32 or 64bit, not universal).
Note:
A potential way to solve problem the problem of absolute file paths in library dependencies is to make library dependency paths relative, i.e. @executable_path/../Components/$libname via the install_name_tool, and then add a Run Script build phase with the following command
mkdir -p "$BUILT_PRODUCTS_DIR/YOURAPPNAME.app/Contents/Components"
ditto "$VIDEO_SDK_ROOT/lib" "$BUILT_PRODUCTS_DIR/YOURAPPNAME.app/Contents/Components"
in order to copy the libraries into the *.app bundle (replace YOURAPPNAME with the name of your application in XCode).
Compiling
Windows
FFMpeg can not be compiled using traditional Windows compilers, only in a posix-like environment, so the usual way to go is to cross-compile on a different platform. See for instance a «mingw64 build script» to build a Win32 or Win64 toolchain to cross compile FFMpeg for Windows architectures or refer to the «MinGW FFMpeg compilation guide» in order to compile FFMpeg directly on Windows within the MinGW environment.
MacOSX
For your convenience, a shell script has been created which should automatically compile the libraries x264, x265, xvid, vpx (vp8 and vp9) as well as FFMpeg with all those libraries mentioned already activated. It is also a reference in case you want to recompile any libraries with additional flags on your own.
It can be run by using the following command in the terminal
sudo sh amt_shell_script_video_libs.sh
On MacSX, it is recommended to use the 64bit libraries as they have assembler optimizations enabled and thus run around two to three times faster than the 32bit versions. The process of adding the libraries to an XCode project is the same as described above, but you can also in XCode link VIDEO_SDK_ROOT directly for example to the universal libraries (i.e. $OUTPUT_DIR/fat/Release/) folder and compile for both 32 and 64 bit.
Letzte Änderung: 08.03.2016, 09:35 | 1337 Worte