Kinesim/vendor/threex/docs/THREEx.glCapability.html

44 lines
10 KiB
HTML
Raw Normal View History

2024-10-03 06:42:49 +05:30
<!DOCTYPE html> <html> <head> <title>THREEx.glCapability.js</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="THREEx.CelShader.html"> THREEx.CelShader.js </a> <a class="source" href="THREEx.DeviceOrientationState.html"> THREEx.DeviceOrientationState.js </a> <a class="source" href="THREEx.FullScreen.html"> THREEx.FullScreen.js </a> <a class="source" href="THREEx.GeometryUtils.html"> THREEx.GeometryUtils.js </a> <a class="source" href="THREEx.GeometryWobble.html"> THREEx.GeometryWobble.js </a> <a class="source" href="THREEx.KeyboardState.html"> THREEx.KeyboardState.js </a> <a class="source" href="THREEx.LogoTurtle.html"> THREEx.LogoTurtle.js </a> <a class="source" href="THREEx.PlasmaShader.html"> THREEx.PlasmaShader.js </a> <a class="source" href="THREEx.SkyMap.html"> THREEx.SkyMap.js </a> <a class="source" href="THREEx.WindowResize.html"> THREEx.WindowResize.js </a> <a class="source" href="THREEx.glCapability.html"> THREEx.glCapability.js </a> <a class="source" href="THREEx.requestAnimationFrame.html"> THREEx.requestAnimationFrame.js </a> <a class="source" href="THREEx.screenshot.html"> THREEx.screenshot.js </a> <a class="source" href="threex.embedded.html"> threex.embedded.js </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> THREEx.glCapability.js </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> </td> <td class="code"> <div class="highlight"><pre><span class="cm">/**</span>
<span class="cm"> * Define namespace</span>
<span class="cm">*/</span>
<span class="k">if</span><span class="p">(</span><span class="k">typeof</span> <span class="nx">THREEx</span> <span class="o">===</span> <span class="s2">&quot;undefined&quot;</span><span class="p">)</span> <span class="kd">var</span> <span class="nx">THREEx</span> <span class="o">=</span> <span class="p">{};</span>
<span class="cm">/**</span>
<span class="cm"> * return the capability of a WebGl context</span>
<span class="cm"> *</span>
<span class="cm"> * TODO to rewrite</span>
<span class="cm"> * - heavily wased on webglreport on sourceforge</span>
<span class="cm"> * - is there other/better properties</span>
<span class="cm"> * - should i get a more readable output ?</span>
<span class="cm"> * - another function ?</span>
<span class="cm"> *</span>
<span class="cm"> * @param {WebGLRenderingContext} webgl context</span>
<span class="cm"> * @returns {Object} capabilities</span>
<span class="cm">*/</span>
<span class="nx">THREEx</span><span class="p">.</span><span class="nx">glCapability</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">gl</span><span class="p">)</span>
<span class="p">{</span></pre></div> </td> </tr> <tr id="section-2"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-2">&#182;</a> </div> <p>sanity check - gl context MUST BE WebGLRenderingContext</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">console</span><span class="p">.</span><span class="nx">assert</span><span class="p">(</span><span class="nx">gl</span> <span class="k">instanceof</span> <span class="nx">WebGLRenderingContext</span><span class="p">)</span></pre></div> </td> </tr> <tr id="section-3"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-3">&#182;</a> </div> <p>TODO find better names</p> </td> <td class="code"> <div class="highlight"><pre> <span class="kd">var</span> <span class="nx">prout</span> <span class="o">=</span> <span class="p">[</span><span class="s1">&#39;VERSION&#39;</span><span class="p">,</span> <span class="s1">&#39;SHADING_LANGUAGE_VERSION&#39;</span><span class="p">,</span> <span class="s1">&#39;VENDOR&#39;</span><span class="p">,</span> <span class="s1">&#39;RENDERER&#39;</span><span class="p">];</span>
<span class="kd">var</span> <span class="nx">pixDepth</span> <span class="o">=</span> <span class="p">[</span><span class="s1">&#39;RED_BITS&#39;</span><span class="p">,</span> <span class="s1">&#39;GREEN_BITS&#39;</span><span class="p">,</span> <span class="s1">&#39;BLUE_BITS&#39;</span><span class="p">,</span> <span class="s1">&#39;ALPHA_BITS&#39;</span><span class="p">,</span> <span class="s1">&#39;DEPTH_BITS&#39;</span><span class="p">,</span> <span class="s1">&#39;STENCIL_BITS&#39;</span><span class="p">];</span>
<span class="kd">var</span> <span class="nx">slota</span> <span class="o">=</span> <span class="p">[</span><span class="s1">&#39;MAX_RENDERBUFFER_SIZE&#39;</span><span class="p">,</span> <span class="s1">&#39;MAX_COMBINED_TEXTURE_IMAGE_UNITS&#39;</span><span class="p">,</span> <span class="s1">&#39;MAX_CUBE_MAP_TEXTURE_SIZE&#39;</span>
<span class="p">,</span> <span class="s1">&#39;MAX_FRAGMENT_UNIFORM_VECTORS&#39;</span><span class="p">,</span> <span class="s1">&#39;MAX_TEXTURE_IMAGE_UNITS&#39;</span>
<span class="p">,</span> <span class="s1">&#39;MAX_TEXTURE_SIZE&#39;</span><span class="p">,</span> <span class="s1">&#39;MAX_VERTEX_ATTRIBS&#39;</span>
<span class="p">,</span> <span class="s1">&#39;MAX_VERTEX_ATTRIBS&#39;</span><span class="p">,</span> <span class="s1">&#39;MAX_VERTEX_TEXTURE_IMAGE_UNITS&#39;</span>
<span class="p">,</span> <span class="s1">&#39;MAX_VERTEX_UNIFORM_VECTORS&#39;</span><span class="p">];</span>
<span class="kd">var</span> <span class="nx">sloti</span> <span class="o">=</span> <span class="p">[</span><span class="s1">&#39;ALIASED_LINE_WIDTH_RANGE&#39;</span><span class="p">,</span> <span class="s1">&#39;ALIASED_POINT_SIZE_RANGE&#39;</span><span class="p">,</span> <span class="s1">&#39;MAX_VIEWPORT_DIMS&#39;</span><span class="p">];</span>
<span class="kd">var</span> <span class="nx">info</span> <span class="o">=</span> <span class="p">{};</span>
<span class="kd">var</span> <span class="nx">collect</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">arr</span><span class="p">){</span>
<span class="nx">arr</span><span class="p">.</span><span class="nx">forEach</span><span class="p">(</span><span class="kd">function</span><span class="p">(</span><span class="nx">parameter</span><span class="p">){</span></pre></div> </td> </tr> <tr id="section-4"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-4">&#182;</a> </div> <p>console.log('parameter', parameter)</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">info</span><span class="p">[</span><span class="nx">parameter</span><span class="p">]</span> <span class="o">=</span> <span class="nx">gl</span><span class="p">.</span><span class="nx">getParameter</span><span class="p">(</span><span class="nx">gl</span><span class="p">[</span><span class="nx">parameter</span><span class="p">])</span>
<span class="p">})</span>
<span class="p">}</span>
<span class="nx">collect</span><span class="p">(</span><span class="nx">prout</span><span class="p">);</span>
<span class="nx">collect</span><span class="p">(</span><span class="nx">pixDepth</span><span class="p">);</span>
<span class="nx">collect</span><span class="p">(</span><span class="nx">slota</span><span class="p">);</span>
<span class="nx">collect</span><span class="p">(</span><span class="nx">sloti</span><span class="p">)</span>
</pre></div> </td> </tr> <tr id="section-5"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-5">&#182;</a> </div> <p>special case to get the extensions</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">info</span><span class="p">[</span><span class="s1">&#39;SUPPORTED_EXTENSIONS&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nx">gl</span><span class="p">.</span><span class="nx">getSupportedExtensions</span><span class="p">()</span>
</pre></div> </td> </tr> <tr id="section-6"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-6">&#182;</a> </div> <p>console.log("info");
console.dir(info)</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">return</span> <span class="nx">info</span><span class="p">;</span>
<span class="p">}</span>
</pre></div> </td> </tr> </tbody> </table> </div> </body> </html>