Restriction on compound removed

71 views
Skip to first unread message

Bruce Sherwood

unread,
Nov 25, 2021, 7:44:43 PM11/25/21
to Glowscript Users
WebGL is the 3D renderer that is built into the browser and used by VPython. Until now, VPython used WebGL 1, which restricted the number of objects that could be in a compound, due to a 16-bit limit of no more than 65536 vertices. Since even a simple box object contains 24 vertices (3 at each of the 8 corners), this was an unfortunate limitation.

Now Web VPython uses WebGL 2, which permits the use of as many as about 4.2e9 vertices, the largest unsigned number represented by a 32-bit integer. Effectively, there isn't a limit.

Bruce

tmo...@pomona.edu

unread,
Nov 25, 2021, 7:56:13 PM11/25/21
to Glowscript Users
I have just started getting an error that says "Error: Can't create canvas: WebGL not supported". The program was running fine in VPython 3.2 a few minutes ago. Could this be related?

tmo...@pomona.edu

unread,
Nov 25, 2021, 7:57:14 PM11/25/21
to Glowscript Users
Seems to fail when trying to create a menu.

tmo...@pomona.edu

unread,
Nov 25, 2021, 7:58:07 PM11/25/21
to Glowscript Users
Runs fine when I change the first line to Glowscript 3.1.

Bruce Sherwood

unread,
Nov 25, 2021, 7:59:17 PM11/25/21
to Glowscript Users
I don't see a menu failure. Can you provide an example program that fails? The new work is very far away from anything to do with menus, so this is very puzzling.

Bruce

Bruce Sherwood

unread,
Nov 26, 2021, 1:38:53 PM11/26/21
to Glowscript Users
The problem turned out to be with an old version of Safari which had access to WebGL 2 turned off. After turning it on, the program works.

Bruce

Dale Griffiths

unread,
Nov 27, 2021, 3:21:07 AM11/27/21
to glowscri...@googlegroups.com
Hi Bruce,
That’s great. Does this mean that is there is no restriction on vertices that in theory it could handle simple meshes to make more complex shapes as well as just extrusions?
Regards
Dale

On Fri, 26 Nov 2021 at 18:38, Bruce Sherwood <bruce.s...@gmail.com> wrote:
The problem turned out to be with an old version of Safari which had access to WebGL 2 turned off. After turning it on, the program works.

Bruce

--

---
You received this message because you are subscribed to the Google Groups "Glowscript Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to glowscript-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/glowscript-users/8f6794ec-8d3f-4cdb-af02-abe1c091f12bn%40googlegroups.com.

Bruce Sherwood

unread,
Nov 27, 2021, 12:10:37 PM11/27/21
to Glowscript Users
It's always been the case that you could create arbitrary non-extrusion 3D objects using triangles and quads, and you could even get around the limitation on the number of vertex objects by compounding the triangles and quads, which frees up the vertex objects to be re-used. But this was awkward and annoying, and you had to keep checking to see whether you were going to hit the 65536 vertex limit. Now the sky's the limit.

Bruce

Dale Griffiths

unread,
Nov 27, 2021, 4:03:33 PM11/27/21
to glowscri...@googlegroups.com
That’s cool does that mean there is potentially a way to import a 3D mesh data like you can in Webgl/Three.js? Well maybe not import as such but possibly copy and paste in all the mesh data? My thoughts are that this would make the program unusable as it would be swamped by all this code/data. Suppose you could post it right at the bottom if you could get it in text format. 
I really enjoy using Python in the glowscript environment so if this extra feature was possible to implement it would be great. 

On Sat, 27 Nov 2021 at 17:10, Bruce Sherwood <bruce.s...@gmail.com> wrote:
It's always been the case that you could create arbitrary non-extrusion 3D objects using triangles and quads, and you could even get around the limitation on the number of vertex objects by compounding the triangles and quads, which frees up the vertex objects to be re-used. But this was awkward and annoying, and you had to keep checking to see whether you were going to hit the 65536 vertex limit. Now the sky's the limit.

Bruce

--

---
You received this message because you are subscribed to the Google Groups "Glowscript Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to glowscript-use...@googlegroups.com.

Bruce Sherwood

unread,
Nov 27, 2021, 5:49:21 PM11/27/21
to Glowscript Users
I don't understand what "feature" you are requesting. If it's simply
the issue of importing a large amount of data that you don't want to
place in the Web VPython file itself, there are two options:

1) Put the data in a file on your computer and read it using read_local_file().

2) Put the data in a file on your own web site and access it with get_library().

Both of these options are described here:

https://www.glowscript.org/docs/VPythonDocs/files.html

Bruce
Reply all
Reply to author
Forward
0 new messages