We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

Issue with integrating Water sample with V3D template app

Home Forums Programming Issue with integrating Water sample with V3D template app

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #67455
    ps
    Participant

    Hi,

    I tried to integrate webgl water example inside my V3D template app. I copied Water2.js, Refractor.js and Reflector.js inside the project folder and added the following to my_app.html & my_app.js file

    <script type=”module” src=”Water2.js” ></script>
    import { Water } from ‘./Water2.js’;

    I am getting the following error in console and app is not getting loaded

    Uncaught SyntaxError: Cannot use import statement outside a module my_app.js:4 a module

    Uncaught TypeError: Failed to resolve module specifier my_app.html:1 “v3d”. Relative references must start with either “/”, “./”, or “../”.

    How to resolve this issue?

    Thanks

    #67457
    kdv
    Participant

    You’d better start with something a little less complicated…

    Porting of code from V3D Code Examples to project’s “name.js” file

    Puzzles and JS coding. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.

    #67499
    ps
    Participant

    Thanks

    #67550
    ps
    Participant

    Hi,

    I tried the RGBShiftShader sample in the link you mentioned and it’s working. But when I tried with the water sample I am getting

    Uncaught TypeError: Failed to resolve module specifier “v3d”. Relative references must start with either “/”, “./”, or “../”.

    I am a beginner in Verge3D and JS, please let me know how to resolve this issue. Download the project file from the following link
    https://drive.google.com/file/d/1SrPdntBl7_6Gek1P0pKkIDHo4VWBI5jG/view?usp=sharing

    Thanks

    #67565
    kdv
    Participant

    Reflector.js and Refractor.js also have imports, not only Water2.js.

    And you can import nothing from v3d.js. Use v3d.module.js for imports.

    Read the source code for that demo
    https://github.com/Soft8Soft/verge3d-code-examples/blob/master/webgl_water.html

    Puzzles and JS coding. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.

    #67603
    ps
    Participant

    Thanks for your help. It’s working. :good:

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.