Coder Social home page Coder Social logo

Runs at 6fps =( about cubecloud HOT 14 OPEN

obviousjim avatar obviousjim commented on July 19, 2024
Runs at 6fps =(

from cubecloud.

Comments (14)

quinkennedy avatar quinkennedy commented on July 19, 2024

I migrated to VBOs, but didn't see a big improvement on my computer. Still want to figure out how to push a lot of the logic to the graphics card instead of using a nested for loop.

from cubecloud.

obviousjim avatar obviousjim commented on July 19, 2024

we gotta try vbo instancing example!

On Tue, Jul 30, 2013 at 10:51 AM, quinkennedy [email protected]:

I migrated to VBOs, but didn't see a big improvement on my computer. Still
want to figure out how to push a lot of the logic to the graphics card
instead of using a nested for loop.


Reply to this email directly or view it on GitHubhttps://github.com//issues/1#issuecomment-21796245
.

  • James

from cubecloud.

larsberg avatar larsberg commented on July 19, 2024

It seems like we could do all of the rendering / randomness in the shader.
Using a big VBO with all the vertices for each box we could get the
randomness and color in the shader with no CPU computation;

I'm happy to help out, maybe I'll branch it and make a little test

On Tue, Jul 30, 2013 at 12:06 PM, James George [email protected]:

we gotta try vbo instancing example!

On Tue, Jul 30, 2013 at 10:51 AM, quinkennedy [email protected]:

I migrated to VBOs, but didn't see a big improvement on my computer.
Still
want to figure out how to push a lot of the logic to the graphics card
instead of using a nested for loop.


Reply to this email directly or view it on GitHub<
https://github.com/CLOUDS-Interactive-Documentary/CubeCloud/issues/1#issuecomment-21796245>

.

  • James


Reply to this email directly or view it on GitHubhttps://github.com//issues/1#issuecomment-21802075
.

from cubecloud.

quinkennedy avatar quinkennedy commented on July 19, 2024

I'd love to work through it with you Lars, but I am a little worried that if you create a branch, all the work will be done and I'll learn nothing!

from cubecloud.

quinkennedy avatar quinkennedy commented on July 19, 2024

it looks like ofVboMesh.drawInstanced does not exist in our version of oF. Also, I can't seem to find ofBoxPrimitive either (which he uses in his example to construct the ofVboMesh). There is an instanced arrays extension in OpenGL (http://sol.gfxile.net/instancing.html) but I'm not familiar enough with the OpenGL pipeline and oF to understand how I would go about experimenting with it.

Would it make sense to create a VBO that is the 10,000 cubes, so in draw all I do is "vboLotsBox.drawElements(...) and the shader handles the rest? Or how else can you efficiently push 10,000 cubes into the pipeline every frame? Anything better than for(1->10000){vboBox.drawElements(...);}?

from cubecloud.

quinkennedy avatar quinkennedy commented on July 19, 2024

so I'm trying this:

vboBox.bind();
glDrawElementsInstanced(GL_TRIANGLES, 36, GL_UNSIGNED_INT, NULL, 10000);

where vboBox is a vbo representing a cube (ripped from ofBox) with 36 indices.

but getting Bad Access errors. :(

from cubecloud.

jonathanminard avatar jonathanminard commented on July 19, 2024

Any progress on this? Would be great to include it!

from cubecloud.

quinkennedy avatar quinkennedy commented on July 19, 2024

so I think I got instancing working on the cpp side with the following code:

vboBox.bind();
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vboBox.getIndexId());
glDrawElementsInstanced(GL_TRIANGLES, 36, GL_UNSIGNED_INT, NULL, 10000);
vboBox.unbind();

but in the example they are using version 150 for the fragment shader, and xcode complains if I set the version above 120. And as it sits now, I don't have access to the ever-important gl_InstanceID variable to know which instance I am rendering.

I tried creating a huge vbo of 10000 cubes up-front so I only have to draw one vbo once each frame, but my framerate is horrible.

from cubecloud.

quinkennedy avatar quinkennedy commented on July 19, 2024

maybe I was mistaken, just tried the 10000 cubes in one vbo and was at 60fps, now I have to update my shader to accommodate.

from cubecloud.

obviousjim avatar obviousjim commented on July 19, 2024

Any updates we can try to pull in Quin? would love to see the optimized VBO version

from cubecloud.

quinkennedy avatar quinkennedy commented on July 19, 2024

Not yet, I started but might not have time until October to finish up the optimization. I'll lift my "Lars Ban" in case you really want to jam it out, y'know, or anyone else.

from cubecloud.

larsberg avatar larsberg commented on July 19, 2024

I could take a pass at it later tonight. Quin, what's the setup here? Are the boxes randomly scaling in one direction? Or is it more complicated then that. I know you were talking about filling buckets… does that mean that the randomness accumulates and dissipates gradually?

from cubecloud.

quinkennedy avatar quinkennedy commented on July 19, 2024

the original code the buckets fill up to 200 and then roll-over to 0, each
bucket corresponds to the height of one cube. from 0-100 the cube bottom is
at 0 and the height increases. from 100-200 the cube top is at full height
and the cube bottom goes up to meet it.

so I was thinking 2 textures to ping-pong the buckets, and then rendering
the cubes based on the bucket texture data.

On Mon, Sep 9, 2013 at 12:01 PM, Lars Berg [email protected] wrote:

I could take a pass at it later tonight. Quin, what's the setup here? Are
the boxes randomly scaling in one direction? Or is it more complicated then
that. I know you were talking about filling buckets… does that mean that
the randomness accumulates and dissipates gradually?


Reply to this email directly or view it on GitHubhttps://github.com//issues/1#issuecomment-24089547
.

Quin Kennedy
[email protected]
cell: (949)232-5775

from cubecloud.

quinkennedy avatar quinkennedy commented on July 19, 2024

I have updated the code to use a shader and set of FBOs to control the cube extrusion. It is in an interim state right now as I test out different approaches for getting the pseudo-randomness to appear truly random.

from cubecloud.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.