You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<pclass="Normal">It may be that C2, C3, and C4 are all empty, but there is no obvious inexpensive way to get the information needed to tell the CPU to avoid scheduling those extra renders, because readPixels is very expensive. If there are more than four transparent layers, this algorithm will not treat them properly. However, note that the fifth and later peels will contribute little to the final pixel color, being partially occluded by four transparent layers in front.</p>
64
64
<pclass="Normal">Before starting the many renders the objects are sorted into opaque and transparent lists, and if there are no transparent objects a simple C0 render is all that is needed. Moreover, this simple render can exploit antialiasing, whereas the storage into textures for depth peeling unfortunately turns off antialiasing.</p>
65
-
<pclass="Normal">It is remarkable that doing 10 separate renders runs adequately fast for real-time rendering of moderately complicated scenes. For example, displaying a 10x10x10 grid of rotating transparent boxes can run at around 20 frames per second on ordinary computers, depending on the graphics card.</p>
65
+
<pclass="Normal">It is remarkable that doing 10 separate renders runs adequately fast for real-time rendering of moderately complicated scenes. For example, displaying 1000 rotating transparent boxes may take only twice the render time needed to display 1000 rotating opaque boxes, depending on the graphics card. </p>
66
66
<pclass="Normal">In OpenGL it is possible to create several textures in one render, but WegGL permits attaching just one texture to a framebuffer object, hence a large number of separate renders are needed.</p>
67
67
<pclass="Normal">To see this algorithm in action, run this <ahref="https://www.glowscript.org/#/user/GlowScriptDemos/folder/Examples/program/Transparency" target="_blank">Transparency</a> example program. </p>
68
68
<pclass="Normal">Note that the code for this transparency demo is remarkably short. Web VPython is aimed at making it feasible for nonexpert programmers to exploit WebGL to generate navigable real-time 3D animations.</p>
69
-
<pclass="Normal">At <ahref="https://www.glowscript.org/docs/GlowScriptDocs/technical.html">https://www.glowscript.org/docs/GlowScriptDocs/technical.html</a><ahref="https://github.com/BruceSherwood/glowscript" target="_blank"></a>, the key files dealing with depth peeling are lib/glow/WebGLRender.js and the shader programs in the shaders folder.</p>
69
+
<pclass="Normal">At <ahref="https://github.com/vpython/glowscript" target="_blank">github.com/vpython/glowscript</a> the key files dealing with depth peeling are lib/glow/WebGLRender.js and the shader programs in the shaders folder.</p>
70
70
<pclass="Normal">It is possible to implement "Fast Approximate Anti-Aliasing" (FXAA) to get around the problem that the use of framebuffer objects turns off anti-aliasing:<br/>
GlowScript makes it easy to write programs in JavaScript or [VPython](http://vpython.org) (which uses the RapydScript compiler) that generate navigable real-time 3D animations, using the WebGL 3D graphics library available in modern browsers (with modern GPU-based graphics cards). For example, the following complete program creates a 3D canvas in the browser, displays a white 3D cube, creates default lighting, places the camera so that the cube fills the scene, and enables mouse controls to rotate and zoom the camera:
4
4
5
5
```javascript
6
-
box()
6
+
box()
7
7
```
8
8
9
9
That's it. That's the whole program (except for the GlowScript version header line that is supplied automatically). The key point is that lots of well-designed defaults are built into the GlowScript library. You can of course specify the canvas size, the color and other attributes of the objects, the direction of the camera view, etc.
10
10
11
11
For a history of the development of VPython, see [A time line for VPython development](https://brucesherwood.net/?p=136). Here is a technical overview of GlowScript VPython and VPython 7: [VPython Architecture](https://vpython.org/contents/VPythonArchitecture.pdf).
12
12
13
-
Documentation
14
-
-------------
13
+
## Documentation
14
+
15
15
At [glowscript.org](http://glowscript.org) click Help for full documentation. There is an extensive set of example programs available from the first page of glowscript.org. Programs can be created and stored at glowscript.org, but it is also possible to export a program to place on your own web page, or to use the GlowScript library without storing the program at glowscript.org. For programs stored at glowscript.org, you can share a link with someone and they can run your program simply by clicking on the link. Here is an example:
GlowScript was inspired by [VPython](http://vpython.org). The project was begun in 2011 by David Scherer and Bruce Sherwood. Originally programs had to be written in JavaScript, but in November 2014 it became possible to use Python, thanks to the [RapydScript](https://github.com/atsepkov/RapydScript) Python-to-JavaScript compiler created by Alex Tsepkov. GlowScript is now using a later version, [RapydScript-ng](https://github.com/kovidgoyal/rapydscript-ng) developed by Kovid Goyal.
20
20
21
21
For information related to building the GlowScript application, see MakingNewVersion.txt in the [docs](docs) folder. Also in the [docs](docs) folder is an overview of the GlowScript architecture, [GlowScriptOverview.md](docs/GlowScriptOverview.md).
22
22
23
-
Sister Project
24
-
--------------
23
+
## Sister Project
24
+
25
25
VPython 7 lets you run VPython programs in a Jupyter notebook or from program launchers such as IDLE or Spyder: see [vpython.org](https://vpython.org). Its development was initiated by John Coady and further developed by him, Ruth Chabay, Matt Craig, and Bruce Sherwood. The syntax is the same as GlowScript VPython, and it uses the GlowScript 3D graphics library, but VPython 7 runs with an installed standard Python, which provides access to the large number of Python modules. GlowScript VPython does not require installing any software but provides access only to libraries written in JavaScript, not to standard Python modules (it does however provide portions of Python's "random" module).
26
-
27
-
Run Locally
28
-
------------------
26
+
27
+
## Run Locally
28
+
29
29
At glowscript.org, your programs are stored in the cloud and are accessible from anywhere. However, there are times when you might need to write and run programs even when disconnected from the internet.
30
30
31
31
In this repository, click GlowScriptOffline3.2.zip and download the zip file.
32
32
33
33
Unzip the GlowScriptOffline package to any convenient place on your computer.
34
34
35
-
Inside the [GlowScriptOffline](GlowScriptOffline) folder, read the README file to learn how to use the package.
36
-
37
-
Run a Local Server (Py3 version)
38
-
------------------
35
+
Inside the [GlowScriptOffline](GlowScriptOffline) folder, read the README file to learn how to use the package.
36
+
37
+
## Run a Local Server
38
+
39
39
There are two sets of instructions given here for two possible
40
-
approaches.
40
+
approaches.
41
41
42
42
1. The first, "All Docker", is quite simple, and involves only
43
-
minimal new software (just [Docker](https://www.docker.com/products/docker-desktop)).
44
-
If you're using macOS or Linux you can run the
45
-
local webserver and datastore all in Docker. You don't need to install
46
-
anything else. However there is a rather annoying
47
-
bug in Windows that prevents the webserver from automatically restarting when
48
-
source files change. For this reason, if they wish to have this feature,
49
-
windows users must run a python process concurrently that tracks file
50
-
changes during development. Having said that, if you just want to try a
51
-
local webserver, and you don't care about having to restart the server
52
-
manually every time you change the source code, you can skip running
53
-
the extra python process. This is all described below.
54
-
55
-
2. The second, "Only Datastore in Docker", requires that users also install a
56
-
recent (e.g., 3.7+) version of python (and pip) such as that provided by
* And when you're running the glowscript server locally, in a *separate* window, execute:
92
-
93
-
docker-volume-watcher glowscript_flask_1
94
-
95
-
* and it will take care of the rest.
96
-
97
79
### Local Server Approach (2) Only Datastore In Docker
98
80
99
-
To run a local webserver with only the datastore in Docker, but the
100
-
webserver itself running natively you need a recent version of Python3 and pip installed. The easiest method
101
-
is probably to install [anaconda](https://docs.anaconda.com/anaconda/install/) (or [miniconda](https://docs.conda.io/en/latest/miniconda.html), if you don't want the GUI package manager and extra applications). Once you have that you need to check out
102
-
or download the py38-app-engine branch of the glowscript repository (currently the `py38-app-engine` branch).
103
-
(How you do this depends on your familiarity with git. The simplest is to download a .zip file of the
104
-
`py38-app-engine` branch of the repository [here](https://github.com/vpython/glowscript/archive/py38-app-engine.zip))
105
-
First "cd" to the `glowscript` directory (the root directory of the repository)
106
-
and create a virtual environment for glowscript like so:
81
+
To run a local webserver with only the datastore in Docker, but the
82
+
webserver itself running natively you need Python-3.8.3. The easiest method
83
+
is probably to install [anaconda](https://docs.anaconda.com/anaconda/install/) (or [miniconda](https://docs.conda.io/en/latest/miniconda.html), if you don't want the GUI package manager and extra applications). With Anaconda or miniconda you can use the `conda` command to do this, for example:
107
84
108
-
cd /path/to/glowscript
109
-
python -m venv venv
85
+
conda create -n py383 python=3.8.3
86
+
conda activate py383
110
87
111
-
This will build a virtual environment for running locally. To activiate the virtual environment:
88
+
Your terminal prompt should now have a `(py383)` indicating that you have
89
+
activated the python-3.8.3 virtual environment. Once you have that you need to check out the glowscript repository. (How you do this depends on your familiarity with git. The simplest is to download a .zip file of the repository [here](https://github.com/vpython/glowscript/archive/refs/heads/master.zip))
90
+
Next change directory to the glowscript repository:
112
91
113
-
mac: source venv/bin/activate
114
-
windows (power shell): venv\Scripts\Activate.ps1
115
-
windows (cmd.exe shell): venv\Scripts\activate.bat
92
+
cd /path/to/glowscript
116
93
117
-
Your terminal prompt should now have a `(venv)` indicating that you have
118
-
activated the glowscript virtual environment. Before you can run glowscript the
94
+
Before you can run glowscript the
119
95
first time, you'll need to install dependencies into the virtual environment.
120
96
This can be done with pip:
121
97
122
98
pip install -r requirements.txt
123
99
124
-
In order to run the local datastore emulator it's easiest to use
a version of Docker that works with your OS. To test that you've
127
105
got docker installed OK, in the glowscript directory type:
128
106
129
107
docker-compose -f docker-datastore.yml up
130
108
131
-
this will take a substantial amount of time the first time, since it has to download all
109
+
this will take a substantial amount of time the first time, since it has to download all
132
110
the docker images. You'll see a lot of log messages, but among them you should see:
133
111
134
112
datastore_1 | [datastore] Dev App Server is now running.
135
113
136
114
In this case you're good! If not, check the error messages and
137
-
see if there are any useful clues. Good luck.
115
+
see if there are any useful clues. Good luck.
138
116
139
117
If the datastore is running, hit ctrl-c, and then type:
140
118
141
119
docker-compose -f docker-datastore.yml up -d
142
120
143
-
This will run the datastore in the background.
121
+
This will run the datastore in the background.
144
122
145
123
With the datastore running, you can run the webserver by typing:
146
124
@@ -154,25 +132,24 @@ When you're finished hit ctrl-c and then type:
154
132
155
133
To stop the background datastore emulator.
156
134
157
-
Then next time you're ready to develop, you can simply activate the environment again (make sure you see the "(venv)" in the shell prompt) and type:
135
+
Then next time you're ready to develop, you can simply activate the environment again (make sure you see the "(py383)" in the shell prompt) and type:
158
136
159
137
docker-compose -f docker-datastore.yml up -d
160
138
161
139
flask run
162
140
163
141
And you'll be up and running!
164
142
165
-
For Developers
166
-
--------------
143
+
## For Developers
144
+
167
145
In this repository's [docs](docs/) folder is a file [GlowScriptOverview.md](docs/GlowScriptOverview.md) that describes the architecture of GlowScript in detail. For many of the current issues, the relevant part of the document is the section on Execution (run-time). To test changes it is necessary to run a local server, as is describe in the previous heading. When you want to run using recent changes, you need to choose a version 0.1 greater than the current version number, and append "dev". For example, if the current version is 2.9, the first line of a test program would be GlowScript 3.0dev VPython.
168
146
169
-
License
170
-
-------
147
+
## License
148
+
171
149
The license is found at [LICENSE.txt](https://github.com/BruceSherwood/glowscript/blob/master/LICENSE.txt).
In December 2014 the original GlowScript repository was corrupted in such a way that it could not be reconstituted, but a backup that contains the history of commits is here:
In December 2014 the original GlowScript repository was corrupted in such a way that it could not be reconstituted, but a backup that contains the history of commits is here:
0 commit comments