How to reduce draw call, seems 2 Spirit will call 2 drawElement #236
-
I'm drawing two tile using two TilingSprite. <Container>
<TilingSprite
width={tileWidthHeight[0]}
height={tileWidthHeight[1]}
anchor={centerAnchor}
tilePosition={bgTilePosition}
interactive
x={props.x}
y={props.y}
cursor="pointer"
texture={tileTexture}
/>
<TilingSprite
width={tileWidthHeight[0]}
height={tileWidthHeight[1]}
anchor={centerAnchor}
tilePosition={fgTilePosition}
interactive
x={props.x}
y={props.y}
cursor="pointer"
texture={tileTexture}
/>
</Container> By using inspector, I see there are two drawElement calls, and probably texture is passing to GPU 2 times. Can this be optimized? Or just I misunderstnd the output of Spector.js browser extension? |
Beta Was this translation helpful? Give feedback.
Answered by
michalochman
Aug 18, 2021
Replies: 1 comment 2 replies
-
@linonetwo are you sure this happens only when using |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
linonetwo
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@linonetwo are you sure this happens only when using
react-pixi-fiber
? Have you checked that the same is not happening when using PIXI without React? Also in development mode, React renders twice when using StrictMode.