Comments (5)
On Aug 27, 2013, at 1:03 PM, Almar Klein [email protected] wrote:
Summary
We discussed this approach (which I know think really sucks):
program['a_pos'] = my_array # Creates a VBO
program['a_pos'] = ClientArray(my_array) # Uses the array directlyWTF!
I agree that seen like this it's a bit weird and should not be allowed and I think your approach is right, let's forget about the ClientArray and do not create anything for the user.
We should add something in the (future) FAQ, "Why is my program so slow" and explain the problem.
from vispy.
I strongly disagree with that. Having the syntax "program['a_pos'] =
my_array" work but much slower than "program['a_pos'] =
VertexBuffer(my_array)" is a terrible idea in my opinion. No documentation
will ever change the fact that tons of users will do it wrong regularly (me
the first). At the very least, we should completely disable the syntax
"program['a_pos'] = my_array" which should throw an exception and tell the
user what to do.
2013/8/27 Almar Klein [email protected]
Summary
We discussed this approach (which I know think really sucks):
program['a_pos'] = my_array # Creates a VBO
program['a_pos'] = ClientArray(my_array) # Uses the array directlyWTF!
Besides being confusing it allows a sloppy style of using oogl that can
byte the user in the ass when he starts using updating attributes in this
way.I propose to not do any magic VertexBuffer creating and instead just
document well that specifying an array as an attribute works, but is not
very efficient.
What we discussedDuring Euroscipy we discussed about creating a VertexBuffer automatically
when the user does:
program['a_position'] = position_arrayHe could also do (to make it explicit):
program['a_position'] = VertexBuffer(position_array)Similarly, we could allow: program['s_texture'] = image_array
Further there is a Program.set_var() function that can be used to set
VertexBuffers that contain structured data (from a structured numpy array).
It also allows setting attributes and uniforms as keyword arguments.Finally, we discussed that to explicitly use a client-side array, the user
should do something like:
program['a_position'] = ClientArray(position_array)
What I didThe above is l currently mostly implemented. When the user uses this
syntax to update a texture or attribute, a warning is given, because he
should use a VBO (and update that) or explicitly use a client side array.What I did not (yet) do is the ClientArray syntax. Instead if a user uses
Program.set_var() there is no auto-conversion.
My worriesI think it is bad practice to automatically convert a given numpy array to
a VertexBufer (let alone a Texture), because it allows a style of
programming that can become very inefficient if the user makes his code
more complex and starts updating stuff. Sure, we warn the user, but this is
not optimal.Also, I think the ClientArray syntax really sucks:
program['a_position'] = my_array # Creates a VBO
program['a_position'] = oogl.ClientArray(my_array) # Uses the array directlyWTF
The approach that I took now (Program.set_var() does not do magic) is
also far from optimal, because it is confusing.
ProposalI propose that we force the user to a way of working that is clear and
efficient.I propose that Program does not automatically create VertexBuffers or
Textures.There are two downsides:
- The user will have to type a tiny bit more.
- The unattentive user may forget to use oogl.VertexBuffer and use a
client-side array.I think (1) is worth it, since it just makes things more explicit and much
less confusion. For (2) I would argue that this is an API to OpenGL, and
users should know a bit about it when they use it. We document this
behaviour well and place a warning in the documentation. Further, most
examples will use an VBO anyway.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/46
.
from vispy.
On Tue, Aug 27, 2013 at 9:48 AM, Cyrille Rossant
[email protected]:
I strongly disagree with that. Having the syntax "program['a_pos'] =
my_array" work but much slower than "program['a_pos'] =
VertexBuffer(my_array)" is a terrible idea in my opinion. No documentation
will ever change the fact that tons of users will do it wrong regularly
(me
the first). At the very least, we should completely disable the syntax
"program['a_pos'] = my_array" which should throw an exception and tell the
user what to do.Agreed. I think it is very important to keep track of and manage your own
VertexArrays, Textures, etc. Too many things can go wrong trying to
automate this.
from vispy.
So can we agree on this?
program['a_pos'] = my_array # Raises ValueError with some helpful info
program['a_pos'] = VertexBuffer(my_array) # OK!
program['a_pos'] = ClientArray(my_array) # OK!
from vispy.
Yes, it looks good!
2013/8/27 Almar Klein [email protected]
So can we agree on this?
program['a_pos'] = my_array # Raises ValueError with some helpful info
program['a_pos'] = VertexBuffer(my_array) # OK!
program['a_pos'] = ClientArray(my_array) # OK!—
Reply to this email directly or view it on GitHubhttps://github.com//issues/46#issuecomment-23367494
.
from vispy.
Related Issues (20)
- The issue of illuminating the backside of a mesh after rotating the camera HOT 6
- resize and set different size of arrows HOT 2
- Dragging LinearRegion limits with mouse HOT 13
- the mouse dragging inside the canvas it is not responsive when using 'Share Camera Views' HOT 17
- Writing text in a gloo canvas (vispy.app.canvas) HOT 11
- Using `QT_SCALE_FACTOR` causes a cropped canvas (Qt backend) HOT 4
- in (/vispy/visuals /surface_plot.py) line 129 HOT 2
- How to render canvas with original pixel values? HOT 13
- The case where the scan lines are parallel to the sides of the rectangle HOT 1
- Cannot find Quartz library on MacOS Sonoma HOT 18
- Issue with Image Clipping in Multiple Viewboxes HOT 3
- how can i disable the canvas border HOT 2
- No setter for some properties of Arrow or Line after instantiation HOT 3
- Question regarding datoviz, backends, gtk HOT 5
- destructive behaviour when lines overlap HOT 1
- Errorous behavior in Vispy.Visuals.Markers.set_data HOT 2
- grid solver constraint not working HOT 4
- Running vispy inside docker and not being able to access OpenGL drivers HOT 1
- SurfacePlotVisual.set_data cause vertex shader to perform unnecessary build HOT 3
- Looking for additional maintainers HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vispy.