⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 glpng.htm

📁 a 3d car ....with color texture..
💻 HTM
📖 第 1 页 / 共 2 页
字号:

<pre><a name="SetStencil"><strong>pngSetStencil(red, green, blue)</strong></a></pre>

<blockquote>
    <table border="1">
        <tr>
            <td valign="top">red,green,blue</td>
            <td>The colour to stencil out when using the <a
            href="#PNG_STENCIL">PNG_STENCIL</a> option</td>
        </tr>
    </table>
</blockquote>

<blockquote>
    <p>This selects the colour to stencil out when using <a
    href="#PNG_STENCIL">PNG_STENCIL</a>. The parameters are 0 to
    255. By default the colour is 0,0,0 (pure black).</p>
</blockquote>

<pre><a name="pngSetAlphaCallback"><strong>pngSetAlphaCallback(function)</strong></a></pre>

<blockquote>
    <table border="1">
        <tr>
            <td valign="top">function</td>
            <td>Pointer to a function taking three unsigned char
            parameters (red, green, blue) and returning an
            unsigned char (alpha)</td>
        </tr>
    </table>
</blockquote>

<blockquote>
    <p>This sets the function to be called when using <a
    href="#PNG_CALLBACK">PNG_CALLBACK</a>. During the alpha
    channel generation process, this function will be called for
    every pixel, with the appropriate RGB values, and will use
    the result for the alpha value. The RGB and alpha values all
    range from 0 to 255. The default callback function simply
    returns 255.</p>
</blockquote>

<pre><a name="pngSetViewingGamma"><strong>pngSetViewingGamma(gamma)</strong></a></pre>

<blockquote>
    <table border="1">
        <tr>
            <td valign="top">gamma</td>
            <td>New gamma correction value</td>
        </tr>
    </table>
    <p>By default, gamma correction is set to 1.0 for Windows, 1.7
    for SGI and 1.45 for Macs. If the VIEWING_GAMMA environmental
    variable is set, that is used instead. You can override both
    of these values using pngSetViewingGamma().</p>
</blockquote>

<pre><a name="pngSetStandardOrientation"><strong>pngSetStandardOrientation(standardorientation)</strong></a></pre>

<blockquote>
    <table border="1">
        <tr>
            <td>standardorientation</td>
            <td>If to use the standard orientation (0 is default)</td>
        </tr>
    </table>
    <p>By default, the image is loaded so that texture
    coordinates 0,0 represent the top-left - a result of me not
    knowing the OpenGL spec :-). If you wish to use the standard
    OpenGL representation where 0,0 is the bottom-left, set this
    to 1.</p>
</blockquote>

<h3>Examples</h3>

<p>Here's an example of pngLoad(), to load &quot;Texture.png&quot;
with nearest filter, clamping on and no mipmaps or alpha channels...</p>

<blockquote>
    <pre>pngInfo info;
GLuint id;</pre>
    <pre>glGenTextures(1, &amp;id);
