Not logged in, Join Here! or Log In Below:  
News Articles Search    

 Home / General Programming / Opengl in Javascript Account Manager
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.

May 10, 2005, 07:25 PM

I just started learning Javascript(I also have alot of previous experience in C++), and it seems like a good way to make cross platform software without having to worry about compilers and such. I was wondering if there is a way to use opengl in javascript. I've found ways to import java class methods into javascript, but this does not seem to work with opengl(I tried it with JOGL). Does anybody know a way to get gl working with javascript?


May 10, 2005, 08:05 PM



May 10, 2005, 08:10 PM

I'm using firefox, and would also prefer to use other browsers besides MSIE, and other os's besides windows. That's the point of me using Javascript in the first place.

Chad Austin

May 10, 2005, 09:12 PM

No browser I'm aware of exports anything but a few small APIs to the scripting engine. So you can't write OpenGL in JS. Look at Python and PyOpenGL or PyGame as an alternative.


May 10, 2005, 10:11 PM

Instead of javascript, there are also a couple of java alternatives. Unlike ActiveX, java will run on most platforms, and its typically an install once kind of thing if the user doesn't have it (rather than prompt you virus like messages for every control that wants to run).

Alternatively, here is another software alternative which can use a hardware backend.


May 11, 2005, 02:11 AM

Javascript isn't a browser only thing, you know.

Build a small (native) program using spidermonkey that exposes the OpenGL API to the JS engine.

The native part will not be cross platform, but you could at least make it ANSI-C. I have made a similar thing that compiles on Win32, Solaris and AIX (that I have tested).


Chad Austin

May 11, 2005, 06:03 AM

Daniel: I'm certainly aware of that, as I used SpiderMonkey in a game engine I wrote back in the day. ;) Ah, I miss the semantic simplicity and embedding niceness...

IMO, JavaScript is a loaded name. 1) It's not even close to Java as all, it just happened to ride the same hype wave and 2) Huge browser connotation. When I had to be pedantic, I'd use the standard name, "ECMAScript", but then everyone looks at you funny. ;) Looking back, I wish I had just called my scripting system (EMCAScript + exported API) "SphereScript". That would have greatly reduced the amount of people saying "Huh? Your game engine is a browser? Can I use HTML in it?" etc.

Just a note...

This thread contains 7 messages.
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.