Can't use TeapotGeometry.js or TeapotBufferGeometry.js to create Tea pot object

Why I can’t use these libraries to draw teapots? Is any way else to draw a teapot?

import {
    TeapotGeometry
} from "./lib/TeapotGeometry.js"

or

import { TeapotBufferGeometry } from './lib/TeapotBufferGeometry.js'

That’s because you have a bug in your code. If you fix it, it will work.

Here is a demo:

https://codepen.io/boytchev/full/poBOpGb

image

2 Likes

oh, thank you so much.
when I add this in the ‘index.html’ file:

<script type="importmap">
  {
    "imports": {
      "three": "https://unpkg.com/three@0.157.0/build/three.module.js",
      "three/addons/": "https://unpkg.com/three@0.157.0/examples/jsm/"
    }
  }

and this in the ‘main.js’ file:

import { TeapotGeometry } from "three/addons/geometries/TeapotGeometry.js";

It works. Thank u so much, I even thought I would give up.

1 Like