Page 3 of 4
Re: Berkelium in Ogre
Posted: Tue Mar 02, 2010 4:30 pm
by my.name
Re: Berkelium in Ogre
Posted: Tue Mar 02, 2010 4:42 pm
by jacmoe
=)
You've been busy.

Re: Berkelium in Ogre
Posted: Sun Mar 21, 2010 10:55 pm
by Simie
First, thanks for this! I plan on using this for the GUI in a small project I'm working on.
I was wondering if there you had any 64-bit plans for this library, or even if chromium supports it yet. We had planned to try and make our game 64-bit, but I admit we don't know how advantageous this would be yet.
Thanks

Re: Berkelium in Ogre
Posted: Mon Mar 29, 2010 4:20 pm
by Nesetalis
ohh this looks interesting

what level of doneness is this library? i mean, is it relatively finished or is it still a beta.
Is anyone using this in ogre yet? I couldn't get the demo on the first page to work, just a black screen.
Re: Berkelium in Ogre
Posted: Thu Jun 03, 2010 9:04 am
by Brocan
I'm currently using berkelium embbeded in MyGUI, it runs well, but I have a problem: I can't logging in any webpage! forums, gmail, youtube... i think that problem is related with cookies or javascript.
Any idea?
Thanks in advance!
Re: Berkelium in Ogre
Posted: Fri Feb 11, 2011 7:36 pm
by Falagard
Sorry for raising this old thread from the dead but I had someone send me a PM asking about my evaluation of Berkelium and I thought I'd post it here.
We're using Berkelium in our commercial home design software as our UI library, so yes we've evaluated and used it heavily.
It's great, and works pretty much exactly like our previous library did (Astral which was the core of the Navi library, predecessor to Awesomium) but with the faster and more up to date Chromium engine rather than Mozilla / Gecko.
We never could get Gecko to compile from sources, so we had to work with Astral binaries and that was a big negative for us, because once Astral stopped being worked on, we couldn't get up to date changes to Gecko / Mozilla.
With Berkelium and Chromium, we can compile everything from source and make changes and bug fixes as we find them.
The person who PM'd me asked how Berkelium communicates with our application and whether or not you have access to DOM events. There's an API for sending data from javascript running in a web page to the hosting application, and that triggers a listener / callback in C++ with the data that was passed. We use this as our mechanism for passing data from the page to our app and have written our own simple system for binding functions to these messages. We pass a function name and name/value pairs for parameters from javascript and then call the appropriate function in C++ and pass the data to the function.
For communicating back from the app to javascript we use the executeJavascript function in Berkelium which simply evaluates a string of javascript and executes it in the web page, and use a similar system of function and name/value pairs.
We've seen that Berkelium has ways to help you bind functions in C++, etc. I think but we ported from a different system to Berkelium and kept things the way we already had them.
If you want to handle DOM events in the hosting application you need to specifically write Javascript in the web page that intercepts the events and sends them to the application.
I hope that answers your questions.
Re: Berkelium in Ogre
Posted: Fri Feb 11, 2011 7:53 pm
by jacmoe
I am shocked! Good old Falagard - what a pleasure.

