From a5f4d66313bb1a455bbc344a671dd16d315a0fdc Mon Sep 17 00:00:00 2001 From: Jon Santmyer Date: Sat, 24 Apr 2021 19:37:31 +0000 Subject: commit 2 --- blockgame/index.html | 16 ++++++++++++++++ blockgame/main.js | 18 ++++++++++++++++++ blockgame/shaders.js | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ img/artix.png | Bin 0 -> 14591 bytes img/artix.svg | 22 ++++++++++++++++++++++ img/icon.ico | Bin 0 -> 1406 bytes index.html | 25 ++++++++++++++++++++++++- pfp.png | Bin 0 -> 894 bytes style.css | 34 ++++++++++++++++++++++++++++++++++ 9 files changed, 163 insertions(+), 1 deletion(-) create mode 100644 blockgame/index.html create mode 100644 blockgame/main.js create mode 100644 blockgame/shaders.js create mode 100644 img/artix.png create mode 100644 img/artix.svg create mode 100644 img/icon.ico create mode 100644 pfp.png create mode 100644 style.css diff --git a/blockgame/index.html b/blockgame/index.html new file mode 100644 index 0000000..a882e14 --- /dev/null +++ b/blockgame/index.html @@ -0,0 +1,16 @@ + + + + + WebGL Block Game + + + +
+
+ +
+
+ + + diff --git a/blockgame/main.js b/blockgame/main.js new file mode 100644 index 0000000..d7bf3ea --- /dev/null +++ b/blockgame/main.js @@ -0,0 +1,18 @@ +import * as shaders from "./shaders.js" + +function main() { + const canvas = document.querySelector("#glCanvas"); + const gl = canvas.getContext("webgl") + + if(gl == null) { + alert("Unable to initialize WebGL."); + return; + } + + const shaderProgram = shaders.init(gl); + + gl.clearColor(0.0, 0.0, 0.0, 1.0); + gl.clear(gl.COLOR_BUFFER_BIT); +} + +window.onload = main; diff --git a/blockgame/shaders.js b/blockgame/shaders.js new file mode 100644 index 0000000..f89270a --- /dev/null +++ b/blockgame/shaders.js @@ -0,0 +1,49 @@ +const vs_src = ` + attribute vec4 position; + + uniform mat4 mv_matrix; + uniform mat4 projection_matrix; + + void main() { + gl_Position = projection_matrix * mv_matrix * position; + } +`; + +const fs_src = ` + void main() { + gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0); + } +`; + +export function init(gl) { + const vshader = loadShader(gl, gl.VERTEX_SHADER, vs_src); + const fshader = loadShader(gl, gl.FRAGMENT_SHADER, fs_src); + + const program = gl.createProgram(); + gl.attachShader(program, vshader); + gl.attachShader(program, fshader); + + gl.linkProgram(program); + + if(!gl.getProgramParameter(program, gl.LINK_STATUS)) { + alert("Unable to initialize shader program: " + gl.getProgramInfoLog(program)); + return null; + } + + return program; +} + +export function loadShader(gl, type, src){ + const shader = gl.createShader(type) + + gl.shaderSource(shader, src); + gl.compileShader(shader); + + if(!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) { + alert('Failed to compile shader : ' + gl.getShaderInfoLog(shader)); + gl.deleteShader(shader); + return null; + } + + return shader; +} diff --git a/img/artix.png b/img/artix.png new file mode 100644 index 0000000..02253fe Binary files /dev/null and b/img/artix.png differ diff --git a/img/artix.svg b/img/artix.svg new file mode 100644 index 0000000..933d4bf --- /dev/null +++ b/img/artix.svg @@ -0,0 +1,22 @@ + + + + +Created by potrace 1.16, written by Peter Selinger 2001-2019 + + + + + diff --git a/img/icon.ico b/img/icon.ico new file mode 100644 index 0000000..5769682 Binary files /dev/null and b/img/icon.ico differ diff --git a/index.html b/index.html index 79debeb..ca587ad 100644 --- a/index.html +++ b/index.html @@ -1,5 +1,28 @@ + + + Jon Santmyer -

Jon Santmyer Website!

+ + + +
+
+

Jon Santmyer's Website

+

A place where I put links to things I find interesting / notable

+ git.jonsantmyer.com + searx.jonsantmyer.com +
+
+

There won't really be any physical media here because storage is expensive. Maybe torrent links...

+

+ I use + + Artix + on my main system and laptop +

+
+
+ diff --git a/pfp.png b/pfp.png new file mode 100644 index 0000000..040b4e5 Binary files /dev/null and b/pfp.png differ diff --git a/style.css b/style.css new file mode 100644 index 0000000..92f050e --- /dev/null +++ b/style.css @@ -0,0 +1,34 @@ +body { + background-color: #FFFFBB; + margin: 0px; + padding: 0px; +} + +.header { + background-color: #FFFFCC; + margin: 0px; + padding: 5px; +} + +.link-button { + display: inline-block; + background-color: #DDDDDD; + color: #000000; + border: outset; + padding: 10px 15px; + text-align: center; + text-decoration: none; + font-size: 16px; + margin: 4px 2px; + cursor: pointer; +} + +.page-body { + display: inline-block; + background-color: #CCCCCC; + + border: solid 5px #DDDDDD; + margin: 5% 10% 5% 10%; + padding: 25px 0px 25px 0px; + width: 80%; +} -- cgit v1.2.1