Jump to content

Should I use image or drawn graphics for single pixel?


Recommended Posts



I'm making a game where I want to add and use a bunch of singe pixels. What would be best practice for that, CPU wise?


Should I let Pixi draw a 1x1 rectangle, or simply create a pixel as a .PNG and add as a sprite (even though it feels kind of silly)? Or does it really matter?


I'm guessing there will be around 100 visible simultaneously..


Thanks in advance!





Link to comment
Share on other sites

It really depends on how many pixels you have. For this, with 100, it is probably better to use polygons (sprites) instead of pixels, since you are drawing to the texture and that requires some back and forth between the CPU and GPU. (assuming the game is supposed to run in webGL)

Link to comment
Share on other sites

So again, if you are doing stuff with pixels that is difficult or impossible with polygons (in your estimation), you should modify the texture. Otherwise, modify the sprite.


It is a different architecture.


With pixels, you have more control but you need to send this information (e.g.:  a texture) to the GPU each frame. Thus, there can be a data bottleneck if the texture is big.


With polygons and textures, most of the data is already sent to the GPU. You just have to send some positioning data, for example.


That's why there are filters and shaders and such... to help with some common graphics manipulation cases.


WebGL ES 2.0 is fairly limited.. WebGL 3 should make things easier, as well.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...