2015-03-15 15:21:47 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
2016-03-02 00:45:47 +00:00
|
|
|
<meta charset='utf-8'>
|
2016-05-13 12:37:19 +00:00
|
|
|
<?php
|
|
|
|
if (!empty($_GET['log'])) {
|
|
|
|
echo '
|
|
|
|
<title>'.$_GET['log'].'</title>';
|
|
|
|
} else {
|
|
|
|
echo '
|
|
|
|
<title>GLSL Editor</title>';
|
|
|
|
}
|
|
|
|
?>
|
2016-03-02 00:45:47 +00:00
|
|
|
<link href='/favicon.gif' rel='shortcut icon'/>
|
2016-05-13 12:37:19 +00:00
|
|
|
|
|
|
|
<!— Open Graph data —>
|
|
|
|
<meta property="og:type" content="article" />
|
|
|
|
<meta property="og:title" content="GLSL Shader Editor" />
|
|
|
|
<meta property="og:site_name" content="The Book of Shaders"/>
|
2016-05-17 15:14:30 +00:00
|
|
|
<meta property="og:description" content="The Book of Shaders Editor" />
|
|
|
|
|
2016-05-13 12:37:19 +00:00
|
|
|
<?php
|
|
|
|
if (!empty($_GET['log'])) {
|
2016-05-17 17:26:04 +00:00
|
|
|
echo '
|
2016-05-17 17:15:41 +00:00
|
|
|
<meta property="og:image" content="http://thebookofshaders.com/log/'.$_GET['log'].'.png"/>
|
|
|
|
<meta property="og:image:secure_url" content="https://thebookofshaders.com/log/'.$_GET['log'].'.png"/>';
|
2016-05-17 15:14:30 +00:00
|
|
|
} else {
|
2016-05-17 17:26:04 +00:00
|
|
|
echo '
|
2016-05-17 15:14:30 +00:00
|
|
|
<meta property="og:image" content="https://thebookofshaders.com/thumb.png"/>';
|
2016-05-13 12:37:19 +00:00
|
|
|
}
|
2016-05-17 15:14:30 +00:00
|
|
|
|
|
|
|
echo'
|
|
|
|
<meta property="og:image:type" content="image/png"/>
|
|
|
|
<meta property="og:image:width" content="500" />
|
|
|
|
<meta property="og:image:height" content="500" />';
|
2016-05-13 12:37:19 +00:00
|
|
|
?>
|
|
|
|
|
2016-05-18 20:16:34 +00:00
|
|
|
<!-- <!— Twitter Card—>
|
2016-05-13 12:37:19 +00:00
|
|
|
<meta name="twitter:card" content="image">
|
|
|
|
<meta name="twitter:site" content="@bookofshaders">
|
|
|
|
<meta name="twitter:title" content="GLSL Shader Editor">
|
|
|
|
<meta name="twitter:description" content="The Book of Shaders editor">
|
2016-05-18 20:16:34 +00:00
|
|
|
<meta name="twitter:domain" content="thebookofshaders.com"> -->
|
2016-05-13 12:37:19 +00:00
|
|
|
<?php
|
2016-05-18 20:16:34 +00:00
|
|
|
// if (!empty($_GET['log'])) {
|
|
|
|
// echo '
|
|
|
|
// <meta name="twitter:image" content="https://thebookofshaders.com/log/'.$_GET['log'].'.png"/>';
|
|
|
|
// } else {
|
|
|
|
// echo '
|
|
|
|
// <meta name="twitter:image" content="https://thebookofshaders.com/thumb.png"/>';
|
|
|
|
// }
|
2016-05-17 15:14:30 +00:00
|
|
|
|
2016-05-18 20:16:34 +00:00
|
|
|
// echo '
|
|
|
|
// <meta name="twitter:image:width" content="500">
|
|
|
|
// <meta name="twitter:image:height" content="500">';
|
2016-05-13 12:37:19 +00:00
|
|
|
?>
|
2015-03-15 15:21:47 +00:00
|
|
|
<style>
|
|
|
|
body {
|
2016-01-19 16:23:55 +00:00
|
|
|
height: 100%;
|
|
|
|
margin: 0;
|
2015-03-15 15:21:47 +00:00
|
|
|
background: #272822;
|
|
|
|
}
|
|
|
|
|
2016-01-19 16:23:55 +00:00
|
|
|
#glsl_editor {
|
|
|
|
height: 100%;
|
2015-03-15 15:21:47 +00:00
|
|
|
}
|
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
<body>
|
2016-03-02 00:45:47 +00:00
|
|
|
<div id='glsl_editor'></div>
|
2016-01-11 00:11:56 +00:00
|
|
|
</body>
|
2016-01-19 16:23:55 +00:00
|
|
|
|
2016-05-07 19:07:34 +00:00
|
|
|
<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>
|
2016-03-02 00:45:47 +00:00
|
|
|
<script type='text/javascript'>
|
2016-05-18 20:16:34 +00:00
|
|
|
var glslEditor = {};
|
|
|
|
|
2016-03-16 11:53:14 +00:00
|
|
|
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');
|
2016-05-13 13:51:39 +00:00
|
|
|
if (!window.glslEditor) {
|
|
|
|
loadjscssfile('src/glslEditor/build/glslEditor.css', 'css');
|
|
|
|
loadjscssfile('src/glslEditor/build/glslEditor.js', 'js', init);
|
|
|
|
}
|
2016-03-16 11:53:14 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
function init() {
|
2016-05-18 20:16:34 +00:00
|
|
|
glslEditor = new GlslEditor('#glsl_editor', {
|
2016-03-16 11:53:14 +00:00
|
|
|
canvas_size: 500,
|
|
|
|
canvas_draggable: true,
|
|
|
|
theme: 'monokai',
|
|
|
|
multipleBuffers: true,
|
|
|
|
watchHash: true,
|
|
|
|
fileDrops: true,
|
|
|
|
menu: true
|
|
|
|
});
|
2016-05-13 17:57:05 +00:00
|
|
|
document.body.style.backgroundColor = window.getComputedStyle(glslEditor.editor.getWrapperElement(),null).getPropertyValue('background-color');
|
2016-03-16 11:53:14 +00:00
|
|
|
}
|
2016-05-13 17:57:05 +00:00
|
|
|
|
2016-01-19 16:23:55 +00:00
|
|
|
</script>
|
2016-03-11 18:57:10 +00:00
|
|
|
<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>
|
2016-02-02 16:44:12 +00:00
|
|
|
</html>
|