reorganised file structure
This commit is contained in:
parent
ea47bd1ca6
commit
d1279703bf
5 changed files with 0 additions and 0 deletions
|
|
@ -1,34 +0,0 @@
|
|||
function initBuffers(gl) {
|
||||
const positionBuffer = initPositionBuffer(gl);
|
||||
|
||||
return {
|
||||
position: positionBuffer,
|
||||
};
|
||||
}
|
||||
|
||||
function initPositionBuffer(gl) {
|
||||
// Position array of a "full-screen" quad (encoded as TRIANGLE_STRIP)
|
||||
// Ref: https://en.wikipedia.org/wiki/Triangle_strip
|
||||
// NOTE: +x,+y is top-right & -x,-y is bottom-left
|
||||
const positions = [
|
||||
-1.0, 1.0,
|
||||
-1.0, -1.0,
|
||||
1.0, 1.0,
|
||||
1.0, -1.0,
|
||||
];
|
||||
|
||||
// Create a buffer for the square's positions.
|
||||
const positionBuffer = gl.createBuffer();
|
||||
// Select the positionBuffer as the one to apply buffer
|
||||
// operations to from here out.
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, positionBuffer);
|
||||
// Now pass the list of positions into WebGL to build the
|
||||
// shape. We do this by creating a Float32Array from the
|
||||
// JavaScript array, then use it to fill the current buffer.
|
||||
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(positions), gl.STATIC_DRAW);
|
||||
|
||||
return positionBuffer;
|
||||
}
|
||||
|
||||
export { initBuffers };
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue