pex-gl / pex-context

Modern WebGL state wrapper for PEX: allocate GPU resources (textures, buffers), setup state pipelines and passes, and combine them into commands.
http://pex-gl.github.io/pex-context/
MIT License
160 stars 12 forks source link

Add programmatic width,height,pixelRatio getters #38

Closed vorg closed 4 months ago

vorg commented 6 years ago
ctx.gl.drawingBufferWidth -> ctx.width
vorg commented 6 years ago

Having ctx.width will help with situations where we use different values for different things. It's better if ctx is the source of truth.

var W = 100
var H = 100
var ctx = createContext({ width:W, height: H, pixelRatio: 2 })

ctx.width //200
H //100