{"id":3992,"date":"2014-08-05T19:39:04","date_gmt":"2014-08-05T10:39:04","guid":{"rendered":"http:\/\/mirror.boy.jp\/?p=1776"},"modified":"2014-08-05T19:39:04","modified_gmt":"2014-08-05T10:39:04","slug":"jit-gl-shader-glsl-%e3%81%a7%e3%83%9d%e3%82%a4%e3%83%b3%e3%83%88%e3%82%b9%e3%83%97%e3%83%a9%e3%82%a4%e3%83%88-maxmsp-jitter-glsl","status":"publish","type":"post","link":"https:\/\/inage.ksd6700.net\/?p=3992","title":{"rendered":"jit.gl.shader \/ GLSL \u3067\u30dd\u30a4\u30f3\u30c8\u30b9\u30d7\u30e9\u30a4\u30c8 #maxmsp #jitter #glsl"},"content":{"rendered":"<h2>\u30b8\u30aa\u30e1\u30c8\u30ea\u30b7\u30a7\u30fc\u30c0 <\/h2>\n<p>\u30b8\u30aa\u30e1\u30c8\u30ea\u30b7\u30a7\u30fc\u30c0\u306f\u3001\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u30d1\u30a4\u30d7\u30e9\u30a4\u30f3\u306b\u304a\u3044\u3066\u3001\u30d0\u30fc\u30c6\u30c3\u30af\u30b9\u30b7\u30a7\u30fc\u30c0\u306e\u5f8c\u306b\u914d\u7f6e\u3055\u308c\u3066\u304a\u308a\u3001GPU\u4e0a\u3067\u30d7\u30ea\u30df\u30c6\u30a3\u30d6\u306e\u5909\u63db\u3084\u5897\u6e1b\u304c\u53ef\u80fd\u306a\u30b7\u30a7\u30fc\u30c0\u3060\u305d\u3046\u3067\u3059\u3002<\/p>\n<p><a href=\"http:\/\/mirror.boy.jp\/wp-content\/uploads\/2014\/08\/%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88-2014-08-05-19.29.40.jpeg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/mirror.boy.jp\/wp-content\/uploads\/2014\/08\/%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88-2014-08-05-19.29.40-1024x576.jpeg\" alt=\"\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8 2014-08-05 19.29.40\" width=\"1024\" height=\"576\" class=\"alignnone size-large wp-image-1783\" \/><\/a><\/p>\n<h2>\u30dd\u30a4\u30f3\u30c8\u30b9\u30d7\u30e9\u30a4\u30c8<\/h2>\n<p>\u30dd\u30a4\u30f3\u30c8\u30b9\u30d7\u30e9\u30a4\u30c8\u3068\u3044\u3046\u624b\u6cd5\u306f\u3001CPU\u304b\u3089points\u3067\u4e0e\u3048\u305f\u70b9\u7fa4\u3092\u30b8\u30aa\u30e1\u30c8\u30ea\u30b7\u30a7\u30fc\u30c0\u3092\u7528\u3044\u3066triangle\u306a\u3069\u306b\u5909\u63db\u3057\u30c6\u30af\u30b9\u30c1\u30e3\u3092\u8cbc\u308b\u3053\u3068\u3067\u3001GPU\u306e\u8a08\u7b97\u80fd\u529b\u3092\u6d3b\u304b\u3057\u3066\u30c6\u30af\u30b9\u30c1\u30e3\u4ed8\u304d\u306e\u30d1\u30fc\u30c6\u30a3\u30af\u30eb\u3092\u3064\u304f\u308b\u65b9\u6cd5\u3067\u3059\u3002<\/p>\n<p><a href=\"http:\/\/mirror.boy.jp\/wp-content\/uploads\/2014\/08\/%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88-2014-08-05-18.46.52.jpeg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/mirror.boy.jp\/wp-content\/uploads\/2014\/08\/%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88-2014-08-05-18.46.52-1024x576.jpeg\" alt=\"\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8 2014-08-05 18.46.52\" width=\"1024\" height=\"576\" class=\"alignnone size-large wp-image-1778\" \/><\/a><\/p>\n<h2>\u5b9f\u88c5\u3057\u3066\u307f\u305f<\/h2>\n<p>\u4eca\u56de\u306fGLSL1.2\u3067\u4f7f\u3048\u308b\u30b8\u30aa\u30e1\u30c8\u30ea\u30b7\u30a7\u30fc\u30c0(Geometry Shader)\u3092\u7528\u3044\u3066\u3001\u30dd\u30a4\u30f3\u30c8\u30b9\u30d7\u30e9\u30a4\u30c8\u3092\u5b9f\u88c5\u3057\u3066\u307f\u307e\u3057\u305f\u3002<a href=\"http:\/\/www.amazon.co.jp\/gp\/product\/4862461891\/ref=as_li_ss_tl?ie=UTF8&#038;camp=247&#038;%23038;creative=7399&#038;%23038;creativeASIN=4862461891&#038;%23038;linkCode=as2&#038;%23038;tag=mrr05-22\">OpenGL 4.0 \u30b7\u30a7\u30fc\u30c7\u30a3\u30f3\u30b0\u8a00\u8a9e -\u5b9f\u4f8b\u3067\u899a\u3048\u308bGLSL\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0-<\/a>\u306b\u63b2\u8f09\u3055\u308c\u3066\u3044\u308b\u30b3\u30fc\u30c9\u3092\u53c2\u8003\u306b\u3057\u3066\u3044\u307e\u3059\u3002\u30b8\u30aa\u30e1\u30c8\u30ea\u30b7\u30a7\u30fc\u30c0\u306f\u3001Max\u306ejit.gl.shader\u3067\u3082\u3061\u3083\u3093\u3068\u4f7f\u3048\u308b\u306e\u3067\u3059\u304c\u3001\u30b0\u30b0\u3063\u3066\u3082\u89e3\u8aac\u304c\u306a\u3044\u305f\u3081\u3064\u307e\u305a\u304f\u30dd\u30a4\u30f3\u30c8\u3082\u591a\u304b\u3063\u305f\u305f\u3081\u3001\u5c11\u3057\u8a73\u3057\u304f\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p><a href=\"http:\/\/mirror.boy.jp\/wp-content\/uploads\/2014\/08\/%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88-2014-08-05-18.46.57.jpeg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/mirror.boy.jp\/wp-content\/uploads\/2014\/08\/%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88-2014-08-05-18.46.57-1024x576.jpeg\" alt=\"\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8 2014-08-05 18.46.57\" width=\"1024\" height=\"576\" class=\"alignnone size-large wp-image-1777\" \/><\/a><\/p>\n<h2>\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u306e\u5ba3\u8a00<\/h2>\n<pre class=\"brush: xml; title: ; notranslate\">\r\n&lt;param name=&quot;size&quot; type=&quot;vec2&quot; default=&quot;1. 1.&quot; \/&gt;\r\n<\/pre>\n<p>\u30b8\u30aa\u30e1\u30c8\u30ea\u30b7\u30a7\u30fc\u30c0\u306b\u9650\u3089\u306a\u3044\u4e8b\u3067\u3059\u304c\u3001Max\u304b\u3089\u6307\u5b9a\u3059\u308b\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u306f\u3001param\u8981\u7d20\u3068\u3057\u3066\u6307\u5b9a\u3057\u307e\u3059\u3002\u521d\u671f\u5024\u3082\u4e0e\u3048\u3089\u308c\u307e\u3059\u304c\u30b3\u30f3\u30de\u3067\u533a\u5207\u3063\u3066\u306f\u99c4\u76ee\u307f\u305f\u3044\u306a\u306e\u3067\u6ce8\u610f\u3067\u3059\u3002<\/p>\n<h2>\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u306e\u30d0\u30a4\u30f3\u30c9<\/h2>\n<pre class=\"brush: xml; title: ; notranslate\">\r\n&lt;language name=&quot;glsl&quot; version=&quot;1.2&quot;&gt;\r\n        &lt;bind param=&quot;size&quot; program=&quot;gp&quot; \/&gt;\r\n        &lt;bind param=&quot;tex0&quot; program=&quot;fp&quot; \/&gt;\r\n        &lt;program&gt; \r\n        &lt;\/program&gt;\r\n&lt;\/language&gt;\r\n<\/pre>\n<p>\u5ba3\u8a00\u3057\u305f\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u304c\u3001\u3069\u306e\u30d7\u30ed\u30b0\u30e9\u30de\u30d6\u30eb\u30b7\u30a7\u30fc\u30c0\u3067\u5229\u7528\u3055\u308c\u308b\u304b\u3092program\u5c5e\u6027\u306bbind\u3057\u307e\u3059\u3002\u4f8b\uff1asize\u3092geometry shader\u3067\u5229\u7528\u3059\u308b\u3002\u4f8b\u5916\u3067\u3059\u304c\u30c6\u30af\u30b9\u30c1\u30e3\u3092\u30b7\u30a7\u30fc\u30c0\u3067\u6271\u3044\u305f\u3044\u5834\u5408\u306b\u306f\u3001Max\u306e\u5834\u5408tex0\u3068\u3044\u3046\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u304c\u4e88\u7d04\u3055\u308c\u3066\u3044\u308b\u3088\u3046\u3067\u3001\u5ba3\u8a00\u3057\u3066\u3044\u306a\u304f\u3066\u3082\u4f7f\u3048\u307e\u3057\u305f\u3002\u30de\u30eb\u30c1\u30c6\u30af\u30b9\u30c1\u30e3\u3092\u3084\u308b\u5834\u5408\u306b\u3064\u3044\u3066\u306f\u672a\u8abf\u67fb\u3067\u3059\u3002<\/p>\n<h3>\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3067\u4f7f\u308f\u308c\u3066\u3044\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u540d\u79f0<\/h3>\n<ul>\n<li>&#8220;gp&#8221; : geometry shader<\/ol>\n<li>&#8220;fp&#8221; : fragment shader<\/ol>\n<li>&#8220;vp&#8221; : vertex shader<\/ol>\n<\/ul>\n<h2>\u30b8\u30aa\u30e1\u30c8\u30ea\u30b7\u30a7\u30fc\u30c0\u306e\u5ba3\u8a00<\/h2>\n<pre class=\"brush: xml; title: ; notranslate\">\r\n&lt;program name=&quot;gp&quot; vertices_out=&quot;4&quot; input_type=&quot;points&quot; output_type=&quot;triangle_strip&quot; type=&quot;geometry&quot;&gt;\r\n&lt;![CDATA[\r\n \/*glsl\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u8a18\u8ff0*\/\r\n]]&gt;\r\n&lt;\/program&gt;\r\n<\/pre>\n<p>program\u8981\u7d20\u3092\u5ba3\u8a00\u3057\u307e\u3059\u3002vertices_out \/ input_type \/ output_type\u304c\u5408\u3063\u3066\u306a\u3044\u3068\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093\u3002\u4eca\u56de\u306f\u3001&#8221;points&#8221;\u3092&#8221;triangle_strip&#8221;\u306b\u5909\u63db\u3057&#8221;\uff14&#8221;\u3064\u306evertex\u304c\u51fa\u529b\u3055\u308c\u308b\u3068\u3044\u3046\u8a2d\u5b9a\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<h2>\u30b8\u30aa\u30e1\u30c8\u30ea\u30b7\u30a7\u30fc\u30c0\u306e\u30b3\u30fc\u30c9<\/h2>\n<pre class=\"brush: cpp; title: ; notranslate\">\r\n#version 120\r\n#extension GL_EXT_geometry_shader4 : enable\r\n\r\nuniform vec2 size;\r\nvarying in vec2 texdim0[1];\r\n\r\nvoid main() {\r\n\tgl_Position = gl_ModelViewProjectionMatrix * gl_PositionIn[0];\r\n \tgl_Position.x -= size.x\/2;\r\n \tgl_Position.y += size.y\/2;\r\n \tgl_TexCoord[0].st = vec2(0,0) * texdim0[0];\r\n \tEmitVertex();\r\n \tgl_Position.y -= size.y;\r\n \tgl_TexCoord[0].st = vec2(0,1) * texdim0[0];\r\n \tEmitVertex();\r\n \tgl_Position.x += size.x;\r\n \tgl_Position.y += size.y;\r\n \tgl_TexCoord[0].st = vec2(1,0) * texdim0[0];\r\n \tEmitVertex();\r\n \tgl_Position.y -= size.y;\r\n \tgl_TexCoord[0].st = vec2(1,1) * texdim0[0];\r\n \tEmitVertex();\r\n}\r\n<\/pre>\n<p>#extension GL_EXT_geometry_shader4 : enable \u3067\u30b8\u30aa\u30e1\u30c8\u30ea\u30b7\u30a7\u30fc\u30c0\u3092\u6709\u52b9\u5316\u3057\u3066\u3044\u307e\u3059\u3002main\u95a2\u6570\u3067\u306f\u3001Max\u304b\u3089\u53d7\u3051\u53d6\u3063\u305fsize\u3092\u4f7f\u3063\u3066\u30dd\u30a4\u30f3\u30c8\uff08\u9802\u70b9\uff09\u3092\u3001\u56db\u3064\u9802\u70b9\u3078\u3068\u5897\u52a0\u3055\u305b\u3066\u3044\u307e\u3059\u3002\u7279\u6b8a\u306a\u66f8\u304d\u65b9\u3067\u3059\u304cEmitVertex()\u3092\u547c\u3076\u3053\u3068\u3067gl_texCoord[0]\u306b\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\u9802\u70b9\u3092\u51fa\u529b\u3057\u3066\u3044\u307e\u3059\u3002gl_TexCoord\u306b\u306f\u3001\u30c6\u30af\u30b9\u30c1\u30e3\u306e\u53c2\u7167\u4f4d\u7f6e\u3092\u5165\u308c\u3066\u3044\u307e\u3059\u306d\u3002Max\u304b\u3089\u53d7\u3051\u53d6\u308b\u30c6\u30af\u30b9\u30c1\u30e3\u306e\u5ea7\u6a19\u304c\u6b63\u898f\u5316\u3044\u306a\u3044\u306e\u3067\u3001texdim0[0]\u3092\u639b\u3051\u3066\u3044\u307e\u3059\u3002 <\/p>\n<h2>JXS TIPS<\/h2>\n<ul>\n<li>\u65e5\u672c\u8a9e\u3067\u30b3\u30e1\u30f3\u30c8\u304c\u66f8\u304b\u308c\u3066\u3044\u308b\u3068Max\u304c\u5373\u843d\u3061\u308b<\/li>\n<li>\u30dd\u30a4\u30f3\u30c8\u30b9\u30d7\u30e9\u30a4\u30c8\u3067\u4f7f\u3046\u30c6\u30af\u30b9\u30c1\u30e3\u306e\u30d0\u30a4\u30f3\u30c9\u5148\u306f\u3001jit.gl.shaer\u3067\u306f\u306a\u304f\u3001jit.gl \u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/li>\n<li>\n<blockquote><p>jit.gl.mesh: unbinding vertex array: GL Error: Invalid operation<\/p>\n<\/blockquote>\n<p>\u3068\u3044\u3046\u30a8\u30e9\u30fc\u304c\u51fa\u305f\u5834\u5408\u306f\u3001jit.gl.mesh\u306edraw_mode\u304cpoints\u306b\u306a\u3063\u3066\u3044\u306a\u3044\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002<\/li>\n<\/ul>\n<p><span id=\"more-1776\"><\/span><\/p>\n<h2>JXS \/ GLSL\u30b3\u30fc\u30c9<\/h2>\n<p>\u7e70\u308a\u8fd4\u3057\u3082\u3042\u308a\u307e\u3059\u304c\u3001\u4ee5\u4e0b\u306bJXS\u306e\u30b3\u30fc\u30c9\u3092\u8cbc\u3063\u3066\u304a\u304d\u307e\u3059\u3002\u3053\u308c\u3092jit.gl.shader\u306bjxs\u3068\u3057\u3066\u8aad\u307f\u8fbc\u307e\u305b\u3066\u3001jit.gl.mesh\u306b\u30d0\u30a4\u30f3\u30c9\u3059\u308b\u3068\u52d5\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: xml; title: ; notranslate\">\r\n&lt;jittershader name=&quot;mrr.templete.geometry.jxs&quot;&gt;\r\n\t&lt;description&gt;Simple geometry shader test&lt;\/description&gt;\r\n\t&lt;param name=&quot;size&quot; type=&quot;vec2&quot; default=&quot;1. 1.&quot; \/&gt;\r\n\t&lt;language name=&quot;glsl&quot; version=&quot;1.2&quot;&gt;\r\n\t\t&lt;bind param=&quot;size&quot; program=&quot;gp&quot; \/&gt;\r\n\t\t&lt;bind param=&quot;tex0&quot; program=&quot;fp&quot; \/&gt;\r\n\t\t&lt;program name=&quot;vp&quot; type=&quot;vertex&quot;&gt;\t\t\r\n&lt;![CDATA[\r\n\r\n#version 120\r\n\r\nvarying vec2 texdim0;\r\n\r\nvoid main(void)\r\n{\r\n\t\/\/just send the things as they are\r\n\tgl_Position = gl_Vertex;\r\n\tgl_FrontColor = gl_Color;\r\n\t\r\n\t\/\/for texture dim\r\n\ttexdim0 = vec2 (abs(gl_TextureMatrix[0][0][0]),abs(gl_TextureMatrix[0][1][1]));\r\n}\r\n\r\n]]&gt;\t\t\r\n\t\t&lt;\/program&gt;\r\n\t\t&lt;program name=&quot;gp&quot; vertices_out=&quot;4&quot; input_type=&quot;points&quot; output_type=&quot;triangle_strip&quot; type=&quot;geometry&quot;&gt;\r\n&lt;![CDATA[\r\n\r\n#version 120\r\n#extension GL_EXT_geometry_shader4 : enable\r\n\r\nuniform vec2 size;\r\nvarying in vec2 texdim0[1];\r\n\r\nvoid main() {\r\n\tgl_Position = gl_ModelViewProjectionMatrix * gl_PositionIn[0];\r\n \tgl_Position.x -= size.x\/2;\r\n \tgl_Position.y += size.y\/2;\r\n \tgl_TexCoord[0].st = vec2(0,0) * texdim0[0];\r\n \tEmitVertex();\r\n \tgl_Position.y -= size.y;\r\n \tgl_TexCoord[0].st = vec2(0,1) * texdim0[0];\r\n \tEmitVertex();\r\n \tgl_Position.x += size.x;\r\n \tgl_Position.y += size.y;\r\n \tgl_TexCoord[0].st = vec2(1,0) * texdim0[0];\r\n \tEmitVertex();\r\n \tgl_Position.y -= size.y;\r\n \tgl_TexCoord[0].st = vec2(1,1) * texdim0[0];\r\n \tEmitVertex();\r\n}\r\n\r\n]]&gt;\r\n\t\t&lt;\/program&gt;\r\n\t\t&lt;program name=&quot;fp&quot; type=&quot;fragment&quot;&gt;\r\n&lt;![CDATA[\r\n\r\n#version 120\r\nuniform sampler2DRect tex0;\r\n\r\nvoid main (void)\r\n{\r\n\tgl_FragColor = texture2DRect(tex0, gl_TexCoord[0].st);\r\n}\r\n\r\n]]&gt;\t\t\r\n\t\t&lt;\/program&gt;\t\t\r\n\t&lt;\/language&gt;\r\n&lt;\/jittershader&gt;\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>&#12472;&#12458;&#12513;&#12488;&#12522;&#12471;&#12455;&#12540;&#12480; &#12472;&#12458;&#12513;&#12488;&#12522;&#12471;&#12455;&#12540;&#12480;&#12399;&#12289;&#12524;&#12531;&#12480;&#12522;&#12531;&#12464;&#12497;&#12452;&#12503;&#12521;&#12452;&#12531;&#12395;&#12362; &#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"_links":{"self":[{"href":"https:\/\/inage.ksd6700.net\/index.php?rest_route=\/wp\/v2\/posts\/3992"}],"collection":[{"href":"https:\/\/inage.ksd6700.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/inage.ksd6700.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/inage.ksd6700.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/inage.ksd6700.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3992"}],"version-history":[{"count":0,"href":"https:\/\/inage.ksd6700.net\/index.php?rest_route=\/wp\/v2\/posts\/3992\/revisions"}],"wp:attachment":[{"href":"https:\/\/inage.ksd6700.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3992"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/inage.ksd6700.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3992"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/inage.ksd6700.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3992"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}