Thanks for your review of Berkelium.
Sounds like a worthwhile GUI alternative.
Re: Berkelium in Ogre
Posted: Thu Feb 17, 2011 11:25 am
by Equinox
Hey there,
I'm kind of new to using Berkelium, and I've been at it for days with no result.
Are there some tutorials that I can look at to get me started?
I don't need anything fancy because it's just a proof-of-concept for my thesis. However somewhere along the line I will need to split up the page into elements (I'll be coding the pages myself since it's only a POC, so no need to worry about how the split's gonna happen) to move them around.
Any pointers would be greatly appreciated!
Re: Berkelium in Ogre
Posted: Thu Feb 17, 2011 11:28 am
by so0os
Berk won't mess with your page, it just renders, so you can:
a) use heavy javascripting
b) split your page yourself
Also, look up wiki for dynamic textures, it's all you need to get it going.
Re: Berkelium in Ogre
Posted: Tue May 10, 2011 7:25 am
by Xplodwild
Equinox wrote:Hey there,
I'm kind of new to using Berkelium, and I've been at it for days with no result.
Are there some tutorials that I can look at to get me started?
Bump here, the demo on previous page doesn't work anymore (404), and it's not really clear how to integrate it. Some quick demo would be very useful.
Re: Berkelium in Ogre
Posted: Tue May 10, 2011 10:15 pm
by Nodrev
Hi,
Don't like to use a showcase topic as a help topic, but as I have worked on Berkelium integration, I'll share my experience on using it. There's two thing you must know about it:
First, if your application got more than one process, it can be very complicated to integrate berkelium.
The second is on the way it work: you have an executable that is run to "populate" Berkelium's process (it may have change but I don't think so regarding developers response on their forum). It's not very "polished" in my opinion.
So, for my part, I switched to a Awesomium fork,
Chromium Offscreen Renderer (from the last LGPL release). I had to patch (I still have to send this patch to the developers) it a little, but it was working well, except some errors on some online webpages, but if you know which html data you'll run on it (if you got the hand on that data, to test it and make sure html seems correct for COR), I recommand you to use it (even if Chromium version used by it is a little hold).
I do not have Berkelium code anymore, but COR integration code in Ogre can be find on
this svn, you can check it even if you wish to use Berkelium, as rtt rendering code and keyboard/mouse/javascript events injection should be very comparable.
<edit>One more thing, I saw on your website that you want a linux version for your game, and Berkelium is windows only if I remember well.</edit>
<edit2>forget the last edit, I'm litlle late for april fools... I feel so dumb

</edit2>
Re: Berkelium in Ogre
Posted: Fri May 13, 2011 7:14 pm
by kulik
Just a little plug for those interested. I've made a Berkelium integration into CEGUI (works with all renderers, including Ogre) a while back, I don't have time for it and it has some issues but they can be easily resolved. I have a little local test where I render Berkelium content into CEGUI images so I can even skin CEGUI Windows with moving Flash, SVGs and GIF

