How can I set the color of a pixel on a canvas using WebGL?

前端 未结 3 1335
一整个雨季
一整个雨季 2021-02-20 06:08

I am very new to WebGL, but not Javascript or Canvas. Essentially, I need a very fast way to be able to change the color of a pixel on a canvas at any coordinate. I feel like

3条回答
  •  逝去的感伤
    2021-02-20 06:27

    If you just want to draw single pixels you're probably better off using canvas 2d.

    Otherwise you can probably figure it out from this tutorial which draws rectangles in pixel units so set the width and height to 1x1 and you'll get single pixels.

    http://games.greggman.com/game/webgl-fundamentals/

提交回复
热议问题