Some thoughts on OpenGL vs the Browser

Skip to first unread message


Jan 5, 2012, 10:28:27 PM1/5/12
to sgine-dev

Hi Matt,

I wanted to give you some of my recent thoughts regarding Sgine and
the Browser.

For a long while I have wanted to develop a new fantastic UI and
definitely I wanted to program it in Scala, and OpenGL chosen because
of the reason that there is a lot of flexibility with OpenGL to do
graphics operations.In particular I wanted to do some 3D graphs,
charts, animations which were very hard to do in HTML. For example, it
was hard to smoothly animate a html table into a graph, or other
complex operations, which were really impossible to do in HTML but as
I'll discuss are now becoming more possible.

Also it is difficult to draw a very nice and attractive user interface
using straight OpenGL, so I tried to render from a browser to OpenGL
and had many difficulties doing it with Sgine, eventually made it work
with Awesomium Chrome browser and Sgine. Then I could render HTML
tables and nice fonts in OpenGL.

Just recently I have discovered that HTML5 combined with many
libraries can do almost all of what I wanted to do with OpenGL as most
of my operations are in the 2 dimensional realm and HTML5 has some
basic 3D operations which are not as efficient as OpenGL, and in some
cases can use OpenGL from javascript, but are sufficient and may
become more efficient in years to come. Also the browser has efficient
management of images resources built in, efficient rendering, its
really a good platform for UI. However, I wanted the flexibility to
cut up rendered images and post-process them, so the html table could
be animated in some ways by cutting cells out and moving them around.
Then eventually I have found I can do most of this in HTML5. However I
have only found this recently in the past month or so.

One of the recent libraries I have discovered can render directly from
HTML to HTML5 Canvas. This is what I was doing in Sgine/OpenGL/
Awesomium. So I can then do complex image transformations from HTML.

Also the browser can process HTML5 Canvas images fast to do image
transformations, cutting of images and moving them elsewhere.

SGine renders to OpenGL, maybe you could consider Sgine to render to
HTML5 instead? The programmer could code Sgine code which runs on the
server side and on the client side it renders to HTML5 Canvas and all
the HTML5 technology. This is just a suggestion! BUT - It then could
be integrated with Liftweb or Play framework to be a rich UI rendering
framework, and you would have the users from those frameworks. We all
like people using our products, it gives feedback.

Also thinking from the point of view of a Liftweb programmer, it would
be nice to be able to write a complete game in server side code, then
the multiplayer functions could be done easily. Also you could deploy
it to many client browsers, mobile phones while only writing it once
in Scala.

Liftweb already works in a particular way that it tries to keep all
Client UI on the server side. I'm not sure if you have used it, but
when you program in Liftweb it emits javascript from your Scala code
to get some things to happen, ajax things and UI things. I.e., if a
user types in an input fiend then something happens, auto-completes,
are completely programmed in Scala and the javascript to make it
happen just happens. So the programmer doesn't have to program the
client javascript. You could adopt the same approach. Take a good look
at how Liftweb generates Javascript.

Also, for Android you could then embed the browser in your application
and keep the client/server all in one application.

I'm slightly worried that Liftweb won't be as popular as Play
framework in future due to the backing of Typesafe and Liftweb is more
complex but better in my opinion with good stateful support. You could
support both? ... suggestions only.


Hicks, Matt

Jan 6, 2012, 9:55:12 AM1/6/12

Good comments, but not really the intent of Sgine.  I am not opposed to running applets in the browser, but no matter how much effort they make towards speeding up JavaScript it will always be a fraction of the speed and capabilities of the JVM.  I think WebGL has merit, but I would recommend looking at something like Vaadin and creating an addon to do WebGL with it and that should give you exactly what you want.

I've been holding out for JavaFX to release support for Linux and then I was planning on taking their WebKit API and using it within Sgine as it's similar to Awesomium, but without the evil license and 100% Java.

I know there is a huge push to make everything in the browser these days, but I believe it's a pretty long-running fad that will eventually come back.  There's only so much you can do with an inferior language like JavaScript and unless NativeClient starts supporting the JVM I don't see the web being sustainable in its current form.  I hope that Applets make a resurgence to the web, and to some degree already are (take a look at NVIDIA's video card detection), but either way, the primary focus of Sgine is high performance games and applications which is not really plausible in the web.

Hope the reasoning makes sense,

Reply all
Reply to author
0 new messages