diff options
author | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
---|---|---|
committer | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
commit | 0ea5fc66924303d1bf73ba283a383e2aadee02f2 (patch) | |
tree | 2568e71a7ccc44ec23b8bb3f0ff97fb6bf2ed709 /docs/doxygen/nel/driver__opengl__states_8cpp-source.html | |
download | nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.tar.xz nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.zip |
Initial commit
Diffstat (limited to 'docs/doxygen/nel/driver__opengl__states_8cpp-source.html')
-rw-r--r-- | docs/doxygen/nel/driver__opengl__states_8cpp-source.html | 754 |
1 files changed, 754 insertions, 0 deletions
diff --git a/docs/doxygen/nel/driver__opengl__states_8cpp-source.html b/docs/doxygen/nel/driver__opengl__states_8cpp-source.html new file mode 100644 index 00000000..f44746fe --- /dev/null +++ b/docs/doxygen/nel/driver__opengl__states_8cpp-source.html @@ -0,0 +1,754 @@ +<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> +<HTML> +<HEAD> + <TITLE>nevrax.org : docs</TITLE> + <LINK REL=stylesheet TYPE="text/css" HREF="http://www.nevrax.org/inc/css/nevrax.css"> + <link href="doxygen.css" rel="stylesheet" type="text/css"> +</HEAD> +<BODY MARGINHEIGHT="0" MARGINWIDTH="0"> + +<!-- uplinks --> +<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0> + <TR> + <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD WIDTH=140 BGCOLOR=#dddddd><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF=http://www.nevrax.org><b>Home</B></FONT></A> </TD> + <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF=http://www.nevrax.com><b>nevrax.com</B></FONT></A> </TD> + </TR> +</TABLE> + +<!-- banner Nevrax --> +<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%> + <TR><TD BGCOLOR="#000000" BACKGROUND="http://www.nevrax.org/inc/img/black_banner.jpg"><A HREF="http://www.nevrax.org"><IMG SRC="http://www.nevrax.org/inc/img/nevrax.gif" WIDTH="170" HEIGHT="45" BORDER=0 ALT="Nevrax" ></A></TD></TR> +</TABLE> + +<!-- main table --> +<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 height=100%> + <TR> + <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD> + <TD WIDTH=140 BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT=""> + + <!------ Begin Box ------> + <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR=black><TR><TD><TABLE border=0 cellspacing=2 cellpadding=0 width=120><tr><TD ALIGN=middle bgcolor=black> + <FONT COLOR=white FACE="sans-serif"><B>Nevrax.org</B></FONT></TD></TR><tr><td colspan=2 bgcolor=#FFFFFF> + <TABLE cellspacing=0 cellpadding=1 border=0> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="Rubrique news"><img width=13 height=15 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-news.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="News">News</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Rubrique mail"><img width=15 height=11 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-mail.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Rubrique docs"><img width=14 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-docs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Documentation">Documentation</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="Rubrique cvs"><img width=13 height=17 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-cvs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="CVS Web">CVS</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Rubrique bugs"><img width=20 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-bugs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Bugtracking">Bugs</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="Rubrique license"><img width=18 height=12 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-gpl.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="License">License</a></td></tr> + </TABLE> + </TD></TR></TABLE></TD></TR></TABLE> + <!------ End Box ------> + + </TD> + <TD WIDTH=15><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD ALIGN=left valign=top><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT=""> + +<!-- title --> +<TABLE background="http://www.nevrax.org/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td> +<A HREF="http://www.nevrax.org/docs/"><img src="http://www.nevrax.org/inc/img/t_docs.gif" ALT="Docs" HEIGHT=20 BORDER=0></A> +</td><td><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT=""> +</td></tr></table> + + +<!-- block --> +<TABLE bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="http://www.nevrax.org/inc/img/reddots.gif"></TD> + <TD><B>Documentation</B></TD> + <TD ALIGN=RIGHT> </td> +</tr></table> +<!-- Generated by Doxygen 1.2.14 --> +<center> +<a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="namespacemembers.html">Namespace Members</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> <a class="qindex" href="pages.html">Related Pages</a> <a class="qindexRef" doxygen="_cgi:http://www.nevrax.org/cgi-bin/nel-search.cgi" href="http://www.nevrax.org/cgi-bin/nel-search.cgi">Search</a> </center> +<hr><h1>driver_opengl_states.cpp</h1><a href="driver__opengl__states_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 +00007 <font class="comment">/* Copyright, 2001 Nevrax Ltd.</font> +00008 <font class="comment"> *</font> +00009 <font class="comment"> * This file is part of NEVRAX NEL.</font> +00010 <font class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify</font> +00011 <font class="comment"> * it under the terms of the GNU General Public License as published by</font> +00012 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option)</font> +00013 <font class="comment"> * any later version.</font> +00014 <font class="comment"></font> +00015 <font class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but</font> +00016 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font> +00017 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font> +00018 <font class="comment"> * General Public License for more details.</font> +00019 <font class="comment"></font> +00020 <font class="comment"> * You should have received a copy of the GNU General Public License</font> +00021 <font class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the</font> +00022 <font class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</font> +00023 <font class="comment"> * MA 02111-1307, USA.</font> +00024 <font class="comment"> */</font> +00025 +00026 <font class="preprocessor">#include "<a class="code" href="stdopengl_8h.html">stdopengl.h</a>"</font> +00027 +00028 +00029 <font class="comment">// ***************************************************************************</font> +00030 <font class="comment">// define it For Debug purpose only. Normal use is to hide this line</font> +00031 <font class="comment">//#define NL3D_GLSTATE_DISABLE_CACHE</font> +00032 +00033 <font class="keyword">namespace </font>NL3D +00034 { +00035 +00036 <font class="comment">// ***************************************************************************</font> +<a name="l00037"></a><a class="code" href="classNL3D_1_1CDriverGLStates.html#a0">00037</a> CDriverGLStates::CDriverGLStates() +00038 { +00039 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o15">_TextureCubeMapSupported</a>= <font class="keyword">false</font>; +00040 } +00041 +00042 +00043 <font class="comment">// ***************************************************************************</font> +<a name="l00044"></a><a class="code" href="classNL3D_1_1CDriverGLStates.html#a1">00044</a> <font class="keywordtype">void</font> CDriverGLStates::init(<font class="keywordtype">bool</font> supportTextureCubeMap) +00045 { +00046 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o15">_TextureCubeMapSupported</a>= supportTextureCubeMap; +00047 +00048 <font class="comment">// By default all arrays are disabled.</font> +00049 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o18">_VertexArrayEnabled</a>= <font class="keyword">false</font>; +00050 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o19">_NormalArrayEnabled</a>= <font class="keyword">false</font>; +00051 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o20">_WeightArrayEnabled</a>= <font class="keyword">false</font>; +00052 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o21">_ColorArrayEnabled</a>= <font class="keyword">false</font>; +00053 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o22">_SecondaryColorArrayEnabled</a>= <font class="keyword">false</font>; +00054 uint i; +00055 <font class="keywordflow">for</font>(i=0; i<<a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>; i++) +00056 { +00057 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o24">_TexCoordArrayEnabled</a>[i]= <font class="keyword">false</font>; +00058 } +00059 <font class="keywordflow">for</font>(i=0; i<CVertexBuffer::NumValue; i++) +00060 { +00061 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o25">_VertexAttribArrayEnabled</a>[i]= <font class="keyword">false</font>; +00062 } +00063 } +00064 +00065 +00066 <font class="comment">// ***************************************************************************</font> +<a name="l00067"></a><a class="code" href="classNL3D_1_1CDriverGLStates.html#a2">00067</a> <font class="keywordtype">void</font> CDriverGLStates::forceDefaults(uint nbStages) +00068 { +00069 <font class="comment">// Enable / disable.</font> +00070 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o0">_CurBlend</a>= <font class="keyword">false</font>; +00071 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o1">_CurCullFace</a>= <font class="keyword">true</font>; +00072 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o2">_CurAlphaTest</a>= <font class="keyword">false</font>; +00073 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o3">_CurLighting</a>= <font class="keyword">false</font>; +00074 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o4">_CurZWrite</a>= <font class="keyword">true</font>; +00075 <font class="comment">// setup GLStates.</font> +00076 glDisable(GL_BLEND); +00077 glEnable(GL_CULL_FACE); +00078 glDisable(GL_ALPHA_TEST); +00079 glDisable(GL_LIGHTING); +00080 glDepthMask(GL_TRUE); +00081 +00082 <font class="comment">// Func.</font> +00083 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o5">_CurBlendSrc</a>= GL_SRC_ALPHA; +00084 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o6">_CurBlendDst</a>= GL_ONE_MINUS_SRC_ALPHA; +00085 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o7">_CurDepthFunc</a>= GL_LEQUAL; +00086 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o8">_CurAlphaTestThreshold</a>= 0.5f; +00087 <font class="comment">// setup GLStates.</font> +00088 glBlendFunc(<a class="code" href="classNL3D_1_1CDriverGLStates.html#o5">_CurBlendSrc</a>, <a class="code" href="classNL3D_1_1CDriverGLStates.html#o6">_CurBlendDst</a>); +00089 glDepthFunc(<a class="code" href="classNL3D_1_1CDriverGLStates.html#o7">_CurDepthFunc</a>); +00090 glAlphaFunc(GL_GREATER, <a class="code" href="classNL3D_1_1CDriverGLStates.html#o8">_CurAlphaTestThreshold</a>); +00091 +00092 <font class="comment">// Materials.</font> +00093 uint32 packedOne= (CRGBA(255,255,255,255)).getPacked(); +00094 uint32 packedZero= (CRGBA(0,0,0,255)).getPacked(); +00095 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o9">_CurEmissive</a>= packedZero; +00096 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o10">_CurAmbient</a>= packedOne; +00097 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o11">_CurDiffuse</a>= packedOne; +00098 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o12">_CurSpecular</a>= packedZero; +00099 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o13">_CurShininess</a>= 1; +00100 +00101 <font class="comment">// Lighted vertex color</font> +00102 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o14">_VertexColorLighted</a>=<font class="keyword">false</font>; +00103 glDisable(GL_COLOR_MATERIAL); +00104 +00105 <font class="comment">// setup GLStates.</font> +00106 <font class="keyword">static</font> <font class="keyword">const</font> GLfloat one[4]= {1,1,1,1}; +00107 <font class="keyword">static</font> <font class="keyword">const</font> GLfloat zero[4]= {0,0,0,1}; +00108 glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, zero); +00109 glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, one); +00110 glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, one); +00111 glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, zero); +00112 glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, <a class="code" href="classNL3D_1_1CDriverGLStates.html#o13">_CurShininess</a>); +00113 +00114 +00115 <font class="comment">// TexModes</font> +00116 uint stage; +00117 <font class="keywordflow">for</font>(stage=0;stage<nbStages; stage++) +00118 { +00119 <font class="comment">// disable texturing.</font> +00120 <a class="code" href="driver__opengl__extension_8h.html#a0">nglActiveTextureARB</a>(GL_TEXTURE0_ARB+stage); +00121 glDisable(GL_TEXTURE_2D); +00122 <font class="keywordflow">if</font>(_TextureCubeMapSupported) +00123 glDisable(GL_TEXTURE_CUBE_MAP_ARB); +00124 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o17">_TextureMode</a>[stage]= <a class="code" href="classNL3D_1_1CDriverGLStates.html#z421_0s0">TextureDisabled</a>; +00125 +00126 <font class="comment">// Tex gen init</font> +00127 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o26">_TexGen</a>[stage] = <font class="keyword">false</font>; +00128 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o27">_TexGenMode</a>[stage] = GL_SPHERE_MAP; +00129 glTexGeni( GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); +00130 glTexGeni( GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); +00131 glTexGeni( GL_R, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); +00132 glDisable( GL_TEXTURE_GEN_S ); +00133 glDisable( GL_TEXTURE_GEN_T ); +00134 glDisable( GL_TEXTURE_GEN_R ); +00135 } +00136 +00137 <font class="comment">// ActiveTexture current texture to 0.</font> +00138 <a class="code" href="driver__opengl__extension_8h.html#a0">nglActiveTextureARB</a>(GL_TEXTURE0_ARB); +00139 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o16">_CurrentActiveTextureARB</a>= 0; +00140 <a class="code" href="driver__opengl__extension_8h.html#a1">nglClientActiveTextureARB</a>(GL_TEXTURE0_ARB); +00141 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o23">_CurrentClientActiveTextureARB</a>= 0; +00142 +00143 <font class="comment">// Depth range</font> +00144 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o28">_CurZRangeDelta</a> = 0; +00145 glDepthRange (0, 1); +00146 } +00147 +00148 +00149 +00150 <font class="comment">// ***************************************************************************</font> +<a name="l00151"></a><a class="code" href="classNL3D_1_1CDriverGLStates.html#z419_0">00151</a> <font class="keywordtype">void</font> CDriverGLStates::enableBlend(uint enable) +00152 { +00153 <font class="comment">// If different from current setup, update.</font> +00154 <font class="keywordtype">bool</font> enabled= (enable!=0); +00155 <font class="preprocessor">#ifndef NL3D_GLSTATE_DISABLE_CACHE</font> +00156 <font class="preprocessor"></font> <font class="keywordflow">if</font>( enabled != <a class="code" href="classNL3D_1_1CDriverGLStates.html#o0">_CurBlend</a> ) +00157 <font class="preprocessor">#endif</font> +00158 <font class="preprocessor"></font> { +00159 <font class="comment">// new state.</font> +00160 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o0">_CurBlend</a>= enabled; +00161 <font class="comment">// Setup GLState.</font> +00162 <font class="keywordflow">if</font>(_CurBlend) +00163 glEnable(GL_BLEND); +00164 <font class="keywordflow">else</font> +00165 glDisable(GL_BLEND); +00166 } +00167 } +00168 +00169 <font class="comment">// ***************************************************************************</font> +<a name="l00170"></a><a class="code" href="classNL3D_1_1CDriverGLStates.html#z419_1">00170</a> <font class="keywordtype">void</font> CDriverGLStates::enableCullFace(uint enable) +00171 { +00172 <font class="comment">// If different from current setup, update.</font> +00173 <font class="keywordtype">bool</font> enabled= (enable!=0); +00174 <font class="preprocessor">#ifndef NL3D_GLSTATE_DISABLE_CACHE</font> +00175 <font class="preprocessor"></font> <font class="keywordflow">if</font>( enabled != <a class="code" href="classNL3D_1_1CDriverGLStates.html#o1">_CurCullFace</a> ) +00176 <font class="preprocessor">#endif</font> +00177 <font class="preprocessor"></font> { +00178 <font class="comment">// new state.</font> +00179 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o1">_CurCullFace</a>= enabled; +00180 <font class="comment">// Setup GLState.</font> +00181 <font class="keywordflow">if</font>(_CurCullFace) +00182 glEnable(GL_CULL_FACE); +00183 <font class="keywordflow">else</font> +00184 glDisable(GL_CULL_FACE); +00185 } +00186 } +00187 +00188 <font class="comment">// ***************************************************************************</font> +<a name="l00189"></a><a class="code" href="classNL3D_1_1CDriverGLStates.html#z419_2">00189</a> <font class="keywordtype">void</font> CDriverGLStates::enableAlphaTest(uint enable) +00190 { +00191 <font class="comment">// If different from current setup, update.</font> +00192 <font class="keywordtype">bool</font> enabled= (enable!=0); +00193 <font class="preprocessor">#ifndef NL3D_GLSTATE_DISABLE_CACHE</font> +00194 <font class="preprocessor"></font> <font class="keywordflow">if</font>( enabled != <a class="code" href="classNL3D_1_1CDriverGLStates.html#o2">_CurAlphaTest</a> ) +00195 <font class="preprocessor">#endif</font> +00196 <font class="preprocessor"></font> { +00197 <font class="comment">// new state.</font> +00198 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o2">_CurAlphaTest</a>= enabled; +00199 +00200 <font class="comment">// Setup GLState.</font> +00201 <font class="keywordflow">if</font>(_CurAlphaTest) +00202 { +00203 glEnable(GL_ALPHA_TEST); +00204 } +00205 <font class="keywordflow">else</font> +00206 { +00207 glDisable(GL_ALPHA_TEST); +00208 } +00209 } +00210 } +00211 +00212 <font class="comment">// ***************************************************************************</font> +<a name="l00213"></a><a class="code" href="classNL3D_1_1CDriverGLStates.html#z419_3">00213</a> <font class="keywordtype">void</font> CDriverGLStates::enableLighting(uint enable) +00214 { +00215 <font class="comment">// If different from current setup, update.</font> +00216 <font class="keywordtype">bool</font> enabled= (enable!=0); +00217 <font class="preprocessor">#ifndef NL3D_GLSTATE_DISABLE_CACHE</font> +00218 <font class="preprocessor"></font> <font class="keywordflow">if</font>( enabled != <a class="code" href="classNL3D_1_1CDriverGLStates.html#o3">_CurLighting</a> ) +00219 <font class="preprocessor">#endif</font> +00220 <font class="preprocessor"></font> { +00221 <font class="comment">// new state.</font> +00222 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o3">_CurLighting</a>= enabled; +00223 <font class="comment">// Setup GLState.</font> +00224 <font class="keywordflow">if</font>(_CurLighting) +00225 glEnable(GL_LIGHTING); +00226 <font class="keywordflow">else</font> +00227 glDisable(GL_LIGHTING); +00228 } +00229 } +00230 +00231 <font class="comment">// ***************************************************************************</font> +<a name="l00232"></a><a class="code" href="classNL3D_1_1CDriverGLStates.html#z419_4">00232</a> <font class="keywordtype">void</font> CDriverGLStates::enableZWrite(uint enable) +00233 { +00234 <font class="comment">// If different from current setup, update.</font> +00235 <font class="keywordtype">bool</font> enabled= (enable!=0); +00236 <font class="preprocessor">#ifndef NL3D_GLSTATE_DISABLE_CACHE</font> +00237 <font class="preprocessor"></font> <font class="keywordflow">if</font>( enabled != <a class="code" href="classNL3D_1_1CDriverGLStates.html#o4">_CurZWrite</a> ) +00238 <font class="preprocessor">#endif</font> +00239 <font class="preprocessor"></font> { +00240 <font class="comment">// new state.</font> +00241 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o4">_CurZWrite</a>= enabled; +00242 <font class="comment">// Setup GLState.</font> +00243 <font class="keywordflow">if</font>(_CurZWrite) +00244 glDepthMask(GL_TRUE); +00245 <font class="keywordflow">else</font> +00246 glDepthMask(GL_FALSE); +00247 } +00248 } +00249 +00250 +00251 +00252 <font class="comment">// ***************************************************************************</font> +<a name="l00253"></a><a class="code" href="classNL3D_1_1CDriverGLStates.html#a3">00253</a> <font class="keywordtype">void</font> CDriverGLStates::blendFunc(GLenum <a class="code" href="driver__opengl__extension__def_8h.html#a409">src</a>, GLenum dst) +00254 { +00255 <font class="comment">// If different from current setup, update.</font> +00256 <font class="preprocessor">#ifndef NL3D_GLSTATE_DISABLE_CACHE</font> +00257 <font class="preprocessor"></font> <font class="keywordflow">if</font>( <a class="code" href="driver__opengl__extension__def_8h.html#a409">src</a>!= <a class="code" href="classNL3D_1_1CDriverGLStates.html#o5">_CurBlendSrc</a> || dst!=<a class="code" href="classNL3D_1_1CDriverGLStates.html#o6">_CurBlendDst</a> ) +00258 <font class="preprocessor">#endif</font> +00259 <font class="preprocessor"></font> { +00260 <font class="comment">// new state.</font> +00261 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o5">_CurBlendSrc</a>= <a class="code" href="driver__opengl__extension__def_8h.html#a409">src</a>; +00262 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o6">_CurBlendDst</a>= dst; +00263 <font class="comment">// Setup GLState.</font> +00264 glBlendFunc(<a class="code" href="classNL3D_1_1CDriverGLStates.html#o5">_CurBlendSrc</a>, <a class="code" href="classNL3D_1_1CDriverGLStates.html#o6">_CurBlendDst</a>); +00265 } +00266 } +00267 +00268 <font class="comment">// ***************************************************************************</font> +<a name="l00269"></a><a class="code" href="classNL3D_1_1CDriverGLStates.html#a4">00269</a> <font class="keywordtype">void</font> CDriverGLStates::depthFunc(GLenum zcomp) +00270 { +00271 <font class="comment">// If different from current setup, update.</font> +00272 <font class="preprocessor">#ifndef NL3D_GLSTATE_DISABLE_CACHE</font> +00273 <font class="preprocessor"></font> <font class="keywordflow">if</font>( zcomp != <a class="code" href="classNL3D_1_1CDriverGLStates.html#o7">_CurDepthFunc</a> ) +00274 <font class="preprocessor">#endif</font> +00275 <font class="preprocessor"></font> { +00276 <font class="comment">// new state.</font> +00277 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o7">_CurDepthFunc</a>= zcomp; +00278 <font class="comment">// Setup GLState.</font> +00279 glDepthFunc(<a class="code" href="classNL3D_1_1CDriverGLStates.html#o7">_CurDepthFunc</a>); +00280 } +00281 } +00282 +00283 +00284 <font class="comment">// ***************************************************************************</font> +<a name="l00285"></a><a class="code" href="classNL3D_1_1CDriverGLStates.html#a5">00285</a> <font class="keywordtype">void</font> CDriverGLStates::alphaFunc(<font class="keywordtype">float</font> threshold) +00286 { +00287 <font class="preprocessor">#ifndef NL3D_GLSTATE_DISABLE_CACHE</font> +00288 <font class="preprocessor"></font> <font class="keywordflow">if</font>(threshold != <a class="code" href="classNL3D_1_1CDriverGLStates.html#o8">_CurAlphaTestThreshold</a>) +00289 <font class="preprocessor">#endif</font> +00290 <font class="preprocessor"></font> { +00291 <font class="comment">// new state</font> +00292 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o8">_CurAlphaTestThreshold</a>= threshold; +00293 <font class="comment">// setup function.</font> +00294 glAlphaFunc(GL_GREATER, <a class="code" href="classNL3D_1_1CDriverGLStates.html#o8">_CurAlphaTestThreshold</a>); +00295 } +00296 } +00297 +00298 +00299 <font class="comment">// ***************************************************************************</font> +<a name="l00300"></a><a class="code" href="classNL3D_1_1CDriverGLStates.html#z420_0">00300</a> <font class="keywordtype">void</font> CDriverGLStates::setEmissive(uint32 packedColor, <font class="keyword">const</font> GLfloat color[4]) +00301 { +00302 <font class="preprocessor">#ifndef NL3D_GLSTATE_DISABLE_CACHE</font> +00303 <font class="preprocessor"></font> <font class="keywordflow">if</font>( packedColor!=<a class="code" href="classNL3D_1_1CDriverGLStates.html#o9">_CurEmissive</a> ) +00304 <font class="preprocessor">#endif</font> +00305 <font class="preprocessor"></font> { +00306 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o9">_CurEmissive</a>= packedColor; +00307 glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, color); +00308 } +00309 } +00310 +00311 <font class="comment">// ***************************************************************************</font> +<a name="l00312"></a><a class="code" href="classNL3D_1_1CDriverGLStates.html#z420_1">00312</a> <font class="keywordtype">void</font> CDriverGLStates::setAmbient(uint32 packedColor, <font class="keyword">const</font> GLfloat color[4]) +00313 { +00314 <font class="preprocessor">#ifndef NL3D_GLSTATE_DISABLE_CACHE</font> +00315 <font class="preprocessor"></font> <font class="keywordflow">if</font>( packedColor!=<a class="code" href="classNL3D_1_1CDriverGLStates.html#o10">_CurAmbient</a> ) +00316 <font class="preprocessor">#endif</font> +00317 <font class="preprocessor"></font> { +00318 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o10">_CurAmbient</a>= packedColor; +00319 glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, color); +00320 } +00321 } +00322 +00323 <font class="comment">// ***************************************************************************</font> +<a name="l00324"></a><a class="code" href="classNL3D_1_1CDriverGLStates.html#z420_2">00324</a> <font class="keywordtype">void</font> CDriverGLStates::setDiffuse(uint32 packedColor, <font class="keyword">const</font> GLfloat color[4]) +00325 { +00326 <font class="preprocessor">#ifndef NL3D_GLSTATE_DISABLE_CACHE</font> +00327 <font class="preprocessor"></font> <font class="keywordflow">if</font>( packedColor!=<a class="code" href="classNL3D_1_1CDriverGLStates.html#o11">_CurDiffuse</a> ) +00328 <font class="preprocessor">#endif</font> +00329 <font class="preprocessor"></font> { +00330 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o11">_CurDiffuse</a>= packedColor; +00331 glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, color); +00332 } +00333 } +00334 +00335 <font class="comment">// ***************************************************************************</font> +<a name="l00336"></a><a class="code" href="classNL3D_1_1CDriverGLStates.html#z420_3">00336</a> <font class="keywordtype">void</font> CDriverGLStates::setSpecular(uint32 packedColor, <font class="keyword">const</font> GLfloat color[4]) +00337 { +00338 <font class="preprocessor">#ifndef NL3D_GLSTATE_DISABLE_CACHE</font> +00339 <font class="preprocessor"></font> <font class="keywordflow">if</font>( packedColor!=<a class="code" href="classNL3D_1_1CDriverGLStates.html#o12">_CurSpecular</a> ) +00340 <font class="preprocessor">#endif</font> +00341 <font class="preprocessor"></font> { +00342 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o12">_CurSpecular</a>= packedColor; +00343 glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, color); +00344 } +00345 } +00346 +00347 <font class="comment">// ***************************************************************************</font> +<a name="l00348"></a><a class="code" href="classNL3D_1_1CDriverGLStates.html#z420_4">00348</a> <font class="keywordtype">void</font> CDriverGLStates::setShininess(<font class="keywordtype">float</font> shin) +00349 { +00350 <font class="preprocessor">#ifndef NL3D_GLSTATE_DISABLE_CACHE</font> +00351 <font class="preprocessor"></font> <font class="keywordflow">if</font>( shin != <a class="code" href="classNL3D_1_1CDriverGLStates.html#o13">_CurShininess</a> ) +00352 <font class="preprocessor">#endif</font> +00353 <font class="preprocessor"></font> { +00354 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o13">_CurShininess</a>= shin; +00355 glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, shin); +00356 } +00357 } +00358 +00359 +00360 <font class="comment">// ***************************************************************************</font> +00361 <font class="keyword">static</font> <font class="keywordtype">void</font> <a class="code" href="namespaceNL3D.html#a345">convColor</a>(CRGBA col, GLfloat glcol[4]) +00362 { +00363 <font class="keyword">static</font> <font class="keyword">const</font> <font class="keywordtype">float</font> OO255= 1.0f/255; +00364 glcol[0]= col.R*OO255; +00365 glcol[1]= col.G*OO255; +00366 glcol[2]= col.B*OO255; +00367 glcol[3]= col.A*OO255; +00368 } +00369 +00370 <font class="comment">// ***************************************************************************</font> +<a name="l00371"></a><a class="code" href="classNL3D_1_1CDriverGLStates.html#z420_5">00371</a> <font class="keywordtype">void</font> CDriverGLStates::setVertexColorLighted(<font class="keywordtype">bool</font> enable) +00372 { +00373 <font class="preprocessor">#ifndef NL3D_GLSTATE_DISABLE_CACHE</font> +00374 <font class="preprocessor"></font> <font class="keywordflow">if</font>( enable != <a class="code" href="classNL3D_1_1CDriverGLStates.html#o14">_VertexColorLighted</a>) +00375 <font class="preprocessor">#endif</font> +00376 <font class="preprocessor"></font> { +00377 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o14">_VertexColorLighted</a>= enable; +00378 +00379 <font class="keywordflow">if</font> (_VertexColorLighted) +00380 { +00381 glEnable (GL_COLOR_MATERIAL); +00382 glColorMaterial (GL_FRONT_AND_BACK, GL_DIFFUSE); +00383 } +00384 <font class="keywordflow">else</font> +00385 { +00386 glDisable (GL_COLOR_MATERIAL); +00387 <font class="comment">// Since we leave glColorMaterial mode, GL diffuse is now scracth. reset him to current value.</font> +00388 CRGBA diffCol; +00389 diffCol.R= (uint8)((<a class="code" href="classNL3D_1_1CDriverGLStates.html#o11">_CurDiffuse</a> >> 24) & 255); +00390 diffCol.G= (uint8)((<a class="code" href="classNL3D_1_1CDriverGLStates.html#o11">_CurDiffuse</a> >> 16) & 255); +00391 diffCol.B= (uint8)((<a class="code" href="classNL3D_1_1CDriverGLStates.html#o11">_CurDiffuse</a> >> 8) & 255); +00392 diffCol.A= (uint8)((_CurDiffuse ) & 255); +00393 GLfloat glColor[4]; +00394 <a class="code" href="namespaceNL3D.html#a345">convColor</a>(diffCol, glColor); +00395 glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, glColor); +00396 } +00397 } +00398 } +00399 +00400 <font class="comment">// ***************************************************************************</font> +<a name="l00401"></a><a class="code" href="classNL3D_1_1CDriverGLStates.html#z420_6">00401</a> <font class="keywordtype">void</font> CDriverGLStates::setDepthRange (<font class="keywordtype">float</font> zDelta) +00402 { +00403 <font class="preprocessor">#ifndef NL3D_GLSTATE_DISABLE_CACHE</font> +00404 <font class="preprocessor"></font> <font class="keywordflow">if</font> (zDelta != <a class="code" href="classNL3D_1_1CDriverGLStates.html#o28">_CurZRangeDelta</a>) +00405 <font class="preprocessor">#endif</font> +00406 <font class="preprocessor"></font> { +00407 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o28">_CurZRangeDelta</a> = zDelta; +00408 +00409 <font class="comment">// Setup the range</font> +00410 glDepthRange (zDelta, 1+zDelta); +00411 } +00412 } +00413 +00414 <font class="comment">// ***************************************************************************</font> +<a name="l00415"></a><a class="code" href="classNL3D_1_1CDriverGLStates.html#z420_7">00415</a> <font class="keywordtype">void</font> CDriverGLStates::enableTexGen (uint stage, <font class="keywordtype">bool</font> enable) +00416 { +00417 <font class="preprocessor">#ifndef NL3D_GLSTATE_DISABLE_CACHE</font> +00418 <font class="preprocessor"></font> <font class="keywordflow">if</font> (enable != <a class="code" href="classNL3D_1_1CDriverGLStates.html#o26">_TexGen</a>[stage]) +00419 <font class="preprocessor">#endif</font> +00420 <font class="preprocessor"></font> { +00421 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o26">_TexGen</a>[stage] = enable; +00422 +00423 <font class="comment">// Enable the tex gen</font> +00424 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CDriverGLStates.html#o26">_TexGen</a>[stage]) +00425 { +00426 glEnable( GL_TEXTURE_GEN_S ); +00427 glEnable( GL_TEXTURE_GEN_T ); +00428 glEnable( GL_TEXTURE_GEN_R ); +00429 } +00430 <font class="keywordflow">else</font> +00431 { +00432 glDisable( GL_TEXTURE_GEN_S ); +00433 glDisable( GL_TEXTURE_GEN_T ); +00434 glDisable( GL_TEXTURE_GEN_R ); +00435 } +00436 } +00437 } +00438 +00439 <font class="comment">// ***************************************************************************</font> +<a name="l00440"></a><a class="code" href="classNL3D_1_1CDriverGLStates.html#z420_8">00440</a> <font class="keywordtype">void</font> CDriverGLStates::setTexGenMode (uint stage, GLint mode) +00441 { +00442 <font class="preprocessor">#ifndef NL3D_GLSTATE_DISABLE_CACHE</font> +00443 <font class="preprocessor"></font> <font class="keywordflow">if</font> (mode != <a class="code" href="classNL3D_1_1CDriverGLStates.html#o27">_TexGenMode</a>[stage]) +00444 <font class="preprocessor">#endif</font> +00445 <font class="preprocessor"></font> { +00446 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o27">_TexGenMode</a>[stage] = mode; +00447 +00448 glTexGeni( GL_S, GL_TEXTURE_GEN_MODE, mode); +00449 glTexGeni( GL_T, GL_TEXTURE_GEN_MODE, mode); +00450 glTexGeni( GL_R, GL_TEXTURE_GEN_MODE, mode); +00451 } +00452 } +00453 +00454 +00455 +00456 +00457 <font class="comment">// ***************************************************************************</font> +<a name="l00458"></a><a class="code" href="classNL3D_1_1CDriverGLStates.html#z421_5">00458</a> <font class="keywordtype">void</font> CDriverGLStates::resetTextureMode() +00459 { +00460 glDisable(GL_TEXTURE_2D); +00461 <font class="keywordflow">if</font> (_TextureCubeMapSupported) +00462 { +00463 glDisable(GL_TEXTURE_CUBE_MAP_ARB); +00464 } +00465 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o17">_TextureMode</a>[<a class="code" href="classNL3D_1_1CDriverGLStates.html#o16">_CurrentActiveTextureARB</a>]= <a class="code" href="classNL3D_1_1CDriverGLStates.html#z421_0s0">TextureDisabled</a>; +00466 } +00467 +00468 +00469 <font class="comment">// ***************************************************************************</font> +<a name="l00470"></a><a class="code" href="classNL3D_1_1CDriverGLStates.html#z421_4">00470</a> <font class="keywordtype">void</font> CDriverGLStates::setTextureMode(TTextureMode texMode) +00471 { +00472 <a class="code" href="classNL3D_1_1CDriverGLStates.html#z421_0">TTextureMode</a> oldTexMode = <a class="code" href="classNL3D_1_1CDriverGLStates.html#o17">_TextureMode</a>[<a class="code" href="classNL3D_1_1CDriverGLStates.html#o16">_CurrentActiveTextureARB</a>]; +00473 <font class="keywordflow">if</font>(oldTexMode != texMode) +00474 { +00475 <font class="comment">// Disable first old mode.</font> +00476 <font class="keywordflow">if</font>(oldTexMode == <a class="code" href="classNL3D_1_1CDriverGLStates.html#z421_0s1">Texture2D</a>) +00477 glDisable(GL_TEXTURE_2D); +00478 <font class="keywordflow">else</font> <font class="keywordflow">if</font>(oldTexMode == <a class="code" href="classNL3D_1_1CDriverGLStates.html#z421_0s2">TextureCubeMap</a>) +00479 { +00480 <font class="keywordflow">if</font>(_TextureCubeMapSupported) +00481 glDisable(GL_TEXTURE_CUBE_MAP_ARB); +00482 <font class="keywordflow">else</font> +00483 glDisable(GL_TEXTURE_2D); +00484 } +00485 +00486 <font class="comment">// Enable new mode.</font> +00487 <font class="keywordflow">if</font>(texMode == <a class="code" href="classNL3D_1_1CDriverGLStates.html#z421_0s1">Texture2D</a>) +00488 glEnable(GL_TEXTURE_2D); +00489 <font class="keywordflow">else</font> <font class="keywordflow">if</font>(texMode == <a class="code" href="classNL3D_1_1CDriverGLStates.html#z421_0s2">TextureCubeMap</a>) +00490 { +00491 <font class="keywordflow">if</font>(_TextureCubeMapSupported) +00492 glEnable(GL_TEXTURE_CUBE_MAP_ARB); +00493 <font class="keywordflow">else</font> +00494 glDisable(GL_TEXTURE_2D); +00495 } +00496 +00497 <font class="comment">// new mode.</font> +00498 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o17">_TextureMode</a>[<a class="code" href="classNL3D_1_1CDriverGLStates.html#o16">_CurrentActiveTextureARB</a>]= texMode; +00499 } +00500 } +00501 +00502 +00503 <font class="comment">// ***************************************************************************</font> +<a name="l00504"></a><a class="code" href="classNL3D_1_1CDriverGLStates.html#z421_1">00504</a> <font class="keywordtype">void</font> CDriverGLStates::activeTextureARB(uint stage) +00505 { +00506 <font class="keywordflow">if</font>( <a class="code" href="classNL3D_1_1CDriverGLStates.html#o16">_CurrentActiveTextureARB</a> != stage ) +00507 { +00508 <a class="code" href="driver__opengl__extension_8h.html#a0">nglActiveTextureARB</a>(GL_TEXTURE0_ARB+stage); +00509 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o16">_CurrentActiveTextureARB</a>= stage; +00510 } +00511 } +00512 +00513 <font class="comment">// ***************************************************************************</font> +<a name="l00514"></a><a class="code" href="classNL3D_1_1CDriverGLStates.html#z421_2">00514</a> <font class="keywordtype">void</font> CDriverGLStates::forceActiveTextureARB(uint stage) +00515 { +00516 <a class="code" href="driver__opengl__extension_8h.html#a0">nglActiveTextureARB</a>(GL_TEXTURE0_ARB+stage); +00517 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o16">_CurrentActiveTextureARB</a>= stage; +00518 } +00519 +00520 +00521 <font class="comment">// ***************************************************************************</font> +<a name="l00522"></a><a class="code" href="classNL3D_1_1CDriverGLStates.html#z422_0">00522</a> <font class="keywordtype">void</font> CDriverGLStates::enableVertexArray(<font class="keywordtype">bool</font> enable) +00523 { +00524 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CDriverGLStates.html#o18">_VertexArrayEnabled</a> != enable) +00525 { +00526 <font class="keywordflow">if</font>(enable) +00527 glEnableClientState(GL_VERTEX_ARRAY); +00528 <font class="keywordflow">else</font> +00529 glDisableClientState(GL_VERTEX_ARRAY); +00530 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o18">_VertexArrayEnabled</a>= enable; +00531 } +00532 } +00533 <font class="comment">// ***************************************************************************</font> +<a name="l00534"></a><a class="code" href="classNL3D_1_1CDriverGLStates.html#z422_1">00534</a> <font class="keywordtype">void</font> CDriverGLStates::enableNormalArray(<font class="keywordtype">bool</font> enable) +00535 { +00536 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CDriverGLStates.html#o19">_NormalArrayEnabled</a> != enable) +00537 { +00538 <font class="keywordflow">if</font>(enable) +00539 glEnableClientState(GL_NORMAL_ARRAY); +00540 <font class="keywordflow">else</font> +00541 glDisableClientState(GL_NORMAL_ARRAY); +00542 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o19">_NormalArrayEnabled</a>= enable; +00543 } +00544 } +00545 <font class="comment">// ***************************************************************************</font> +<a name="l00546"></a><a class="code" href="classNL3D_1_1CDriverGLStates.html#z422_2">00546</a> <font class="keywordtype">void</font> CDriverGLStates::enableWeightArray(<font class="keywordtype">bool</font> enable) +00547 { +00548 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CDriverGLStates.html#o20">_WeightArrayEnabled</a> != enable) +00549 { +00550 <font class="keywordflow">if</font>(enable) +00551 glEnableClientState(GL_VERTEX_WEIGHTING_EXT); +00552 <font class="keywordflow">else</font> +00553 glDisableClientState(GL_VERTEX_WEIGHTING_EXT); +00554 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o20">_WeightArrayEnabled</a>= enable; +00555 } +00556 } +00557 <font class="comment">// ***************************************************************************</font> +<a name="l00558"></a><a class="code" href="classNL3D_1_1CDriverGLStates.html#z422_3">00558</a> <font class="keywordtype">void</font> CDriverGLStates::enableColorArray(<font class="keywordtype">bool</font> enable) +00559 { +00560 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CDriverGLStates.html#o21">_ColorArrayEnabled</a> != enable) +00561 { +00562 <font class="keywordflow">if</font>(enable) +00563 glEnableClientState(GL_COLOR_ARRAY); +00564 <font class="keywordflow">else</font> +00565 glDisableClientState(GL_COLOR_ARRAY); +00566 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o21">_ColorArrayEnabled</a>= enable; +00567 } +00568 } +00569 +00570 +00571 <font class="comment">// ***************************************************************************</font> +<a name="l00572"></a><a class="code" href="classNL3D_1_1CDriverGLStates.html#z422_4">00572</a> <font class="keywordtype">void</font> CDriverGLStates::enableSecondaryColorArray(<font class="keywordtype">bool</font> enable) +00573 { +00574 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CDriverGLStates.html#o22">_SecondaryColorArrayEnabled</a> != enable) +00575 { +00576 <font class="keywordflow">if</font>(enable) +00577 glEnableClientState(GL_SECONDARY_COLOR_ARRAY_EXT); +00578 <font class="keywordflow">else</font> +00579 glDisableClientState(GL_SECONDARY_COLOR_ARRAY_EXT); +00580 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o22">_SecondaryColorArrayEnabled</a>= enable; +00581 } +00582 } +00583 +00584 <font class="comment">// ***************************************************************************</font> +<a name="l00585"></a><a class="code" href="classNL3D_1_1CDriverGLStates.html#z422_5">00585</a> <font class="keywordtype">void</font> CDriverGLStates::clientActiveTextureARB(uint stage) +00586 { +00587 <font class="keywordflow">if</font>( <a class="code" href="classNL3D_1_1CDriverGLStates.html#o23">_CurrentClientActiveTextureARB</a> != stage ) +00588 { +00589 <a class="code" href="driver__opengl__extension_8h.html#a1">nglClientActiveTextureARB</a>(GL_TEXTURE0_ARB+stage); +00590 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o23">_CurrentClientActiveTextureARB</a>= stage; +00591 } +00592 } +00593 +00594 <font class="comment">// ***************************************************************************</font> +<a name="l00595"></a><a class="code" href="classNL3D_1_1CDriverGLStates.html#z422_6">00595</a> <font class="keywordtype">void</font> CDriverGLStates::enableTexCoordArray(<font class="keywordtype">bool</font> enable) +00596 { +00597 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CDriverGLStates.html#o24">_TexCoordArrayEnabled</a>[<a class="code" href="classNL3D_1_1CDriverGLStates.html#o23">_CurrentClientActiveTextureARB</a>] != enable) +00598 { +00599 <font class="keywordflow">if</font>(enable) +00600 glEnableClientState(GL_TEXTURE_COORD_ARRAY); +00601 <font class="keywordflow">else</font> +00602 glDisableClientState(GL_TEXTURE_COORD_ARRAY); +00603 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o24">_TexCoordArrayEnabled</a>[<a class="code" href="classNL3D_1_1CDriverGLStates.html#o23">_CurrentClientActiveTextureARB</a>]= enable; +00604 } +00605 } +00606 +00607 <font class="comment">// ***************************************************************************</font> +<a name="l00608"></a><a class="code" href="classNL3D_1_1CDriverGLStates.html#z422_7">00608</a> <font class="keywordtype">void</font> CDriverGLStates::enableVertexAttribArray(uint glIndex, <font class="keywordtype">bool</font> enable) +00609 { +00610 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CDriverGLStates.html#o25">_VertexAttribArrayEnabled</a>[glIndex] != enable) +00611 { +00612 <font class="keywordflow">if</font>(enable) +00613 glEnableClientState(glIndex+<a class="code" href="driver__opengl__extension__def_8h.html#a36">GL_VERTEX_ATTRIB_ARRAY0_NV</a>); +00614 <font class="keywordflow">else</font> +00615 glDisableClientState(glIndex+<a class="code" href="driver__opengl__extension__def_8h.html#a36">GL_VERTEX_ATTRIB_ARRAY0_NV</a>); +00616 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o25">_VertexAttribArrayEnabled</a>[glIndex]= enable; +00617 } +00618 } +00619 +00620 +00621 <font class="comment">// ***************************************************************************</font> +<a name="l00622"></a><a class="code" href="classNL3D_1_1CDriverGLStates.html#z422_8">00622</a> <font class="keywordtype">void</font> CDriverGLStates::enableVertexAttribArrayForEXTVertexShader(uint glIndex, <font class="keywordtype">bool</font> enable, uint *variants) +00623 { +00624 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CDriverGLStates.html#o25">_VertexAttribArrayEnabled</a>[glIndex] != enable) +00625 { +00626 <font class="keywordflow">switch</font>(glIndex) +00627 { +00628 <font class="keywordflow">case</font> 0: <font class="comment">// position </font> +00629 <a class="code" href="classNL3D_1_1CDriverGLStates.html#z422_0">enableVertexArray</a>(enable); +00630 <font class="keywordflow">break</font>; +00631 <font class="keywordflow">case</font> 1: <font class="comment">// skin weight</font> +00632 <font class="keywordflow">if</font>(enable) +00633 <a class="code" href="driver__opengl__extension_8h.html#a132">nglEnableVariantClientStateEXT</a>(variants[CDriverGL::EVSSkinWeightVariant]); +00634 <font class="keywordflow">else</font> +00635 <a class="code" href="driver__opengl__extension_8h.html#a133">nglDisableVariantClientStateEXT</a>(variants[CDriverGL::EVSSkinWeightVariant]); +00636 <font class="keywordflow">break</font>; +00637 <font class="keywordflow">case</font> 2: <font class="comment">// normal</font> +00638 <a class="code" href="classNL3D_1_1CDriverGLStates.html#z422_1">enableNormalArray</a>(enable); +00639 <font class="keywordflow">break</font>; +00640 <font class="keywordflow">case</font> 3: <font class="comment">// color</font> +00641 <a class="code" href="classNL3D_1_1CDriverGLStates.html#z422_3">enableColorArray</a>(enable); +00642 <font class="keywordflow">break</font>; +00643 <font class="keywordflow">case</font> 4: <font class="comment">// secondary color</font> +00644 <font class="keywordflow">if</font>(enable) +00645 <a class="code" href="driver__opengl__extension_8h.html#a132">nglEnableVariantClientStateEXT</a>(variants[CDriverGL::EVSSecondaryColorVariant]); +00646 <font class="keywordflow">else</font> +00647 <a class="code" href="driver__opengl__extension_8h.html#a133">nglDisableVariantClientStateEXT</a>(variants[CDriverGL::EVSSecondaryColorVariant]); +00648 <font class="keywordflow">break</font>; +00649 <font class="keywordflow">case</font> 5: <font class="comment">// fog coordinate</font> +00650 <font class="keywordflow">if</font>(enable) +00651 <a class="code" href="driver__opengl__extension_8h.html#a132">nglEnableVariantClientStateEXT</a>(variants[CDriverGL::EVSFogCoordsVariant]); +00652 <font class="keywordflow">else</font> +00653 <a class="code" href="driver__opengl__extension_8h.html#a133">nglDisableVariantClientStateEXT</a>(variants[CDriverGL::EVSFogCoordsVariant]); +00654 <font class="keywordflow">break</font>; +00655 <font class="keywordflow">case</font> 6: <font class="comment">// palette skin</font> +00656 <font class="keywordflow">if</font>(enable) +00657 <a class="code" href="driver__opengl__extension_8h.html#a132">nglEnableVariantClientStateEXT</a>(variants[CDriverGL::EVSPaletteSkinVariant]); +00658 <font class="keywordflow">else</font> +00659 <a class="code" href="driver__opengl__extension_8h.html#a133">nglDisableVariantClientStateEXT</a>(variants[CDriverGL::EVSPaletteSkinVariant]); +00660 <font class="keywordflow">break</font>; +00661 <font class="keywordflow">case</font> 7: <font class="comment">// empty</font> +00662 <a class="code" href="debug_8h.html#a12">nlstop</a> +00663 <font class="keywordflow">break</font>; +00664 <font class="keywordflow">case</font> 8: +00665 <font class="keywordflow">case</font> 9: +00666 <font class="keywordflow">case</font> 10: +00667 <font class="keywordflow">case</font> 11: +00668 <font class="keywordflow">case</font> 12: +00669 <font class="keywordflow">case</font> 13: +00670 <font class="keywordflow">case</font> 14: +00671 <font class="keywordflow">case</font> 15: +00672 <a class="code" href="classNL3D_1_1CDriverGLStates.html#z422_5">clientActiveTextureARB</a>(glIndex - 8); +00673 <a class="code" href="classNL3D_1_1CDriverGLStates.html#z422_6">enableTexCoordArray</a>(enable); +00674 <font class="keywordflow">break</font>; +00675 <font class="keywordflow">default</font>: +00676 <a class="code" href="debug_8h.html#a12">nlstop</a>; <font class="comment">// invalid value</font> +00677 <font class="keywordflow">break</font>; +00678 } +00679 <a class="code" href="classNL3D_1_1CDriverGLStates.html#o25">_VertexAttribArrayEnabled</a>[glIndex]= enable; +00680 } +00681 } +00682 +00683 +00684 +00685 } <font class="comment">// NL3D</font> +</pre></div> + +<!-- footer --> +<BR><FONT Size=+5> </FONT> +</TD> +<TD WIDTH=15><IMG SRC=http://www.nevrax.org/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD> +</TR> +</TABLE> +</BODY> +</HTML> |