Giter VIP home page Giter VIP logo

Comments (7)

fuzzie360 avatar fuzzie360 commented on May 14, 2024

We do have plans to add an API that will allow you to specify both JavaScript and WebGL implementations of a segment of code, but we haven't planned how the API will look like.

from gpu.js.

robertleeplummerjr avatar robertleeplummerjr commented on May 14, 2024

Related: #79

from gpu.js.

robertleeplummerjr avatar robertleeplummerjr commented on May 14, 2024

As of d5cb8bb you can now do this:

var gpu = new GPU();
var myFunction = gpu.createKernel(function() {
  return amazingNoise();
});
myFunction.addGLSLFunction('amazingNoise', `highp float amazingNoise(vec2 co)
{
    highp float a = 12.9898;
    highp float b = 78.233;
    highp float c = 43758.5453;
    highp float dt= dot(co.xy ,vec2(a,b));
    highp float sn= mod(dt,3.14);
    return fract(sin(sn) * c);
}`);

from gpu.js.

robertleeplummerjr avatar robertleeplummerjr commented on May 14, 2024

Note, I created this as a means of implementing a fix for this #164 but because of the complexity of random numbers, I ended up partially rolling it back and using the abstractions for resolving this issue.

from gpu.js.

radio412 avatar radio412 commented on May 14, 2024

Sorry, I am a bit confused, so this is currently not working? The example, with the latest "develop" branch, I get "An error occurred compiling the shaders: ERROR: 0:133: 'amazingNoise' : no matching overloaded function found"

from gpu.js.

robertleeplummerjr avatar robertleeplummerjr commented on May 14, 2024

I'll double check it at my earliest and ensure there is a test for it, fyi.

from gpu.js.

robertleeplummerjr avatar robertleeplummerjr commented on May 14, 2024

The name was changed to addNativeFunction here: 49c8af0 but is tested, care to try latest again?

from gpu.js.

Related Issues (20)

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.