thebookofshaders/edit.html
Patricio Gonzalez Vivo 5b0e52ee11 ssl links
2016-05-07 15:07:34 -04:00

85 lines
3.3 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title>GLSL Editor</title>
<link href='/favicon.gif' rel='shortcut icon'/>
<!-- GLSL Canvas -->
<script type='text/javascript' src='https://thebookofshaders.com/glslCanvas/GlslCanvas.js'></script>
<style>
body {
height: 100%;
margin: 0;
background: #272822;
}
#glsl_editor {
height: 100%;
}
</style>
</head>
<body>
<div id='glsl_editor'></div>
</body>
<link type='text/css' rel='stylesheet' href='https://thebookofshaders.com/glslEditor/glslEditor.css'>
<script type='application/javascript' src='https://thebookofshaders.com/glslEditor/glslEditor.js'></script>
<script type='text/javascript'>
function loadjscssfile(filename, filetype, callback){
if (filetype=="js") { //if filename is a external JavaScript file
var fileref = document.createElement('script')
fileref.setAttribute("type","text/javascript")
fileref.setAttribute("src", filename)
}
else if (filetype=="css") { //if filename is an external CSS file
var fileref = document.createElement("link")
fileref.setAttribute("rel", "stylesheet")
fileref.setAttribute("type", "text/css")
fileref.setAttribute("href", filename)
}
fileref.onload = callback;
fileref.onreadystatechange = callback;
if (typeof fileref != "undefined") {
document.getElementsByTagName("head")[0].appendChild(fileref)
}
}
window.onload = function() {
// if ()
if (window.GlslEditor && window.GlslEditor) {
init();
}
else {
console.log('Try to load a local glslEditor');
loadjscssfile('src/glslCanvas/build/glslCanvas.min.js', 'js');
loadjscssfile('src/glslEditor/build/glslEditor.css', 'css');
loadjscssfile('src/glslEditor/build/glslEditor.js', 'js', init);
}
};
function init() {
window.glslEditor = new GlslEditor('#glsl_editor', {
canvas_size: 500,
canvas_draggable: true,
theme: 'monokai',
multipleBuffers: true,
watchHash: true,
fileDrops: true,
menu: true
});
}
</script>
<script>
(function(i,s,o,g,r,a,m){i["GoogleAnalyticsObject"]=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,"script","//www.google-analytics.com/analytics.js","ga");
ga("create", "UA-18824436-2", "auto");
ga("send", "pageview");
</script>
</html>