-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master'
- Loading branch information
Showing
3 changed files
with
222 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,213 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
<meta http-equiv="x-ua-compatible" content="ie=edge"> | ||
<title>I be gay yo</title> | ||
|
||
<link rel="icon" type="image/png" href="/img/favicon.png" /> | ||
<link rel="shortcut icon" type="image/png" href="/img/favicon.png" /> | ||
<meta name="theme-color" content="#ff594f"> | ||
|
||
<link rel="alternate" href="/" hreflang="x-default" /> | ||
<link rel="alternate" href="/?hl=en" hreflang="en" /> | ||
<link rel="alternate" href="/?hl=ie" hreflang="ie" /> | ||
<link rel="alternate" href="/?hl=pt" hreflang="pt" /> | ||
|
||
<!-- Font Awesome --> | ||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"> | ||
<!-- Bootstrap core CSS --> | ||
<link href="/css/bootstrap.min.css" rel="stylesheet"> | ||
<!-- Material Design Bootstrap --> | ||
<link href="/css/mdb.min.css" rel="stylesheet"> | ||
|
||
<link href="/css/style.css" rel="stylesheet"> | ||
|
||
</head> | ||
|
||
<body class="fixed-sn"> | ||
|
||
<canvas id="gl_canvas" width="640" height="480"></canvas> | ||
|
||
<!-- JQuery --> | ||
<script type="text/javascript" src="/js/jquery-3.2.1.min.js"></script> | ||
|
||
<!-- Bootstrap tooltips --> | ||
<script type="text/javascript" src="/js/popper.min.js"></script> | ||
|
||
<!-- Bootstrap core JavaScript --> | ||
<script type="text/javascript" src="/js/bootstrap.min.js"></script> | ||
|
||
<!-- MDB core JavaScript --> | ||
<script type="text/javascript" src="/js/mdb.min.js"></script> | ||
|
||
<script> | ||
//Animation init | ||
new WOW().init(); | ||
//Modal | ||
$('#myModal').on('shown.bs.modal', function () { | ||
$('#myInput').focus() | ||
}) | ||
// Material Select Initialization | ||
$(document).ready(function () { | ||
$('.mdb-select').material_select(); | ||
}); | ||
// SideNav Button Initialization | ||
$(".button-collapse").sideNav(); | ||
// SideNav Scrollbar Initialization | ||
var sideNavScrollbar = document.querySelector('.custom-scrollbar'); | ||
Ps.initialize(sideNavScrollbar); | ||
// Tooltips Initialization | ||
$(function () { | ||
$('[data-toggle="tooltip"]').tooltip() | ||
}) | ||
</script> | ||
|
||
<script> | ||
"use strict"; | ||
class Vertex2D { | ||
constructor(x, y) { | ||
this.x = x; | ||
this.y = y; | ||
} | ||
} | ||
const vsSource = | ||
` | ||
attribute vec2 vertex_pos; | ||
void main() { | ||
gl_Position = vec4(vertex_pos.xy, 0.0, 1.0); | ||
} | ||
`; | ||
const fsSource = | ||
` | ||
void main() { | ||
gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0); | ||
} | ||
`; | ||
const initShaderProgram = (gl, vsSource, fsSource) => { | ||
const vertexShader = loadShader(gl, gl.VERTEX_SHADER, vsSource); | ||
const fragmentShader = loadShader(gl, gl.FRAGMENT_SHADER, fsSource); | ||
const shaderProgram = gl.createProgram(); | ||
gl.attachShader(shaderProgram, vertexShader); | ||
gl.attachShader(shaderProgram, fragmentShader); | ||
gl.linkProgram(shaderProgram); | ||
if (gl.getProgramParameter(shaderProgram, gl.LINK_STATUS) === false) { | ||
alert('Unable to initialize the shader program: ' + gl.getProgramInfoLog(shaderProgram)); | ||
return null; | ||
} | ||
return shaderProgram; | ||
} | ||
const loadShader = (gl, type, source) => { | ||
const shader = gl.createShader(type); | ||
gl.shaderSource(shader, source); | ||
gl.compileShader(shader); | ||
if (gl.getShaderParameter(shader, gl.COMPILE_STATUS) === false) { | ||
alert('An error occurred compiling the shaders: ' + gl.getShaderInfoLog(shader)); | ||
gl.deleteShader(shader); | ||
return null; | ||
} | ||
return shader; | ||
} | ||
const initBuffers = gl => { | ||
const positionBuffer = gl.createBuffer(); | ||
gl.bindBuffer(gl.ARRAY_BUFFER, positionBuffer); | ||
const positions = [-0.5, -0.5, 0.7, 0.7, 0.3, -0.3]; | ||
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(positions), gl.STATIC_DRAW); | ||
return positionBuffer; | ||
} | ||
const drawScene = (gl, programInfo, buffers) => { | ||
gl.clearColor(0.0, 0.0, 0.0, 1.0); | ||
gl.clear(gl.COLOR_BUFFER_BIT); | ||
{ | ||
const numComponents = 2; | ||
const type = gl.FLOAT; | ||
const normalize = false; | ||
const stride = 0; | ||
const offset = 0; | ||
gl.vertexAttribPointer(programInfo.attribLocations.vertexPosition, numComponents, type, normalize, | ||
stride, offset); | ||
gl.enableVertexAttribArray(programInfo.attribLocations.vertexPosition); | ||
} | ||
gl.useProgram(programInfo.program); | ||
{ | ||
const offset = 0; | ||
const vertexCount = 3; | ||
gl.drawArrays(gl.TRIANGLES, offset, vertexCount); | ||
} | ||
} | ||
// | ||
// start here | ||
// | ||
function main() { | ||
const canvas = document.querySelector("#gl_canvas"); | ||
// Initialize the GL context | ||
const gl = canvas.getContext("webgl"); | ||
// Only continue if WebGL is available and working | ||
if (gl === null) { | ||
alert("Unable to initialize WebGL. Your browser or machine may not support it."); | ||
return; | ||
} | ||
// Set clear color to black, fully opaque | ||
gl.clearColor(0.0, 0.0, 0.0, 1.0); | ||
// Clear the color buffer with specified clear color | ||
gl.clear(gl.COLOR_BUFFER_BIT); | ||
const shaderProgram = initShaderProgram(gl, vsSource, fsSource); | ||
const programInfo = { | ||
program: shaderProgram, | ||
attribLocations: { | ||
vertexPosition: gl.getAttribLocation(shaderProgram, "vertex_pos"), | ||
} | ||
}; | ||
const buffers = initBuffers(gl); | ||
drawScene(gl, programInfo, buffers); | ||
} | ||
window.onload = () => { | ||
main(); | ||
} | ||
</script> | ||
|
||
</body> | ||
|
||
</html> |