MCPcopy
hub / github.com/regl-project/regl / reglRenderbuffer

Function reglRenderbuffer

lib/renderbuffer.js:108–179  ·  view source on GitHub ↗
(a, b)

Source from the content-addressed store, hash-verified

106 stats.renderbufferCount++
107
108 function reglRenderbuffer (a, b) {
109 var w = 0
110 var h = 0
111 var format = GL_RGBA4
112
113 if (typeof a === 'object' && a) {
114 var options = a
115 if ('shape' in options) {
116 var shape = options.shape
117 check(Array.isArray(shape) && shape.length >= 2,
118 'invalid renderbuffer shape')
119 w = shape[0] | 0
120 h = shape[1] | 0
121 } else {
122 if ('radius' in options) {
123 w = h = options.radius | 0
124 }
125 if ('width' in options) {
126 w = options.width | 0
127 }
128 if ('height' in options) {
129 h = options.height | 0
130 }
131 }
132 if ('format' in options) {
133 check.parameter(options.format, formatTypes,
134 'invalid renderbuffer format')
135 format = formatTypes[options.format]
136 }
137 } else if (typeof a === 'number') {
138 w = a | 0
139 if (typeof b === 'number') {
140 h = b | 0
141 } else {
142 h = w
143 }
144 } else if (!a) {
145 w = h = 1
146 } else {
147 check.raise('invalid arguments to renderbuffer constructor')
148 }
149
150 // check shape
151 check(
152 w > 0 && h > 0 &&
153 w <= limits.maxRenderbufferSize && h <= limits.maxRenderbufferSize,
154 'invalid renderbuffer size')
155
156 if (w === renderbuffer.width &&
157 h === renderbuffer.height &&
158 format === renderbuffer.format) {
159 return
160 }
161
162 reglRenderbuffer.width = renderbuffer.width = w
163 reglRenderbuffer.height = renderbuffer.height = h
164 renderbuffer.format = format
165

Callers 1

createRenderbufferFunction · 0.85

Calls 2

getRenderbufferSizeFunction · 0.85
checkFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…