Skip to content

Commit

Permalink
02-texture-2d: day 7 - NPOT cat
Browse files Browse the repository at this point in the history
  • Loading branch information
pastleo committed Aug 27, 2021
1 parent f976e7c commit f68190e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions 02-texture-2d.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ async function main() {
const resolutionUniformLocation = gl.getUniformLocation(program, 'u_resolution');
const textureUniformLocation = gl.getUniformLocation(program, 'u_texture');

const image = await loadImage('https://i.imgur.com/ISdY40yh.jpg');
// const image = await loadImage('https://i.imgur.com/ISdY40yh.jpg');
const image = await loadImage('https://i.imgur.com/vryPVknh.jpg');
const texture = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D, texture);
gl.texImage2D(
Expand All @@ -58,7 +59,12 @@ async function main() {
gl.UNSIGNED_BYTE, // type
image, // data
);
gl.generateMipmap(gl.TEXTURE_2D);

// gl.generateMipmap(gl.TEXTURE_2D);

gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);

// a_position
const positionBuffer = gl.createBuffer();
Expand Down

0 comments on commit f68190e

Please sign in to comment.