Skip to content

Commit 97e6e67

Browse files
committed
Fix picking
1 parent 8d28bf7 commit 97e6e67

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

webgl/lessons/ko/webgl-picking.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,8 @@ const pixelY = gl.canvas.height - mouseY * gl.canvas.height / gl.canvas.clientHe
376376

377377
const subLeft = left + pixelX * width / gl.canvas.width;
378378
const subBottom = bottom + pixelY * height / gl.canvas.height;
379-
const subWidth = 1 / gl.canvas.width;
380-
const subHeight = 1 / gl.canvas.height;
379+
const subWidth = width / gl.canvas.width;
380+
const subHeight = height / gl.canvas.height;
381381

382382
// 해당 1픽셀에 대한 절두체 만들기
383383
const projectionMatrix = m4.frustum(

webgl/lessons/webgl-picking.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -442,8 +442,8 @@ const pixelY = gl.canvas.height - mouseY * gl.canvas.height / gl.canvas.clientHe
442442

443443
const subLeft = left + pixelX * width / gl.canvas.width;
444444
const subBottom = bottom + pixelY * height / gl.canvas.height;
445-
const subWidth = 1 / gl.canvas.width;
446-
const subHeight = 1 / gl.canvas.height;
445+
const subWidth = width / gl.canvas.width;
446+
const subHeight = height / gl.canvas.height;
447447

448448
// make a frustum for that 1 pixel
449449
const projectionMatrix = m4.frustum(

webgl/webgl-picking-w-gpu-1pixel-w-texture.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,8 @@
316316

317317
const subLeft = left + pixelX * width / gl.canvas.width;
318318
const subBottom = bottom + pixelY * height / gl.canvas.height;
319-
const subWidth = 1 / gl.canvas.width;
320-
const subHeight = 1 / gl.canvas.height;
319+
const subWidth = width / gl.canvas.width;
320+
const subHeight = height / gl.canvas.height;
321321

322322
// make a frustum for that 1 pixel
323323
const projectionMatrix = m4.frustum(

webgl/webgl-picking-w-gpu-1pixel.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,8 @@
282282

283283
const subLeft = left + pixelX * width / gl.canvas.width;
284284
const subBottom = bottom + pixelY * height / gl.canvas.height;
285-
const subWidth = 1 / gl.canvas.width;
286-
const subHeight = 1 / gl.canvas.height;
285+
const subWidth = width / gl.canvas.width;
286+
const subHeight = height / gl.canvas.height;
287287

288288
// make a frustum for that 1 pixel
289289
const projectionMatrix = m4.frustum(

0 commit comments

Comments
 (0)