Skip to content

Batch flushing data to GLBuffer #71

@JMurph2015

Description

@JMurph2015

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

Activity

SimonDanisch

SimonDanisch commented on Aug 10, 2017

@SimonDanisch
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

JMurph2015 commented on Aug 10, 2017

@JMurph2015
Author

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @SimonDanisch@JMurph2015

        Issue actions

          Batch flushing data to GLBuffer · Issue #71 · JuliaGL/GLAbstraction.jl