{"action":"created","comment":{"url":"https://api.github.com/repos/mcgrue/maped4/pulls/comments/44889065","id":44889065,"diff_hunk":"@@ -0,0 +1,205 @@\n+var app = require('remote').require('app');\r\n+var jetpack = require('fs-jetpack').cwd(app.getAppPath());\r\n+\r\n+function buildShaderProgram(gl) {\r\n+    var vertexShader = gl.createShader(gl.VERTEX_SHADER);\r\n+    gl.shaderSource(vertexShader, jetpack.read(\"../app/vertex.glsl\"));\r\n+    gl.compileShader(vertexShader);\r\n+    if (!gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS)) {\r\n+        throw new Error(\"Failed to compile vertex shader: \" + gl.getShaderInfoLog(vertexShader));\r\n+    }\r\n+\r\n+    var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);\r\n+    gl.shaderSource(fragmentShader, jetpack.read(\"../app/fragment.glsl\"));\r\n+    gl.compileShader(fragmentShader);\r\n+    if (!gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS)) {\r\n+        throw new Error(\"Failed to compile fragment shader: \" + gl.getShaderInfoLog(fragmentShader));\r\n+    }\r\n+\r\n+    var program = gl.createProgram();\r\n+    gl.attachShader(program, vertexShader);\r\n+    gl.attachShader(program, fragmentShader);\r\n+    gl.linkProgram(program);\r\n+    if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {\r\n+        throw new Error(\"Failed to link shader program: \" + gl.getProgramInfoLog(program));\r\n+    }\r\n+\r\n+    return program;\r\n+}\r\n+\r\n+function buildTileDataTexture(data) {\r","path":"app/map.js","position":30,"original_position":30,"commit_id":"5ed6bcb71f46ecb85f2544cb7ae756f0ec66431a","original_commit_id":"5ed6bcb71f46ecb85f2544cb7ae756f0ec66431a","user":{"login":"mcgrue","id":213483,"avatar_url":"https://avatars.githubusercontent.com/u/213483?v=3","gravatar_id":"","url":"https://api.github.com/users/mcgrue","html_url":"https://github.com/mcgrue","followers_url":"https://api.github.com/users/mcgrue/followers","following_url":"https://api.github.com/users/mcgrue/following{/other_user}","gists_url":"https://api.github.com/users/mcgrue/gists{/gist_id}","starred_url":"https://api.github.com/users/mcgrue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcgrue/subscriptions","organizations_url":"https://api.github.com/users/mcgrue/orgs","repos_url":"https://api.github.com/users/mcgrue/repos","events_url":"https://api.github.com/users/mcgrue/events{/privacy}","received_events_url":"https://api.github.com/users/mcgrue/received_events","type":"User","site_admin":false},"body":"I saw this technique in other tutorials.  It somewhat baffles me that it's how things are really done.\r\n\r\nI suppose textures are the data format du jour for shaders?","created_at":"2015-11-16T04:56:28Z","updated_at":"2015-11-16T04:56:28Z","html_url":"https://github.com/mcgrue/maped4/pull/1#discussion_r44889065","pull_request_url":"https://api.github.com/repos/mcgrue/maped4/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/mcgrue/maped4/pulls/comments/44889065"},"html":{"href":"https://github.com/mcgrue/maped4/pull/1#discussion_r44889065"},"pull_request":{"href":"https://api.github.com/repos/mcgrue/maped4/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/mcgrue/maped4/pulls/1","id":50760973,"html_url":"https://github.com/mcgrue/maped4/pull/1","diff_url":"https://github.com/mcgrue/maped4/pull/1.diff","patch_url":"https://github.com/mcgrue/maped4/pull/1.patch","issue_url":"https://api.github.com/repos/mcgrue/maped4/issues/1","number":1,"state":"open","locked":false,"title":"Map Rendering with Shaders","user":{"login":"speveril","id":277316,"avatar_url":"https://avatars.githubusercontent.com/u/277316?v=3","gravatar_id":"","url":"https://api.github.com/users/speveril","html_url":"https://github.com/speveril","followers_url":"https://api.github.com/users/speveril/followers","following_url":"https://api.github.com/users/speveril/following{/other_user}","gists_url":"https://api.github.com/users/speveril/gists{/gist_id}","starred_url":"https://api.github.com/users/speveril/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/speveril/subscriptions","organizations_url":"https://api.github.com/users/speveril/orgs","repos_url":"https://api.github.com/users/speveril/repos","events_url":"https://api.github.com/users/speveril/events{/privacy}","received_events_url":"https://api.github.com/users/speveril/received_events","type":"User","site_admin":false},"body":"The whole thing just renders into a &lt;canvas>. It should work with whatever styling applied to it; you might need to call .resize on the map if you've done something to resize it (it will automatically handle window resizes, but if it gets placed inside something else that may not work). The canvas is the size of the viewport; the map scrolls within that viewport. Because of that it may be hard to get scroll bars on the canvas.\r\n\r\nThat said, it currently supports moving the map around (click-drag) and zooming (scroll-wheel). app.js instantiates a map.\r\n\r\nI haven't changed the map JSON formats at all. It seems like it'd make sense to have the reference to the map/tile data and to the vsp data from inside the original map JSON. That shouldn't be too hard to change.","created_at":"2015-11-16T00:09:01Z","updated_at":"2015-11-16T04:56:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5af7439d971759d17d81e90834e10fb4a5e60442","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mcgrue/maped4/pulls/1/commits","review_comments_url":"https://api.github.com/repos/mcgrue/maped4/pulls/1/comments","review_comment_url":"https://api.github.com/repos/mcgrue/maped4/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mcgrue/maped4/issues/1/comments","statuses_url":"https://api.github.com/repos/mcgrue/maped4/statuses/5ed6bcb71f46ecb85f2544cb7ae756f0ec66431a","head":{"label":"speveril:master","ref":"master","sha":"5ed6bcb71f46ecb85f2544cb7ae756f0ec66431a","user":{"login":"speveril","id":277316,"avatar_url":"https://avatars.githubusercontent.com/u/277316?v=3","gravatar_id":"","url":"https://api.github.com/users/speveril","html_url":"https://github.com/speveril","followers_url":"https://api.github.com/users/speveril/followers","following_url":"https://api.github.com/users/speveril/following{/other_user}","gists_url":"https://api.github.com/users/speveril/gists{/gist_id}","starred_url":"https://api.github.com/users/speveril/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/speveril/subscriptions","organizations_url":"https://api.github.com/users/speveril/orgs","repos_url":"https://api.github.com/users/speveril/repos","events_url":"https://api.github.com/users/speveril/events{/privacy}","received_events_url":"https://api.github.com/users/speveril/received_events","type":"User","site_admin":false},"repo":{"id":46158621,"name":"maped4","full_name":"speveril/maped4","owner":{"login":"speveril","id":277316,"avatar_url":"https://avatars.githubusercontent.com/u/277316?v=3","gravatar_id":"","url":"https://api.github.com/users/speveril","html_url":"https://github.com/speveril","followers_url":"https://api.github.com/users/speveril/followers","following_url":"https://api.github.com/users/speveril/following{/other_user}","gists_url":"https://api.github.com/users/speveril/gists{/gist_id}","starred_url":"https://api.github.com/users/speveril/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/speveril/subscriptions","organizations_url":"https://api.github.com/users/speveril/orgs","repos_url":"https://api.github.com/users/speveril/repos","events_url":"https://api.github.com/users/speveril/events{/privacy}","received_events_url":"https://api.github.com/users/speveril/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/speveril/maped4","description":"ZOMG MAPEDITRO!112","fork":true,"url":"https://api.github.com/repos/speveril/maped4","forks_url":"https://api.github.com/repos/speveril/maped4/forks","keys_url":"https://api.github.com/repos/speveril/maped4/keys{/key_id}","collaborators_url":"https://api.github.com/repos/speveril/maped4/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/speveril/maped4/teams","hooks_url":"https://api.github.com/repos/speveril/maped4/hooks","issue_events_url":"https://api.github.com/repos/speveril/maped4/issues/events{/number}","events_url":"https://api.github.com/repos/speveril/maped4/events","assignees_url":"https://api.github.com/repos/speveril/maped4/assignees{/user}","branches_url":"https://api.github.com/repos/speveril/maped4/branches{/branch}","tags_url":"https://api.github.com/repos/speveril/maped4/tags","blobs_url":"https://api.github.com/repos/speveril/maped4/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/speveril/maped4/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/speveril/maped4/git/refs{/sha}","trees_url":"https://api.github.com/repos/speveril/maped4/git/trees{/sha}","statuses_url":"https://api.github.com/repos/speveril/maped4/statuses/{sha}","languages_url":"https://api.github.com/repos/speveril/maped4/languages","stargazers_url":"https://api.github.com/repos/speveril/maped4/stargazers","contributors_url":"https://api.github.com/repos/speveril/maped4/contributors","subscribers_url":"https://api.github.com/repos/speveril/maped4/subscribers","subscription_url":"https://api.github.com/repos/speveril/maped4/subscription","commits_url":"https://api.github.com/repos/speveril/maped4/commits{/sha}","git_commits_url":"https://api.github.com/repos/speveril/maped4/git/commits{/sha}","comments_url":"https://api.github.com/repos/speveril/maped4/comments{/number}","issue_comment_url":"https://api.github.com/repos/speveril/maped4/issues/comments{/number}","contents_url":"https://api.github.com/repos/speveril/maped4/contents/{+path}","compare_url":"https://api.github.com/repos/speveril/maped4/compare/{base}...{head}","merges_url":"https://api.github.com/repos/speveril/maped4/merges","archive_url":"https://api.github.com/repos/speveril/maped4/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/speveril/maped4/downloads","issues_url":"https://api.github.com/repos/speveril/maped4/issues{/number}","pulls_url":"https://api.github.com/repos/speveril/maped4/pulls{/number}","milestones_url":"https://api.github.com/repos/speveril/maped4/milestones{/number}","notifications_url":"https://api.github.com/repos/speveril/maped4/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/speveril/maped4/labels{/name}","releases_url":"https://api.github.com/repos/speveril/maped4/releases{/id}","created_at":"2015-11-14T02:42:14Z","updated_at":"2015-11-14T02:42:15Z","pushed_at":"2015-11-16T00:03:39Z","git_url":"git://github.com/speveril/maped4.git","ssh_url":"git@github.com:speveril/maped4.git","clone_url":"https://github.com/speveril/maped4.git","svn_url":"https://github.com/speveril/maped4","homepage":null,"size":947,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mcgrue:master","ref":"master","sha":"ef5b11c102fdfb87ab50bd92fef7b7b7df72bb8b","user":{"login":"mcgrue","id":213483,"avatar_url":"https://avatars.githubusercontent.com/u/213483?v=3","gravatar_id":"","url":"https://api.github.com/users/mcgrue","html_url":"https://github.com/mcgrue","followers_url":"https://api.github.com/users/mcgrue/followers","following_url":"https://api.github.com/users/mcgrue/following{/other_user}","gists_url":"https://api.github.com/users/mcgrue/gists{/gist_id}","starred_url":"https://api.github.com/users/mcgrue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcgrue/subscriptions","organizations_url":"https://api.github.com/users/mcgrue/orgs","repos_url":"https://api.github.com/users/mcgrue/repos","events_url":"https://api.github.com/users/mcgrue/events{/privacy}","received_events_url":"https://api.github.com/users/mcgrue/received_events","type":"User","site_admin":false},"repo":{"id":42222889,"name":"maped4","full_name":"mcgrue/maped4","owner":{"login":"mcgrue","id":213483,"avatar_url":"https://avatars.githubusercontent.com/u/213483?v=3","gravatar_id":"","url":"https://api.github.com/users/mcgrue","html_url":"https://github.com/mcgrue","followers_url":"https://api.github.com/users/mcgrue/followers","following_url":"https://api.github.com/users/mcgrue/following{/other_user}","gists_url":"https://api.github.com/users/mcgrue/gists{/gist_id}","starred_url":"https://api.github.com/users/mcgrue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcgrue/subscriptions","organizations_url":"https://api.github.com/users/mcgrue/orgs","repos_url":"https://api.github.com/users/mcgrue/repos","events_url":"https://api.github.com/users/mcgrue/events{/privacy}","received_events_url":"https://api.github.com/users/mcgrue/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mcgrue/maped4","description":"ZOMG MAPEDITRO!112","fork":false,"url":"https://api.github.com/repos/mcgrue/maped4","forks_url":"https://api.github.com/repos/mcgrue/maped4/forks","keys_url":"https://api.github.com/repos/mcgrue/maped4/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mcgrue/maped4/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mcgrue/maped4/teams","hooks_url":"https://api.github.com/repos/mcgrue/maped4/hooks","issue_events_url":"https://api.github.com/repos/mcgrue/maped4/issues/events{/number}","events_url":"https://api.github.com/repos/mcgrue/maped4/events","assignees_url":"https://api.github.com/repos/mcgrue/maped4/assignees{/user}","branches_url":"https://api.github.com/repos/mcgrue/maped4/branches{/branch}","tags_url":"https://api.github.com/repos/mcgrue/maped4/tags","blobs_url":"https://api.github.com/repos/mcgrue/maped4/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mcgrue/maped4/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mcgrue/maped4/git/refs{/sha}","trees_url":"https://api.github.com/repos/mcgrue/maped4/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mcgrue/maped4/statuses/{sha}","languages_url":"https://api.github.com/repos/mcgrue/maped4/languages","stargazers_url":"https://api.github.com/repos/mcgrue/maped4/stargazers","contributors_url":"https://api.github.com/repos/mcgrue/maped4/contributors","subscribers_url":"https://api.github.com/repos/mcgrue/maped4/subscribers","subscription_url":"https://api.github.com/repos/mcgrue/maped4/subscription","commits_url":"https://api.github.com/repos/mcgrue/maped4/commits{/sha}","git_commits_url":"https://api.github.com/repos/mcgrue/maped4/git/commits{/sha}","comments_url":"https://api.github.com/repos/mcgrue/maped4/comments{/number}","issue_comment_url":"https://api.github.com/repos/mcgrue/maped4/issues/comments{/number}","contents_url":"https://api.github.com/repos/mcgrue/maped4/contents/{+path}","compare_url":"https://api.github.com/repos/mcgrue/maped4/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mcgrue/maped4/merges","archive_url":"https://api.github.com/repos/mcgrue/maped4/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mcgrue/maped4/downloads","issues_url":"https://api.github.com/repos/mcgrue/maped4/issues{/number}","pulls_url":"https://api.github.com/repos/mcgrue/maped4/pulls{/number}","milestones_url":"https://api.github.com/repos/mcgrue/maped4/milestones{/number}","notifications_url":"https://api.github.com/repos/mcgrue/maped4/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mcgrue/maped4/labels{/name}","releases_url":"https://api.github.com/repos/mcgrue/maped4/releases{/id}","created_at":"2015-09-10T04:54:50Z","updated_at":"2015-09-10T04:59:35Z","pushed_at":"2015-11-16T00:09:01Z","git_url":"git://github.com/mcgrue/maped4.git","ssh_url":"git@github.com:mcgrue/maped4.git","clone_url":"https://github.com/mcgrue/maped4.git","svn_url":"https://github.com/mcgrue/maped4","homepage":null,"size":947,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mcgrue/maped4/pulls/1"},"html":{"href":"https://github.com/mcgrue/maped4/pull/1"},"issue":{"href":"https://api.github.com/repos/mcgrue/maped4/issues/1"},"comments":{"href":"https://api.github.com/repos/mcgrue/maped4/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/mcgrue/maped4/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/mcgrue/maped4/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mcgrue/maped4/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/mcgrue/maped4/statuses/5ed6bcb71f46ecb85f2544cb7ae756f0ec66431a"}}}}