Skip to content

Commit

Permalink
Revert "Slideshow: Prevent passing invalid value to vertex attribute"
Browse files Browse the repository at this point in the history
This reverts commit 96b82ae.

Signed-off-by: Javiya Vivekkumar Dineshbhai <[email protected]>
Change-Id: I94e3fc4b55a6d497da320b6cae57f5ae7eb930ec
  • Loading branch information
codewithvk authored and eszkadev committed Sep 5, 2024
1 parent 7d93af0 commit 40e6f9d
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 55 deletions.
41 changes: 19 additions & 22 deletions browser/src/slideshow/Transition2d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,28 +100,25 @@ abstract class TransitionBase {
'a_texCoord',
);

if (positionLocation !== -1) {
this.gl.enableVertexAttribArray(positionLocation);
this.gl.vertexAttribPointer(
positionLocation,
3,
this.gl.FLOAT,
false,
5 * 4,
0,
);
}
if (texCoordLocation !== -1) {
this.gl.enableVertexAttribArray(texCoordLocation);
this.gl.vertexAttribPointer(
texCoordLocation,
2,
this.gl.FLOAT,
false,
5 * 4,
3 * 4,
);
}
this.gl.enableVertexAttribArray(positionLocation);
this.gl.vertexAttribPointer(
positionLocation,
3,
this.gl.FLOAT,
false,
5 * 4,
0,
);

this.gl.enableVertexAttribArray(texCoordLocation);
this.gl.vertexAttribPointer(
texCoordLocation,
2,
this.gl.FLOAT,
false,
5 * 4,
3 * 4,
);
}

public startTransition(): void {
Expand Down
62 changes: 29 additions & 33 deletions browser/src/slideshow/transition/SimpleTransition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,39 +73,35 @@ class SimpleTransition extends SlideShow.Transition3d {
'a_texCoord',
);

if (positionLocation !== -1) {
this.gl.enableVertexAttribArray(positionLocation);
this.gl.vertexAttribPointer(
positionLocation,
3,
this.gl.FLOAT,
false,
8 * 4,
0,
);
}
if (normalLocation !== -1) {
this.gl.enableVertexAttribArray(normalLocation);
this.gl.vertexAttribPointer(
normalLocation,
3,
this.gl.FLOAT,
false,
8 * 4,
3 * 4,
);
}
if (texCoordLocation !== -1) {
this.gl.enableVertexAttribArray(texCoordLocation);
this.gl.vertexAttribPointer(
texCoordLocation,
2,
this.gl.FLOAT,
false,
8 * 4,
6 * 4,
);
}
this.gl.enableVertexAttribArray(positionLocation);
this.gl.vertexAttribPointer(
positionLocation,
3,
this.gl.FLOAT,
false,
8 * 4,
0,
);

this.gl.enableVertexAttribArray(normalLocation);
this.gl.vertexAttribPointer(
normalLocation,
3,
this.gl.FLOAT,
false,
8 * 4,
3 * 4,
);

this.gl.enableVertexAttribArray(texCoordLocation);
this.gl.vertexAttribPointer(
texCoordLocation,
2,
this.gl.FLOAT,
false,
8 * 4,
6 * 4,
);

this.gl.bindBuffer(this.gl.ARRAY_BUFFER, null);
this.gl.bindVertexArray(null);
Expand Down

0 comments on commit 40e6f9d

Please sign in to comment.