WebGL
Khronos
 

WebGL OES_fbo_render_mipmap Extension Draft Specification

Name

OES_fbo_render_mipmap

Contact

WebGL working group (public_webgl 'at' khronos.org)

Contributors

Florian Boesch (pyalot 'at' gmail.com)

Members of the WebGL working group

Version

Last modified date: January 31, 2015
Revision: 2

Number

WebGL extension #28

Dependencies

Written against the WebGL API 1.0 specification.

Promoted to core and no longer available as an extension in WebGL API 2.0 specification.

Overview

This extension exposes the OES_fbo_render_mipmap functionality to WebGL.

There are no WebGL-specific behavioral changes.

Consult the above extension for documentation, issues and new functions and enumerants.

When this extension is enabled:

IDL

[NoInterfaceObject]
interface OES_fbo_render_mipmap {
};
  

Sample Code

        var extension = gl.getExtension('OES_fbo_render_mipmap');
        if(extension !=== null){
            var texture = gl.createTexture();
            gl.bindTexture(gl.TEXTURE_2D, texture);
            var fbos = [];
            
            for(var level=0; level<7; level++){
                var size = 128/Math.pow(2, level);
                gl.texImage2D(gl.TEXTURE_2D, level, gl.RGBA, size, size, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
                var fbo = gl.createFramebuffer();
                gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);
                gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, level);
                fbos.push(fbo);
                
                var fboStatus = gl.checkFramebufferStatus(gl.FRAMEBUFFER);
                console.assert(fboStatus == gl.FRAMEBUFFER_COMPLETE, 'Framebuffer is not complete');
            }

            gl.bindTexture(gl.TEXTURE_2D, null);
            gl.bindFramebuffer(gl.FRAMEBUFFER, null);

            console.assert(gl.getError() == gl.NO_ERROR, 'A GL error occured');
        }
    

Revision History

Revision 1, 2015/01/26

Revision 2, 2015/01/31