Raspberry pi

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
ibrown
Gremlin
Posts: 164
Joined: Wed Aug 18, 2004 6:41 pm
Location: London
Contact:

Raspberry pi

Post by ibrown »

I've just got ogre 1.9 compiled for the raspberry pi - cross compiling using the semi-official cross compiling tools as I think it would take too long to compile on the device itself. Initial tests look okay. Target is the official wheeze hard float distribution.

I checked in the changes I made to a fork: https://bitbucket.org/bigianb/ogre
I'll probably put some notes on my blog (blog.ijbrown.net) when I get time.

Anyone else had a go at this?

Ian
User avatar
Klaim
Old One
Posts: 2565
Joined: Sun Sep 11, 2005 1:04 am
Location: Paris, France
x 56
Contact:

Re: Raspberry pi

Post by Klaim »

Ouh nice! Good Job! :D

I didn't try my RaspberryPi yet, had it for several months :oops:
But I want to try something with Ogre with it somewhere in the end of the year so it's interesting.
bharling
Gremlin
Posts: 166
Joined: Fri Jun 30, 2006 1:04 pm

Re: Raspberry pi

Post by bharling »

I went crazy and tried to build on the device using your fork, thanks!

It's working ( am up to the samples now ) but its been going 6 hours!!

cant wait to see how Ogre fairs on the pi, have been impressed with other EGL-type demos, and some QT stuff. The pi is a wonderful little device :)
Was here
ibrown
Gremlin
Posts: 164
Joined: Wed Aug 18, 2004 6:41 pm
Location: London
Contact:

Re: Raspberry pi

Post by ibrown »

