diff options
| author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:17 -0500 |
|---|---|---|
| committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:17 -0500 |
| commit | da78a9e329e272dedb2400b79a3bdeebff387d47 (patch) | |
| tree | e6ef8aa7c43556f55ddfe031a01cf0a8fa271bfe /files/ko/web/api/webgl_api/by_example/detect_webgl | |
| parent | 1109132f09d75da9a28b649c7677bb6ce07c40c0 (diff) | |
| download | translated-content-da78a9e329e272dedb2400b79a3bdeebff387d47.tar.gz translated-content-da78a9e329e272dedb2400b79a3bdeebff387d47.tar.bz2 translated-content-da78a9e329e272dedb2400b79a3bdeebff387d47.zip | |
initial commit
Diffstat (limited to 'files/ko/web/api/webgl_api/by_example/detect_webgl')
| -rw-r--r-- | files/ko/web/api/webgl_api/by_example/detect_webgl/index.html | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/files/ko/web/api/webgl_api/by_example/detect_webgl/index.html b/files/ko/web/api/webgl_api/by_example/detect_webgl/index.html new file mode 100644 index 0000000000..087a614d5d --- /dev/null +++ b/files/ko/web/api/webgl_api/by_example/detect_webgl/index.html @@ -0,0 +1,72 @@ +--- +title: WebGL 찾기 +slug: Web/API/WebGL_API/By_example/Detect_WebGL +translation_of: Web/API/WebGL_API/By_example/Detect_WebGL +--- +<div>{{IncludeSubnav("/en-US/Learn")}}</div> + +<p>{{PreviousNext("Learn/WebGL/By_example","Learn/WebGL/By_example/Clearing_with_colors")}}</p> + +<div id="detect-webgl"> +<div class="summary"> +<p>이 예시는 어떻게 {{Glossary("WebGL")}} 랜더링 컨텐츠를 찾고, 유저에게 결과를 보고할지를 보여줍니다.</p> +</div> + +<p>{{EmbedLiveSample("detect-webgl-source",660,150)}}</p> + +<div id="detect-webgl-intro"> +<h3 id="기능-검색_WebGl">기능-검색 WebGl</h3> + +<p>이 첫 예시에서, 우리는 브라우저가 {{Glossary("WebGL")}}를 지원하는지 아닌 지를 확인합니다. 우리는 {{domxref("HTMLCanvasElement","canvas")}} element로 부터 {{domxref("WebGLRenderingContext","WebGL rendering context","",1)}}을 얻기 위하여 노력합니다. {{domxref("WebGLRenderingContext","WebGL rendering context", "", 1)}}는 당신이 설정하고 그래픽 기계의 상태를 쿼리하고, WebGl에 데이터를 전송하고, 그리기 명령어들을 실행할 수 있는 인터페이스입니다.</p> + +<p>한 문장 인터페이스에서 그래픽 기계의 상태를 저장하는 것은 {{Glossary("WebGL")}}에 고유하지 않습니다. 이것은 또한 다른 그래픽 {̣{Glossary("API")}}, {{domxref("CanvasRenderingContext2D","canvas 2D rendering context", "", 1)}}에 의해 행해집니다. 하지만 특성과 당신이 만드는 변수들은 각 {̣{Glossary("API")}}에서 다를 수 있습니다.</p> +</div> + +<div id="detect-webgl-source"> +<pre class="brush: html"><p>[ Here would go the result of WebGL feature detection ]</p> +<button>Press here to detect WebGLRenderingContext</button> +</pre> + +<pre class="brush: css">body { + text-align : center; +} +button { + display : block; + font-size : inherit; + margin : auto; + padding : 0.6em; +} +</pre> + +<pre class="brush: js">// Run everything inside window load event handler, to make sure +// DOM is fully loaded and styled before trying to manipulate it. +window.addEventListener("load", function() { + var paragraph = document.querySelector("p"), + button = document.querySelector("button"); + // Adding click event handler to button. + button.addEventListener("click", detectWebGLContext, false); + function detectWebGLContext () { + // Create canvas element. The canvas is not added to the + // document itself, so it is never displayed in the + // browser window. + var canvas = document.createElement("canvas"); + // Get WebGLRenderingContext from canvas element. + var gl = canvas.getContext("webgl") + || canvas.getContext("experimental-webgl"); + // Report the result. + if (gl && gl instanceof WebGLRenderingContext) { + paragraph.innerHTML = + "Congratulations! Your browser supports WebGL."; + } else { + paragraph.innerHTML = "Failed to get WebGL context. " + + "Your browser or device may not support WebGL."; + } + } +}, false); +</pre> + +<p>The source code of this example is also available on <a href="https://github.com/idofilin/webgl-by-example/tree/master/detect-webgl">GitHub</a>.</p> +</div> +</div> + +<p>{{PreviousNext("Learn/WebGL/By_example","Learn/WebGL/By_example/Clearing_with_colors")}}</p> |
