Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Sgine as a applet, dlls?

6 views
Skip to first unread message

philip

unread,
Dec 30, 2010, 5:05:19 AM12/30/10
to sgine-dev
Hi,

What I want to do is to run my Sgine application within a firefox
window, just on my local machine, not for internet deployment.
How can I do this?

I guess, I should run it as an applet, but how is it going to call the
DLL files?
I dont need to run it as a applet ... as long as there is some way to
run the java program within firefox browser window. Its because I need
to do a lot of calls to firefox to render pages and to bring those
pages into Sgine as bitmaps. By locating the java application within
the firefox webpage I can have complete control over firefox through
the use of my plugin.

Any ideas?

Thanks, Philip

Hicks, Matt

unread,
Dec 30, 2010, 9:27:03 AM12/30/10
to sgin...@googlegroups.com
Something like this?

http://www.captiveimagination.com/download/sgine/testbox/jlaunch.html

If you click on the image the applet will load.  As far as rendering pages and then bringing them into Sgine as bitmaps...you mean rendering web pages in OpenGL?  Unfortunately I don't think you can do that the way you're suggesting.  However, you can use a Swing-based rendering of HTML to background render and then use the snapshot, or if you can get JWebPane to run you'd have most of what you want.  Finally, you could write a DLL to communicate with Firefox (or another browser) and render to a texture probably, but any of these options will be quite a bit of work and excludes any interactivity.

philip

unread,
Dec 30, 2010, 11:24:34 AM12/30/10
to sgine-dev

Hi Matt,

Is that url actually loading DLL's? seems to be the case, thats
amazing. Um, maybe I'm slightly off topic of Sgine specifically but
I'll talk about what I was trying to do.

What I've been trying to do is to be able to load webpages into Images
to display on sgine. Not needing any interactivity at this moment,
just a few URLs and a few pages as images.
Firstly I thought well I could embed a browser, so I tried SWT, but
that draws directly to the screen and I couldn't capture the bitmap
data from that due to some bug in SWT which only captures what is
actually on the screen, not what its going to display.
Then I tried Selenium to remote control Firefox, but I don't want
another firefox window open, I mean Selenium remote controls another
firefox window and I can get the image data back through selenium, but
- especially its no good if Selenium is opening lots of firefox
windows and that interrupts the application I am writing, I want just
one application window open.

Then I thought, I could create a firefox plugin which controls firefox
and get the screen data and sends it to my Sgine application. Firefox
can access the JVM and I've seen firefox plugin code which can access
the screen visual data within firefox, so it should be able to pass
the page image through.
So either, my Sgine application sits within a firefox tab and controls
other tabs through the use of the plugin I write and get image data
from firefox, or my Sgine application runs independently, controls a
separate firefox window by communicating with this plugin which I
write.

also - you said
" Swing-based rendering of HTML to
background render and then use the snapshot, or if you can get
JWebPane to
run you'd have most of what you want"

Does JWebPane come out ?.. maybe its in jdk 7, i will take a look.

I don't know how to do it using Swing, I was using SWT which writes
directly to the HWND so no good.

Phil




On Dec 30, 10:27 pm, "Hicks, Matt" <mhi...@captiveimagination.com>
wrote:

Hicks, Matt

unread,
Dec 30, 2010, 11:56:43 AM12/30/10
to sgin...@googlegroups.com
Since Swing does not render directly to screen you can use a Swing component to render the HTML to a BufferedImage and then convert it to a Texture in Sgine....in fact, Sgine already has convenience methods for that.

philip

unread,
Dec 30, 2010, 11:59:08 AM12/30/10
to sgine-dev
I could manage "some" interactivity if I write a decent firefox
plugin, when the user clicks mouse, the mouse click could be passed
through.
Selenium web test allows for this click at x,y type of thing.


On Dec 30, 10:27 pm, "Hicks, Matt" <mhi...@captiveimagination.com>
wrote:

philip

unread,
Dec 30, 2010, 9:36:42 PM12/30/10
to sgine-dev

Some update - I don't think this is a full swing component as I have
to do the following.

NativeComponent nativeComponent = webBrowser.getNativeComponent();
nativeComponent.paintComponent(image);

So I'm going to guess, as a "strange" swing component with
NativeComponent its not going to work directly within Sgine as a swing
component. I'll try and see - "suck and see" as they used to say.

Honestly, as long as I can get the image data, I'll settle with that
as good enough for now, it takes about 1/2 a second to take a full
page capture of www.newscientist.com all within the Java application
on my machine. I can then transfer that image to display on Sgine. Its
kind of good enough, I guess if its a full swing component its going
to be a bit faster and bit more automatic to do the transfer of data.

It uses DJNativeSwing - four jars
DJNativeSwing-SWT.jar
DJNativeSwing.jar
MozillaInterfaces-1.8.1.3.jar
swt-3.6-win32-win32-x86.jar

Pastebin here http://pastebin.com/cJkiUTVn

On Dec 31, 12:56 am, "Hicks, Matt" <mhi...@captiveimagination.com>
wrote:

philip

unread,
Dec 30, 2010, 9:57:23 PM12/30/10
to sgine-dev
Also - I'm using XUL from Mozilla, if you want to run this code, you
need to install XUL Runner runtime from Mozilla.

On Dec 31, 10:36 am, philip <philip14...@gmail.com> wrote:
> Some update - I don't think this is a full swing component as I have
> to do the following.
>
> NativeComponent nativeComponent = webBrowser.getNativeComponent();
> nativeComponent.paintComponent(image);
>
> So I'm going to guess, as a "strange" swing component with
> NativeComponent its not going to work directly within Sgine as a swing
> component. I'll try and see - "suck and see" as they used to say.
>
> Honestly, as long as I can get the image data, I'll settle with that
> as good enough for now, it takes about 1/2 a second to take a full
> page capture ofwww.newscientist.comall within the Java application
> on my machine. I can then transfer that image to display on Sgine. Its
> kind of good enough, I guess if its a full swing component its going
> to be a bit faster and bit more automatic to do the transfer of data.
>
> It uses DJNativeSwing - four jars
> DJNativeSwing-SWT.jar
> DJNativeSwing.jar
> MozillaInterfaces-1.8.1.3.jar
> swt-3.6-win32-win32-x86.jar
>
> Pastebin herehttp://pastebin.com/cJkiUTVn

Hicks, Matt

unread,
Dec 31, 2010, 8:40:06 AM12/31/10
to sgin...@googlegroups.com
That should work fine with Sgine.  I was referring to BufferedImage translation to texture built-in, not Swing support.

Take a look at TextureUtil: http://code.google.com/p/sgine/source/browse/src/main/scala/org/sgine/render/TextureUtil.scala?r=2ac1f1528dc299f1b98f95a1de7644c7ffe59128#20

I've never used DJNativeSwing but am curious how it turns out.  I presume it provides native access to render against Firefox?
Reply all
Reply to author
Forward
0 new messages