GlowScript: 3D animations in a browser

You are invited to try out GlowScript (“Graphics Library on Web”), an easy to use 3D programming environment inspired by VPython, but which runs in a browser window. GlowScript has been developed by David Scherer (the originator of VPython) and me.

Thanks to the use of the RapydScript Python-to-JavaScript compiler, you can write programs using the syntax and semantics of VPython. With some limitations, a VPython program can now run either in “classic” mode after installing Python and the VPython module, or in a browser. VPython can also be used in a Jupyter notebook, thanks to the vpython module created by John Coady and extended by Ruth Chabay and me, which uses the GlowScript libraries to display 3D animations in a browser-based notebook.

In addition to writing programs using the VPython definitions, you can write programs in JavaScript or RapydScript. Just change the name “VPython” in the header line of the program to one of these other languages.

* At glowscript.org, click Example programs to see the kinds of things that VPython can do in a browser. When viewing a list of programs you can click View to see the VPython program, or when running a program you can click Edit this program to see the code.

* Click Help in the upper right corner of the window for detailed documentation on GlowScript VPython (and a link to more technical documentation on using JavaScript or RapydScript, and on how to use the GlowScript text editor).

* GlowScript uses the WebGL 3D graphics library that is included in current versions of major web browsers. You must have a modern graphics card with Graphics Processing Units (GPUs). GlowScript even works in browsers on smartphones and tablets.

* To write your own programs, log in (you’ll be asked for a Google login, such as a gmail account).

* Click “Run this program” or press Ctrl-1 to execute your program in the same window, then click “Edit this program” to return to editing.

* Alternatively, while editing press Ctrl-2 to execute your program in a separate window, so that you can view the execution and the program code simultaneously. After making edits, press Ctrl-2 in the editor to run the new program.

* While running a program, click Screenshot to capture a thumbnail image for your program page.

* In the editor, click Share this program to learn how to let other people run your program.

There is a version system in place that will allow old programs to continue running in the future. The first line of a program you write is automatically created to be “GlowScript X.Y VPython” (where X.Y is the current version number). When a new version comes out, the software for running the older version is retained for use whenever a program with an old version number is encountered.

There is now a user forum connected to glowscript.org, where you can describe your experiences or ask for assistance.

WebGL’s emphasis on the use of the Graphics Processing Unit (GPU) available on modern graphics cards makes it possible for GlowScript to do high-quality graphics.

For users of VPython, note that the VPython Help summarizes the main differences between Classic and GlowScript versions of VPython. Also available there is a Python program for converting VPython programs to GlowScript programs.

The GlowScript libraries have been implemented by Brian Marks in Trinkets and in the new Jupyter version of VPython mentioned above.

If you are new to programming, you may find the Python tutorials at www.codecademy.com very helpful.

Bruce Sherwood

This entry was posted in Uncategorized. Bookmark the permalink.

8 Responses to GlowScript: 3D animations in a browser

  1. Hi there colleagues, its great paragraph on the topic
    of teachingand fully explained, keep it up all the time.

  2. Pingback: OSMOCES 2013: Computational Modeling with VPython | Pedagogue Padawan

  3. Ethan says:

    Thanks!!! Your article is very helpful!!! By the way, I read your paper “Work and heat transfer in the presence of sliding friction” recently. It’s awesome!! Most of physics teacher in Taiwan don’t know and perhaps don’t want to resolve the paradox you mentioned in that paper. It really help me so much!!

  4. Ethan says:

    oh…Do you know how to post the javascript of Glowscript in wordpress post?…

    • Glad you liked the friction paper! I’m not sure what you mean by your JavaScript question, since a JavaScript program is just text and can certainly be posted to a WordPress blog. Maybe you mean, “How can one place a working GlowScript program into a web page?” On the first page of the Help at glowscript.org you’ll find this statement:

      “On the GlowScript edit page, click Share this program to see how to let other people run your program.”

      The information given when you click “Share this program” includes how to place the GlowScript program into your own web page. A different issue is how to place such a program into a WordPress blog, and I don’t know how to do that. However, see my blog article about neutron decay to see an example of a direct link to a GlowScript visualization.

      • Ethan says:

        WOW!!! I’m so exciting to talk to you!!! Yes, my question is how to place GlowScript program into my own WordPress Post. I want to create powerful physics animations to illustrate those abstract concepts such as the gravitational potential energy in gravitational field. That’s why I want to post GlowScript animation on my wordpress post. I’ll go to see your article about neutron!! Hmm…. I’m not good at discussing physics in English…. LOL

  5. Jaclyn says:

    First off I want to say terrific blog! I had a quick question which I’d like to ask if you don’t mind.
    I was curious to know how you center yourself and clear your mind before writing.
    I have had a tough time clearing my mind in getting my thoughts out.

    I truly do enjoy writing but it just seems like the first 10 to 15 minutes tend
    to be lost simply just trying to figure out how to begin.
    Any recommendations or hints? Thanks!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s