Create a gist now

Instantly share code, notes, and snippets.

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;
} );
@ankush2611

Getting Error: UVMApping() is not a function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment