Skip to content

@mrdoob /gist:1224685
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Create POT texture from a nonPOT
var texture = THREE.ImageUtils.loadTexture( 'nonPOT.png', new THREE.UVMapping(), function () {
var nextPOT = function ( value ) { var pot = 1; while ( pot < value ) pot <<= 1; return pot; };
var canvas = document.createElement( 'canvas' );
canvas.width = nextPOT( texture.image.width );
canvas.height = nextPOT( texture.image.height );
canvas.getContext( '2d' ).drawImage( texture.image, 0, 0, texture.image.width, texture.image.height, 0, 0, canvas.width, canvas.height );
texture.image = canvas;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.