OGRE port to NaCl (Google's Native Client)
-
- 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)
I used pepper 20, I am not sure what is your issue, I can have a look later today.
Watch out for my OGRE related tweets here.
-
- Gnoblar
- Posts: 12
- Joined: Wed Aug 22, 2012 8:08 am
Re: OGRE port to NaCl (Google's Native Client)
This morning I have resolved the problem. The project have generated the '"nexe" file. I can run with chrome successfully .But the effect is not good. Some samples do not work well. Thank you for your help in these days.
-
- 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)
Yes, some samples does not work, but some do, why do you need all the samples?
Watch out for my OGRE related tweets here.
-
- Gnoblar
- Posts: 12
- Joined: Wed Aug 22, 2012 8:08 am
Re: OGRE port to NaCl (Google's Native Client)
Some can work but some can not.I am just very curious about the reason.
I hear nacl from someone by chance some time ago.When Ifirstly get in touch with nacl I think it is very magical and mysterious, so I try to know something about it .But after I have compiled the ogre_nacl Irealize I just nearly know nothing about nacl and need to study deeply.
Finally thank you for your guides. I am so sorry to disturbed you these days.
Hope to communicate with you someday again! Thank you for more than one time!
I hear nacl from someone by chance some time ago.When Ifirstly get in touch with nacl I think it is very magical and mysterious, so I try to know something about it .But after I have compiled the ogre_nacl Irealize I just nearly know nothing about nacl and need to study deeply.
Finally thank you for your guides. I am so sorry to disturbed you these days.
Hope to communicate with you someday again! Thank you for more than one time!
-
- 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)
Sure, good luck.
Watch out for my OGRE related tweets here.
-
- Gnoblar
- Posts: 9
- Joined: Mon Nov 05, 2012 12:28 am
Re: OGRE port to NaCl (Google's Native Client)
Hi guys!
This is my first post on Ogre forums so hello to everyone
I'm currently in the middle of creating NaCl Ogre build for linux, using naclpotrs scripts.
When I'll finish I'll try to push whole code directly to http://code.google.com/p/naclports/ so everyone will be able to use it.
Right now I have all configuration for Ogre ready and I'm working on OIS. Thanks to incredible work done by Assaf that should be quite easy.
Ideally I would like to prepare push request to make Assaf code part of the official distribution.
If that won't be possible then I'll keep all the changes in form of patch file (as naclports normally do). There is one problem however.
To do that I probably will need your permission to copy/modify your code Assaf. Is it guarded by any particular license or can I grab it freely?
Until all that will happen I'll keep all code here: https://github.com/pkukielka/naclports-ogre so everyone can have early access.
I still have one small problem with Ogre makefiles, but I'll come back later to ask proper questions
This is my first post on Ogre forums so hello to everyone

I'm currently in the middle of creating NaCl Ogre build for linux, using naclpotrs scripts.
When I'll finish I'll try to push whole code directly to http://code.google.com/p/naclports/ so everyone will be able to use it.
Right now I have all configuration for Ogre ready and I'm working on OIS. Thanks to incredible work done by Assaf that should be quite easy.
Ideally I would like to prepare push request to make Assaf code part of the official distribution.
If that won't be possible then I'll keep all the changes in form of patch file (as naclports normally do). There is one problem however.
To do that I probably will need your permission to copy/modify your code Assaf. Is it guarded by any particular license or can I grab it freely?

Until all that will happen I'll keep all code here: https://github.com/pkukielka/naclports-ogre so everyone can have early access.
I still have one small problem with Ogre makefiles, but I'll come back later to ask proper questions

-
- Gnoblar
- Posts: 9
- Joined: Mon Nov 05, 2012 12:28 am
Re: OGRE port to NaCl (Google's Native Client)
Hi guys!
Since this is my first post on Ogre forums I would like to say hello to everyone
I'm working on bringing Ogre to naclports. I already created sh script/makefiles for Ogre itself and now
I'm looking on last dependency which I need to make everything work - OIS. I know that Assaf Raman already
ported it to NaCl (awesome work overall, thanks!). I think some solution which people can use right away without
playing itself with build systems, dependencies, etc. would be really nice.
Unlucky when I looked into code which you posted Assaf it looks like whole logic is commented out.
Not only that, it doesn't look like something which is matching current pepper API. What happened here?
DO you maybe have working code which you could share with me, and which we possibly use for naclports?
If not then I'll need to do the same work myself I guess.
I wrote one post in similar fashion few days ago, but since I pasted link to github it required administration approval.
I think it was Monday, and looks like no one care to approve it. I hope I'm not violating any forum rule by posting this again,
but I would like to get any feedback.
Initial code is already present on github. I'm not going to paste any links here again, but you can find it yourself
looking at my projects (my nick on gh is same as here). If someone want to help/comment/etc. please feel free.
BTW. Did anyone already managed to make it work with NaCl on linux? If so then with what OIS?
Regards
Since this is my first post on Ogre forums I would like to say hello to everyone

I'm working on bringing Ogre to naclports. I already created sh script/makefiles for Ogre itself and now
I'm looking on last dependency which I need to make everything work - OIS. I know that Assaf Raman already
ported it to NaCl (awesome work overall, thanks!). I think some solution which people can use right away without
playing itself with build systems, dependencies, etc. would be really nice.
Unlucky when I looked into code which you posted Assaf it looks like whole logic is commented out.
Not only that, it doesn't look like something which is matching current pepper API. What happened here?
DO you maybe have working code which you could share with me, and which we possibly use for naclports?
If not then I'll need to do the same work myself I guess.
I wrote one post in similar fashion few days ago, but since I pasted link to github it required administration approval.
I think it was Monday, and looks like no one care to approve it. I hope I'm not violating any forum rule by posting this again,
but I would like to get any feedback.
Initial code is already present on github. I'm not going to paste any links here again, but you can find it yourself
looking at my projects (my nick on gh is same as here). If someone want to help/comment/etc. please feel free.
BTW. Did anyone already managed to make it work with NaCl on linux? If so then with what OIS?
Regards

-
- 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)
Look at "Samples\Browser\include\SampleBrowser_NaCl.h" line 694 and on
Watch out for my OGRE related tweets here.
-
- 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)
Nice effort, I will help you get this finished as much as I can.
Watch out for my OGRE related tweets here.
-
- Gnoblar
- Posts: 9
- Joined: Mon Nov 05, 2012 12:28 am
Re: OGRE port to NaCl (Google's Native Client)
Thank you very much, that's exactly what I needed to progress with the whole thingAssaf Raman wrote:Look at "Samples\Browser\include\SampleBrowser_NaCl.h" line 694 and on

I'll keep you and other guys updated. I believe everything should be done and available on github before end of the week.
I'll also try to push it to the official naclports repo but it's hard to say how much time it could take.
-
- Gnoblar
- Posts: 9
- Joined: Mon Nov 05, 2012 12:28 am
Re: OGRE port to NaCl (Google's Native Client)
I had some problems with porting OIS so for now I disabled Samples and OIS is not needed.
Core Ogre should be compiling without problems (just remember to export NACL_GLIBC=1 as mentioned in README).
Here is link to the repository: https://github.com/pkukielka/naclports-ogre3d
Core Ogre should be compiling without problems (just remember to export NACL_GLIBC=1 as mentioned in README).
Here is link to the repository: https://github.com/pkukielka/naclports-ogre3d
-
- Gnoblar
- Posts: 6
- Joined: Thu Nov 15, 2012 11:59 am
Re: OGRE port to NaCl (Google's Native Client)
Assaf, nice job porting Ogre to Nacl! The samples run great on my system, both when running Win7 and Ubuntu.
I've gotten google's nacl working and all googles examples compile and work in the browser.
I have downloaded OGRE_nacl.rar, and created the environment variable
NACL_SDK_ROOT and pointed it to my g:\nacl_sdk\pepper_23 folder.
Then I run the ORGE_64_NaCl.bat file. It works for a long time but eventually fails with the following error:
from ..\..\SampleBrowser_NaCl.h:111: error: ISO C++ forbids declaration of 'CompletionCallbackFactory' with no type [-fpermissive]
And then a whole bunch of errors from SampleBrowser_NaCl.h
-Kevin
I've gotten google's nacl working and all googles examples compile and work in the browser.
I have downloaded OGRE_nacl.rar, and created the environment variable
NACL_SDK_ROOT and pointed it to my g:\nacl_sdk\pepper_23 folder.
Then I run the ORGE_64_NaCl.bat file. It works for a long time but eventually fails with the following error:
from ..\..\SampleBrowser_NaCl.h:111: error: ISO C++ forbids declaration of 'CompletionCallbackFactory' with no type [-fpermissive]
And then a whole bunch of errors from SampleBrowser_NaCl.h
-Kevin
-
- 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)
I guess they changed something in the latest NaCl SDK. I will have a look.
Watch out for my OGRE related tweets here.
-
- Gnoblar
- Posts: 6
- Joined: Thu Nov 15, 2012 11:59 am
Re: OGRE port to NaCl (Google's Native Client)
I may be using something out of date. I started with this from your post on 15 Sep 2011.
2> C:\1.txt which I assume was sending output to a file which causing Access Denied failure.
Then I found that I had to add
#include "ppapi/utility/completion_callback_factory.h" to SampleBrowser_NaCl.h
This gets rid of the problem I reported this earlier this morning.
Now I have undefined reference to 'GLES2ProgramUniverm1fvEXT' which I am working on.
So perhaps my basic problem is that I'm starting with something old?
If this is not to be used, then it would be great if you could point me to the proper place to start. I did check out the ogre source with mercurial and compile the windows version using MSVC 2010, and that worked and produced a working sdk folder, but although I could see some nacl stuff in there I wasn't clear on if or how you would actually build a NaCl version.
Anyway, the 32bit version included aThe OGRE NaCl sample is working once more, with faster loading (it is on a site with more bandwidth), I also added a progress bar for the loading and resource downloading.
Try it out here: http://goo.gl/RVl4h
2> C:\1.txt which I assume was sending output to a file which causing Access Denied failure.
Then I found that I had to add
#include "ppapi/utility/completion_callback_factory.h" to SampleBrowser_NaCl.h
This gets rid of the problem I reported this earlier this morning.
Now I have undefined reference to 'GLES2ProgramUniverm1fvEXT' which I am working on.
So perhaps my basic problem is that I'm starting with something old?
If this is not to be used, then it would be great if you could point me to the proper place to start. I did check out the ogre source with mercurial and compile the windows version using MSVC 2010, and that worked and produced a working sdk folder, but although I could see some nacl stuff in there I wasn't clear on if or how you would actually build a NaCl version.
-
- 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)
Not sure, try to work it out yourself, seems that you are doing a good job so far...
Watch out for my OGRE related tweets here.
-
- Gnoblar
- Posts: 6
- Joined: Thu Nov 15, 2012 11:59 am
Re: OGRE port to NaCl (Google's Native Client)
Ok, after about 14 hours, I finally have the sample browser compiled from source and running in chrome (although not perfectly). I will make another post which shows all the steps I took in more detail, but I would like to quickly point out the two things which took the most time.Assaf Raman wrote:Not sure, try to work it out yourself, seems that you are doing a good job so far...
I started with the 1.8 stable source from the main svn:
hg clone http://bitbucket.org/sinbad/ogre/ -u v1-8
There is a problem with OgreGLSLESLinkProgram.cpp near line #156:
If the #if is not true, the 'else' below the #endif is dangling, resulting in failed compiles.
Code: Select all
logObjectInfo( getCombinedName() + String("GLSL link result : "), mGLProgramHandle );
#if GL_EXT_separate_shader_objects && OGRE_PLATFORM != OGRE_PLATFORM_NACL
if(Root::getSingleton().getRenderSystem()->getCapabilities()->hasCapability(RSC_SEPARATE_SHADER_OBJECTS) &&
glIsProgramPipelineEXT(mGLProgramHandle))
{
glValidateProgramPipelineEXT(mGLProgramHandle);
}
#endif
else if(glIsProgram(mGLProgramHandle))
{
glValidateProgram(mGLProgramHandle);
}
OGRE_BUILD_PLUGIN_CG
was on by default. Turning this off with cmake-gui was the last thing keeping my build of the nexes from working.
Here is what I get on my Win7 64bit system running chrome v23:

The problem seems to be that near the camera, the floor is black for some reason. Perhaps somebody with more Ogre experience recognizes a possible cause? This does not happen with Assaf's version...
In the javascript console I'm seeing red messages like:
C036FD06: GL ERROR :GL_INVALID_ENUM : glRenderbufferStorage: internalformat was GL_STENCIL_INDEX1_OES
C036FD06: GL ERROR :GL_INVALID_ENUM : glRenderbufferStorage: internalformat was GL_DEPTH_COMPONENT24_OES
And 124 of the following:
RENDER WARNING: texture bound to texture unit 0 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering or is not 'texture complete'
-Kevin
-
- OGRE Team Member
- Posts: 1525
- Joined: Fri Feb 03, 2006 10:37 pm
- Location: Austria - Leoben
- x 100
Re: OGRE port to NaCl (Google's Native Client)
The black floor happens because ogre tries to use texture filtering (bilinear/triliniear/anisotropic) without mipmaps - the same happens on every android device / emulator except on iOS this is not an issue.
Atm i check if the current bounded has any mips at all if not i fallback to a supported filtering mode but this is guarded inside a ANDROID_PLATFORM guard in the gles rendersystem.
Atm i check if the current bounded has any mips at all if not i fallback to a supported filtering mode but this is guarded inside a ANDROID_PLATFORM guard in the gles rendersystem.
-
- Gnoblar
- Posts: 6
- Joined: Thu Nov 15, 2012 11:59 am
Re: OGRE port to NaCl (Google's Native Client)
ah ok, thanks wolfmanfx that is a good hint about the floor.
For anybody else who wants to try making a NaCl version of Ogre, I took all my notes and cleaned them up a bit and put them here:
https://sites.google.com/a/pieintheskys ... ive-client
-Kevin
For anybody else who wants to try making a NaCl version of Ogre, I took all my notes and cleaned them up a bit and put them here:
https://sites.google.com/a/pieintheskys ... ive-client
-Kevin
-
- Gnoblar
- Posts: 9
- Joined: Mon Nov 05, 2012 12:28 am
Re: OGRE port to NaCl (Google's Native Client)
Hi guys,
As I mentioned earlier I was porting Ogre to naclports. And this is already done: https://github.com/pkukielka/naclports-ogre3d
Now I wanted to create simple example of NaCl Ogre application. There were few reasons for this:
a) I had to disable Samples in my port because I decided to not port OIS for now
b) I think SampleBrowser is way too big and cluttered to be good example how to deal with NaCl
So here is my attempt:
https://github.com/pkukielka/ogre3d-nacl-template
Using build.sh it allows you to build complete multi-platform example (including manifest etc.).
Unlucky it's not fully working yet.
I'm able to create viewport and even set some color for it, but that's all.
I cannot draw anything. Also if you will look at the code (it's just couple of lines) you will see that
I'm trying to use renderOneFrame as SwapCallback - unlucky for some reason SwapCallback is never called.
Maybe someone can look at this and check if I didn't do something stupid?
I was looking at onSwapCallback/renderOneFrame methods in SampleBrowser_NaCl.h but to be honest
current implementation looks fishy to me and I'm not sure if I fully understand it.
I'll appreciate any help.
As I mentioned earlier I was porting Ogre to naclports. And this is already done: https://github.com/pkukielka/naclports-ogre3d
Now I wanted to create simple example of NaCl Ogre application. There were few reasons for this:
a) I had to disable Samples in my port because I decided to not port OIS for now
b) I think SampleBrowser is way too big and cluttered to be good example how to deal with NaCl
So here is my attempt:
https://github.com/pkukielka/ogre3d-nacl-template
Using build.sh it allows you to build complete multi-platform example (including manifest etc.).
Unlucky it's not fully working yet.
I'm able to create viewport and even set some color for it, but that's all.
I cannot draw anything. Also if you will look at the code (it's just couple of lines) you will see that
I'm trying to use renderOneFrame as SwapCallback - unlucky for some reason SwapCallback is never called.
Maybe someone can look at this and check if I didn't do something stupid?
I was looking at onSwapCallback/renderOneFrame methods in SampleBrowser_NaCl.h but to be honest
current implementation looks fishy to me and I'm not sure if I fully understand it.
I'll appreciate any help.
Last edited by pkukielka on Wed Nov 21, 2012 11:05 pm, edited 1 time in total.
-
- 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)
Are you using the RTSS in your simple sample?
Watch out for my OGRE related tweets here.
-
- Gnoblar
- Posts: 9
- Joined: Mon Nov 05, 2012 12:28 am
Re: OGRE port to NaCl (Google's Native Client)
Unless something is enabled by default then answer is: no.Assaf Raman wrote:Are you using the RTSS in your simple sample?
Actually code is so short that I can present it here:
Code: Select all
void SampleNaClInstance::renderOneFrame(int32_t result) {
WindowEventUtilities::messagePump();
mOgreRoot->renderOneFrame();
}
bool SampleNaClInstance::Init(uint32_t argc, const char* argn[], const char* argv[]) {
try {
RequestInputEvents(PP_INPUTEVENT_CLASS_MOUSE | PP_INPUTEVENT_CLASS_WHEEL | PP_INPUTEVENT_CLASS_KEYBOARD);
mRenderSystem.reset(new GLES2Plugin());
mOgreRoot.reset(new Root);
mOgreRoot->installPlugin(mRenderSystem.get());
mOgreRoot->setRenderSystem(mOgreRoot->getAvailableRenderers().front());
mOgreRoot->initialise(false);
NameValuePairList miscParams;
pp::CompletionCallbackFactory<SampleNaClInstance> mCcFactory;
mNaClSwapCallback = mCcFactory.NewCallback(&SampleNaClInstance::renderOneFrame);
miscParams["pp::Instance"] = Ogre::StringConverter::toString((unsigned long) this);
miscParams["SwapCallback"] = Ogre::StringConverter::toString((unsigned long) &mNaClSwapCallback);
RenderWindow* renderWindow = mOgreRoot->createRenderWindow("MainWindow", 800, 600, false, &miscParams);
SceneManager* sceneMgr = mOgreRoot->createSceneManager(Ogre::ST_GENERIC);
Camera* mainCam = sceneMgr->createCamera("MainCamera");
Light* light = sceneMgr->createLight("MainLight");
Viewport* viewport = renderWindow->addViewport(mainCam);
viewport->setBackgroundColour(ColourValue::Green);
renderOneFrame(0);
} catch (Ogre::Exception& e ) {
printf("Error: %s\n", e.getFullDescription().c_str()); fflush(stdout);
return false;
}
}
-
- 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)
there in no fixed pipeline in GLES2 - so write shaders or use RTSS.
Watch out for my OGRE related tweets here.
-
- Gnoblar
- Posts: 9
- Joined: Mon Nov 05, 2012 12:28 am
Re: OGRE port to NaCl (Google's Native Client)
Thanks, I guess that is the pars which is missing.Assaf Raman wrote:there in no fixed pipeline in GLES2 - so write shaders or use RTSS.
I'll try to look at RTSS (it's something new to me) and proceed with my sample.
Unlucky there is more and more work to finish even simple example, honestly I thought it will be simpler :/
-
- Gnoblar
- Posts: 9
- Joined: Mon Nov 05, 2012 12:28 am
Re: OGRE port to NaCl (Google's Native Client)
I was trying to play with RTSS a bit but honestly I'm not sure if I'm going in good direction and if it makes sense at all.
I added libOgreRTShaderSystemStatic.a to to linking phase and tried to initialize RTShader this way:
It seems to be ok (or maybe not?) but doesn't really change anything.
My biggest concern is that it's not Shader problem. I'm not even trying to render anything yet, so why I would need shader?
I just want to get SwapCallback, so I'll be able to render nothing frame by frame.
But this callback never happens. Can it be really caused by missing shaders?
It may be worth mentioning that all functions seems to finish successfully but on the outpupt
I see pleanty of messages like that:
I added libOgreRTShaderSystemStatic.a to to linking phase and tried to initialize RTShader this way:
Code: Select all
if (RTShader::ShaderGenerator::initialize()) {
RTShader::ShaderGenerator::getSingletonPtr()->addSceneManager(sceneMgr);
viewport->setMaterialScheme(Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME);
}
My biggest concern is that it's not Shader problem. I'm not even trying to render anything yet, so why I would need shader?
I just want to get SwapCallback, so I'll be able to render nothing frame by frame.
But this callback never happens. Can it be really caused by missing shaders?
It may be worth mentioning that all functions seems to finish successfully but on the outpupt
I see pleanty of messages like that:
(Well, at least during the module initialization, later it stops).[7238:7238:4694979838:ERROR:gles2_cmd_decoder.cc(5115)] GL ERROR :GL_INVALID_ENUM : glRenderbufferStorage: internalformat GL_INVALID_ENUM
[7238:7238:4694981785:ERROR:gles2_cmd_decoder.cc(5115)] GL ERROR :GL_INVALID_ENUM : glTexImage2D: format GL_INVALID_ENUM
-
- Gnoblar
- Posts: 9
- Joined: Mon Nov 05, 2012 12:28 am
Re: OGRE port to NaCl (Google's Native Client)
I dropped project for now since I decided to go with webgl instead and for my taste there were too many difficulties with NaCl + Ogre.
However naclports-ogre3d should be more or less complete and ogre3d-nacl-template misses some details and shaders I guess.
If someone want to contribute to that projects or take them over let me know.
However naclports-ogre3d should be more or less complete and ogre3d-nacl-template misses some details and shaders I guess.
If someone want to contribute to that projects or take them over let me know.