Comments (13)
enable_objects is pretty useless as it stands now since it is only used in draw_elements for the index buffer. We should activate/deactivate the index buffer when drawing and that's it.
- it should be renamed to activate_object() and probably be made _vispy_private because we only use it internally
- It is not useless and is used to activate the texture and vbo (in variables.py). The points is that it allows one to activate an object and make it automatically be de-activated when the program is deactivated.
Overloaded methods need docstring, at least for us to understand quickly what the method is doing.
assert isinstance(name, str) is pretty useless test since it is followed by an if/elis/else
Agreed
set_data seems a better name for set_var since a bunch of data can be set
I disagree. Consider this:
texture = oogl.Texture2D()
....
texture.set_data(my_array)
program.set_data(texture) # What?
Apart from uniform scalars/vectors/matrices, you actually do not set any data. You associate/attach data.
Other possible names:
- attach() -> already used for shaders
- associate() -> a bit long
- set_attr() -> we only need it for attributes, but then users will wonder why there is no set_uniform
- set()
- set_var()
- set_item()
- other?
from vispy.
On Aug 28, 2013, at 11:17 AM, Almar Klein [email protected] wrote:
enable_objects is pretty useless as it stands now since it is only used in draw_elements for the index buffer. We should activate/deactivate the index buffer when drawing and that's it.
- it should be renamed to activate_object() and probably be made _vispy_private because we only use it internally
- It is not useless and is used to activate the texture and vbo (in variables.py). The points is that it allows one to activate an object and make it automatically be de-activated when the program is deactivated.
Yep, I see how this may be useful later for complex cascading of object, but this is not necessary for the elementbuffer and will maje things slower.
Overloaded methods need docstring, at least for us to understand quickly what the method is doing.
assert isinstance(name, str) is pretty useless test since it is followed by an if/elis/elseAgreed
set_data seems a better name for set_var since a bunch of data can be set
I disagree. Consider this:
texture = oogl.Texture2D()
....
texture.set_data(my_array)
program.set_data(texture) # What?Apart from uniform scalars/vectors/matrices, you actually do not set any data. You associate/attach data.
"attach" is fine for me since this what we actually do (attach a shader or attach some data to the program).
Even better it is already used for shader indeed.
Other possible names:
- attach() -> already used for shaders
- associate() -> a bit long
- set_attr() -> we only need it for attributes, but then users will wonder why there is no set_uniform
- set()
- set_var()
- set_item()
- other?
Reply to this email directly or view it on GitHub:
#50 (comment)
from vispy.
Yep, I see how this may be useful later for complex cascading of object, but this is not necessary for the elementbuffer and will maje things slower.
It is necessary in my opinion. The ElementBuffer, VertexBuffer and Texture objects all need to be activated in order to use them. We could just activate them, but then they are never deactivated. The enable_object() is there to do this all automatically. There is no slowing down, because if we did not do this, the program would simply not work :)
from vispy.
"attach" is fine for me since this what we actually do (attach a shader or attach some data to the program). Even better it is already used for shader indeed.
Mmm ... but it might be confusing to use it both for shaders, uniforms and attributes. On the other hand, it does exactly what it says. What do @lcampagn and @rossant think?
from vispy.
I was saying:
def draw(…)
elembuffer.activate()
...
elembuffer.deactivate()
in this specific case (would the element buffer ever activates other objects ?)
On Aug 28, 2013, at 11:28 AM, Almar Klein [email protected] wrote:
Yep, I see how this may be useful later for complex cascading of object, but this is not necessary for the elementbuffer and will maje things slower.
It is necessary in my opinion. The ElementBuffer, VertexBuffer and Texture objects all need to be activated in order to use them. We could just activate them, but then they are never deactivated. The enable_object() is there to do this all automatically. There is no slowing down, because if we did not do this, the program would simply not work :)
Reply to this email directly or view it on GitHub:
#50 (comment)
from vispy.
Ah, right. So the element_buffer can indeed follow that pattern. But this still leaves vertex buffer and texture.
would the element buffer ever activates other objects ?
No, because all objects are agnostic about other objects, except for the Program, that is like the central unit that is aware of how things are connected.
from vispy.
On Wed, Aug 28, 2013 at 3:29 AM, Almar Klein [email protected]:
"attach" is fine for me since this what we actually do (attach a shader or
attach some data to the program). Even better it is already used for shader
indeed.Mmm ... but it might be confusing to use it both for shaders, uniforms and
attributes. On the other hand, it does exactly what it says. What do
@lcampagn https://github.com/lcampagn and @rossanthttps://github.com/rossantthink?I agree "attach" might be confusing. "set_var" makes the most sense to me,
because we are setting the contents of a GLSL variable.
from vispy.
Perhaps set_vars() is even better, and reserving the function only for dicts and structured arrays.
from vispy.
I like set_vars(**kwargs) and update_vars(dict_or_structured) since it follows dict conventions (and conceptually, we are configuring a namespace which is very much like a dict).
from vispy.
I left the **kwargs intact. So one can actually do:
prog.set_vars(a_dict)
or prog.set_vars(**a_dict)
The latter can of course only be done with a real dict, whereas the first option also accepts a structured array or a structured VertexBuffer.
from vispy.
If everyone is happy, we can close this issue.
from vispy.
I'm happy :)
from vispy.
Closing issue. If not happy, reopen :)
from vispy.
Related Issues (20)
- 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
- vispy flickering on Windows with real time data HOT 12
- How to use a canvas decorator inside a custom class HOT 2
- How to change shortcut for camera Interaction in vispy HOT 2
- VisPy does not work properly if QtWebEngineWidgets is imported HOT 4
- Outdated Vispy version with Debian 12 package HOT 2
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.