Skip to content

Commit

Permalink
Deploying to gh-pages from @ ca702ba 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
greggman committed Jan 15, 2025
1 parent 7bc74e6 commit 1140e54
Show file tree
Hide file tree
Showing 33 changed files with 1,453 additions and 1,413 deletions.
602 changes: 301 additions & 301 deletions atom.xml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contributors.js

Large diffs are not rendered by default.

602 changes: 301 additions & 301 deletions webgl/lessons/atom.xml

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions webgl/lessons/de/atom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<feed xmlns="http://www.w3.org/2005/Atom">
<id/>
<title>Grundlagen WebGL2</title>
<updated>2025-01-15T04:14:30.000Z</updated>
<updated>2025-01-15T04:49:01.000Z</updated>
<generator>https://github.com/jpmonette/feed</generator>
<author>
<name>WebGL2Fundamentals Contributors</name>
Expand All @@ -15,22 +15,22 @@
<title type="html"><![CDATA[Wie benutzt man WebGL2]]></title>
<id>https://webgl2fundamentals.org/webgl/lessons/de/webgl-getting-webgl2.html</id>
<link href="https://webgl2fundamentals.org/webgl/lessons/de/webgl-getting-webgl2.html"/>
<updated>2025-01-15T04:14:30.000Z</updated>
<updated>2025-01-15T04:49:01.000Z</updated>
<author>
<name>WebGL2Fundamentals Contributors</name>
<uri>https://webgl2fundamentals.org/contributors.html</uri>
</author>
<published>2025-01-15T04:14:30.000Z</published>
<published>2025-01-15T04:49:01.000Z</published>
</entry>
<entry>
<title type="html"><![CDATA[Unterschiede zu WebGLFundamentals.org]]></title>
<id>https://webgl2fundamentals.org/webgl/lessons/de/webgl1-to-webgl2-fundamentals.html</id>
<link href="https://webgl2fundamentals.org/webgl/lessons/de/webgl1-to-webgl2-fundamentals.html"/>
<updated>2025-01-15T04:14:30.000Z</updated>
<updated>2025-01-15T04:49:01.000Z</updated>
<author>
<name>WebGL2Fundamentals Contributors</name>
<uri>https://webgl2fundamentals.org/contributors.html</uri>
</author>
<published>2025-01-15T04:14:30.000Z</published>
<published>2025-01-15T04:49:01.000Z</published>
</entry>
</feed>
38 changes: 19 additions & 19 deletions webgl/lessons/ja/atom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<feed xmlns="http://www.w3.org/2005/Atom">
<id/>
<title>WebGL2の基本</title>
<updated>2025-01-15T04:14:30.000Z</updated>
<updated>2025-01-15T04:49:01.000Z</updated>
<generator>https://github.com/jpmonette/feed</generator>
<author>
<name>WebGL2Fundamentals Contributors</name>
Expand All @@ -15,99 +15,99 @@
<title type="html"><![CDATA[WebGL2の基本]]></title>
<id>https://webgl2fundamentals.org/webgl/lessons/ja/webgl-fundamentals.html</id>
<link href="https://webgl2fundamentals.org/webgl/lessons/ja/webgl-fundamentals.html"/>
<updated>2025-01-15T04:14:30.000Z</updated>
<updated>2025-01-15T04:49:01.000Z</updated>
<author>
<name>WebGL2Fundamentals Contributors</name>
<uri>https://webgl2fundamentals.org/contributors.html</uri>
</author>
<published>2025-01-15T04:14:30.000Z</published>
<published>2025-01-15T04:49:01.000Z</published>
</entry>
<entry>
<title type="html"><![CDATA[WebGL2の使い方]]></title>
<id>https://webgl2fundamentals.org/webgl/lessons/ja/webgl-getting-webgl2.html</id>
<link href="https://webgl2fundamentals.org/webgl/lessons/ja/webgl-getting-webgl2.html"/>
<updated>2025-01-15T04:14:30.000Z</updated>
<updated>2025-01-15T04:49:01.000Z</updated>
<author>
<name>WebGL2Fundamentals Contributors</name>
<uri>https://webgl2fundamentals.org/contributors.html</uri>
</author>
<published>2025-01-15T04:14:30.000Z</published>
<published>2025-01-15T04:49:01.000Z</published>
</entry>
<entry>
<title type="html"><![CDATA[WebGLの仕組み]]></title>
<id>https://webgl2fundamentals.org/webgl/lessons/ja/webgl-how-it-works.html</id>
<link href="https://webgl2fundamentals.org/webgl/lessons/ja/webgl-how-it-works.html"/>
<updated>2025-01-15T04:14:30.000Z</updated>
<updated>2025-01-15T04:49:01.000Z</updated>
<author>
<name>WebGL2Fundamentals Contributors</name>
<uri>https://webgl2fundamentals.org/contributors.html</uri>
</author>
<published>2025-01-15T04:14:30.000Z</published>
<published>2025-01-15T04:49:01.000Z</published>
</entry>
<entry>
<title type="html"><![CDATA[WebGL2における画像処理の続き]]></title>
<id>https://webgl2fundamentals.org/webgl/lessons/ja/webgl-image-processing-continued.html</id>
<link href="https://webgl2fundamentals.org/webgl/lessons/ja/webgl-image-processing-continued.html"/>
<updated>2025-01-15T04:14:30.000Z</updated>
<updated>2025-01-15T04:49:01.000Z</updated>
<author>
<name>WebGL2Fundamentals Contributors</name>
<uri>https://webgl2fundamentals.org/contributors.html</uri>
</author>
<published>2025-01-15T04:14:30.000Z</published>
<published>2025-01-15T04:49:01.000Z</published>
</entry>
<entry>
<title type="html"><![CDATA[WebGL2における画像処理]]></title>
<id>https://webgl2fundamentals.org/webgl/lessons/ja/webgl-image-processing.html</id>
<link href="https://webgl2fundamentals.org/webgl/lessons/ja/webgl-image-processing.html"/>
<updated>2025-01-15T04:14:30.000Z</updated>
<updated>2025-01-15T04:49:01.000Z</updated>
<author>
<name>WebGL2Fundamentals Contributors</name>
<uri>https://webgl2fundamentals.org/contributors.html</uri>
</author>
<published>2025-01-15T04:14:30.000Z</published>
<published>2025-01-15T04:49:01.000Z</published>
</entry>
<entry>
<title type="html"><![CDATA[WebGLシェーダーとGLSL]]></title>
<id>https://webgl2fundamentals.org/webgl/lessons/ja/webgl-shaders-and-glsl.html</id>
<link href="https://webgl2fundamentals.org/webgl/lessons/ja/webgl-shaders-and-glsl.html"/>
<updated>2025-01-15T04:14:30.000Z</updated>
<updated>2025-01-15T04:49:01.000Z</updated>
<author>
<name>WebGL2Fundamentals Contributors</name>
<uri>https://webgl2fundamentals.org/contributors.html</uri>
</author>
<published>2025-01-15T04:14:30.000Z</published>
<published>2025-01-15T04:49:01.000Z</published>
</entry>
<entry>
<title type="html"><![CDATA[WebGLFundamentals.orgとの違い]]></title>
<id>https://webgl2fundamentals.org/webgl/lessons/ja/webgl1-to-webgl2-fundamentals.html</id>
<link href="https://webgl2fundamentals.org/webgl/lessons/ja/webgl1-to-webgl2-fundamentals.html"/>
<updated>2025-01-15T04:14:30.000Z</updated>
<updated>2025-01-15T04:49:01.000Z</updated>
<author>
<name>WebGL2Fundamentals Contributors</name>
<uri>https://webgl2fundamentals.org/contributors.html</uri>
</author>
<published>2025-01-15T04:14:30.000Z</published>
<published>2025-01-15T04:49:01.000Z</published>
</entry>
<entry>
<title type="html"><![CDATA[WebGL1からWebGL2への移行]]></title>
<id>https://webgl2fundamentals.org/webgl/lessons/ja/webgl1-to-webgl2.html</id>
<link href="https://webgl2fundamentals.org/webgl/lessons/ja/webgl1-to-webgl2.html"/>
<updated>2025-01-15T04:14:30.000Z</updated>
<updated>2025-01-15T04:49:01.000Z</updated>
<author>
<name>WebGL2Fundamentals Contributors</name>
<uri>https://webgl2fundamentals.org/contributors.html</uri>
</author>
<published>2025-01-15T04:14:30.000Z</published>
<published>2025-01-15T04:49:01.000Z</published>
</entry>
<entry>
<title type="html"><![CDATA[WebGL2の新機能]]></title>
<id>https://webgl2fundamentals.org/webgl/lessons/ja/webgl2-whats-new.html</id>
<link href="https://webgl2fundamentals.org/webgl/lessons/ja/webgl2-whats-new.html"/>
<updated>2025-01-15T04:14:30.000Z</updated>
<updated>2025-01-15T04:49:01.000Z</updated>
<author>
<name>WebGL2Fundamentals Contributors</name>
<uri>https://webgl2fundamentals.org/contributors.html</uri>
</author>
<published>2025-01-15T04:14:30.000Z</published>
<published>2025-01-15T04:49:01.000Z</published>
</entry>
</feed>
45 changes: 23 additions & 22 deletions webgl/lessons/ja/webgl-how-it-works.html
Original file line number Diff line number Diff line change
Expand Up @@ -542,11 +542,11 @@ <h2 id="バッファや属性のコマンドは何をしているのか?">バ
</p>
<p>実際にコーディングしてみましょう。データの取り出し方を指定する部分は以下のコードになります。</p>
<pre class="prettyprint showlinemods">
var size = 4;
* var type = gl.UNSIGNED_BYTE;
* var normalize = true;
var stride = 0;
var offset = 0;
var size &#x3D; 4;
* var type &#x3D; gl.UNSIGNED_BYTE;
* var normalize &#x3D; true;
var stride &#x3D; 0;
var offset &#x3D; 0;
gl.vertexAttribPointer(colorLocation, size, type, normalize, stride, offset);
</pre>
<p>バッファを色で塗りつぶす時は次のようにします。</p>
Expand All @@ -555,24 +555,25 @@ <h2 id="バッファや属性のコマンドは何をしているのか?">バ
// that make the rectangle.
function setColors(gl) {
// Pick 2 random colors.
var r1 = Math.random() * 256; // 0 to 255.99999
var b1 = Math.random() * 256; // these values
var g1 = Math.random() * 256; // will be truncated
var r2 = Math.random() * 256; // when stored in the
var b2 = Math.random() * 256; // Uint8Array
var g2 = Math.random() * 256;
<p>gl.bufferData(
gl.ARRAY_BUFFER,
new Uint8Array( // Uint8Array
[ r1, b1, g1, 255,
r1, b1, g1, 255,
r1, b1, g1, 255,
r2, b2, g2, 255,
r2, b2, g2, 255,
r2, b2, g2, 255]),
gl.STATIC_DRAW);
var r1 &#x3D; Math.random() * 256; // 0 to 255.99999
var b1 &#x3D; Math.random() * 256; // these values
var g1 &#x3D; Math.random() * 256; // will be truncated
var r2 &#x3D; Math.random() * 256; // when stored in the
var b2 &#x3D; Math.random() * 256; // Uint8Array
var g2 &#x3D; Math.random() * 256;

gl.bufferData(
gl.ARRAY_BUFFER,
new Uint8Array( // Uint8Array
[ r1, b1, g1, 255,
r1, b1, g1, 255,
r1, b1, g1, 255,
r2, b2, g2, 255,
r2, b2, g2, 255,
r2, b2, g2, 255]),
gl.STATIC_DRAW);
}
</pre></p>
</pre>
<p>
実行結果はこのようになります。
</p>
Expand Down
81 changes: 41 additions & 40 deletions webgl/lessons/ja/webgl1-to-webgl2.html
Original file line number Diff line number Diff line change
Expand Up @@ -541,48 +541,49 @@ <h3>WebGL1の拡張機能をWebGL2のように見せる</h3>
<p>1つの回避策は、初期化時にWebGL1の拡張機能をWebGLコンテキストにコピーする事です。そうすると残りのコードをそのままにできます。以下が例です。
</p>
<pre class="prettyprint">
const gl = someCanvas.getContext("webgl");
const haveVAOs = getAndApplyExtension(gl, "OES_vertex_array_object");
<p>function getAndApplyExtension(gl, name) {
const ext = gl.getExtension(name);
if (!ext) {
return null;
}
const fnSuffix = name.split(&quot;<em>&quot;)[0];
const enumSuffix = '</em>’ + fnSuffix;
for (const key in ext) {
const value = ext[key];
const isFunc = typeof (value) === ‘function’;
const suffix = isFunc ? fnSuffix : enumSuffix;
let name = key;
// examples of where this is not true are WEBGL_compressed_texture_s3tc
// and WEBGL_compressed_texture_pvrtc
if (key.endsWith(suffix)) {
name = key.substring(0, key.length - suffix.length);
}
if (gl[name] !== undefined) {
if (!isFunc &amp;&amp; gl[name] !== value) {
console.warn(“conflict:”, name, gl[name], value, key);
}
} else {
if (isFunc) {
gl[name] = function(origFn) {
return function() {
return origFn.apply(ext, arguments);
};
}(value);
} else {
gl[name] = value;
}
}
}
return ext;
const gl &#x3D; someCanvas.getContext(&quot;webgl&quot;);
const haveVAOs &#x3D; getAndApplyExtension(gl, &quot;OES_vertex_array_object&quot;);

function getAndApplyExtension(gl, name) {
const ext &#x3D; gl.getExtension(name);
if (!ext) {
return null;
}
const fnSuffix &#x3D; name.split(&quot;_&quot;)[0];
const enumSuffix &#x3D; &#x27;_&#x27; + fnSuffix;
for (const key in ext) {
const value &#x3D; ext[key];
const isFunc &#x3D; typeof (value) &#x3D;&#x3D;&#x3D; &#x27;function&#x27;;
const suffix &#x3D; isFunc ? fnSuffix : enumSuffix;
let name &#x3D; key;
// examples of where this is not true are WEBGL_compressed_texture_s3tc
// and WEBGL_compressed_texture_pvrtc
if (key.endsWith(suffix)) {
name &#x3D; key.substring(0, key.length - suffix.length);
}
if (gl[name] !&#x3D;&#x3D; undefined) {
if (!isFunc &amp;&amp; gl[name] !&#x3D;&#x3D; value) {
console.warn(&quot;conflict:&quot;, name, gl[name], value, key);
}
} else {
if (isFunc) {
gl[name] &#x3D; function(origFn) {
return function() {
return origFn.apply(ext, arguments);
};
}(value);
} else {
gl[name] &#x3D; value;
}
}
}
return ext;
}
</pre></p>
</pre>
<p>コードが両方で同じように動作するようになりました。例:</p>
<pre class="prettyprint">
if (haveVAOs) {
var someVAO = gl.createVertexArray();
var someVAO &#x3D; gl.createVertexArray();
...
} else {
... do whatever for no VAOs.
Expand All @@ -592,9 +593,9 @@ <h3>WebGL1の拡張機能をWebGL2のように見せる</h3>
<pre class="prettyprint">
if (haveVAOs) {
if (isWebGL2)
someVAO = gl.createVertexArray();
someVAO &#x3D; gl.createVertexArray();
} else {
someVAO = vaoExt.createVertexArrayOES();
someVAO &#x3D; vaoExt.createVertexArrayOES();
}
...
} else {
Expand Down
Loading

0 comments on commit 1140e54

Please sign in to comment.