It's super easy to use with stuff like FlashWidget, HTMLWidget, etc... Plugs into CEGUI's resource system.
A very dated proof
[youtube]eZbIZEffilU[/youtube]
Re: Berkelium in Ogre
Posted: Fri Aug 26, 2011 2:39 pm
by Giggzee
Re: Berkelium in Ogre
Posted: Mon Aug 29, 2011 7:21 pm
by duststorm
I've also made an effort of including it in my application.
The result is a minimal-amount-of-code version to get berkelium to render to a texture in ogre. (there is no input handling)
It was educational, as I learned how to use pixelboxes for fiddling with texture buffers. This will come in handy in other projects.
This code is created for the current stable API version of berkelium (Berkelium 8.0.552.23)
For those interested:
BrowserWindow.cpp
Code: Select all
#include "include/BrowserWindow.h"
#include "berkelium/Context.hpp"
BrowserWindow::BrowserWindow(Ogre::String materialName, uint width, uint height)
{
mMaterialName = materialName;
mTextureName = materialName.append("_texture");
// TODO assert size > 0
mWidth = width;
mHeight = height;
// Create texture to render to
mTexture = Ogre::TextureManager::getSingleton().createManual(
mTextureName,
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
Ogre::TEX_TYPE_2D,
width,
height,
0, // no mipmaps
Ogre::PF_BYTE_BGRA,
Ogre::TU_DYNAMIC);
// Create a material using the texture
Ogre::MaterialPtr mMaterial = Ogre::MaterialManager::getSingleton().create(mMaterialName, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
mMaterial->getTechnique(0)->getPass(0)->createTextureUnitState(mTextureName);
// Create new browser window in Berkelium
Berkelium::Context * context = Berkelium::Context::create();
mWindow = Berkelium::Window::create(context);
mWindow->resize(width, height);
// Listen to updates of the browser window to render them to the texture
mWindow->setDelegate(this);
// Browse to webpage
browseToPage("http://www.google.com");
}
BrowserWindow::~BrowserWindow()
{
mWindow->destroy();
}
void BrowserWindow::onPaint(
Berkelium::Window *win,
const unsigned char *sourceBuffer,
const Berkelium::Rect &sourceBufferRect,
size_t numCopyRects,
const Berkelium::Rect *copyRects,
int dx,
int dy,
const Berkelium::Rect &scrollRect)
{
// Pixels to be written to texture
const Ogre::PixelBox srcBox = Ogre::PixelBox(
// Box that defines position of src buffer within complete browser window
rectToBox(sourceBufferRect),
Ogre::PF_BYTE_BGRA,
const_cast<unsigned char*>(sourceBuffer)
);
// Update texture
Ogre::HardwarePixelBufferSharedPtr pixelBuffer = mTexture->getBuffer();
// There might be multiple areas of the texture to update
for( int i =0; i<numCopyRects; i++) {
// Box that defines area of texture that has to be updated)
const Ogre::Box::Box destBox = rectToBox(copyRects[i]);
// Copy updated browser surface to texture (note: Don't lock the buffer yourself!! blitFromMemory does this)
pixelBuffer->blitFromMemory(srcBox.getSubVolume(destBox), destBox);
}
}
inline Ogre::Box BrowserWindow::rectToBox(Berkelium::Rect rect)
{
return Ogre::Box(
rect.left(),
rect.top(),
0,
rect.right(),
rect.bottom(),
1);
}
Ogre::String BrowserWindow::getMaterialName()
{
return mMaterialName;
}
Ogre::String BrowserWindow::getTextureName()
{
return mTextureName;
}
Ogre::MaterialPtr BrowserWindow::getMaterial()
{
return Ogre::MaterialManager::getSingletonPtr()->getByName(getMaterialName());
}
Ogre::TexturePtr BrowserWindow::getTexture()
{
return Ogre::TextureManager::getSingletonPtr()->getByName(getTextureName());
}
void BrowserWindow::browseToPage(Ogre::String url)
{
mUrl = url;
mWindow->navigateTo(url.data(), url.length());
}
Ogre::String BrowserWindow::getCurrentPage()
{
return mUrl;
}
BrowserWindow.h
Code: Select all
#ifndef OGREBROWSERWINDOW_H
#define OGREBROWSERWINDOW_H
#include <berkelium/WindowDelegate.hpp>
#include <Ogre.h>
class BrowserWindow : public Berkelium::WindowDelegate
{
public:
BrowserWindow(Ogre::String textureName, uint width=1024, uint height=1024);
~BrowserWindow();
virtual void onPaint(
Berkelium::Window *win,
const unsigned char *sourceBuffer,
const Berkelium::Rect &sourceBufferRect,
size_t numCopyRects,
const Berkelium::Rect *copyRects,
int dx, int dy,
const Berkelium::Rect &scrollRect);
virtual Ogre::String getMaterialName(void);
virtual Ogre::String getTextureName(void);
Ogre::MaterialPtr getMaterial(void);
Ogre::TexturePtr getTexture(void);
void browseToPage(Ogre::String url);
Ogre::String getCurrentPage(void);
inline Ogre::Box rectToBox(Berkelium::Rect rect);
private:
Ogre::String mTextureName;
Ogre::String mMaterialName;
Ogre::TexturePtr mTexture;
Ogre::String mUrl;
uint mWidth;
uint mHeight;
Berkelium::Window *mWindow;
};
#endif // OGREBROWSERWINDOW_H
Just include these two files in your code. To create a plane with a browser on it, do this:
Code: Select all
// Initialise the global Berkelium browser manager
Berkelium::init(Berkelium::FileString::empty());
// Create a browser instance
BrowserWindow *browserWindow = new BrowserWindow("BerkeliumMaterial");
// Create plane for testing browser component on
Ogre::MeshManager::getSingletonPtr()->createPlane("BerkeliumPlane", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
Ogre::Plane(Ogre::Vector3::UNIT_Z, 0), 3, 3);
Ogre::Entity *browserPlaneEnt = mSceneMgr->createEntity("BrowserPlane", "BerkeliumPlane");
mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(browserPlaneEnt);
// Assign it the material with the browser texture
browserPlaneEnt->setMaterial(browserWindow->getMaterial());
// Position the plane
Ogre::SceneNode *sceneNode = browserPlaneEnt->getParentSceneNode();
sceneNode->setPosition(Ogre::Vector3(0, 3, 5));
By default it will go to google.com
To make it go to another website you can
Code: Select all
mBrowserWindow->browseToPage("http://www.ogre3d.org");
Now you only need to update Berkelium regularly. To do this, add this line somewhere in the frameRenderingQueued() method of your application:
Code: Select all
// Update Berkelium
Berkelium::update();
I'm thinking of creating an article for it on the wiki to get people started quickly. I think this code is interesting to teach others how the buffer update using rectangles or ogre boxes works. But before that, I'll leave the code here for reviewal from others, and some possible improvements.
Re: Berkelium in Ogre
Posted: Tue Nov 08, 2011 10:17 pm
by Delaney
Tried to use this sample code to get Berkelium into my ogre 1.7 project but all I'm seeing is a black square. Also noticed that a breakpoint at the top of BrowserWindow::onPaint is never getting called. Is there extra bootstrapping needed to get BrowserWindow going outside of this example? Thanks!
Re: Berkelium in Ogre
Posted: Wed Nov 09, 2011 12:19 am
by Klaim
Do you call Berkelium's update function regularly?
Re: Berkelium in Ogre
Posted: Wed Nov 09, 2011 9:09 am
by Brocan
I don't know what version of berkelium are you using, but keep in mind that the "onPaint" interface was changed in one of the berkelium revisions. Look if you don't have the old version of the interface (so the virtual function is no called).
Cheers!
Re: Berkelium in Ogre
Posted: Wed Nov 09, 2011 12:29 pm
by duststorm
Yes, now I see. Apparently I forgot to mention one tiny bit
You need to update Berkelium regularly, which is not said in my post.
In the method frameRenderingQueued() of your application, add this part somewhere:
Code: Select all
// Update Berkelium
Berkelium::update();
Re: Berkelium in Ogre
Posted: Wed Nov 09, 2011 7:00 pm
by Delaney
Thanks guys! Figured it was something simple thought there might be some magic hook up I wasn't seeing.
Berkelium 64-bits
Posted: Fri Jul 13, 2012 11:04 am
by mattmatt
Hi!
This thread is pretty old, but I hope there is still some people interested in Berkelium!
Berkelium seems very awsome, I tried the little demo from the site.
We have a project in which we would like to use berkelium, but the thing is that it's "Windows x64", and Chromium is only 32-bit for the moment.
Would it exist a solution to use a 64-bit project with berkelium, using a 32-bit Chromium?
Thanx in advance for the help
Re: Berkelium in Ogre
Posted: Fri Jul 13, 2012 12:53 pm
by duststorm
There seems to exist no easy (or even possible) solution for linking 64bit to 32bit libraries.
http://stackoverflow.com/questions/1943 ... it-program
http://stackoverflow.com/questions/1116 ... 2-bit-dlls
What I would do is use a 32bit ogre (and make your application 32bit) and link it with berkelium.
64bit systems can run 32 bit applications (on linux for example with ia32)
I believe there is no 64bit berkelium because some time ago there was simply no 64bit chromium. Who knows, if you try compiling berkelium yourself with a newer chromium in 64bit it might just work.
That's actually the biggest disadvantage of berkelium: chromium is a huge and complex dependency.
Re: Berkelium in Ogre
Posted: Fri Jul 13, 2012 3:15 pm
by saejox
there three alternatives to berkelium i know of:
1 -
http://code.google.com/p/chromiumembedded/ - BSD
2 - QtWebkit - lgpl
3 - Awesomium - $$$
check them. maybe they can compile to 64bit
i use 32bit berkelium.
Re: Berkelium in Ogre
Posted: Fri Jul 13, 2012 3:25 pm
by AshMcConnell
Awesomium is free for indie developers (if you made < $100k last year)
http://awesomium.com/buy/
I'm hoping to use it for ORC
Re: Berkelium in Ogre
Posted: Mon Jul 16, 2012 5:08 pm
by duststorm
I already wanted to do this for a long time but I have finally
created a wiki article about this sample. Hope it proves useful to someone

Re: Berkelium in Ogre
Posted: Mon Sep 03, 2012 5:51 pm
by Kosmos
Is there anyway to use window.external in JavaScript code to execute C++ functions?
I can see it support this to execute JS code:
virtual void executeJavascript (WideString javascript)=0
Execute Javascript in the context of the Window.
But is there anyway to call c++ functions from JS?