{"id":2470,"date":"2013-05-03T21:57:24","date_gmt":"2013-05-03T12:57:24","guid":{"rendered":"http:\/\/peta.okechan.net\/blog\/?p=2470"},"modified":"2013-05-04T01:30:08","modified_gmt":"2013-05-03T16:30:08","slug":"opengl-3-2glsl-1-50%e5%af%be%e5%bf%9c","status":"publish","type":"post","link":"https:\/\/peta.okechan.net\/blog\/archives\/2470","title":{"rendered":"OpenGL 3.2(GLSL 1.50)\u5bfe\u5fdc"},"content":{"rendered":"<p>\u4eca\u307e\u3067\u307b\u3068\u3093\u3069\u78ba\u8a8d\u7528\u306e\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u306e\u305f\u3081\u3060\u3051\u306b\u3057\u304b\u4f7f\u3063\u3066\u306a\u304b\u3063\u305f\u306e\u3067\u3001OpenGL 2.1(GLSL 1.20)\u306e\u307e\u307e\u3067\u3084\u3063\u3066\u304d\u305f\u3051\u3069\u3001GPGPU\u7684\u306b\u4f7f\u3046\u3088\u3046\u306b\u306a\u3063\u305f\u306e\u3067OpenGL 3.2\u3067\u5b9f\u884c\u3059\u308b\u3088\u3046\u306b\u5909\u66f4\u3057\u305f\u3002<br \/>\n\u3084\u3063\u3071\u5c11\u3057\u3067\u3082\u67d4\u8edf\u6027\u306f\u9ad8\u3044\u307b\u3046\u304c\u3044\u3044\u3060\u308d\u3046\u3057\u3001\u4eca\u306e\u3068\u3053\u308d\u5168\u304f\u30a2\u30a4\u30c7\u30a2\u306f\u306a\u3044\u3051\u3069\u30b8\u30aa\u30e1\u30c8\u30ea\u30b7\u30a7\u30fc\u30c0\u3067\u306a\u306b\u304b\u51fa\u6765\u308b\u304b\u3082\u3057\u308c\u306a\u3044\u3057\u3002<\/p>\n<p>OpenGL\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u306e\u5909\u66f4\u306b\u4f34\u3044\u3001\u30b3\u30fc\u30c9\u306e\u4fee\u6b63\u304c\u5fc5\u8981\u306b\u306a\u3063\u305f\u3002<br \/>\n\u5143\u3005\u30b7\u30a7\u30fc\u30c0\u5168\u958b\u3067\u56fa\u5b9a\u6a5f\u80fd\u306e\u95a2\u6570\u306f\u4f7f\u3063\u3066\u306a\u304b\u3063\u305f\u306e\u3067\u697d\u306b\u5bfe\u5fdc\u3067\u304d\u305f\u3068\u601d\u3046\u3002<\/p>\n<p>\u30d0\u30fc\u30b8\u30e7\u30f3\u7b49\u306f\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3067\u8abf\u3079\u305f\u3002<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">printf(&quot;Renderer %s\\n&quot;, glGetString(GL_RENDERER));\r\nprintf(&quot;Vendor %s\\n&quot;, glGetString(GL_VENDOR));\r\nprintf(&quot;OpenGL version %s\\n&quot;, glGetString(GL_VERSION));\r\nprintf(&quot;GLSL version %s\\n&quot;, glGetString(GL_SHADING_LANGUAGE_VERSION));<\/pre>\n<p>\u3053\u306e\u5b9f\u884c\u7d50\u679c\u306f\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3002<br \/>\n\u5909\u66f4\u524d\u304c\u4e0a\u3001\u5909\u66f4\u5f8c\u304c\u4e0b\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">Renderer NVIDIA GeForce 9400M OpenGL Engine\r\nVendor NVIDIA Corporation\r\nOpenGL version 2.1 NVIDIA-8.10.44 304.10.65f03\r\nGLSL version 1.20<\/pre>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">Renderer NVIDIA GeForce 9400M OpenGL Engine\r\nVendor NVIDIA Corporation\r\nOpenGL version 3.2 NVIDIA-8.10.44 304.10.65f03\r\nGLSL version 1.50<\/pre>\n<p>\u4eca\u56de\u884c\u3063\u305f\u4fee\u6b63\u306f\u4ee5\u4e0b\u306e4\u70b9\u3002<\/p>\n<ol>\n<li>glValidateProgram\u306e\u554f\u984c\u306e\u4fee\u6b63<\/li>\n<li>Vertex Array Object(VAO)\u5bfe\u5fdc<\/li>\n<li>\u30b7\u30a7\u30fc\u30c0\u306e\u66f8\u304d\u63db\u3048<\/li>\n<li>\u30d5\u30e9\u30b0\u30e1\u30f3\u30c8\u30b7\u30a7\u30fc\u30c0\u306e\u51fa\u529b\u5148\u306e\u8a2d\u5b9a<\/li>\n<\/ol>\n<h3>1. glValidateProgram\u306e\u554f\u984c\u306e\u4fee\u6b63<\/h3>\n<p>glValidateProgram \u304c\u5931\u6557\u3057\u3001 glGetProgramInfoLog \u3067\u8abf\u3079\u308b\u3068 Validation Failed: No vertex array object bound. \u3068\u3044\u3046\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u5f97\u3089\u308c\u308b\u554f\u984c\u3002<br \/>\n\u554f\u984c\u3068\u3044\u3046\u304b\u3053\u308c\u306f\u79c1\u304cglValidateProgram\u306e\u7528\u9014\u3092\u52d8\u9055\u3044\u3057\u3066\u305f\u3060\u3051\u3060\u3051\u3069\u3002<\/p>\n<p>\u3067\u306f\u3001 glValidateProgram \u306f\u4f55\u306e\u305f\u3081\u306e\u95a2\u6570\u306a\u306e\u304b\u3002<br \/>\n<a href=\"http:\/\/www.opengl.org\/sdk\/docs\/man3\/xhtml\/glValidateProgram.xml\" target=\"_blank\">http:\/\/www.opengl.org\/sdk\/docs\/man3\/xhtml\/glValidateProgram.xml<\/a>\u3092\u8aad\u3080\u3068\u89e3\u308b\u3068\u304a\u308a\u3001\u73fe\u5728\u306eOpenGL\u30b9\u30c6\u30fc\u30c8\u3067\u30b7\u30a7\u30fc\u30c0\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u5b9f\u884c\u53ef\u80fd\u304b\uff08\u5b9f\u884c\u53ef\u80fd\u3067\u3042\u3063\u3066\u3082\u975e\u52b9\u7387\u3067\u306f\u306a\u3044\u304b\u7b49\u3082\uff09\u3092\u8abf\u3079\u308b\u95a2\u6570\u3002<br \/>\n\u3064\u307e\u308a\u3001\u3053\u308c\u306f\u30b7\u30a7\u30fc\u30c0\u306e\u751f\u6210\u30d5\u30a7\u30fc\u30ba\u3067\u4f7f\u3046\u3082\u306e\u3067\u306f\u306a\u304f\u3001\u30b7\u30a7\u30fc\u30c0\u306e\u5b9f\u884c\u524d\u3001\u3064\u307e\u308a\u63cf\u753b\u30b3\u30de\u30f3\u30c9\u306e\u5b9f\u884c\u524d\u306b\u547c\u3076\u3079\u304d\u3082\u306e\u3067\u3042\u308b\u3002<br \/>\n\u958b\u767a\u4e2d\u306b\u306f\u4fbf\u5229\u306b\u4f7f\u3048\u308b\u95a2\u6570\u3060\u304c\u3001\u63cf\u753b\u30eb\u30fc\u30d7\u3054\u3068\u30b7\u30a7\u30fc\u30c0\u3054\u3068\u306b\u6bce\u56de\u547c\u3073\u51fa\u3057\u3066\u305f\u3089\u52b9\u7387\u304c\u60aa\u3044\u306e\u3067\u3001\u554f\u984c\u306a\u3044\u3068\u3044\u3046\u3053\u3068\u304c\u78ba\u8a8d\u3067\u304d\u305f\u3089\u4f55\u304b\u4e8b\u60c5\u304c\u7121\u3044\u9650\u308a\u6700\u7d42\u7684\u306b\u306f\u547c\u3073\u51fa\u3055\u306a\u3044\u3088\u3046\u306b\u3059\u3079\u304d\u3060\u308d\u3046\u3002<\/p>\n<p>\u3053\u308c\u3092\u52d8\u9055\u3044\u3057\u3066\u30b7\u30a7\u30fc\u30c0\u306e\u30ea\u30f3\u30af\u76f4\u5f8c\u306b\u884c\u3063\u3066\u3044\u305f\u3002<br \/>\nOpenGL 3.2\u3067\u306fVAO\u304c\u5fc5\u9808\u306b\u306a\u3063\u305f\u304c\u3001\u30b7\u30a7\u30fc\u30c0\u306e\u521d\u671f\u5316\u6bb5\u968e\u3001\u3064\u307e\u308a\u307e\u3060VAO\u306e\u30d0\u30a4\u30f3\u30c9\u3092\u3057\u3066\u306a\u3044\u6bb5\u968e\u3067\u5b9f\u884c\u3057\u3066\u3044\u305f\u305f\u3081\u3001\u30a8\u30e9\u30fc\u304c\u8d77\u3053\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u307f\u305f\u3044\u3002<br \/>\n\u30b7\u30a7\u30fc\u30c0\u306e\u521d\u671f\u5316\u6bb5\u968e\u3067\u306f glValidateProgram \u3092\u884c\u308f\u306a\u3044\u3088\u3046\u306b\u3057\u305f\u3002<\/p>\n<p>\u3042\u3068\u3001OpenGL 3.2\u3067\u63cf\u753b\u306bVAO\u304c\u5fc5\u9808\u306b\u306a\u3063\u305f\u3068\u66f8\u3044\u305f\u3051\u3069\u53b3\u5bc6\u306b\u306f\u9055\u3046\u3089\u3057\u3044\u3002<br \/>\n\u8ab0\u304b\u304c\u305d\u3046\u66f8\u3044\u3066\u3044\u305f\u306e\u3092\u30c1\u30e9\u30c3\u3068\u898b\u305f\u3060\u3051\u3067\u3001\u3069\u3053\u306b\u66f8\u3044\u3066\u3042\u3063\u305f\u304b\u5fd8\u308c\u3066\u3057\u307e\u3063\u305f\u306e\u3067\u3001\u771f\u507d\u306e\u7a0b\u306f\u5206\u304b\u3089\u306a\u3044\u3002<br \/>\n\u5fc5\u9808\u306a\u306e\u306fApple\u306eOpenGL\u306e\u5b9f\u88c5\u3060\u3051\u306e\u8a71\u304b\u3082\u3057\u308c\u306a\u3044\u3002<\/p>\n<h3>2. Vertex Array Object(VAO)\u5bfe\u5fdc<\/h3>\n<p>\u3059\u3067\u306bglGenVertexArraysAPPLE\u3068\u304b\u3092\u4f7f\u3063\u3066\u305f\u306e\u3067\u3001\u57fa\u672c\u7684\u306b\u306f\u305d\u308c\u3089\u3092glGenVertexArrays\u3068\u304b\u306b\u66f8\u304d\u63db\u3048\u305f\u3060\u3051\u3002<\/p>\n<h3>3. \u30b7\u30a7\u30fc\u30c0\u306e\u66f8\u304d\u63db\u3048<\/h3>\n<p>GLSL\u306e\u30d0\u30fc\u30b7\u30e7\u30f3\u304c1.20\u304b\u30891.50\u306b\u5909\u308f\u3063\u305f\u306e\u3067\u305d\u306e\u307e\u307e\u3067\u306f\u30b7\u30a7\u30fc\u30c0\u304c\u30b3\u30f3\u30d1\u30a4\u30eb\u51fa\u6765\u306a\u304f\u306a\u3063\u305f\u3002<br \/>\n\u305f\u3060\u3001\u6a5f\u68b0\u7684\u306b\u5909\u66f4\u3059\u308b\u3060\u3051\u306a\u306e\u3067\u305f\u3044\u3057\u3066\u5927\u5909\u3067\u306f\u306a\u304b\u3063\u305f\u3002<br \/>\n\u5909\u66f4\u3057\u305f\u5185\u5bb9\u306f\u6b21\u306e\u3088\u3046\u306a\u611f\u3058\u3002<\/p>\n<ul>\n<li>\u30b7\u30a7\u30fc\u30c0\u306e1\u884c\u76ee\u306b#version 150\u3092\u8ffd\u52a0\u3002<\/li>\n<li>\u9802\u70b9\u30b7\u30a7\u30fc\u30c0\u306eattribute\u3092in\u3001varying\u3092out\u306b\u3001\u30d5\u30e9\u30b0\u30e1\u30f3\u30c8\u30b7\u30a7\u30fc\u30c0\u306evarying\u3092in\u306b\u66f8\u304d\u63db\u3048\u3002<\/li>\n<li>\u30d5\u30e9\u30b0\u30e1\u30f3\u30c8\u30b7\u30a7\u30fc\u30c0\u3067gl_FragColor\u3084gl_FragData\u304c\u4f7f\u3048\u306a\u304f\u306a\u3063\u305f\u305f\u3081\u3001\u51fa\u529b\u5148\u3068\u3057\u3066out vec4 fragColor0;\u307f\u305f\u3044\u306a\u5ba3\u8a00\u3092\u8ffd\u52a0\u3057\u3066\u305d\u3053\u306b\u66f8\u304d\u8fbc\u3080\u3088\u3046\u306b\u3057\u305f\u3002<\/li>\n<li>texture2D\u95a2\u6570\u304c\u7121\u304f\u306a\u3063\u305f\u306e\u3067texture\u95a2\u6570\u306b\u5909\u66f4\u3002<\/li>\n<li>\u305d\u308c\u306b\u5408\u308f\u305btexture\u3068\u3044\u3046\u5909\u6570\u540d\u3092\u4f7f\u3063\u3066\u305f\u90e8\u5206\u3092\u5909\u66f4\u3002<\/li>\n<\/ul>\n<h3>4. \u30d5\u30e9\u30b0\u30e1\u30f3\u30c8\u30b7\u30a7\u30fc\u30c0\u306e\u51fa\u529b\u5148\u306e\u8a2d\u5b9a<\/h3>\n<p>\u30d5\u30e9\u30b0\u30e1\u30f3\u30c8\u30b7\u30a7\u30fc\u30c0\u306b out vec4 fragColor0; \u3068\u304b\u5ba3\u8a00\u3057\u305f\u3051\u3069\u3001\u3053\u308c\u3060\u3051\u3067\u306f\u30c0\u30e1\u3067\u3001\u3069\u306e\u5909\u6570\u304c\u4f55\u756a\u76ee\u306e\u51fa\u529b\u5148\u306b\u5bfe\u5fdc\u3059\u308b\u306e\u304b\u3001OpenGL\u306e\u95a2\u6570\u3067\u6559\u3048\u3066\u3042\u3052\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u307f\u305f\u3044\u3002<br \/>\n\uff08\u3053\u306e\u4ed5\u69d8\u3063\u3066\u51fa\u529b\u5148\u306e\u5909\u6570\u540d\u3092\u81ea\u7531\u306b\u3067\u304d\u308b\u4ee5\u5916\u306e\u5229\u70b9\u3063\u3066\u4f55\u304b\u3042\u308b\u306e\u304b\u306a\uff1f\uff09<br \/>\n\u3068\u308a\u3042\u3048\u305a\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u56fa\u5b9a\u7684\u306b\u8a2d\u5b9a\u3059\u308b\u3088\u3046\u306b\u3057\u305f\u3002<br \/>\n\u3053\u308c\u3092\u30b7\u30a7\u30fc\u30c0\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u30ea\u30f3\u30af\u76f4\u5f8c\u306b\u884c\u3046\u3002<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">glBindFragDataLocation(program, 0, &quot;fragColor0&quot;);\r\nglBindFragDataLocation(program, 1, &quot;fragColor1&quot;);\r\nglBindFragDataLocation(program, 2, &quot;fragColor2&quot;);\r\nglBindFragDataLocation(program, 3, &quot;fragColor3&quot;);<\/pre>\n<p>\u3046\u3061\u306e\u74b0\u5883\u3067\u3057\u304b\u78ba\u8a8d\u3057\u3066\u306a\u3044\u3051\u3069\u3001\u30b7\u30a7\u30fc\u30c0\u306bfragColor0\u3057\u304b\u66f8\u3044\u3066\u306a\u304f\u3066\u3082\u3001\u3064\u307e\u308a\u5b58\u5728\u3057\u306a\u3044\u5909\u6570\u306b\u5bfe\u3057\u3066glBindFragDataLocation\u3092\u547c\u3093\u3067\u3082\u3001\u7279\u306b\u52d5\u4f5c\u304c\u304a\u304b\u3057\u304f\u306a\u3063\u305f\u308a\u3059\u308b\u3053\u3068\u306f\u7121\u3044\u307f\u305f\u3044\u3002<br \/>\n\u4ee5\u524d\u306e\u3088\u3046\u306b\u56fa\u5b9a\u7684\u306b\u3057\u305f\u3044\u3063\u3066\u3068\u304d\u306b\u3001\u3053\u308c\u3067\u3044\u3061\u3044\u3061\u554f\u984c\u304c\u51fa\u3066\u305f\u3089\u9762\u5012\u3060\u3082\u3093\u306d\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4eca\u307e\u3067\u307b\u3068\u3093\u3069\u78ba\u8a8d\u7528\u306e\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u306e\u305f\u3081\u3060\u3051\u306b\u3057\u304b\u4f7f\u3063\u3066\u306a\u304b\u3063\u305f\u306e\u3067\u3001OpenGL 2.1(GLSL 1.20)\u306e\u307e\u307e\u3067\u3084\u3063\u3066\u304d\u305f\u3051\u3069\u3001GPGPU\u7684\u306b\u4f7f\u3046\u3088\u3046\u306b\u306a\u3063\u305f\u306e\u3067OpenGL 3.2\u3067\u5b9f\u884c\u3059\u308b\u3088\u3046\u306b\u5909\u66f4\u3057\u305f\u3002<br \/>\n\u3084\u3063\u3071\u5c11\u3057\u3067\u3082\u67d4\u8edf\u6027\u306f\u9ad8\u3044\u307b\u3046\u304c\u3044\u3044\u3060\u308d\u3046\u3057\u3001\u4eca\u306e\u3068\u3053\u308d\u5168\u304f\u30a2\u30a4\u30c7\u30a2\u306f\u306a\u3044\u3051\u3069\u30b8\u30aa\u30e1\u30c8\u30ea\u30b7\u30a7\u30fc\u30c0\u3067\u306a\u306b\u304b\u51fa\u6765\u308b\u304b\u3082\u3057\u308c\u306a\u3044\u3057\u3002<\/p>\n<p>OpenGL\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u306e\u5909\u66f4\u306b\u4f34\u3044\u3001\u30b3\u30fc\u30c9\u306e\u4fee\u6b63\u304c\u5fc5\u8981\u306b\u306a\u3063\u305f\u3002<br \/>\n\u5143\u3005\u30b7\u30a7\u30fc\u30c0\u5168\u958b\u3067\u56fa\u5b9a\u6a5f\u80fd\u306e\u95a2\u6570\u306f\u4f7f\u3063\u3066\u306a\u304b\u3063\u305f\u306e\u3067\u697d\u306b\u5bfe\u5fdc\u3067\u304d\u305f\u3068\u601d\u3046\u3002<\/p>\n<p>\u30d0\u30fc\u30b8\u30e7\u30f3\u7b49\u306f\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3067\u8abf\u3079\u305f\u3002<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">printf(&quot;Renderer %s\\n&quot;, glGetString(GL_RENDERER));\r\nprintf(&quot;Vendor %s\\n&quot;, glGetString(GL_VENDOR));\r\nprintf(&quot;OpenGL version %s\\n&quot;, glGetString(GL_VERSION));\r\nprintf(&quot;GLSL version %s\\n&quot;, glGetString(GL_SHADING_LANGUAGE_VERSION));<\/pre>\n<p>\u3053\u306e\u5b9f\u884c\u7d50\u679c\u306f\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3002<br \/>\n\u5909\u66f4\u524d\u304c\u4e0a\u3001\u5909\u66f4\u5f8c\u304c\u4e0b\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">Renderer NVIDIA GeForce 9400M OpenGL Engine\r\nVendor NVIDIA Corporation\r\nOpenGL version 2.1 NVIDIA-8.10.44 304.10.65f03\r\nGLSL version 1.20<\/pre>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">Renderer NVIDIA GeForce 9400M OpenGL Engine\r\nVendor NVIDIA Corporation\r\nOpenGL version 3.2 NVIDIA-8.10.44 304.10.65f03\r\nGLSL version 1.50<\/pre>\n<p>\u4eca\u56de\u884c\u3063\u305f\u4fee\u6b63\u306f\u4ee5\u4e0b\u306e4\u70b9\u3002<\/p>\n<ol>\n<li>glValidateProgram\u306e\u554f\u984c\u306e\u4fee\u6b63<\/li>\n<li>Vertex Array Object(VAO)\u5bfe\u5fdc<\/li>\n<li>\u30b7\u30a7\u30fc\u30c0\u306e\u66f8\u304d\u63db\u3048<\/li>\n<li>\u30d5\u30e9\u30b0\u30e1\u30f3\u30c8\u30b7\u30a7\u30fc\u30c0\u306e\u51fa\u529b\u5148\u306e\u8a2d\u5b9a<\/li>\n<\/ol>\n<h3>1. glValidateProgram\u306e\u554f\u984c\u306e\u4fee\u6b63<\/h3>\n<p>glValidateProgram \u304c\u5931\u6557\u3057\u3001 glGetProgramInfoLog \u3067\u8abf\u3079\u308b\u3068 Validation Failed: No vertex array object bound. \u3068\u3044\u3046\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u5f97\u3089\u308c\u308b\u554f\u984c\u3002<br \/>\n\u554f\u984c\u3068\u3044\u3046\u304b\u3053\u308c\u306f\u79c1\u304cglValidateProgram\u306e\u7528\u9014\u3092\u52d8\u9055\u3044\u3057\u3066\u305f\u3060\u3051\u3060\u3051\u3069\u3002<\/p>\n<p>\u3067\u306f\u3001 glValidateProgram \u306f\u4f55\u306e\u305f\u3081\u306e\u95a2\u6570\u306a\u306e\u304b\u3002<br \/>\n<a href=\"http:\/\/www.opengl.org\/sdk\/docs\/man3\/xhtml\/glValidateProgram.xml\" target=\"_blank\">http:\/\/www.opengl.org\/sdk\/docs\/man3\/xhtml\/glValidateProgram.xml<\/a>\u3092\u8aad\u3080\u3068\u89e3\u308b\u3068\u304a\u308a\u3001\u73fe\u5728\u306eOpenGL\u30b9\u30c6\u30fc\u30c8\u3067\u30b7\u30a7\u30fc\u30c0\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u5b9f\u884c\u53ef\u80fd\u304b\uff08\u5b9f\u884c\u53ef\u80fd\u3067\u3042\u3063\u3066\u3082\u975e\u52b9\u7387\u3067\u306f\u306a\u3044\u304b\u7b49\u3082\uff09\u3092\u8abf\u3079\u308b\u95a2\u6570\u3002<br \/>\n\u3064\u307e\u308a\u3001\u3053\u308c\u306f\u30b7\u30a7\u30fc\u30c0\u306e\u751f\u6210\u30d5\u30a7\u30fc\u30ba\u3067\u4f7f\u3046\u3082\u306e\u3067\u306f\u306a\u304f\u3001\u30b7\u30a7\u30fc\u30c0\u306e\u5b9f\u884c\u524d\u3001\u3064\u307e\u308a\u63cf\u753b\u30b3\u30de\u30f3\u30c9\u306e\u5b9f\u884c\u524d\u306b\u547c\u3076\u3079\u304d\u3082\u306e\u3067\u3042\u308b\u3002<br \/>\n\u958b\u767a\u4e2d\u306b\u306f\u4fbf\u5229\u306b\u4f7f\u3048\u308b\u95a2\u6570\u3060\u304c\u3001\u63cf\u753b\u30eb\u30fc\u30d7\u3054\u3068\u30b7\u30a7\u30fc\u30c0\u3054\u3068\u306b\u6bce\u56de\u547c\u3073\u51fa\u3057\u3066\u305f\u3089\u52b9\u7387\u304c\u60aa\u3044\u306e\u3067\u3001\u554f\u984c\u306a\u3044\u3068\u3044\u3046\u3053\u3068\u304c\u78ba\u8a8d\u3067\u304d\u305f\u3089\u4f55\u304b\u4e8b\u60c5\u304c\u7121\u3044\u9650\u308a\u6700\u7d42\u7684\u306b\u306f\u547c\u3073\u51fa\u3055\u306a\u3044\u3088\u3046\u306b\u3059\u3079\u304d\u3060\u308d\u3046\u3002<\/p>\n<p>\u3053\u308c\u3092\u52d8\u9055\u3044\u3057\u3066\u30b7\u30a7\u30fc\u30c0\u306e\u30ea\u30f3\u30af\u76f4\u5f8c\u306b\u884c\u3063\u3066\u3044\u305f\u3002<br \/>\nOpenGL 3.2\u3067\u306fVAO\u304c\u5fc5\u9808\u306b\u306a\u3063\u305f\u304c\u3001\u30b7\u30a7\u30fc\u30c0\u306e\u521d\u671f\u5316\u6bb5\u968e\u3001\u3064\u307e\u308a\u307e\u3060VAO\u306e\u30d0\u30a4\u30f3\u30c9\u3092\u3057\u3066\u306a\u3044\u6bb5\u968e\u3067\u5b9f\u884c\u3057\u3066\u3044\u305f\u305f\u3081\u3001\u30a8\u30e9\u30fc\u304c\u8d77\u3053\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u307f\u305f\u3044\u3002<br \/>\n\u30b7\u30a7\u30fc\u30c0\u306e\u521d\u671f\u5316\u6bb5\u968e\u3067\u306f glValidateProgram \u3092\u884c\u308f\u306a\u3044\u3088\u3046\u306b\u3057\u305f\u3002<\/p>\n<p>\u3042\u3068\u3001OpenGL 3.2\u3067\u63cf\u753b\u306bVAO\u304c\u5fc5\u9808\u306b\u306a\u3063\u305f\u3068\u66f8\u3044\u305f\u3051\u3069\u53b3\u5bc6\u306b\u306f\u9055\u3046\u3089\u3057\u3044\u3002<br \/>\n\u8ab0\u304b\u304c\u305d\u3046\u66f8\u3044\u3066\u3044\u305f\u306e\u3092\u30c1\u30e9\u30c3\u3068\u898b\u305f\u3060\u3051\u3067\u3001\u3069\u3053\u306b\u66f8\u3044\u3066\u3042\u3063\u305f\u304b\u5fd8\u308c\u3066\u3057\u307e\u3063\u305f\u306e\u3067\u3001\u771f\u507d\u306e\u7a0b\u306f\u5206\u304b\u3089\u306a\u3044\u3002<br \/>\n\u5fc5\u9808\u306a\u306e\u306fApple\u306eOpenGL\u306e\u5b9f\u88c5\u3060\u3051\u306e\u8a71\u304b\u3082\u3057\u308c\u306a\u3044\u3002<\/p>\n<h3>2. Vertex Array Object(VAO)\u5bfe\u5fdc<\/h3>\n<p>\u3059\u3067\u306bglGenVertexArraysAPPLE\u3068\u304b\u3092\u4f7f\u3063\u3066\u305f\u306e\u3067\u3001\u57fa\u672c\u7684\u306b\u306f\u305d\u308c\u3089\u3092glGenVertexArrays\u3068\u304b\u306b\u66f8\u304d\u63db\u3048\u305f\u3060\u3051\u3002<\/p>\n<h3>3. \u30b7\u30a7\u30fc\u30c0\u306e\u66f8\u304d\u63db\u3048<\/h3>\n<p>GLSL\u306e\u30d0\u30fc\u30b7\u30e7\u30f3\u304c1.20\u304b\u30891.50\u306b\u5909\u308f\u3063\u305f\u306e\u3067\u305d\u306e\u307e\u307e\u3067\u306f\u30b7\u30a7\u30fc\u30c0\u304c\u30b3\u30f3\u30d1\u30a4\u30eb\u51fa\u6765\u306a\u304f\u306a\u3063\u305f\u3002<br \/>\n\u305f\u3060\u3001\u6a5f\u68b0\u7684\u306b\u5909\u66f4\u3059\u308b\u3060\u3051\u306a\u306e\u3067\u305f\u3044\u3057\u3066\u5927\u5909\u3067\u306f\u306a\u304b\u3063\u305f\u3002<br \/>\n\u5909\u66f4\u3057\u305f\u5185\u5bb9\u306f\u6b21\u306e\u3088\u3046\u306a\u611f\u3058\u3002<\/p>\n<ul>\n<li>\u30b7\u30a7\u30fc\u30c0\u306e1\u884c\u76ee\u306b#version 150\u3092\u8ffd\u52a0\u3002<\/li>\n<li>\u9802\u70b9\u30b7\u30a7\u30fc\u30c0\u306eattribute\u3092in\u3001varying\u3092out\u306b\u3001\u30d5\u30e9\u30b0\u30e1\u30f3\u30c8\u30b7\u30a7\u30fc\u30c0\u306evarying\u3092in\u306b\u66f8\u304d\u63db\u3048\u3002<\/li>\n<li>\u30d5\u30e9\u30b0\u30e1\u30f3\u30c8\u30b7\u30a7\u30fc\u30c0\u3067gl_FragColor\u3084gl_FragData\u304c\u4f7f\u3048\u306a\u304f\u306a\u3063\u305f\u305f\u3081\u3001\u51fa\u529b\u5148\u3068\u3057\u3066out vec4 fragColor0;\u307f\u305f\u3044\u306a\u5ba3\u8a00\u3092\u8ffd\u52a0\u3057\u3066\u305d\u3053\u306b\u66f8\u304d\u8fbc\u3080\u3088\u3046\u306b\u3057\u305f\u3002<\/li>\n<li>texture2D\u95a2\u6570\u304c\u7121\u304f\u306a\u3063\u305f\u306e\u3067texture\u95a2\u6570\u306b\u5909\u66f4\u3002<\/li>\n<li>\u305d\u308c\u306b\u5408\u308f\u305btexture\u3068\u3044\u3046\u5909\u6570\u540d\u3092\u4f7f\u3063\u3066\u305f\u90e8\u5206\u3092\u5909\u66f4\u3002<\/li>\n<\/ul>\n<h3>4. \u30d5\u30e9\u30b0\u30e1\u30f3\u30c8\u30b7\u30a7\u30fc\u30c0\u306e\u51fa\u529b\u5148\u306e\u8a2d\u5b9a<\/h3>\n<p>\u30d5\u30e9\u30b0\u30e1\u30f3\u30c8\u30b7\u30a7\u30fc\u30c0\u306b out vec4 fragColor0; \u3068\u304b\u5ba3\u8a00\u3057\u305f\u3051\u3069\u3001\u3053\u308c\u3060\u3051\u3067\u306f\u30c0\u30e1\u3067\u3001\u3069\u306e\u5909\u6570\u304c\u4f55\u756a\u76ee\u306e\u51fa\u529b\u5148\u306b\u5bfe\u5fdc\u3059\u308b\u306e\u304b\u3001OpenGL\u306e\u95a2\u6570\u3067\u6559\u3048\u3066\u3042\u3052\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u307f\u305f\u3044\u3002<br \/>\n\uff08\u3053\u306e\u4ed5\u69d8\u3063\u3066\u51fa\u529b\u5148\u306e\u5909\u6570\u540d\u3092\u81ea\u7531\u306b\u3067\u304d\u308b\u4ee5\u5916\u306e\u5229\u70b9\u3063\u3066\u4f55\u304b\u3042\u308b\u306e\u304b\u306a\uff1f\uff09<br \/>\n\u3068\u308a\u3042\u3048\u305a\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u56fa\u5b9a\u7684\u306b\u8a2d\u5b9a\u3059\u308b\u3088\u3046\u306b\u3057\u305f\u3002<br \/>\n\u3053\u308c\u3092\u30b7\u30a7\u30fc\u30c0\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u30ea\u30f3\u30af\u76f4\u5f8c\u306b\u884c\u3046\u3002<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">glBindFragDataLocation(program, 0, &quot;fragColor0&quot;);\r\nglBindFragDataLocation(program, 1, &quot;fragColor1&quot;);\r\nglBindFragDataLocation(program, 2, &quot;fragColor2&quot;);\r\nglBindFragDataLocation(program, 3, &quot;fragColor3&quot;);<\/pre>\n<p>\u3046\u3061\u306e\u74b0\u5883\u3067\u3057\u304b\u78ba\u8a8d\u3057\u3066\u306a\u3044\u3051\u3069\u3001\u30b7\u30a7\u30fc\u30c0\u306bfragColor0\u3057\u304b\u66f8\u3044\u3066\u306a\u304f\u3066\u3082\u3001\u3064\u307e\u308a\u5b58\u5728\u3057\u306a\u3044\u5909\u6570\u306b\u5bfe\u3057\u3066glBindFragDataLocation\u3092\u547c\u3093\u3067\u3082\u3001\u7279\u306b\u52d5\u4f5c\u304c\u304a\u304b\u3057\u304f\u306a\u3063\u305f\u308a\u3059\u308b\u3053\u3068\u306f\u7121\u3044\u307f\u305f\u3044\u3002<br \/>\n\u4ee5\u524d\u306e\u3088\u3046\u306b\u56fa\u5b9a\u7684\u306b\u3057\u305f\u3044\u3063\u3066\u3068\u304d\u306b\u3001\u3053\u308c\u3067\u3044\u3061\u3044\u3061\u554f\u984c\u304c\u51fa\u3066\u305f\u3089\u9762\u5012\u3060\u3082\u3093\u306d\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32],"tags":[434],"class_list":["post-2470","post","type-post","status-publish","format-standard","hentry","category-tech","tag-opengl"],"_links":{"self":[{"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/posts\/2470","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/comments?post=2470"}],"version-history":[{"count":0,"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/posts\/2470\/revisions"}],"wp:attachment":[{"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/media?parent=2470"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/categories?post=2470"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/tags?post=2470"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}