Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Batch flushing data to GLBuffer #71

Open
JMurph2015 opened this issue Aug 10, 2017 · 2 comments
Open

Batch flushing data to GLBuffer #71

JMurph2015 opened this issue Aug 10, 2017 · 2 comments

Comments

@JMurph2015
Copy link

Is there a good way for me to flush a large array into a GLBuffer? Currently the setindex methods incur a huge amount of overhead for my purposes.

Context:
I'm rendering a bunch of arbitrarily colored squares on a window, and need to update the colors on every frame using data from a TCP socket connection. See the repo below for more info, not that it has much documentation at this point, but it's only about 100 lines of code)
https://github.com/JMurph2015/LEDSimulator.jl

@SimonDanisch
Copy link
Member

Sorry, your code is a bit complex for a quick look at why this is slow.
I see you're using glBufferSubData, which should be relatively fast for large arrays.
Maybe you can speed things up, if you leave the buffer mapped, similar to this:
https://github.com/JuliaGL/GLAbstraction.jl/blob/master/src/GLBuffer.jl#L117

Btw, any reason why you don't use GLVisualize for this?
Seems like you could easily save yourself from most of the code you've written there ;)

@JMurph2015
Copy link
Author

JMurph2015 commented Aug 10, 2017

So, I actually figured out the glBufferSubData after the comment here, but it would be nice if the version in GLAbstraction supported something like this in broadcasting to make the call streamlined. When I was using the setindex! methods defined for GLBuffers I was ending up binding, calling glBufferSubData, and unbinding 36,000 times or so. My stuff runs pretty acceptably fast now. (and sorry for subjecting your eyes to that code, it looks like a warzone right now.)

Re GLVisualize: Mainly that it was such a simple layout that it was pretty easy to do in closer to raw OpenGL without having to learn a new API for it. GLVisualize didn't seem to be geared toward polygons so much as data sets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants