Results 1 to 10 of 35

Thread: Some gravity particles

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #5
    Problem is in that each thread will access to same particle data at the same time. I cannot split them to isolated index groups, because each particle is compared to every other. So many threads could apply forces to same particle at the same time. But it's just a simple sum operation, the calculation does not depend on value of the movement vector, so it might not matter. I do not know. I could do the "// Move particles" part in main thread after the forces are updated, cause i think that's the fastest part of it. I would also put main thread waiting for those to finish before continuing. It will go to same 1-4 fps while counting it anyway, it's hardly controllable at all.

    Extra treat, shaders:
    Code:
    #version 120
    attribute vec3 in_position;
    attribute vec4 in_color;
    varying vec4 color;
    uniform mat4 pmv;
    void main() {
      color = in_color;
      gl_Position = pmv * vec4(in_position, 1.0);
    }
    Code:
    #version 120
    varying vec4 color;
    void main() {
      gl_FragColor = color;
    }
    edit: Using 4 physics threads now on the time-critical part, and CPU use went up to 90% or so. I don't at least see any differences in the visual outcome, sure it counts it faster.
    Attached Images Attached Images
    Last edited by User137; 13-06-2013 at 03:16 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •