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

Property 'color' does not exist on type 'Framebuffer2D' #659

Open
bergwerf opened this issue Nov 8, 2022 · 2 comments
Open

Property 'color' does not exist on type 'Framebuffer2D' #659

bergwerf opened this issue Nov 8, 2022 · 2 comments

Comments

@bergwerf
Copy link

bergwerf commented Nov 8, 2022

I am trying to convert the sprites.js example to TypeScript. The first issue I encountered is #602, and the second is that on line 159 it says SPRITES[(tick) % 2].color[0], but the Framebuffer2D class does not have a color property.

@bergwerf
Copy link
Author

bergwerf commented Nov 8, 2022

This could be the line where the color property is assigned https://github.com/regl-project/regl/blob/master/lib/framebuffer.js#L635.

@bergwerf
Copy link
Author

bergwerf commented Nov 8, 2022

My inelegant workaround is to add the following interface:

interface ExtendedFramebuffer2D extends REGL.Framebuffer2D {
  color: REGL.Framebuffer2DAttachment[]
}

And then write:

const sprite_buffer = SPRITES[(tick) % 2] as ExtendedFramebuffer2D
(sprite_buffer.color[0] as REGL.Texture2D).subimage(
  BLOCK, count % N, ((count / N) | 0) % N)

A working TypeScript version of the sprites.js demo: index.ts

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

1 participant