OGRE port to NaCl (Google's Native Client)

Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.
Post Reply
dermont
Bugbear
Posts: 812
Joined: Thu Dec 09, 2004 2:51 am
x 42

Re: OGRE port to NaCl (Google's Native Client)

Post by dermont »

Hi, I'm trying to build this on Linux as an alternative to using firebreath.

I see from previous posts that a number of users have successfully built this on Linux, however for me CMake generation fails due to a path/case issue (Nacl instead of NaCl) when trying to locate OgreConfigDialogImp.h.

Both default/1.8 branches look the same, which branch should I be using? These were the changes I applied to the CMake file to resolve the above.

Code: Select all

if (OGRE_BUILD_PLATFORM_NACL)
  include_directories("include/NaCl")
  set(PLATFORM_HEADER_FILES
    include/NaCl/OgreConfigDialogImp.h
    include/NaCl/OgreErrorDialogImp.h
    include/NaCl/OgreTimerImp.h
  )
  set(PLATFORM_SOURCE_FILES
    src/NaCl/OgreConfigDialog.cpp
    src/NaCl/OgreErrorDialog.cpp
    src/NaCl/OgreTimer.cpp
    src/OgreSearchOps.cpp
  )
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Re: OGRE port to NaCl (Google's Native Client)

Post by Assaf Raman »

1.8 and the trunk are the same.
Regarding the issue - I will fix it in both.
Did you get everything to compile and run in the end?
If so - can you post the steps?
Watch out for my OGRE related tweets here.
JDX_John
Gnome
Posts: 397
Joined: Sat Nov 08, 2008 1:59 pm
x 2

Re: OGRE port to NaCl (Google's Native Client)

Post by JDX_John »

This is an exciting project - I don't like NaCl in theory but I do want a way to run my Ogre apps in the browser. I've been planning to use Firebreath but that means building Mac/Win/Linux versions.

Anyway, a couple of questions...
  1. The forum calls this a PORT. Is that accurate - it's like MOGRE rather than actually being Ogre proper? Or can we build the same code into both Win32 binaries and NaCl? Is it actually the Ogre source, or a snapshot you took and then modified?
  2. What's the current state and goal of this project - to become official like iOS support, or just a side-project?
  3. I saw a few links to online demos... what is the most current please?
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Re: OGRE port to NaCl (Google's Native Client)

Post by Assaf Raman »

1. actually the Ogre source. Think of it as a new platform.
2. Official, and it stable for you to use now, you don't have to wait.
3. https://chrome.google.com/webstore/deta ... ijajghikla
Watch out for my OGRE related tweets here.
JDX_John
Gnome
Posts: 397
Joined: Sat Nov 08, 2008 1:59 pm
x 2

Re: OGRE port to NaCl (Google's Native Client)

Post by JDX_John »

Those are great answers :) So is it actually in the 1.8 trunk (or whatever the DVCS term is)? I'm still on 1.7, waiting for a good reason to upgrade...

also - I just updated Chrome (15.something) on Win7 64 bit, and it loaded/ran pretty OK. Nowhere near 6min either, less than 1.
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Re: OGRE port to NaCl (Google's Native Client)

Post by Assaf Raman »

Yes, I should really remove the 6 min thing...
Watch out for my OGRE related tweets here.
JDX_John
Gnome
Posts: 397
Joined: Sat Nov 08, 2008 1:59 pm
x 2

Re: OGRE port to NaCl (Google's Native Client)

Post by JDX_John »

Hmm, is it supposed to work on Mac? Everything was looking great - rendersystem set up etc, then it got to:
create context started
Now it has just stopped - nothing rendered. Does it think it is working if it got this far? I just updated to 15.0.874 on Mac 10.5.
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Re: OGRE port to NaCl (Google's Native Client)

Post by Assaf Raman »

Does this demo work for you (try the Tumbler on that app)?
https://chrome.google.com/webstore/deta ... lfndbjhjcn
Watch out for my OGRE related tweets here.
JDX_John
Gnome
Posts: 397
Joined: Sat Nov 08, 2008 1:59 pm
x 2

Re: OGRE port to NaCl (Google's Native Client)

Post by JDX_John »

I'll try to remember to test when I'm on my MacBook next.

I had a question about your demo - how do you handle the resource downloading/checking? Did you roll your own functionality, use some NaCl "standard library", or is there stuff in Ogre to load remote resources already?
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Re: OGRE port to NaCl (Google's Native Client)

Post by Assaf Raman »

I use NaCl peeper API to download zip files, then read them, then I upload to memory, then I use as resources using the EmbeddedZipArchiveFactory classes.
I could have used only the EmbeddedZipArchiveFactory and embed the resources into your nexe - meaning less work, but I wanted to demonstrate downloading resources from the internet - as this may be the more common case for web applications.
Watch out for my OGRE related tweets here.
User avatar
Zonder
Ogre Magi
Posts: 1168
Joined: Mon Aug 04, 2008 7:51 pm
Location: Manchester - England
x 73

Re: OGRE port to NaCl (Google's Native Client)

Post by Zonder »

yeah you would want your app open sooner and download resources as needed if it was a game you might have 40 levels no need to download each lvl until the user gets to them
There are 10 types of people in the world: Those who understand binary, and those who don't...
dermont
Bugbear
Posts: 812
Joined: Thu Dec 09, 2004 2:51 am
x 42

Re: OGRE port to NaCl (Google's Native Client)

Post by dermont »

Assaf Raman wrote:1.8 and the trunk are the same.
Regarding the issue - I will fix it in both.
Did you get everything to compile and run in the end?
If so - can you post the steps?
Sorry I didn't manage to compile, still problems linking.

I do not know enough about nacl but I'm probably wrongly assuming that nacl is just a derivative of mingw.

I've built the dependencies with nacl (not sure about OIS) but I don't understand how this works since OIS is built against Xlib (X11) on Linux. Surely I can't mix the libraries I link against i.e. nacl/system.

I've cross-compiled before on Linux against a vanilla mingw and as with ncal the CMake build is a pain, each change invoking a complete rebuild.

After a recent Ubuntu update for Chromium the nacl samples don't even run, they did previously so I'm not sure how I will test this even if I manage to build. Anyway any help/suggestions would be appreciated.

These are the changes that I made:

Code: Select all

diff --git a/Samples/Browser/include/SampleBrowser_NaCl.h b/Samples/Browser/include/SampleBrowser_NaCl.h
--- a/Samples/Browser/include/SampleBrowser_NaCl.h
+++ b/Samples/Browser/include/SampleBrowser_NaCl.h
@@ -63,7 +63,8 @@
 #include "ppapi/cpp/completion_callback.h"
 #include "ppapi/cpp/input_event.h"
 #include "OgreZip.h"
-#include <GLES2\gl2.h>
+#include <GLES2/gl2.h>
+//#include <gl2.h>
 
 namespace 
 {
@@ -836,9 +837,9 @@
                 void capture(){};
                 OIS::Interface* queryInterface(OIS::Interface::IType) {return NULL;};
                 void _initialize(){};
-                bool isKeyDown(OIS::KeyCode){return false;};
+                bool isKeyDown(OIS::KeyCode) const {return false;};
                 const std::string& getAsString(OIS::KeyCode){return "";};
-                void copyKeyStates(char*){};
+                void copyKeyStates(char*) const {};
                 bool HandleInputEvent(const pp::InputEvent& event)
                 {
                     const pp::KeyboardInputEvent *keyboardEvent =
diff --git a/Samples/Browser/src/FileSystemLayerImpl_NaCl.cpp b/Samples/Browser/src/FileSystemLayerImpl_NaCl.cpp
--- a/Samples/Browser/src/FileSystemLayerImpl_NaCl.cpp
+++ b/Samples/Browser/src/FileSystemLayerImpl_NaCl.cpp
@@ -27,9 +27,9 @@
  */
 #include "FileSystemLayerImpl.h"
 #include <sys/types.h>
-#include <ppapi\cpp\file_system.h>
-#include <ppapi\cpp\file_ref.h>
-#include <ppapi\cpp\file_io.h>
+#include <ppapi/cpp/file_system.h>
+#include <ppapi/cpp/file_ref.h>
+#include <ppapi/cpp/file_io.h>
 
 namespace OgreBites
 {
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Re: OGRE port to NaCl (Google's Native Client)

Post by Assaf Raman »

I don't have all the information needed to help you out, sorry.
Watch out for my OGRE related tweets here.
JDX_John
Gnome
Posts: 397
Joined: Sat Nov 08, 2008 1:59 pm
x 2

Re: OGRE port to NaCl (Google's Native Client)

Post by JDX_John »

Assaf Raman wrote:Does this demo work for you (try the Tumbler on that app)?
https://chrome.google.com/webstore/deta ... lfndbjhjcn
Pong works but Tumbler doesn't - no errors shown, just a title and no graphics.

Do I maybe need to enable something manually on Mac? I'm on v15 on both Mac and W7, W7 worked great.
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Re: OGRE port to NaCl (Google's Native Client)

Post by Assaf Raman »

Watch out for my OGRE related tweets here.
JDX_John
Gnome
Posts: 397
Joined: Sat Nov 08, 2008 1:59 pm
x 2

Re: OGRE port to NaCl (Google's Native Client)

Post by JDX_John »

Is the graphics API available to NaCl the same as what you get on iOS, GL-ES?
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Re: OGRE port to NaCl (Google's Native Client)

Post by Assaf Raman »

Yes, you have full OpenGL ES 2.0 support.
Watch out for my OGRE related tweets here.
Wolfos
Gnoblar
Posts: 12
Joined: Fri May 21, 2010 3:49 pm

Re: OGRE port to NaCl (Google's Native Client)

Post by Wolfos »

Doesn't even load for me. The previously mentioned Tumblr demo works fine, but when I try loading the Ogre demo page, it says "NaCI plugin not loaded" or something like that.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: OGRE port to NaCl (Google's Native Client)

Post by jacmoe »

Did you configure Chrome as instructed? :)
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Re: OGRE port to NaCl (Google's Native Client)

Post by Assaf Raman »

Are you trying the Chrome web store version of the OGRE NaCl demo?
Watch out for my OGRE related tweets here.
rndbit
Gnoblar
Posts: 20
Joined: Sat Mar 05, 2011 7:57 pm

Re: OGRE port to NaCl (Google's Native Client)

Post by rndbit »

this is certainly big addition to ogre. is this going to make into the release of ogre any time in the future?
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Re: OGRE port to NaCl (Google's Native Client)

Post by Assaf Raman »

It is in the trunk, feel free to use it.
Watch out for my OGRE related tweets here.
User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126
Contact:

Re: OGRE port to NaCl (Google's Native Client)

Post by masterfalcon »

Actually, the code is also in the 1.8 branch.
rndbit
Gnoblar
Posts: 20
Joined: Sat Mar 05, 2011 7:57 pm

Re: OGRE port to NaCl (Google's Native Client)

Post by rndbit »

thats amazing news. i did not expect this to be supported in next release! thank you guys :)
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Re: OGRE port to NaCl (Google's Native Client)

Post by Assaf Raman »

After 3 different people asked me for it, I created a zip file that you can download and compile out of the box that includes all the relevant files and is not relative path dependent.
It makes compiling OGRE for NaCl mush easier.
So try it out.
1. Install the NaCl SDK (Google it and figure it out for yourself.)
2. Set an environment variable called "NACL_SDK_ROOT" to the NaCl SDK directory (Ex: "C:\nacl\sdk_update\nacl_sdk\pepper_16" - make sure you have the pepper_xx in it...)
3. Download this file: http://goo.gl/Qnr9G
4. There are two batch files in the zip to build OGRE - OGRE_32_NaCl.bat and OGRE_64_NaCl.bat to build the 32 and 64 bit versions of OGRE - just execute them.
Watch out for my OGRE related tweets here.
Post Reply