I'd be interested to see if it works compiling on the device. I'm going to try it, but I want to get the cross compiling working first. 6 hours is not bad though - I thought it would take longer.
I think you will need -DRPI on the command line so that the correct paths get included (the toolchain will set this - but if you're on the device you would not use the toolchain).
There is a small issue in building the render systems at the moment - I will probably commit something to fix it this evening. Basically, it needs to look in the directories that ANDROID does for the EGL files and not where linux looks.

Ian
ultirock
Gnoblar
Posts: 6
Joined: Fri Feb 01, 2013 5:33 pm

Re: Raspberry pi

Post by ultirock »

Hi,
I cross compiled Ogre for Raspberry pi using your branch. But I have an assert during the Render window creation. I tried to change the displayFrequency in ogre.cfg but it did not work. Do you know what is wrong?

btw, thanks for this great work!

Code: Select all

17:07:46: Creating resource group General
17:07:46: Creating resource group Internal
17:07:46: Creating resource group Autodetect
17:07:46: SceneManagerFactory for type 'DefaultSceneManager' registered.
17:07:46: Registering ResourceManager for type Material
17:07:46: Registering ResourceManager for type Mesh
17:07:46: Registering ResourceManager for type Skeleton
17:07:46: MovableObjectFactory for type 'ParticleSystem' registered.
17:07:46: ArchiveFactory for archive type FileSystem registered.
17:07:46: ArchiveFactory for archive type Zip registered.
17:07:46: ArchiveFactory for archive type EmbeddedZip registered.
17:07:46: DDS codec registering
17:07:46: FreeImage version: 3.15.1
17:07:46: This program uses FreeImage, a free, open source image library supporting all common bitmap formats. See http://freeimage.sourceforge.net for details
17:07:46: Supported formats: bmp,ico,jpg,jif,jpeg,jpe,jng,koa,iff,lbm,mng,pbm,pbm,pcd,pcx,pgm,pgm,png,ppm,ppm,ras,tga,targa,tif,tiff,wap,wbmp,wbm,psd,cut,xbm,xpm,gif,hdr,g3,sgi,exr,j2k,j2c,jp2,pfm,pct,pict,pic,3fr,arw,bay,bmq,cap,cine,cr2,crw,cs1,dc2,dcr,drf,dsc,dng,erf,fff,ia,iiq,k25,kc2,kdc,mdc,mef,mos,mrw,nef,nrw,orf,pef,ptx,pxn,qtk,raf,raw,rdc,rw2,rwl,rwz,sr2,srf,sti
17:07:46: PVRTC codec registering
17:07:46: ETC1 codec registering
17:07:46: Registering ResourceManager for type HighLevelGpuProgram
17:07:46: Registering ResourceManager for type Compositor
17:07:46: MovableObjectFactory for type 'Entity' registered.
17:07:46: MovableObjectFactory for type 'Light' registered.
17:07:46: MovableObjectFactory for type 'BillboardSet' registered.
17:07:46: MovableObjectFactory for type 'ManualObject' registered.
17:07:46: MovableObjectFactory for type 'BillboardChain' registered.
17:07:46: MovableObjectFactory for type 'RibbonTrail' registered.
17:07:46: Loading library /home/pi/ogre/lib/RenderSystem_GLES2
17:07:46: Installing plugin: OpenGL ES 2.0 RenderSystem
17:07:46: OpenGL ES 2.x Rendering Subsystem created.
17:07:46: Plugin successfully installed
17:07:46: Loading library /home/pi/ogre/lib/Plugin_ParticleFX
17:07:46: Installing plugin: ParticleFX
17:07:46: Particle Emitter Type 'Point' registered
17:07:46: Particle Emitter Type 'Box' registered
17:07:46: Particle Emitter Type 'Ellipsoid' registered
17:07:46: Particle Emitter Type 'Cylinder' registered
17:07:46: Particle Emitter Type 'Ring' registered
17:07:46: Particle Emitter Type 'HollowEllipsoid' registered
17:07:46: Particle Affector Type 'LinearForce' registered
17:07:46: Particle Affector Type 'ColourFader' registered
17:07:46: Particle Affector Type 'ColourFader2' registered
17:07:46: Particle Affector Type 'ColourImage' registered
17:07:46: Particle Affector Type 'ColourInterpolator' registered
17:07:46: Particle Affector Type 'Scaler' registered
17:07:46: Particle Affector Type 'Rotator' registered
17:07:46: Particle Affector Type 'DirectionRandomiser' registered
17:07:46: Particle Affector Type 'DeflectorPlane' registered
17:07:46: Plugin successfully installed
17:07:46: Loading library /home/pi/ogre/lib/Plugin_BSPSceneManager
17:07:46: Installing plugin: BSP Scene Manager
17:07:46: Plugin successfully installed
17:07:46: Loading library /home/pi/ogre/lib/Plugin_PCZSceneManager
17:07:46: Installing plugin: Portal Connected Zone Scene Manager
17:07:46: PCZone Factory Type 'ZoneType_Default' registered
17:07:46: Plugin successfully installed
17:07:46: Loading library /home/pi/ogre/lib/Plugin_OctreeZone
17:07:46: Installing plugin: Octree Zone Factory
17:07:46: Plugin successfully installed
17:07:46: Loading library /home/pi/ogre/lib/Plugin_OctreeSceneManager
17:07:46: Installing plugin: Octree Scene Manager
17:07:46: Plugin successfully installed
17:07:46: *-*-* OGRE Initialising
17:07:46: *-*-* Version 1.9.0unstable (Ghadamon)
17:07:46: OverlayElementFactory for type Panel registered.
17:07:46: OverlayElementFactory for type BorderPanel registered.
17:07:46: OverlayElementFactory for type TextArea registered.
17:07:46: Registering ResourceManager for type Font
17:07:46: CPU Identifier & Features
17:07:46: -------------------------
17:07:46:  *   CPU ID: 
17:07:46:  *      VFP: yes
17:07:46:  *     NEON: no
17:07:46: -------------------------
17:07:46: Registering ResourceManager for type Texture
17:07:46: GLES2RenderSystem::_createRenderWindow "OGRE Sample Browser", 1280x800 windowed  miscParams: FSAA= displayFrequency=0 MHz 
SampleBrowser: /home/chris/build/ogre/ogre_rasp/ogre/RenderSystems/GLES2/src/EGL/OgreEGLContext.cpp:44: Ogre::EGLContext::EGLContext(EGLDisplay, const Ogre::EGLSupport*, EGLConfig, EGLSurface): Assertion `drawable' failed.
Aborted
ibrown
Gremlin
Posts: 164
Joined: Wed Aug 18, 2004 6:41 pm
Location: London
Contact:

Re: Raspberry pi

Post by ibrown »

yes, the basic issue is that EGL windows in X11 are not accelerated on the Raspberry pi - so there is no point in supporting that. To get accelerated 3D in the pi, you need to run from the console and the EGL window needs to be created using the native rpi video-core functions. It should be pretty simple as orgre abstracts the window creation - but I ran into some problems due to my lack of EGL knowledge. Unfortunately, my paying job is now taking all of my time for the foreseeable future so my rpi is gathering dust at the moment. I hope to get back to it - but don't know when. Hopefully someone may get there first and finish that bit off :)

The rpi samples that come with raspberian show how to create the EGL window, so from what I can see it should be a relatively small amount of work.

Ian
OpenGLPriest
Gnoblar
Posts: 8
Joined: Tue May 28, 2013 1:31 am

Re: Raspberry pi

Post by OpenGLPriest »

I just got Ogre running on the Raspberry Pi, with a few changes to the e4d4bcc commit of the bigianb fork. Right now all I see is a glorious cyan test screen, but I will be cleaning it up and testing more Ogre functions over the next few days. Is anyone still watching this thread?
hedphelym
Gremlin
Posts: 180
Joined: Tue Nov 25, 2008 10:58 am
Location: Kristiansand, Norway
x 23
Contact:

Re: Raspberry pi

Post by hedphelym »

I have a raspberrypi too, and I'd love to try this, but I need some guidance, would be nice with a wiki entry of how to do this.
And also maybe a precompiled demo download (the samples that works) so that one can test it quickly.

Seems very exciting to have ogre on it, it's always cool to compile and run things on 'small' hardware.
Feels different from using it on the good old computer.
OpenGLPriest
Gnoblar
Posts: 8
Joined: Tue May 28, 2013 1:31 am

Re: Raspberry pi

Post by OpenGLPriest »

I'll see what I can do, but "quickly" is not a word I would associate with this project right now. Just getting the OGRE libraries to build when I started working on this took quite some time, and required some surgical symlinking to get it to use the right files. After my improvements are finished, if I can find somewhere to host modified OGRE libraries and a demo, then people can do a pretty quick test.

On the other hand: I recorded my procedures through the entire process, so if there was demand from other developers, I could post procedures for setting up a cross-compile build environment and building OGRE for the Raspberry Pi. This setup would probably take a few hours, plus an estimated ~1hr to build the Raspberry Pi OGRE main library and the GLES2 rendersystem on a fairly modern desktop.
User avatar
mattmatt
Gnoblar
Posts: 12
Joined: Tue Feb 14, 2012 2:06 pm

Re: Raspberry pi

Post by mattmatt »

Hi folks!

Nice job! I'm trying now to compile bigianb directly on my device, but it seems it will need a lot of time!

@openGLPriest: Yes we would be very interested in having the information about cross-compiling ;)

One newbie question: Is it possible just to compile only OpenGLES RenderSystem, and use the Ogre packages from the debian repositories?
Fetching the lib like that...:

Code: Select all

sudo apt-get install libogre-1.8.0 libogre-1.8-dev
And using a simple makefile like this:

Code: Select all

NAME=ogreHello
CXXFLAGS=-Wall -std=c++0x
INCLUDES= -I/opt/vc/include \
                 -I/usr/include/OGRE \
                 -I/opt/vc/include/interface/vmcs_host/linux \
                 `pkg-config --cflags sdl`
LDFLAGS=-L/usr/lib/arm-linux-gnueabihf -lOgreMain -L/opt/vc/lib -lGLESv2 -lEGL -lbcm_host 
SRCS=LowLevelOgre.cpp
OBJS=$(SRCS:%.cpp=%.o)

all: $(NAME)

$(NAME): $(OBJS)
        $(CXX) -o $@ $(OBJS) $(LDFLAGS)

.cpp.o:
        $(CXX) $(CXXFLAGS) $(INCLUDES) -c -o $@ $<

LowLevelOgre.o: LowLevelOgre.h

clean:
        rm -f $(OBJS)
        rm -f $(NAME)
OpenGLPriest
Gnoblar
Posts: 8
Joined: Tue May 28, 2013 1:31 am

Re: Raspberry pi

Post by OpenGLPriest »

MattMatt: I never thought of building only the GLES2 rendersystem. I guess it's possible, but have a feeling that it wouldn't work: you would have to find an OgreMain library that was already built for the ARM target, and Android OGRE probably has a bunch of Android-specific stuff in it. Once you're set up for cross-compilation, building it yourself will be the easy way.

Regarding cross-compilation: Earlier in this thread, bharling mentioned being 6 hours into a build on the Pi. My observed cross-compile build time for both libOgreMain and RenderSystem_GLES2 is roughly 1 hour (on a 2011-era laptop). Assuming my procedure is replicable, one should be able to set up cross-compilation and build the project before a native build would be finished.

I need to clean up my notes a bit, but I will post some procedure instructions in this thread over the next few hours. These will be instructions for setting up cross-compilation for the Raspberry Pi target on an x64 Ubuntu dev machine, using the Eclipse IDE.
OpenGLPriest
Gnoblar
Posts: 8
Joined: Tue May 28, 2013 1:31 am

Re: Raspberry pi

Post by OpenGLPriest »

Ok, here is part one: setting up cross-compilation, plus an extra section on remote debugging over the network. If anyone uses this, tell me if something doesn't work.

Code: Select all

2013.5.31 A condensed procedure for cross-compiling a Raspberry Pi program from an Ubuntu Linux x64 development machine, and network debugging a program running on the Raspberry Pi from the development machine.
+-+-+ drawn heavily from the excellent tutorials at http://hertaville.com/raspberry-pi/ +-+-+

Prerequisites: An Ubuntu Linux x64 development machine (anything debian-based will probably work, I use Ubuntu-based Linux Mint) with a network connection to a Raspberry Pi with ssh enabled. 
Note: All control of the Raspberry Pi is done from the development machine over ssh. I haven't had a keyboard plugged into the Pi for most of the time that I've developed for it.

Development machine commands are marked with "dev:", and Raspberry Pi commands are marked with "rpi:".
"[raspberry pi IP]" in a command should be replaced with the Raspberry Pi's ip address.


Strongly-suggested first step: add the development machine's public key to the Raspberry Pi's authorized_keys file. This will save you from having to type the ssh password every time you make a new connection, of which there will be many.
dev:	cat ~/.ssh/id_rsa.pub
	This will print the public key to the console.

rpi:	touch ~/.ssh/authorized_keys	(if it doesn't already exist)
	nano ~/.ssh/authorized_keys
	Use the nano editor to paste the public key into authorized_keys and save. SSH connections from the dev machine will now be accepted automatically.


Set up the cross-compiling toolchain: (reference: http://hertaville.com/2012/09/28/development-environment-raspberry-pi-cross-compiler/ )
dev:	sudo apt-get install git
	sudo apt-get install ia32-libs	(this took ~10 minutes)
	mkdir ~/raspberrypi
	cd ~/raspberrypi
	sudo git clone git://github.com/raspberrypi/tools.git	(this took ~6 minutes)
	cd ~/
	sudo nano .bashrc
		add to the end: “export PATH=$PATH:$HOME/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin” 
	sudo nano .profile
		add to the end: “export PATH=$PATH:$HOME/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin” 
	log out, log back in
	arm-linux-gnueabihf-gcc -v (test: this should now display the installed toolchain version)


Install Eclipse:
dev:	sudo apt-get install eclipse-platform
	sudo apt-get install eclipse-cdt


Set up Eclipse cross-compilation & HelloWorld test:
dev:	in Eclipse
	File -> New -> C++ Project
		"Hello World C++ Project"
		Linux GCC toolchain

	edit project properties (note: not all of this is necessary for this particular test project)
	C/C++ General -> Paths and Symbols
		Includes -> C++
			~/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/arm-linux-gnueabihf/include
			~/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/arm-linux-gnueabihf/libc/usr/include
			~/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/lib/gcc/arm-linux-gnueabihf/4.7.2/include-fixed
			~/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/lib/gcc/arm-linux-gnueabihf/4.7.2/include
			~/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/lib/gcc/arm-linux-gnueabihf/4.7.2/finclude
		Library Paths
			~/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/arm-linux-gnueabihf/lib
			~/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/arm-linux-gnueabihf/libc/lib
			~/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/arm-linux-gnueabihf/libc/lib/arm-linux-gnueabihf
			~/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/lib/gcc/arm-linux-gnueabihf/4.7.2
			~/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/libexec/gcc/arm-linux-gnueabihf/4.7.2
	C/C++ Build -> Settings -> Tool Settings
		GCC C++ Compiler -> command: arm-linux-gnueabihf-g++
		GCC C Compiler -> command: arm-linux-gnueabihf-gcc
		GCC C++ Linker -> command: arm-linux-gnueabihf-g++
		GCC Assembler -> command: arm-linux-gnueabihf-as

	Window -> Show View -> Other -> Remote Systems -> Remote Systems Details (drag on to interface, if necessary)
		Remote Systems Detail -> New Connection
			Select Remote System Type: SSH only , next
			Enter raspberry pi network info, finish

	[transfer test]
	Remote System tab -> Raspberry Pi
		Connect
		Remote Systems Detail -> Show in Remote Systems View
		[use interface to copy HelloWorld bin to raspberry pi]
	or
		rsync -e ssh /home/user/workspace/HelloWorld/Debug/HelloWorld pi@[raspberry pi IP]:~/
	~/HelloWorld should now be able to run on the Raspberry Pi


Set up Eclipse Remote Debugging:
dev:	in Eclipse
	Run -> Debug Configurations
		double click on “C/C++ Remote Application”, call it “Automatic Debug”
		confirm “Using GDB (DSF) Automatic Remote Debugging Launcher” below tabs
		Main tab:
			“C/C++ Application” confirm path to bin on dev machine (relative to project directory, or absolute)
			Project: confirm project name
			Build (if required) before launching
				check “Select configuration using ‘C/C++ Application’"
				select ‘Enable auto build’ radio button
			Connection: select “Raspberry Pi”
			Remote Absolute File Path for C/C++ Application:	set to remote path for binary (manually create the directory on the Raspberry Pi if it doesn't already exist)
			Commands to Execute Before application:
				sudo -i	(necessary for system resources like GPIO, may be optional)
				chmod +x HelloWorld
			“Skip download to target path”: confirm unchecked
		Debug tab:
			GDB debugger: arm-linux-gnueabihf-gdb
		Common tab:
			check Debug in Favourites Menu->Debug
	By using the option you just added to Eclipse's Debug pull-down menu, You should now be able to hit breakpoints, etc., in the HelloWorld app running on the Raspberry Pi.
After doing this, you can be certain of successful cross-compilation on your dev machine. OGRE-specific material to follow...
OpenGLPriest
Gnoblar
Posts: 8
Joined: Tue May 28, 2013 1:31 am

Re: Raspberry pi

Post by OpenGLPriest »

Part 2: Actually building Ogre libraries: note that this uses the newest Raspberry Pi Ogre port code available on bitbucket, and won't actually allow you to render graphics yet. However, this procedure will build the working render code when it's ready.

Code: Select all

2013.6.1  A procedure for cross-compiling OGRE Libs for the Raspberry Pi platform from an Ubuntu Linux x64 development machine,
	using the code from
	https://bitbucket.org/bigianb/ogre/commits/e4d4bccd916a17adf64ad27c89443409b3fee82c
	(direct download as of 2013.6.1: https://bitbucket.org/bigianb/ogre/get/v1-9.zip )
	Known issues:	this build is missing the Overlay subsystem
			Ogre engine samples do not build
			RenderSystem_GLES2 port is in progress and does not render yet (this should be fixed soon)

	+-+-+ This is a work in progress: successful execution of an OGRE demo program linked to these libraries will generate error messages, not graphics. +-+-+

Prerequisites:
	An Ubuntu Linux x64 development machine (anything debian-based will probably work, I use Ubuntu-based Linux Mint) with a network connection to a Raspberry Pi with ssh enabled.
		Note: All control of the Raspberry Pi is done from the development machine over ssh. I haven't had a keyboard plugged into the Pi for most of the time that I've developed for it.
	The Raspberry Pi cross-compiling toolchain installed in ~/raspberrypi
	The Ogre library source	in ~/ogre-source/bigianb-ogre-e4d4bccd916a

Development machine commands are marked with "dev:", and Raspberry Pi commands are marked with "rpi:".
"[raspberry pi IP]" in a command should be replaced with the Raspberry Pi's ip address.


Install dependencies on the Raspberry Pi: (some of these are optional)
rpi:
	sudo apt-get install libogre-1.8-dev
	sudo apt-get install rsync
	sudo apt-get install libfreetype6-dev
	sudo apt-get install libboost-date-time-dev
	sudo apt-get install libboost-thread-dev
	sudo apt-get install nvidia-cg-toolkit
	sudo apt-get install libfreeimage-dev
	sudo apt-get install zlib1g-dev
	sudo apt-get install libzzip-dev
	sudo apt-get install libois-dev
	sudo apt-get install libcppunit-dev
	(skip this, 964MB) sudo apt-get install doxygen
	sudo apt-get install libxt-dev
	sudo apt-get install libxaw7-dev
	sudo apt-get install libxxf86vm-dev
	sudo apt-get install libxrandr-dev
	sudo apt-get install libglu-dev
	sudo apt-get install libgles2-mesa
	sudo apt-get install libgles2-mesa-dev
	sudo apt-get install libpoco-dev
	sudo apt-get install libraspberrypi-dev


Install CMake on the development machine:
dev:
	sudo apt-get install cmake-qt-gui


Copy dependencies from the Raspberry Pi to a cross-compile target root ( ~/raspberrypi/native ) on the build machine:
dev:
	rsync -e ssh -lrh --progress pi@[raspberry pi IP]:/usr/include ~/raspberrypi/native/usr/;\
	rsync -e ssh -lrh --progress pi@[raspberry pi IP]:/usr/lib ~/raspberrypi/native/usr/;\
	rsync -e ssh -lrh --progress pi@[raspberry pi IP]:/opt/vc/include ~/raspberrypi/native/opt/vc/;\
	rsync -e ssh -lrh --progress pi@[raspberry pi IP]:/opt/vc/lib ~/raspberrypi/native/opt/vc/;\
	rsync -e ssh -lrh --progress pi@[raspberry pi IP]:/lib ~/raspberrypi/native/

Redirect files and directories with symlinks:
dev:
	Delete files and directories to be replaced:
		rm -r ~/raspberrypi/native/usr/include/GLES2
		rm -r ~/raspberrypi/native/usr/include/EGL
		rm ~/raspberrypi/native/usr/lib/arm-linux-gnueabihf/libGLESv2.so
		rm ~/raspberrypi/native/usr/lib/arm-linux-gnueabihf/libEGL.so

		ln -s ~/raspberrypi/native/opt/vc/include/GLES2 ~/raspberrypi/native/usr/include/GLES2
		ln -s ~/raspberrypi/native/opt/vc/include/EGL ~/raspberrypi/native/usr/include/EGL
		ln -s ~/raspberrypi/native/opt/vc/lib/libGLESv2.so ~/raspberrypi/native/usr/lib/arm-linux-gnueabihf/libGLESv2.so
		ln -s ~/raspberrypi/native/opt/vc/lib/libEGL.so ~/raspberrypi/native/usr/lib/arm-linux-gnueabihf/libEGL.so

		ln -s ~/raspberrypi/native/opt/vc/include/interface ~/raspberrypi/native/usr/include/interface

	Fix non-standard paths:
		ln -s ~/raspberrypi/native/opt/vc/include/interface/vcos/pthreads/vcos_platform_types.h ~/raspberrypi/native/opt/vc/include/interface/vcos
		ln -s ~/raspberrypi/native/opt/vc/include/interface/vcos/pthreads/vcos_platform.h ~/raspberrypi/native/opt/vc/include/interface/vcos
		ln -s ~/raspberrypi/native/opt/vc/include/interface/vcos/pthreads/vcos_futex_mutex.h ~/raspberrypi/native/opt/vc/include/interface/vcos

		ln -s ~/raspberrypi/native/opt/vc/include/bcm_host.h ~/raspberrypi/native/usr/include
		ln -s ~/raspberrypi/native/opt/vc/include/vcinclude ~/raspberrypi/native/usr/include

	libz fix:
		rm ~/raspberrypi/native/usr/lib/arm-linux-gnueabihf/libz.so
		ln -s ~/raspberrypi/native/lib/arm-linux-gnueabihf/libz.so.1.2.7 ~/raspberrypi/native/usr/lib/arm-linux-gnueabihf/libz.so

Use CMake to generate the make files:
dev:	in cmake-gui:
		source: ~/ogre-source/bigianb-ogre-e4d4bccd916a
		build: ~/ogre-source/build
		File->Delete Cache
		Tools->Configure
			select Unix Makefiles, Specify options for cross-compiling
			OS: Linux
			C: ~/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc
			C++: ~/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++
			Target Root: ~/raspberrypi/native
			all Modes: Search only in Target Root
		check Advanced, set CMAKE_MAKE_PROGRAM to /usr/bin/make
		add entry: RPI (set to true)
		Configure
		change OGRE_BUILD_RENDERSYSTEM_GL to false
		Configure
		Generate

Use Make to build the libraries:
dev:
	cd ~/ogre-source/build
	make

Expected time: ~1 hour
Results: libraries will build successfully, peripheral errors will occur
(known issues)
finished at 98%
~/raspberrypi/native/usr/lib/libfreeimage.so: undefined reference to `png_read_info@PNG12_0'
and other link errors in SampleBrowser
Still to come: a simple Ogre test app and deployment instructions.
OpenGLPriest
Gnoblar
Posts: 8
Joined: Tue May 28, 2013 1:31 am

Re: Raspberry pi

Post by OpenGLPriest »

Part 3: Deploying a minimal test app that enables remote debug of the Ogre libraries. With the currently uploaded libraries, you will see error messages, but with my version, the demo shows me a cyan screen.
Use this code:

Code: Select all

#include <Ogre.h>

Ogre::RenderWindow *renderWindow = NULL;

class FrameListener : public Ogre::FrameListener
{
public:
   FrameListener(){}
   bool frameStarted(const Ogre::FrameEvent& evt)
    {
      // stop render in main window is closed
        if(renderWindow->isClosed()){return false;}
      return true;
   }
   bool frameEnded(const Ogre::FrameEvent &evt){return true;}
};

int main(int argc, char* argv[])
{
	try
	{
		Ogre::Root *root = new Ogre::Root();
		root->loadPlugin("/home/pi/RPI_OGRE_GLES2/RenderSystem_GLES2.so.1.9.0");

		Ogre::RenderSystemList rs = root->getAvailableRenderers();
		Ogre::RenderSystem * r=rs.at(0);

		root->setRenderSystem(r);
		root->initialise(false);
		renderWindow = root->createRenderWindow("Main",1920,1080,true);

		Ogre::SceneManager *sceneMan = root->createSceneManager(Ogre::ST_GENERIC);
		Ogre::Camera *cam = sceneMan->createCamera("mainCam");

		Ogre::Viewport *vp = renderWindow->addViewport(cam);
		vp->setBackgroundColour(Ogre::ColourValue(0,1,1));

		FrameListener listener;
		root->addFrameListener(&listener);

		// start rendering
		root->startRendering();

	} catch(Ogre::Exception& e ) {
        printf("An exception has occured: %s\n",
                e.getFullDescription().c_str());
    }
	return 0;
}
with this procedure (based on my last 2 posts)

Code: Select all

2013.6.1 Raspberry Pi Ogre test app (Eclipse) setup notes w/debug symbols for OgreMain and RenderSystem_GLES2
	Notes:	Replace "/home/user" with your home directory, using '~' causes failures here.
		Seeing "Error during file upload." error -> probably a path error somewhere in the project settings.

Project Setup:
	Set up a successful cross-compiling app with remote debug as before, then set project settings:

	project properties -> C/C++ Build -> Settings -> Tool Settings
		GCC C++ Compiler -> Includes -> Include paths (-l) 
			/home/user/raspberrypi/native/usr/include
			/home/user/ogre-source/bigianb-ogre-e4d4bccd916a/RenderSystems/GLES2/include
			/home/user/ogre-source/bigianb-ogre-e4d4bccd916a/OgreMain/include
			/home/user/ogre-source/build/include

		GCC C++ Linker -> Libraries
			clear library and library path lists (-l and -L)

		GCC C++ Linker -> Miscellaneous -> Other options (-Xlinker [option])
			/home/user/ogre-source/build/lib/libOgreMain.so
			/home/user/ogre-source/build/lib/RenderSystem_GLES2.so
			/home/user/raspberrypi/native/usr/lib/arm-linux-gnueabihf/libOIS.so
			-rpath=/home/user/raspberrypi/native/usr/lib/arm-linux-gnueabihf
			-rpath=/home/user/raspberrypi/native/lib/arm-linux-gnueabihf
			-rpath=/home/user/raspberrypi/native/usr/lib
			-rpath=/home/user/raspberrypi/native/opt/vc/lib


	Debug Configurations -> (remote debugger) -> Debugger -> Main
		GDB Command File:
			set to /home/user/workspace/ogre_RPi_SimpleTest1/gdbinit
			create this file, with the following contents
				# GDB command file
				set sysroot /home/user/raspberrypi/native
			Debug info from the local copy of the Raspberry Pi libraries will now be loaded when remote debug starts.

on Raspberry Pi:
	mkdir /home/pi/RPI_OGRE_GLES2	(for remote debug shared libraries)

	point default library path to copy directory
		sudo ln -s ~/RPI_OGRE_GLES2/libOgreMain.so.1.9.0 /usr/lib/libOgreMain.so.1.9.0;\
		sudo ln -s ~/RPI_OGRE_GLES2/RenderSystem_GLES2.so.1.9.0 /usr/lib/RenderSystem_GLES2.so.1.9.0

back on the development machine:
	copy libraries to the Raspberry Pi:
		rsync -e ssh /home/user/ogre-source/build/lib/libOgreMain.so.1.9.0 pi@192.168.1.12:~/RPI_OGRE_GLES2/;\
		rsync -e ssh /home/user/ogre-source/build/lib/RenderSystem_GLES2.so.1.9.0 pi@192.168.1.12:~/RPI_OGRE_GLES2/
	link to Ogre libraries in build directory from the local target root:
		ln -s /home/user/ogre-source/build/lib/libOgreMain.so.1.9.0 /home/user/raspberrypi/native/usr/lib/libOgreMain.so.1.9.0
		ln -s /home/user/ogre-source/build/lib/RenderSystem_GLES2.so.1.9.0 /home/user/raspberrypi/native/usr/lib/RenderSystem_GLES2.so.1.9.0
		
To use GDB console while debugging in Eclipse: use left-most down arrow in the Console tab, select GDB.
The app, OgreMain, and RenderSystem_GLES2 code should now be inspectable in the debugger.
Again, if anything doesn't work, let me know so I can refine the procedure. The Raspberry Pi Ogre code is in progress, so this should all be useful pretty soon.
ramin
Gnoblar
Posts: 8
Joined: Thu May 12, 2011 3:30 pm

Re: Raspberry pi

Post by ramin »

Can I build and run Ogre3D for Linux/Ubuntu/Linaro on an ARM powered device similar to Raspberry Pi with OpenGLES 2.0 ?

I do have X but of course EGL without X would be nice too.

I have built Ogre3D for desktop Ubuntu with OpenGL but this is now a different target.

Any suggestions - is this possible?
sphaero
Gnoblar
Posts: 3
Joined: Mon Oct 13, 2014 2:51 pm

Re: Raspberry pi

Post by sphaero »

Any more progress on this? I'm currently trying to build Ogre on the RPI. It takes a while as I'm not cross compiling.

I've encounter some issues....
1: You need to add an entry RPI and set it to true in cmake. I guess you mean setting it to ON. Cmake has BOOL as ON/OFF.
2: Second you need to tell the Cmake build which EGL/GLES2 libraries to use. I've set the include paths to /opt/vc/include. I still had to move some files around as it couldn't find egl.h for example. I also needed to add -I/usr/include/interface/vcos/pthreads/ to fix some include error.

Has anybody had any success with this? I'm still waiting for my build to complete.

Rg,

Arnaud
sphaero
Gnoblar
Posts: 3
Joined: Mon Oct 13, 2014 2:51 pm

Re: Raspberry pi

Post by sphaero »

Yaikes... This is going to take a while... every change I make to the Cmake config (adding include paths) results in a complete rebuild....
sphaero
Gnoblar
Posts: 3
Joined: Mon Oct 13, 2014 2:51 pm

Re: Raspberry pi

Post by sphaero »

Apparently I was on the wrong branch... main instead of v1-9... Anyway it compiled, crashes now on EGL stuff...
To get it compiled I had to add set some paths for the EGL/GLES2 stuff:

CMAKE_CXX_FLAGS:STRING=-I/opt/vc/include/interface/vcos/pthreads/
EGL_INCLUDE_DIR:PATH=/opt/vc/include
EGL_egl_LIBRARY:FILEPATH=/opt/vc/lib/libEGL.so
OPENGLES2_INCLUDE_DIR:PATH=/opt/vc/include
OPENGLES2_gl_LIBRARY:FILEPATH=/opt/vc/lib/libGLESv2.so
OPENGLES_INCLUDE_DIR:PATH=/opt/vc/include
OPENGLES_gl_LIBRARY:FILEPATH=/opt/vc/lib/libGLESv1_CM.so

I also copied egl includes to the GLES dir:
cp /opt/vc/include/EGL/* /opt/vc/include/GLES/
(there's probably a nicer way)

Cmake progressed up to 188% :?:

Crashes are GLES2:
Loading library /home/pi/src/ogre_build/lib/RenderSystem_GLES2
Installing plugin: OpenGL ES 2.0 RenderSystem
OpenGL ES 2.x Rendering Subsystem created.
terminate called after throwing an instance of 'Ogre::RenderingAPIException'
what(): OGRE EXCEPTION(3:RenderingAPIException): Couldn`t open X display in X11EGLSupport::getXDisplay at /home/pi/src/ogre/RenderSystems/GLES2/src/EGL/X11/OgreX11EGLSupport.cpp (line 152)
Aborted

which makes sense, there's no X11

GLES:
Loading library /home/pi/src/ogre_build/lib/RenderSystem_GLES
An exception has occurred: OGRE EXCEPTION(7:InternalErrorException): Could not load dynamic library /home/pi/src/ogre_build/lib/RenderSystem_GLES. System Error: /home/pi/src/ogre_build/lib/RenderSystem_GLES.so: undefined symbol: _ZN4Ogre29GLESHardwareBufferManagerBase19createUniformBufferEjNS_14HardwareBuffer5UsageEbRKSs in DynLib::load at /home/pi/src/ogre/OgreMain/src/OgreDynLib.cpp (line 95)

I'm now switching to the RPI branch
Post Reply