Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

question: how to convert old loadTextures method to new format #1488

Open
tamir-jether opened this issue Aug 11, 2021 · 1 comment
Open

question: how to convert old loadTextures method to new format #1488

tamir-jether opened this issue Aug 11, 2021 · 1 comment

Comments

@tamir-jether
Copy link

tamir-jether commented Aug 11, 2021

Im trying to use an old luma.gl example. So im trying to convert old methods to newer versions methods.

Reading the docs, i know loadTextures is deprecated and i should now use:
new Texture(gl, {data: url, parameters})

But lets say i have something like that:

  loadTextures(gl, {
  urls: [url],
  parameters: {
    parameters: {
      [GL.TEXTURE_MAG_FILTER]: GL.LINEAR,
      [GL.TEXTURE_MIN_FILTER]: GL.LINEAR,
      [GL.TEXTURE_WRAP_S]: GL.CLAMP_TO_EDGE,
      [GL.TEXTURE_WRAP_T]: GL.CLAMP_TO_EDGE
    }
  }
   }).then(textures => {
      this.setState({texture: textures[0]});
    });

How should i convert this snippet to use the new format?

@ibgreen
Copy link
Collaborator

ibgreen commented Aug 11, 2021

Without looking closely at the API and making sure this exact code is working before posting, it would be something like:

 this.setState({texture: new Texture2D(gl, {
    data: url,
    parameters: {
      [GL.TEXTURE_MAG_FILTER]: GL.LINEAR,
      [GL.TEXTURE_MIN_FILTER]: GL.LINEAR,
      [GL.TEXTURE_WRAP_S]: GL.CLAMP_TO_EDGE,
      [GL.TEXTURE_WRAP_T]: GL.CLAMP_TO_EDGE
    }
  });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants