MCPcopy Create free account
hub / github.com/tensorflow/tfjs-examples / createTextureFrameBuffer

Function createTextureFrameBuffer

gpu-pipeline/webgl/gl-util.js:107–125  ·  view source on GitHub ↗
(gl, filterMode, width, height)

Source from the content-addressed store, hash-verified

105
106// Returns a wrapper class with a framebuffer and output texture for it.
107function createTextureFrameBuffer(gl, filterMode, width, height) {
108 const framebuffer = gl.createFramebuffer();
109 gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
110
111 const texture = createWebGLTexture(
112 gl, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, filterMode, null, width,
113 height);
114 checkGlError(gl, 'TextureFramebuffer::Create: create texture');
115
116 gl.framebufferTexture2D(
117 gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0);
118 const status = gl.checkFramebufferStatus(gl.FRAMEBUFFER);
119
120 if (status != gl.FRAMEBUFFER_COMPLETE) {
121 throw new Error(`Bad framebuffer status:${status}`);
122 }
123
124 return new GlTextureFramebuffer(gl, framebuffer, texture, width, height);
125 }
126
127 // Returns a wrapper class with a texture and its util.
128 function createTexture(gl, texture, width, height) {

Callers 2

startProcessFrameMethod · 0.85
initFunction · 0.85

Calls 3

createWebGLTextureFunction · 0.85
checkGlErrorFunction · 0.85
bindFramebufferMethod · 0.80

Tested by

no test coverage detected