js13k-2d | A 2kb webgl 2d sprite renderer , designed for Js13kGames | Game Engine library
kandi X-RAY | js13k-2d Summary
kandi X-RAY | js13k-2d Summary
A 2kb webgl 2d sprite renderer, designed for Js13kGames.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Creates a t object
- append element
- turns a node element
js13k-2d Key Features
js13k-2d Examples and Code Snippets
Community Discussions
Trending Discussions on js13k-2d
QUESTION
If you have a single power-of-two width/height texture (say 2048) and you want to blit out scaled and translated subsets of it (say 64x92-sized tiles scaled down) as quickly as possible onto another texture (as a buffer so it can be cached when not dirty), then draw that texture onto a webgl canvas, and you have no more requirements - what is the fastest strategy?
Is it first loading the source texture, binding an empty texture to a framebuffer, rendering the source with drawElementsInstancedANGLE
to the framebuffer, then unbinding the framebuffer and rendering to the canvas?
I don't know much about WebGL and I'm trying to write a non-stateful version of https://github.com/kutuluk/js13k-2d (that just uses draw() calls instead of sprites that maintain state, since I would have millions of sprites). Before I get too far into the weeds, I'm hoping for some feedback.
...ANSWER
Answered 2020-Jul-08 at 09:24There is no generic fastest way. The fastest way is different by GPU and also different by specifics.
- Are you drawing lots of things the same size?
- Are the parts of the texture atlas the same size?
- Will you be rotating or scaling each instance?
- Can their movement be based on time alone?
- Will their drawing order change?
- Do the textures have transparency?
- Is that transparency 100% or not (0 or 1) or is it various values in between?
I'm sure there's tons of other considerations. For every consideration I might choose a different approach.
In general your idea if using drawElementsAngleInstanced
seems fine but without knowing exactly what you're trying to do and on which device it's hard to know.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install js13k-2d
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page