glBindTexture(GL_TEXTURE_2D, id);</pre>
    <pre>glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);</pre>
    <pre>if (pngLoad(&quot;Texture.png&quot;, PNG_NOMIPMAP, PNG_SOLID, &amp;info)) {
   puts(&quot;Loaded Texture.png with resounding success&quot;);
   printf(&quot;Size=%i,%i Depth=%i Alpha=%i\n&quot;, info.Width, info.Height, info.Depth, info.Alpha);
}
else {
   puts(&quot;Can't load Texture.png&quot;);
   exit(1);
}</pre>
</blockquote>

<p>And here's an example to load the same texture with the same
options using pngBind()...</p>

<blockquote>
    <pre>pngInfo info;
GLuint id = pngBind(&quot;Texture.png&quot;, PNG_NOMIPMAP, PNG_SOLID, &amp;info, GL_CLAMP, GL_NEAREST, GL_NEAREST);</pre>
    <pre>if (id != 0) {
   puts(&quot;Loaded Texture.png with resounding success&quot;);
   printf(&quot;Size=%i,%i Depth=%i Alpha=%i\n&quot;, info.Width, info.Height, info.Depth, info.Alpha);
}
else {
   puts(&quot;Can't load Texture.png&quot;);
   exit(1);
}</pre>
</blockquote>

<p>If those two examples don't make sense, try the included full
source example (which needs <a
href="http://reality.sgi.com/opengl/glut3/glut3.html">GLUT</a>).</p>

<h3>Bugs</h3>

<ul>
    <li>64-bit PNGs can't be loaded (missing LibPNG feature as
        far as I can tell).</li>
</ul>

<h3>Possible Future Developments</h3>

<ul>
    <li>Better attempts could be made to find the optimal texture
        format for OpenGL. At the moment, it converts everything
        to 24 or 32 bit, or uses the paletted texture extension
        in certain (easy to handle) cases.</li>
    <li>Other mipmap generating algorithms could be implemented (wavelet
        stuff?). Source donations are welcome.</li>
    <li>Saving the frame buffer to a PNG file.</li>
    <li>Support for GL_INTENSITY, GL_LUMINANCE_ALPHA and others.</li>
</ul>

<h3>History</h3>

<table border="0">
    <tr>
        <td valign="top" nowrap>1.33 (20/5/99)</td>
        <td valign="top">First public release.</td>
    </tr>
    <tr>
        <td valign="top" nowrap>1.34 (27/5/99)</td>
        <td valign="top">Optimised alpha channel generating,
        added Alpha property to the pngInfo structure, illegal
        texture sizes are resized.</td>
    </tr>
    <tr>
        <td valign="top" nowrap>1.35 (4/6/99)</td>
        <td valign="top">Added pngLoadRaw and pngLoadRawF
        functions.</td>
    </tr>
    <tr>
        <td valign="top" nowrap>1.36 (9/6/99)</td>
        <td valign="top">Fixed problem causing linking warnings/errors
        (I think) and reduced the size of the library
        considerably.</td>
    </tr>
    <tr>
        <td valign="top" nowrap>1.37 (13/6/99)</td>
        <td valign="top">Added alpha channel generation callback
        function.</td>
    </tr>
    <tr>
        <td valign="top" nowrap>1.38 (22/6/99)</td>
        <td valign="top">Stopped it from disabling texturing on
        calls to pngBind and pngBindF.</td>
    </tr>
    <tr>
        <td valign="top" nowrap>1.39 (8/7/99)</td>
        <td valign="top">Fixed a bug in the extensions reading
        code, which caused some machines to crash.</td>
    </tr>
    <tr>
        <td valign="top" nowrap>1.40 (27/9/99)</td>
        <td valign="top">Added support for SGI, Linux, and gamma
        correction (thanks to Mark B. Allan!). Fixed bug in raw
        reading of gray textures (thanks to Johann Scholtz!).
        Removed all use of GLU functions to make it easier to
        dynamically load opengl32.dll or 3dfxvgl.dll or whatever.
        Added simple mipmap generator.</td>
    </tr>
    <tr>
        <td valign="top" nowrap>1.41 (20/10/99)</td>
        <td valign="top">Made a small optimisation and improved
        documentation. Remembered to include the makefiles for
        Linux and SGI in the zip (!).</td>
    </tr>
    <tr>
        <td valign="top" nowrap>1.42 (01/03/00)</td>
        <td valign="top">Fixed problems with compiling on SGI (thanks
        to Thomas Sondergaard!). Added pngSetStandardOrientation
        (thanks to Scott Franke!).</td>
    </tr>
    <tr>
        <td valign="top" nowrap>1.43 (11/05/00)</td>
        <td valign="top">Added debug library and fixed the crash
        when there wasn't a terminating png info structure (thanks
        to Dan Hawkins!).</td>
    </tr>
    <tr>
        <td valign="top" nowrap>1.44 (01/07/00)</td>
        <td valign="top">Fixed release and debug libraries so
        they stop producing warnings and errors in MSDEV.</td>
    </tr>
    <tr>
        <td valign="top" nowrap>1.45 (10/07/00)</td>
        <td valign="top">Fixed bug where the standard orientation
        flag was being ignored in pngLoadRawF (thanks to Mark B.
        Allan!).</td>
    </tr>
</table>

<p>Get the latest version from <a
href="http://www.wyatt100.freeserve.co.uk/download.htm">http://www.wyatt100.freeserve.co.uk/download.htm</a></p>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -