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_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_8cpp-source.html')
-rw-r--r-- | docs/doxygen/nel/driver__opengl_8cpp-source.html | 2443 |
1 files changed, 2443 insertions, 0 deletions
diff --git a/docs/doxygen/nel/driver__opengl_8cpp-source.html b/docs/doxygen/nel/driver__opengl_8cpp-source.html new file mode 100644 index 00000000..a4db00b3 --- /dev/null +++ b/docs/doxygen/nel/driver__opengl_8cpp-source.html @@ -0,0 +1,2443 @@ +<!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.cpp</h1><a href="driver__opengl_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 +00009 <font class="comment">/* Copyright, 2000 Nevrax Ltd.</font> +00010 <font class="comment"> *</font> +00011 <font class="comment"> * This file is part of NEVRAX NEL.</font> +00012 <font class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify</font> +00013 <font class="comment"> * it under the terms of the GNU General Public License as published by</font> +00014 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option)</font> +00015 <font class="comment"> * any later version.</font> +00016 <font class="comment"></font> +00017 <font class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but</font> +00018 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font> +00019 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font> +00020 <font class="comment"> * General Public License for more details.</font> +00021 <font class="comment"></font> +00022 <font class="comment"> * You should have received a copy of the GNU General Public License</font> +00023 <font class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the</font> +00024 <font class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</font> +00025 <font class="comment"> * MA 02111-1307, USA.</font> +00026 <font class="comment"> */</font> +00027 +00028 <font class="preprocessor">#include "<a class="code" href="stdopengl_8h.html">stdopengl.h</a>"</font> +00029 +00030 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font> +00031 <font class="preprocessor"></font> +00032 <font class="preprocessor">#define WIN32_LEAN_AND_MEAN</font> +00033 <font class="preprocessor"></font><font class="preprocessor">#include <windows.h></font> +00034 <font class="preprocessor">#include <windowsx.h></font> +00035 <font class="preprocessor">#include <string></font> +00036 +00037 +00038 <font class="preprocessor">#else // NL_OS_UNIX</font> +00039 <font class="preprocessor"></font> +00040 <font class="preprocessor">#include <GL/glx.h></font> +00041 +00042 <font class="preprocessor">#endif // NL_OS_UNIX</font> +00043 <font class="preprocessor"></font> +00044 <font class="preprocessor">#include <vector></font> +00045 <font class="preprocessor">#include <GL/gl.h></font> +00046 +00047 <font class="preprocessor">#include "<a class="code" href="viewport_8h.html">nel/3d/viewport.h</a>"</font> +00048 <font class="preprocessor">#include "<a class="code" href="scissor_8h.html">nel/3d/scissor.h</a>"</font> +00049 <font class="preprocessor">#include "<a class="code" href="u__driver_8h.html">nel/3d/u_driver.h</a>"</font> +00050 <font class="preprocessor">#include "<a class="code" href="vertex__buffer_8h.html">3d/vertex_buffer.h</a>"</font> +00051 <font class="preprocessor">#include "<a class="code" href="light_8h.html">3d/light.h</a>"</font> +00052 <font class="preprocessor">#include "<a class="code" href="3d_2primitive__block_8h.html">3d/primitive_block.h</a>"</font> +00053 <font class="preprocessor">#include "<a class="code" href="rect_8h.html">nel/misc/rect.h</a>"</font> +00054 <font class="preprocessor">#include "<a class="code" href="di__event__emitter_8h.html">nel/misc/di_event_emitter.h</a>"</font> +00055 <font class="preprocessor">#include "<a class="code" href="driver__opengl__vertex__buffer__hard_8h.html">driver_opengl_vertex_buffer_hard.h</a>"</font> +00056 +00057 +00058 <font class="keyword">using</font> <font class="keyword">namespace </font>std; +00059 <font class="keyword">using</font> <font class="keyword">namespace </font>NLMISC; +00060 +00061 +00062 +00063 <font class="comment">// ***************************************************************************</font> +00064 <font class="comment">// try to allocate 16Mo by default of AGP Ram.</font> +<a name="l00065"></a><a class="code" href="driver__opengl_8cpp.html#a0">00065</a> <font class="preprocessor">#define NL3D_DRV_VERTEXARRAY_AGP_INIT_SIZE (16384*1024)</font> +00066 <font class="preprocessor"></font> +00067 +00068 <font class="comment">// ***************************************************************************</font> +00069 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font> +00070 <font class="preprocessor"></font><font class="comment">// dllmain::</font> +00071 BOOL WINAPI <a class="code" href="memory_8cpp.html#a0">DllMain</a>(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) +00072 { +00073 <font class="keywordflow">if</font> (fdwReason == DLL_PROCESS_ATTACH) +00074 { +00075 <font class="comment">// Yoyo: Vianney change: don't need to call initDebug() anymore.</font> +00076 <font class="comment">// initDebug();</font> +00077 } +00078 <font class="keywordflow">return</font> <font class="keyword">true</font>; +00079 } +00080 <font class="preprocessor">#endif</font> +00081 <font class="preprocessor"></font> +00082 +00083 <font class="keyword">namespace </font>NL3D +00084 { +00085 +00086 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font> +00087 <font class="preprocessor"></font>uint CDriverGL::_Registered=0; +00088 <font class="preprocessor">#endif // NL_OS_WINDOWS</font> +00089 <font class="preprocessor"></font> +00090 <font class="comment">// Version of the driver. Not the interface version!! Increment when implementation of the driver change.</font> +<a name="l00091"></a><a class="code" href="classNL3D_1_1CDriverGL.html#r0">00091</a> <font class="keyword">const</font> uint32 CDriverGL::ReleaseVersion = 0x8; +00092 +00093 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font> +00094 <font class="preprocessor"></font> +00095 <a class="code" href="namespaceNLSOUND.html#a78">__declspec</a>(dllexport) IDriver* NL3D_createIDriverInstance () +00096 { +00097 <font class="keywordflow">return</font> <font class="keyword">new</font> CDriverGL; +00098 } +00099 +00100 <a class="code" href="namespaceNLSOUND.html#a78">__declspec</a>(dllexport) uint32 NL3D_interfaceVersion () +00101 { +00102 <font class="keywordflow">return</font> IDriver::InterfaceVersion; +00103 } +00104 +00105 <font class="keyword">static</font> <font class="keywordtype">void</font> GlWndProc(CDriverGL *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +00106 { +00107 <font class="keywordflow">if</font>(message == WM_SIZE) +00108 { +00109 RECT rect; +00110 <font class="keywordflow">if</font> (driver != NULL) +00111 { +00112 GetClientRect (driver->_hWnd, &rect); +00113 +00114 <font class="comment">// Setup gl viewport</font> +00115 driver->_WindowWidth = rect.right-rect.left; +00116 driver->_WindowHeight = rect.bottom-rect.top; +00117 } +00118 } +00119 +00120 <font class="keywordflow">if</font> (driver->_EventEmitter.getNumEmitters() > 0) +00121 { +00122 CWinEventEmitter *we = NLMISC::safe_cast<CWinEventEmitter *>(driver->_EventEmitter.getEmitter(0)); +00123 <font class="comment">// Process the message by the emitter</font> +00124 we->setHWnd((uint32)hWnd); +00125 we->processMessage ((uint32)hWnd, message, wParam, lParam); +00126 } +00127 } +00128 +00129 <font class="keyword">static</font> LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +00130 { +00131 <font class="comment">// Get the driver pointer..</font> +00132 CDriverGL *pDriver=(CDriverGL*)GetWindowLong (hWnd, GWL_USERDATA); +00133 <font class="keywordflow">if</font> (pDriver != NULL) +00134 { +00135 GlWndProc (pDriver, hWnd, message, wParam, lParam); +00136 } +00137 <font class="keywordflow">return</font> DefWindowProc(hWnd, message, wParam, lParam); +00138 } +00139 +00140 <font class="preprocessor">#elif defined (NL_OS_UNIX)</font> +00141 <font class="preprocessor"></font> +00142 <font class="keyword">extern</font> <font class="stringliteral">"C"</font> +00143 { +00144 IDriver* NL3D_createIDriverInstance () +00145 { +00146 <font class="keywordflow">return</font> <font class="keyword">new</font> CDriverGL; +00147 } +00148 +00149 uint32 NL3D_interfaceVersion () +00150 { +00151 <font class="keywordflow">return</font> IDriver::InterfaceVersion; +00152 } +00153 } +00154 <font class="comment">/*</font> +00155 <font class="comment">static Bool WndProc(Display *d, XEvent *e, char *arg)</font> +00156 <font class="comment">{</font> +00157 <font class="comment"> nlinfo("glop %d %d", e->type, e->xmap.window);</font> +00158 <font class="comment"> CDriverGL *pDriver = (CDriverGL*)arg;</font> +00159 <font class="comment"> if (pDriver != NULL)</font> +00160 <font class="comment"> {</font> +00161 <font class="comment"> // Process the message by the emitter</font> +00162 <font class="comment"> pDriver->_EventEmitter.processMessage();</font> +00163 <font class="comment"> }</font> +00164 <font class="comment"> // TODO i'don t know what to return exactly</font> +00165 <font class="comment"> return (e->type == MapNotify) && (e->xmap.window == (Window) arg);</font> +00166 <font class="comment">}</font> +00167 <font class="comment">*/</font> +00168 <font class="preprocessor">#endif // NL_OS_UNIX</font> +00169 <font class="preprocessor"></font> +00170 +00171 <font class="comment">// ***************************************************************************</font> +<a name="l00172"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a1">00172</a> CDriverGL::CDriverGL() +00173 { +00174 <a class="code" href="classNL3D_1_1CDriverGL.html#o1">_OffScreen</a> = <font class="keyword">false</font>; +00175 +00176 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font> +00177 <font class="preprocessor"></font> _PBuffer = NULL; +00178 _hWnd = NULL; +00179 _hRC = NULL; +00180 _hDC = NULL; +00181 _NeedToRestaureGammaRamp = <font class="keyword">false</font>; +00182 <font class="preprocessor">#elif defined (NL_OS_UNIX) // NL_OS_WINDOWS</font> +00183 <font class="preprocessor"></font> +00184 cursor = None; +00185 +00186 <font class="preprocessor">#ifdef XF86VIDMODE</font> +00187 <font class="preprocessor"></font> <font class="comment">// zero the old screen mode</font> +00188 memset(&_OldScreenMode, 0, <font class="keyword">sizeof</font>(_OldScreenMode)); +00189 <font class="preprocessor">#endif //XF86VIDMODE</font> +00190 <font class="preprocessor"></font> +00191 <font class="preprocessor">#endif // NL_OS_UNIX</font> +00192 <font class="preprocessor"></font> +00193 <a class="code" href="classNL3D_1_1CDriverGL.html#o0">_FullScreen</a>= <font class="keyword">false</font>; +00194 +00195 <a class="code" href="classNL3D_1_1CDriverGL.html#z405_2">_CurrentMaterial</a>=NULL; +00196 <a class="code" href="classNL3D_1_1CDriverGL.html#o2">_Initialized</a> = <font class="keyword">false</font>; +00197 +00198 <a class="code" href="classNL3D_1_1CDriverGL.html#o16">_FogEnabled</a>= <font class="keyword">false</font>; +00199 <a class="code" href="classNL3D_1_1CDriverGL.html#o17">_CurrentFogColor</a>[0]= 0; +00200 <a class="code" href="classNL3D_1_1CDriverGL.html#o17">_CurrentFogColor</a>[1]= 0; +00201 <a class="code" href="classNL3D_1_1CDriverGL.html#o17">_CurrentFogColor</a>[2]= 0; +00202 <a class="code" href="classNL3D_1_1CDriverGL.html#o17">_CurrentFogColor</a>[3]= 0; +00203 +00204 +00205 <a class="code" href="classNL3D_1_1CDriverGL.html#o5">_LightSetupDirty</a>= <font class="keyword">false</font>; +00206 <a class="code" href="classNL3D_1_1CDriverGL.html#o6">_ModelViewMatrixDirty</a>= <font class="keyword">false</font>; +00207 <a class="code" href="classNL3D_1_1CDriverGL.html#o9">_RenderSetupDirty</a>= <font class="keyword">false</font>; +00208 +00209 +00210 <a class="code" href="classNL3D_1_1CDriverGL.html#o23">_CurrentGlNormalize</a>= <font class="keyword">false</font>; +00211 <a class="code" href="classNL3D_1_1CDriverGL.html#o4">_ForceNormalize</a>= <font class="keyword">false</font>; +00212 +00213 <a class="code" href="classNL3D_1_1CDriverGL.html#z411_10">_AGPVertexArrayRange</a>= NULL; +00214 <a class="code" href="classNL3D_1_1CDriverGL.html#z411_11">_VRAMVertexArrayRange</a>= NULL; +00215 <a class="code" href="classNL3D_1_1CDriverGL.html#z411_3">_CurrentVertexArrayRange</a>= NULL; +00216 <a class="code" href="classNL3D_1_1CDriverGL.html#z411_4">_CurrentVertexBufferHard</a>= NULL; +00217 <a class="code" href="classNL3D_1_1CDriverGL.html#z411_5">_NVCurrentVARPtr</a>= NULL; +00218 <a class="code" href="classNL3D_1_1CDriverGL.html#z411_6">_NVCurrentVARSize</a>= 0; +00219 <a class="code" href="classNL3D_1_1CDriverGL.html#z411_7">_SupportVBHard</a>= <font class="keyword">false</font>; +00220 <a class="code" href="classNL3D_1_1CDriverGL.html#z411_8">_SlowUnlockVBHard</a>= <font class="keyword">false</font>; +00221 <a class="code" href="classNL3D_1_1CDriverGL.html#z411_9">_MaxVerticesByVBHard</a>= 0; +00222 +00223 <a class="code" href="classNL3D_1_1CDriverGL.html#z412_3">_AllocatedTextureMemory</a>= 0; +00224 +00225 <a class="code" href="classNL3D_1_1CDriverGL.html#o27">_ForceDXTCCompression</a>= <font class="keyword">false</font>; +00226 <a class="code" href="classNL3D_1_1CDriverGL.html#o28">_ForceTextureResizePower</a>= 0; +00227 +00228 <a class="code" href="classNL3D_1_1CDriverGL.html#z412_6">_SumTextureMemoryUsed</a> = <font class="keyword">false</font>; +00229 +00230 <a class="code" href="classNL3D_1_1CDriverGL.html#z405_9">_NVTextureShaderEnabled</a> = <font class="keyword">false</font>; +00231 +00232 +00233 <font class="comment">// Compute the Flag which say if one texture has been changed in CMaterial.</font> +00234 uint i; +00235 <a class="code" href="classNL3D_1_1CDriverGL.html#z405_12">_MaterialAllTextureTouchedFlag</a>= 0; +00236 <font class="keywordflow">for</font>(i=0; i < <a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>; i++) +00237 { +00238 <a class="code" href="classNL3D_1_1CDriverGL.html#z405_12">_MaterialAllTextureTouchedFlag</a>|= <a class="code" href="namespaceNL3D.html#a108">IDRV_TOUCHED_TEX</a>[i]; +00239 <a class="code" href="classNL3D_1_1CDriverGL.html#z405_8">_CurrentTexAddrMode</a>[i] = GL_NONE; +00240 } +00241 +00242 +00243 <a class="code" href="classNL3D_1_1CDriverGL.html#o30">_UserTexMatEnabled</a> = 0; +00244 +00245 <font class="comment">// Ligtmap preca.</font> +00246 <a class="code" href="classNL3D_1_1CDriverGL.html#z407_10">_LastVertexSetupIsLightMap</a>= <font class="keyword">false</font>; +00247 <font class="keywordflow">for</font>(i=0; i < <a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>; i++) +00248 <a class="code" href="classNL3D_1_1CDriverGL.html#z407_11">_LightMapUVMap</a>[i]= -1; +00249 <font class="comment">// reserve enough space to never reallocate, nor test for reallocation.</font> +00250 <a class="code" href="classNL3D_1_1CDriverGL.html#z407_8">_LightMapLUT</a>.resize(<a class="code" href="driver__opengl_8h.html#a1">NL3D_DRV_MAX_LIGHTMAP</a>); +00251 <font class="comment">// must set replace for alpha part.</font> +00252 <a class="code" href="classNL3D_1_1CDriverGL.html#z407_9">_LightMapLastStageEnv</a>.Env.OpAlpha= CMaterial::Replace; +00253 <a class="code" href="classNL3D_1_1CDriverGL.html#z407_9">_LightMapLastStageEnv</a>.Env.SrcArg0Alpha= CMaterial::Texture; +00254 <a class="code" href="classNL3D_1_1CDriverGL.html#z407_9">_LightMapLastStageEnv</a>.Env.OpArg0Alpha= CMaterial::SrcAlpha; +00255 +00256 <a class="code" href="classNL3D_1_1CDriverGL.html#o7">_ProjMatDirty</a> = <font class="keyword">true</font>; +00257 +00258 std::fill(<a class="code" href="classNL3D_1_1CDriverGL.html#z405_10">_StageSupportEMBM</a>, <a class="code" href="classNL3D_1_1CDriverGL.html#z405_10">_StageSupportEMBM</a> + <a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>, <font class="keyword">false</font>); +00259 +00261 +00262 } +00263 +00264 +00265 <font class="comment">// ***************************************************************************</font> +<a name="l00266"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a2">00266</a> CDriverGL::~CDriverGL() +00267 { +00268 <a class="code" href="classNL3D_1_1CDriverGL.html#a58">release</a>(); +00269 } +00270 +00271 <font class="comment">// ***************************************************************************</font> +<a name="l00272"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a3">00272</a> <font class="keywordtype">bool</font> CDriverGL::init() +00273 { +00274 <font class="preprocessor">#ifdef WIN32</font> +00275 <font class="preprocessor"></font> WNDCLASS wc; +00276 +00277 <font class="keywordflow">if</font> (!_Registered) +00278 { +00279 memset(&wc,0,<font class="keyword">sizeof</font>(wc)); +00280 wc.style = CS_HREDRAW | CS_VREDRAW ;<font class="comment">//| CS_DBLCLKS;</font> +00281 wc.lpfnWndProc = (WNDPROC)WndProc; +00282 wc.cbClsExtra = 0; +00283 wc.cbWndExtra = 0; +00284 wc.hInstance = GetModuleHandle(NULL); +00285 wc.hIcon = NULL; +00286 wc.hCursor = LoadCursor(NULL,IDC_ARROW); +00287 wc.hbrBackground = WHITE_BRUSH; +00288 wc.lpszClassName = <font class="stringliteral">"NLClass"</font>; +00289 wc.lpszMenuName = NULL; +00290 <font class="keywordflow">if</font> ( !RegisterClass(&wc) ) +00291 { +00292 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00293 } +00294 _Registered=1; +00295 } +00296 +00297 <font class="comment">// Backup monitor color parameters</font> +00298 HDC dc = CreateDC (<font class="stringliteral">"DISPLAY"</font>, NULL, NULL, NULL); +00299 <font class="keywordflow">if</font> (dc) +00300 { +00301 _NeedToRestaureGammaRamp = GetDeviceGammaRamp (dc, _GammaRampBackuped) != FALSE; +00302 +00303 <font class="comment">// Release the DC</font> +00304 ReleaseDC (NULL, dc); +00305 } +00306 <font class="keywordflow">else</font> +00307 { +00308 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"(CDriverGL::init): can't create DC"</font>); +00309 } +00310 +00311 <font class="preprocessor">#endif</font> +00312 <font class="preprocessor"></font> <font class="keywordflow">return</font> <font class="keyword">true</font>; +00313 } +00314 +00315 <font class="comment">// --------------------------------------------------</font> +00316 +<a name="l00317"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a4">00317</a> <a class="code" href="namespaceNL3D.html#a28">ModeList</a> CDriverGL::enumModes() +00318 { +00319 <a class="code" href="namespaceNL3D.html#a28">ModeList</a> ML; +00320 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font> +00321 <font class="preprocessor"></font> DEVMODE devmode; +00322 sint n; +00323 GfxMode Mode; +00324 +00325 n=0; +00326 <font class="keywordflow">while</font>( EnumDisplaySettings(NULL, n, &devmode) ) +00327 { +00328 Mode.Windowed=<font class="keyword">false</font>; +00329 Mode.Width=(uint16)devmode.dmPelsWidth; +00330 Mode.Height=(uint16)devmode.dmPelsHeight; +00331 Mode.Depth=(uint8)devmode.dmBitsPerPel; +00332 ML.push_back(Mode); +00333 n++; +00334 } +00335 <font class="preprocessor">#endif // NL_OS_WINDOWS</font> +00336 <font class="preprocessor"></font> <font class="keywordflow">return</font> ML; +00337 } +00338 +00339 <font class="comment">// --------------------------------------------------</font> +00340 +<a name="l00341"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a5">00341</a> <font class="keywordtype">void</font> CDriverGL::disableHardwareVertexProgram() +00342 { +00343 <a class="code" href="classNL3D_1_1CDriverGL.html#z403_0">_Extensions</a>.DisableHardwareVertexProgram= <font class="keyword">true</font>; +00344 } +00345 +<a name="l00346"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a6">00346</a> <font class="keywordtype">void</font> CDriverGL::disableHardwareVertexArrayAGP() +00347 { +00348 <a class="code" href="classNL3D_1_1CDriverGL.html#z403_0">_Extensions</a>.DisableHardwareVertexArrayAGP= <font class="keyword">true</font>; +00349 } +00350 +<a name="l00351"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a7">00351</a> <font class="keywordtype">void</font> CDriverGL::disableHardwareTextureShader() +00352 { +00353 <a class="code" href="classNL3D_1_1CDriverGL.html#z403_0">_Extensions</a>.DisableHardwareTextureShader= <font class="keyword">true</font>; +00354 } +00355 +00356 <font class="comment">// --------------------------------------------------</font> +00357 +<a name="l00358"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a8">00358</a> <font class="keywordtype">bool</font> CDriverGL::setDisplay(<font class="keywordtype">void</font> *wnd, <font class="keyword">const</font> GfxMode &mode) <font class="keywordflow">throw</font>(EBadDisplay) +00359 { +00360 uint <a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a> = mode.Width; +00361 uint <a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a> = mode.Height; +00362 +00363 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font> +00364 <font class="preprocessor"></font> +00365 <font class="comment">// Driver caps.</font> +00366 <font class="comment">//=============</font> +00367 <font class="comment">// Retrieve the WGL extensions before init the driver.</font> +00368 <font class="keywordtype">int</font> pf; +00369 +00370 _OffScreen = mode.OffScreen; +00371 +00372 <font class="comment">// Init pointers</font> +00373 _PBuffer = NULL; +00374 _hWnd = NULL; +00375 _WindowWidth = _WindowHeight = 0; +00376 _hRC = NULL; +00377 _hDC = NULL; +00378 +00379 <font class="comment">// Offscreen mode ?</font> +00380 <font class="keywordflow">if</font> (_OffScreen) +00381 { +00382 <font class="comment">// Get a hdc</font> +00383 +00384 ULONG WndFlags=WS_OVERLAPPEDWINDOW+WS_CLIPCHILDREN+WS_CLIPSIBLINGS; +00385 WndFlags&=~WS_VISIBLE; +00386 RECT WndRect; +00387 WndRect.left=0; +00388 WndRect.top=0; +00389 WndRect.right=<a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>; +00390 WndRect.bottom=<a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>; +00391 AdjustWindowRect(&WndRect,WndFlags,FALSE); +00392 HWND tmpHWND = CreateWindow( <font class="stringliteral">"NLClass"</font>, +00393 <font class="stringliteral">""</font>, +00394 WndFlags, +00395 CW_USEDEFAULT,CW_USEDEFAULT, +00396 WndRect.right,WndRect.bottom, +00397 NULL, +00398 NULL, +00399 GetModuleHandle(NULL), +00400 NULL); +00401 <font class="keywordflow">if</font> (!tmpHWND) +00402 { +00403 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"CDriverGL::setDisplay: CreateWindow failed"</font>); +00404 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00405 } +00406 +00407 <font class="comment">// resize the window</font> +00408 RECT rc; +00409 SetRect (&rc, 0, 0, <a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>); +00410 _WindowWidth = <a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>; +00411 _WindowHeight = <a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>; +00412 AdjustWindowRectEx (&rc, GetWindowStyle (_hWnd), GetMenu (_hWnd) != NULL, GetWindowExStyle (_hWnd)); +00413 SetWindowPos (_hWnd, NULL, 0, 0, rc.right - rc.left, rc.bottom - rc.top, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE ); +00414 +00415 <font class="comment">// Get the </font> +00416 HDC tempHDC = GetDC(tmpHWND); +00417 +00418 _Depth=GetDeviceCaps(tempHDC,BITSPIXEL); +00419 +00420 <font class="comment">// ---</font> +00421 memset(&_pfd,0,<font class="keyword">sizeof</font>(_pfd)); +00422 _pfd.nSize = <font class="keyword">sizeof</font>(_pfd); +00423 _pfd.nVersion = 1; +00424 _pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; +00425 _pfd.iPixelType = PFD_TYPE_RGBA; +00426 _pfd.cColorBits = (char)_Depth; +00427 +00428 <font class="comment">// Choose best suited Depth Buffer.</font> +00429 <font class="keywordflow">if</font>(_Depth<=16) +00430 { +00431 _pfd.cDepthBits = 16; +00432 } +00433 <font class="keywordflow">else</font> +00434 { +00435 _pfd.cDepthBits = 24; +00436 _pfd.cAlphaBits = 8; +00437 } +00438 _pfd.iLayerType = PFD_MAIN_PLANE; +00439 pf=ChoosePixelFormat(tempHDC,&_pfd); +00440 <font class="keywordflow">if</font> (!pf) +00441 { +00442 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"CDriverGL::setDisplay: ChoosePixelFormat failed"</font>); +00443 DestroyWindow (tmpHWND); +00444 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00445 } +00446 <font class="keywordflow">if</font> ( !SetPixelFormat(tempHDC,pf,&_pfd) ) +00447 { +00448 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"CDriverGL::setDisplay: SetPixelFormat failed"</font>); +00449 DestroyWindow (tmpHWND); +00450 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00451 } +00452 +00453 <font class="comment">// Create gl context</font> +00454 HGLRC tempGLRC = wglCreateContext(tempHDC); +00455 <font class="keywordflow">if</font> (tempGLRC == NULL) +00456 { +00457 DWORD error = GetLastError (); +00458 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"CDriverGL::setDisplay: wglCreateContext failed: 0x%x"</font>, error); +00459 DestroyWindow (tmpHWND); +00460 _PBuffer = NULL; +00461 _hWnd = NULL; +00462 _hRC = NULL; +00463 _hDC = NULL; +00464 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00465 } +00466 +00467 <font class="comment">// Make the context current</font> +00468 <font class="keywordflow">if</font> (!wglMakeCurrent(tempHDC,tempGLRC)) +00469 { +00470 DWORD error = GetLastError (); +00471 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"CDriverGL::setDisplay: wglMakeCurrent failed: 0x%x"</font>, error); +00472 wglDeleteContext (tempGLRC); +00473 DestroyWindow (tmpHWND); +00474 _PBuffer = NULL; +00475 _hWnd = NULL; +00476 _hRC = NULL; +00477 _hDC = NULL; +00478 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00479 } +00480 +00481 <font class="comment">// Register WGL functions</font> +00482 registerWGlExtensions (_Extensions, tempHDC); +00483 +00484 HDC hdc = wglGetCurrentDC (); +00485 <font class="keywordflow">if</font> (hdc == NULL) +00486 { +00487 DWORD error = GetLastError (); +00488 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"CDriverGL::setDisplay: wglGetCurrentDC failed: 0x%x"</font>, error); +00489 DestroyWindow (tmpHWND); +00490 _PBuffer = NULL; +00491 _hWnd = NULL; +00492 _hRC = NULL; +00493 _hDC = NULL; +00494 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00495 } +00496 +00497 <font class="comment">// Get ready to query for a suitable pixel format that meets our</font> +00498 <font class="comment">// minimum requirements.</font> +00499 <font class="keywordtype">int</font> iattributes[2*20]; +00500 <font class="keywordtype">float</font> fattributes[2*20]; +00501 <font class="keywordtype">int</font> nfattribs = 0; +00502 <font class="keywordtype">int</font> niattribs = 0; +00503 +00504 <font class="comment">// Attribute arrays must be “0” terminated – for simplicity, first</font> +00505 <font class="comment">// just zero-out the array then fill from left to right.</font> +00506 <font class="keywordflow">for</font> ( <font class="keywordtype">int</font> a = 0; a < 2*20; a++ ) +00507 { +00508 iattributes[a] = 0; +00509 fattributes[a] = 0; +00510 } +00511 +00512 <font class="comment">// Since we are trying to create a pbuffer, the pixel format we</font> +00513 <font class="comment">// request (and subsequently use) must be “p-buffer capable”.</font> +00514 iattributes[2*niattribs ] = <a class="code" href="driver__opengl__extension__def_8h.html#a135">WGL_DRAW_TO_PBUFFER_ARB</a>; +00515 iattributes[2*niattribs+1] = <font class="keyword">true</font>; +00516 niattribs++; +00517 +00518 <font class="comment">// We require a minimum of 24-bit depth.</font> +00519 iattributes[2*niattribs ] = <a class="code" href="driver__opengl__extension__def_8h.html#a123">WGL_DEPTH_BITS_ARB</a>; +00520 iattributes[2*niattribs+1] = 24; +00521 niattribs++; +00522 +00523 <font class="comment">// We require a minimum of 8-bits for each R, G, B, and A.</font> +00524 iattributes[2*niattribs ] = <a class="code" href="driver__opengl__extension__def_8h.html#a110">WGL_RED_BITS_ARB</a>; +00525 iattributes[2*niattribs+1] = 8; +00526 niattribs++; +00527 iattributes[2*niattribs ] = <a class="code" href="driver__opengl__extension__def_8h.html#a112">WGL_GREEN_BITS_ARB</a>; +00528 iattributes[2*niattribs+1] = 8; +00529 niattribs++; +00530 iattributes[2*niattribs ] = <a class="code" href="driver__opengl__extension__def_8h.html#a114">WGL_BLUE_BITS_ARB</a>; +00531 iattributes[2*niattribs+1] = 8; +00532 niattribs++; +00533 iattributes[2*niattribs ] = <a class="code" href="driver__opengl__extension__def_8h.html#a116">WGL_ALPHA_BITS_ARB</a>; +00534 iattributes[2*niattribs+1] = 8; +00535 niattribs++; +00536 +00537 <font class="comment">// Now obtain a list of pixel formats that meet these minimum</font> +00538 <font class="comment">// requirements.</font> +00539 <font class="keywordtype">int</font> pformat[20]; +00540 <font class="keywordtype">unsigned</font> <font class="keywordtype">int</font> nformats; +00541 <font class="keywordflow">if</font> ( !wglChoosePixelFormatARB ( hdc, iattributes, fattributes, +00542 20, pformat, &nformats ) ) +00543 { +00544 <a class="code" href="debug_8h.html#a2">nlwarning</a> ( <font class="stringliteral">"pbuffer creation error: Couldn't find a suitable pixel format.\n"</font> ); +00545 wglDeleteContext (tempGLRC); +00546 DestroyWindow (tmpHWND); +00547 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00548 } +00549 +00550 <font class="comment">/* After determining a compatible pixel format, the next step is to create a pbuffer of the</font> +00551 <font class="comment"> chosen format. Fortunately this step is fairly easy, as you merely select one of the formats</font> +00552 <font class="comment"> returned in the list in step #2 and call the function: */</font> +00553 <font class="keywordtype">int</font> iattributes2[1] = {0}; +00554 <font class="comment">// int iattributes2[] = {WGL_PBUFFER_LARGEST_ARB, 1, 0};</font> +00555 _PBuffer = wglCreatePbufferARB( hdc, pformat[0], <a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>, iattributes2 ); +00556 <font class="keywordflow">if</font> (_PBuffer == NULL) +00557 { +00558 DWORD error = GetLastError (); +00559 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"CDriverGL::setDisplay: wglCreatePbufferARB failed: 0x%x"</font>, error); +00560 wglDeleteContext (tempGLRC); +00561 DestroyWindow (tmpHWND); +00562 _PBuffer = NULL; +00563 _hWnd = NULL; +00564 _hRC = NULL; +00565 _hDC = NULL; +00566 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00567 } +00568 +00569 <font class="comment">/* After creating a pbuffer, you may use this functions to determine the dimensions of the pbuffer actually created. */</font> +00570 <font class="keywordflow">if</font> ( !wglQueryPbufferARB( _PBuffer, <a class="code" href="driver__opengl__extension__def_8h.html#a140">WGL_PBUFFER_WIDTH_ARB</a>, (<font class="keywordtype">int</font>*)&<a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a> ) ) +00571 { +00572 DWORD error = GetLastError (); +00573 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"CDriverGL::setDisplay: wglQueryPbufferARB failed: 0x%x"</font>, error); +00574 wglDeleteContext (tempGLRC); +00575 DestroyWindow (tmpHWND); +00576 _PBuffer = NULL; +00577 _hWnd = NULL; +00578 _hRC = NULL; +00579 _hDC = NULL; +00580 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00581 } +00582 <font class="keywordflow">if</font> ( !wglQueryPbufferARB( _PBuffer, <a class="code" href="driver__opengl__extension__def_8h.html#a141">WGL_PBUFFER_HEIGHT_ARB</a>, (<font class="keywordtype">int</font>*)&<a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a> ) ) +00583 { +00584 DWORD error = GetLastError (); +00585 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"CDriverGL::setDisplay: wglQueryPbufferARB failed: 0x%x"</font>, error); +00586 wglDeleteContext (tempGLRC); +00587 DestroyWindow (tmpHWND); +00588 _PBuffer = NULL; +00589 _hWnd = NULL; +00590 _hRC = NULL; +00591 _hDC = NULL; +00592 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00593 } +00594 _WindowWidth = <a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>; +00595 _WindowHeight = <a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>; +00596 +00597 <font class="comment">/* The next step is to create a device context for the newly created pbuffer. To do this,</font> +00598 <font class="comment"> call the the function: */</font> +00599 _hDC = wglGetPbufferDCARB( _PBuffer ); +00600 <font class="keywordflow">if</font> (_hDC == NULL) +00601 { +00602 DWORD error = GetLastError (); +00603 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"CDriverGL::setDisplay: wglGetPbufferDCARB failed: 0x%x"</font>, error); +00604 wglDestroyPbufferARB( _PBuffer ); +00605 wglDeleteContext (tempGLRC); +00606 DestroyWindow (tmpHWND); +00607 _PBuffer = NULL; +00608 _hWnd = NULL; +00609 _hRC = NULL; +00610 _hDC = NULL; +00611 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00612 } +00613 +00614 +00615 <font class="comment">/* The final step of pbuffer creation is to create an OpenGL rendering context and</font> +00616 <font class="comment"> associate it with the handle for the pbuffer’s device context created in step #4. This is done as follows */</font> +00617 _hRC = wglCreateContext( _hDC ); +00618 <font class="keywordflow">if</font> (_hRC == NULL) +00619 { +00620 DWORD error = GetLastError (); +00621 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"CDriverGL::setDisplay: wglCreateContext failed: 0x%x"</font>, error); +00622 wglReleasePbufferDCARB( _PBuffer, _hDC ); +00623 wglDestroyPbufferARB( _PBuffer ); +00624 wglDeleteContext (tempGLRC); +00625 DestroyWindow (tmpHWND); +00626 _PBuffer = NULL; +00627 _hWnd = NULL; +00628 _hRC = NULL; +00629 _hDC = NULL; +00630 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00631 } +00632 +00633 <font class="comment">// Get the depth</font> +00634 _Depth = GetDeviceCaps (_hDC, BITSPIXEL); +00635 +00636 <font class="comment">// Destroy the temp gl context</font> +00637 <font class="keywordflow">if</font> (!wglDeleteContext (tempGLRC)) +00638 { +00639 DWORD error = GetLastError (); +00640 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"CDriverGL::setDisplay: wglDeleteContext failed: 0x%x"</font>, error); +00641 } +00642 +00643 <font class="comment">// Destroy the temp windows</font> +00644 <font class="keywordflow">if</font> (!DestroyWindow (tmpHWND)) +00645 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"CDriverGL::setDisplay: DestroyWindow failed"</font>); +00646 +00647 <font class="comment">/* After a pbuffer has been successfully created you can use it for off-screen rendering. To do</font> +00648 <font class="comment"> so, you’ll first need to bind the pbuffer, or more precisely, make its GL rendering context</font> +00649 <font class="comment"> the current context that will interpret all OpenGL commands and state changes. */</font> +00650 <font class="keywordflow">if</font> (!wglMakeCurrent(_hDC,_hRC)) +00651 { +00652 DWORD error = GetLastError (); +00653 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"CDriverGL::setDisplay: wglMakeCurrent failed: 0x%x"</font>, error); +00654 wglDeleteContext (_hRC); +00655 wglReleasePbufferDCARB( _PBuffer, _hDC ); +00656 wglDestroyPbufferARB( _PBuffer ); +00657 DestroyWindow (tmpHWND); +00658 _PBuffer = NULL; +00659 _hWnd = NULL; +00660 _hRC = NULL; +00661 _hDC = NULL; +00662 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00663 } +00664 } +00665 <font class="keywordflow">else</font> +00666 { +00667 _FullScreen= <font class="keyword">false</font>; +00668 <font class="keywordflow">if</font> (wnd) +00669 { +00670 _hWnd=(HWND)wnd; +00671 _DestroyWindow=<font class="keyword">false</font>; +00672 } +00673 <font class="keywordflow">else</font> +00674 { +00675 ULONG WndFlags; +00676 RECT WndRect; +00677 +00678 <font class="comment">// Must destroy this window</font> +00679 _DestroyWindow=<font class="keyword">true</font>; +00680 +00681 <font class="keywordflow">if</font>(mode.Windowed) +00682 WndFlags=WS_OVERLAPPEDWINDOW+WS_CLIPCHILDREN+WS_CLIPSIBLINGS; +00683 <font class="keywordflow">else</font> +00684 { +00685 WndFlags=WS_POPUP; +00686 +00687 _FullScreen= <font class="keyword">true</font>; +00688 DEVMODE devMode; +00689 _OldScreenMode.dmSize= <font class="keyword">sizeof</font>(DEVMODE); +00690 _OldScreenMode.dmDriverExtra= 0; +00691 EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &_OldScreenMode); +00692 _OldScreenMode.dmFields= DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY ; +00693 +00694 devMode.dmSize= <font class="keyword">sizeof</font>(DEVMODE); +00695 devMode.dmDriverExtra= 0; +00696 devMode.dmFields= DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT; +00697 devMode.dmPelsWidth= <a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>; +00698 devMode.dmPelsHeight= <a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>; +00699 devMode.dmBitsPerPel= mode.Depth; +00700 ChangeDisplaySettings(&devMode, CDS_FULLSCREEN); +00701 } +00702 WndRect.left=0; +00703 WndRect.top=0; +00704 WndRect.right=<a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>; +00705 WndRect.bottom=<a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>; +00706 AdjustWindowRect(&WndRect,WndFlags,FALSE); +00707 _hWnd = CreateWindow( <font class="stringliteral">"NLClass"</font>, +00708 <font class="stringliteral">""</font>, +00709 WndFlags, +00710 CW_USEDEFAULT,CW_USEDEFAULT, +00711 WndRect.right,WndRect.bottom, +00712 NULL, +00713 NULL, +00714 GetModuleHandle(NULL), +00715 NULL); +00716 <font class="keywordflow">if</font> (!_hWnd) +00717 { +00718 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00719 } +00720 +00721 SetWindowLong (_hWnd, GWL_USERDATA, (LONG)<font class="keyword">this</font>); +00722 +00723 <font class="comment">// resize the window</font> +00724 RECT rc; +00725 SetRect (&rc, 0, 0, <a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>); +00726 AdjustWindowRectEx (&rc, GetWindowStyle (_hWnd), GetMenu (_hWnd) != NULL, GetWindowExStyle (_hWnd)); +00727 SetWindowPos (_hWnd, NULL, 0, 0, rc.right - rc.left, rc.bottom - rc.top, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE ); +00728 +00729 ShowWindow(_hWnd,SW_SHOW); +00730 } +00731 +00732 <font class="comment">// Init Window Width and Height</font> +00733 RECT clientRect; +00734 GetClientRect (_hWnd, &clientRect); +00735 _WindowWidth = clientRect.right-clientRect.left; +00736 _WindowHeight = clientRect.bottom-clientRect.top; +00737 +00738 _hDC=GetDC(_hWnd); +00739 wglMakeCurrent(_hDC,NULL); +00740 _Depth=GetDeviceCaps(_hDC,BITSPIXEL); +00741 <font class="comment">// ---</font> +00742 memset(&_pfd,0,<font class="keyword">sizeof</font>(_pfd)); +00743 _pfd.nSize = <font class="keyword">sizeof</font>(_pfd); +00744 _pfd.nVersion = 1; +00745 _pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; +00746 _pfd.iPixelType = PFD_TYPE_RGBA; +00747 _pfd.cColorBits = (char)_Depth; +00748 <font class="comment">// Choose best suited Depth Buffer.</font> +00749 <font class="keywordflow">if</font>(_Depth<=16) +00750 { +00751 _pfd.cDepthBits = 16; +00752 } +00753 <font class="keywordflow">else</font> +00754 { +00755 _pfd.cDepthBits = 24; +00756 _pfd.cAlphaBits = 8; +00757 } +00758 _pfd.iLayerType = PFD_MAIN_PLANE; +00759 pf=ChoosePixelFormat(_hDC,&_pfd); +00760 <font class="keywordflow">if</font> (!pf) +00761 { +00762 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00763 } +00764 +00765 <font class="keywordflow">if</font> ( !SetPixelFormat(_hDC,pf,&_pfd) ) +00766 { +00767 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00768 } +00769 _hRC=wglCreateContext(_hDC); +00770 wglMakeCurrent(_hDC,_hRC); +00771 } +00772 +00774 <font class="keywordflow">while</font> (_EventEmitter.getNumEmitters() != 0) +00775 { +00776 _EventEmitter.removeEmitter(_EventEmitter.getEmitter(_EventEmitter.getNumEmitters() - 1)); +00777 } +00778 NLMISC::CWinEventEmitter *we = <font class="keyword">new</font> NLMISC::CWinEventEmitter; +00779 <font class="comment">// setup the event emitter, and try to retrieve a direct input interface</font> +00780 _EventEmitter.addEmitter(we, <font class="keyword">true</font> <font class="comment">/*must delete*/</font>); <font class="comment">// the main emitter</font> +00782 <font class="comment"> try</font> +00783 { +00784 NLMISC::CDIEventEmitter *diee = NLMISC::CDIEventEmitter::create(GetModuleHandle(NULL), _hWnd, we); +00785 <font class="keywordflow">if</font> (diee) +00786 { +00787 _EventEmitter.addEmitter(diee, <font class="keyword">true</font>); +00788 } +00789 } +00790 <font class="keywordflow">catch</font>(EDirectInput &e) +00791 { +00792 <a class="code" href="debug_8h.html#a1">nlinfo</a>(e.what()); +00793 } +00794 +00795 <font class="preprocessor">#elif defined(NL_OS_UNIX) // NL_OS_WINDOWS</font> +00796 <font class="preprocessor"></font> +00797 dpy = XOpenDisplay(NULL); +00798 <font class="keywordflow">if</font> (dpy == NULL) +00799 { +00800 <a class="code" href="debug_8h.html#a3">nlerror</a> (<font class="stringliteral">"XOpenDisplay failed on '%s'"</font>,getenv(<font class="stringliteral">"DISPLAY"</font>)); +00801 } +00802 <font class="keywordflow">else</font> +00803 { +00804 <a class="code" href="debug_8h.html#a0">nldebug</a>(<font class="stringliteral">"XOpenDisplay on '%s' OK"</font>, getenv(<font class="stringliteral">"DISPLAY"</font>)); +00805 } +00806 +00807 <font class="keywordtype">int</font> sAttribList[] = +00808 { +00809 GLX_RGBA, +00810 GLX_DOUBLEBUFFER, +00811 <font class="comment">//GLX_BUFFER_SIZE, 16,</font> +00812 GLX_DEPTH_SIZE, 16, +00813 GLX_RED_SIZE, 4, +00814 GLX_GREEN_SIZE, 4, +00815 GLX_BLUE_SIZE, 4, +00816 <font class="comment">//GLX_ALPHA_SIZE, 8,</font> +00817 None +00818 }; +00819 <font class="comment">/*</font> +00820 <font class="comment"> int sAttribList[] =</font> +00821 <font class="comment"> {</font> +00822 <font class="comment"> GLX_RGBA,</font> +00823 <font class="comment"> GLX_DOUBLEBUFFER,</font> +00824 <font class="comment"> //GLX_BUFFER_SIZE, 32,</font> +00825 <font class="comment"> GLX_DEPTH_SIZE, 32,</font> +00826 <font class="comment"> GLX_RED_SIZE, 8,</font> +00827 <font class="comment"> GLX_GREEN_SIZE, 8,</font> +00828 <font class="comment"> GLX_BLUE_SIZE, 8,</font> +00829 <font class="comment"> GLX_ALPHA_SIZE, 8,</font> +00830 <font class="comment"> None</font> +00831 <font class="comment"> };</font> +00832 <font class="comment"> */</font> +00833 XVisualInfo *visual_info = glXChooseVisual (dpy, DefaultScreen(dpy), sAttribList); +00834 +00835 <font class="keywordflow">if</font>(visual_info == NULL) +00836 { +00837 <a class="code" href="debug_8h.html#a3">nlerror</a>(<font class="stringliteral">"glXChooseVisual() failed"</font>); +00838 } +00839 <font class="keywordflow">else</font> +00840 { +00841 <a class="code" href="debug_8h.html#a0">nldebug</a>(<font class="stringliteral">"glXChooseVisual OK"</font>); +00842 } +00843 +00844 ctx = glXCreateContext (dpy, visual_info, None, GL_TRUE); +00845 +00846 <font class="keywordflow">if</font>(ctx == NULL) +00847 { +00848 <a class="code" href="debug_8h.html#a3">nlerror</a>(<font class="stringliteral">"glXCreateContext() failed"</font>); +00849 } +00850 <font class="keywordflow">else</font> +00851 { +00852 <a class="code" href="debug_8h.html#a0">nldebug</a>(<font class="stringliteral">"glXCreateContext() OK"</font>); +00853 } +00854 +00855 Colormap cmap = XCreateColormap (dpy, RootWindow(dpy, DefaultScreen(dpy)), visual_info->visual, AllocNone); +00856 +00857 XSetWindowAttributes attr; +00858 attr.colormap = cmap; +00859 attr.background_pixel = BlackPixel(dpy, DefaultScreen(dpy)); +00860 +00861 <font class="preprocessor">#ifdef XF86VIDMODE</font> +00862 <font class="preprocessor"></font> <font class="comment">// If we're going to attempt fullscreen, we need to set redirect to True,</font> +00863 <font class="comment">// This basically places the window with no borders in the top left </font> +00864 <font class="comment">// corner of the screen.</font> +00865 <font class="keywordflow">if</font> (mode.Windowed) +00866 { +00867 attr.override_redirect = False; +00868 } +00869 <font class="keywordflow">else</font> +00870 { +00871 attr.override_redirect = True; +00872 } +00873 <font class="preprocessor">#else</font> +00874 <font class="preprocessor"></font> attr.override_redirect = False; +00875 <font class="preprocessor">#endif</font> +00876 <font class="preprocessor"></font> +00877 <font class="keywordtype">int</font> attr_flags = CWOverrideRedirect | CWColormap | CWBackPixel; +00878 +00879 win = XCreateWindow (dpy, RootWindow(dpy, DefaultScreen(dpy)), 0, 0, <a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>, 0, visual_info->depth, InputOutput, visual_info->visual, attr_flags, &attr); +00880 +00881 <font class="keywordflow">if</font>(!win) +00882 { +00883 <a class="code" href="debug_8h.html#a3">nlerror</a>(<font class="stringliteral">"XCreateWindow() failed"</font>); +00884 } +00885 <font class="keywordflow">else</font> +00886 { +00887 <a class="code" href="debug_8h.html#a0">nldebug</a>(<font class="stringliteral">"XCreateWindow() OK"</font>); +00888 } +00889 +00890 XSizeHints size_hints; +00891 size_hints.x = 0; +00892 size_hints.y = 0; +00893 size_hints.width = <a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>; +00894 size_hints.height = <a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>; +00895 size_hints.flags = PSize | PMinSize | PMaxSize; +00896 size_hints.min_width = <a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>; +00897 size_hints.min_height = <a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>; +00898 size_hints.max_width = <a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>; +00899 size_hints.max_height = <a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>; +00900 +00901 XTextProperty text_property; +00902 <font class="keywordtype">char</font> *title=<font class="stringliteral">"NeL window"</font>; +00903 XStringListToTextProperty(&title, 1, &text_property); +00904 +00905 XSetWMProperties (dpy, win, &text_property, &text_property, 0, 0, &size_hints, 0, 0); +00906 glXMakeCurrent (dpy, win, ctx); +00907 XMapRaised (dpy, win); +00908 +00909 XSelectInput (dpy, win, +00910 KeyPressMask| +00911 KeyReleaseMask| +00912 ButtonPressMask| +00913 ButtonReleaseMask| +00914 PointerMotionMask +00915 ); +00916 +00917 XMapWindow(dpy, win); +00918 +00919 _EventEmitter.init (dpy, win); +00920 +00921 <font class="comment">// XEvent event;</font> +00922 <font class="comment">// XIfEvent(dpy, &event, WaitForNotify, (char *)this);</font> +00923 +00924 <font class="preprocessor">#ifdef XF86VIDMODE</font> +00925 <font class="preprocessor"></font> <font class="keywordflow">if</font> (!mode.Windowed) +00926 { +00927 +00928 <font class="comment">// Set window to the right size, map it to the display, and raise it</font> +00929 <font class="comment">// to the front</font> +00930 XResizeWindow(dpy,win,<a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>,<a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>); +00931 XMapRaised(dpy,win); +00932 XRaiseWindow(dpy, win); +00933 +00934 <font class="comment">// grab the mouse and keyboard on the fullscreen window </font> +00935 <font class="keywordflow">if</font> ((XGrabPointer(dpy, win, True, 0, +00936 GrabModeAsync, GrabModeAsync, +00937 win, None, CurrentTime) != GrabSuccess) || +00938 (XGrabKeyboard(dpy, win, True, +00939 GrabModeAsync, GrabModeAsync, CurrentTime) != 0) ) +00940 { +00941 <font class="comment">// Until I work out how to deal with this nicely, it just gives</font> +00942 <font class="comment">// an error and exits the prorgam.</font> +00943 <a class="code" href="debug_8h.html#a3">nlerror</a>(<font class="stringliteral">"Unable to grab keyboard and mouse\n"</font>); +00944 } +00945 <font class="keywordflow">else</font> +00946 { +00947 <font class="comment">// Save the old screen mode and dotclock</font> +00948 memset(&_OldScreenMode, 0, <font class="keyword">sizeof</font>(_OldScreenMode)); +00949 XF86VidModeGetModeLine(dpy, +00950 DefaultScreen(dpy), +00951 &_OldDotClock, +00952 &_OldScreenMode); +00953 <font class="comment">// Save the old viewport</font> +00954 XF86VidModeGetViewPort(dpy, +00955 DefaultScreen(dpy), +00956 &_OldX, +00957 &_OldY); +00958 +00959 <font class="comment">// get a list of modes, search for an appropriate one.</font> +00960 XF86VidModeModeInfo **modes; +00961 <font class="keywordtype">int</font> nmodes; +00962 <font class="keywordflow">if</font> (XF86VidModeGetAllModeLines(dpy, +00963 DefaultScreen(dpy), +00964 &nmodes,&modes)) +00965 { +00966 <font class="keywordtype">int</font> mode_index = -1; <font class="comment">// Gah, magic numbers all bad. </font> +00967 <font class="keywordflow">for</font> (<font class="keywordtype">int</font> i = 0; i < nmodes; i++) +00968 { +00969 <a class="code" href="debug_8h.html#a0">nldebug</a>(<font class="stringliteral">"Available mode - %dx%d\n"</font>,<a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>,<a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>); +00970 <font class="keywordflow">if</font>( (modes[i]->hdisplay == <a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>) && +00971 (modes[i]->vdisplay == <a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>)) +00972 { +00973 mode_index = i; +00974 } +00975 } +00976 <font class="comment">// Switch to the mode</font> +00977 <font class="keywordflow">if</font> (mode_index != -1) +00978 { +00979 <font class="keywordflow">if</font>(XF86VidModeSwitchToMode(dpy, +00980 DefaultScreen(dpy), +00981 modes[mode_index])) +00982 { +00983 <a class="code" href="debug_8h.html#a1">nlinfo</a>(<font class="stringliteral">"Switching to mode %dx%d,\n"</font>,<a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>, +00984 <a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>); +00985 XF86VidModeSetViewPort(dpy,DefaultScreen(dpy),0, 0); +00986 _FullScreen = <font class="keyword">true</font>; +00987 } +00988 } +00989 <font class="keywordflow">else</font> +00990 { +00991 <font class="comment">// This is a problem, since we've nuked the border from </font> +00992 <font class="comment">// window in the setup stage, until I work out how</font> +00993 <font class="comment">// to get it back (recreate window? seems excessive)</font> +00994 <a class="code" href="debug_8h.html#a3">nlerror</a>(<font class="stringliteral">"Couldn't find an appropriate mode %dx%d\n"</font>, +00995 <a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>, +00996 <a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>); +00997 } +00998 } +00999 } +01000 } +01001 +01002 <font class="preprocessor">#endif // XF86VIDMODE</font> +01003 <font class="preprocessor"></font> +01004 <font class="preprocessor">#endif // NL_OS_UNIX</font> +01005 <font class="preprocessor"></font> +01006 +01007 <font class="comment">// Driver caps.</font> +01008 <font class="comment">//=============</font> +01009 <font class="comment">// Retrieve the extensions for the current context.</font> +01010 <a class="code" href="namespaceNL3D.html#a342">NL3D::registerGlExtensions</a> (_Extensions); +01011 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font> +01012 <font class="preprocessor"></font> NL3D::registerWGlExtensions (_Extensions, _hDC); +01013 <font class="preprocessor">#endif // ifdef NL_OS_WINDOWS</font> +01014 <font class="preprocessor"></font> +01015 <font class="comment">// Check required extensions!!</font> +01016 <font class="comment">// ARBMultiTexture is a opengl 1.2 required extension.</font> +01017 <font class="keywordflow">if</font>(!_Extensions.ARBMultiTexture) +01018 { +01019 <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"Missing Required GL extension: GL_ARB_multitexture. Update your driver"</font>); +01020 <font class="keywordflow">throw</font> EBadDisplay(<font class="stringliteral">"Missing Required GL extension: GL_ARB_multitexture. Update your driver"</font>); +01021 } +01022 <font class="keywordflow">if</font>(!_Extensions.EXTTextureEnvCombine) +01023 { +01024 <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"Missing Important GL extension: GL_EXT_texture_env_combine => All envcombine are setup to GL_MODULATE!!!"</font>); +01025 } +01026 +01027 +01028 <font class="comment">// init _DriverGLStates</font> +01029 _DriverGLStates.init(_Extensions.ARBTextureCubeMap); +01030 +01031 +01032 <font class="comment">// Init OpenGL/Driver defaults.</font> +01033 <font class="comment">//=============================</font> +01034 glViewport(0,0,<a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>,<a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>); +01035 glMatrixMode(GL_PROJECTION); +01036 glLoadIdentity(); +01037 glOrtho(0,<a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>,<a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>,0,-1.0f,1.0f); +01038 glMatrixMode(GL_MODELVIEW); +01039 glLoadIdentity(); +01040 glDisable(GL_AUTO_NORMAL); +01041 glDisable(GL_COLOR_MATERIAL); +01042 glEnable(GL_DITHER); +01043 glDisable(GL_FOG); +01044 glDisable(GL_LINE_SMOOTH); +01045 glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); +01046 glEnable(GL_DEPTH_TEST); +01047 glDisable(GL_NORMALIZE); +01048 _CurrentGlNormalize= <font class="keyword">false</font>; +01049 _ForceNormalize= <font class="keyword">false</font>; +01050 <font class="comment">// Setup defaults for blend, lighting ...</font> +01051 _DriverGLStates.forceDefaults(inlGetNumTextStages()); +01052 <font class="comment">// Default delta camera pos.</font> +01053 _PZBCameraPos= CVector::Null; +01054 +01055 <font class="keywordflow">if</font> (_NVTextureShaderEnabled) +01056 { +01057 enableNVTextureShader(<font class="keyword">false</font>); +01058 } +01059 +01060 <font class="comment">// Be always in EXTSeparateSpecularColor.</font> +01061 <font class="keywordflow">if</font>(_Extensions.EXTSeparateSpecularColor) +01062 { +01063 glLightModeli((GLenum)GL_LIGHT_MODEL_COLOR_CONTROL_EXT, GL_SEPARATE_SPECULAR_COLOR_EXT); +01064 } +01065 +01066 _VertexProgramEnabled= <font class="keyword">false</font>; +01067 _LastSetupGLArrayVertexProgram= <font class="keyword">false</font>; +01068 +01069 +01070 <font class="comment">// Init VertexArrayRange according to supported extenstion.</font> +01071 _SupportVBHard= <font class="keyword">false</font>; +01072 _SlowUnlockVBHard= <font class="keyword">false</font>; +01073 _MaxVerticesByVBHard= 0; +01074 <font class="comment">// Try with NVidia ext first.</font> +01075 <font class="keywordflow">if</font>(_Extensions.NVVertexArrayRange) +01076 { +01077 _AGPVertexArrayRange= <font class="keyword">new</font> CVertexArrayRangeNVidia(<font class="keyword">this</font>); +01078 _VRAMVertexArrayRange= <font class="keyword">new</font> CVertexArrayRangeNVidia(<font class="keyword">this</font>); +01079 _SupportVBHard= <font class="keyword">true</font>; +01080 _MaxVerticesByVBHard= _Extensions.NVVertexArrayRangeMaxVertex; +01081 } +01082 <font class="comment">// Else, try with ATI ext</font> +01083 <font class="keywordflow">else</font> <font class="keywordflow">if</font>(_Extensions.ATIVertexArrayObject) +01084 { +01085 _AGPVertexArrayRange= <font class="keyword">new</font> CVertexArrayRangeATI(<font class="keyword">this</font>); +01086 _VRAMVertexArrayRange= <font class="keyword">new</font> CVertexArrayRangeATI(<font class="keyword">this</font>); +01087 _SupportVBHard= <font class="keyword">true</font>; +01088 <font class="comment">// BAD ATI extension scheme.</font> +01089 _SlowUnlockVBHard= <font class="keyword">true</font>; +01090 <font class="comment">//_MaxVerticesByVBHard= 65000;</font> +01091 _MaxVerticesByVBHard= 32767; +01092 } +01093 +01094 <font class="comment">// Reset VertexArrayRange.</font> +01095 _CurrentVertexArrayRange= NULL; +01096 _CurrentVertexBufferHard= NULL; +01097 _NVCurrentVARPtr= NULL; +01098 _NVCurrentVARSize= 0; +01099 <font class="keywordflow">if</font>(_SupportVBHard) +01100 { +01101 <font class="comment">// try to allocate 16Mo by default of AGP Ram.</font> +01102 initVertexArrayRange(<a class="code" href="driver__opengl_8cpp.html#a0">NL3D_DRV_VERTEXARRAY_AGP_INIT_SIZE</a>, 0); +01103 +01104 <font class="comment">// If not success to allocate at least a minimum space in AGP, then disable completely VBHard feature</font> +01105 <font class="keywordflow">if</font>( _AGPVertexArrayRange->sizeAllocated()==0 ) +01106 { +01107 <font class="comment">// reset any allocated VRAM space.</font> +01108 resetVertexArrayRange(); +01109 +01110 <font class="comment">// delete containers</font> +01111 <font class="keyword">delete</font> _AGPVertexArrayRange; +01112 <font class="keyword">delete</font> _VRAMVertexArrayRange; +01113 _AGPVertexArrayRange= NULL; +01114 _VRAMVertexArrayRange= NULL; +01115 +01116 <font class="comment">// disable.</font> +01117 _SupportVBHard= <font class="keyword">false</font>; +01118 _SlowUnlockVBHard= <font class="keyword">false</font>; +01119 _MaxVerticesByVBHard= 0; +01120 } +01121 } +01122 +01123 <font class="comment">// Init embm if present</font> +01124 <font class="comment">//===========================================================</font> +01125 initEMBM(); +01126 +01127 +01128 <font class="comment">// Activate the default texture environnments for all stages.</font> +01129 <font class="comment">//===========================================================</font> +01130 <font class="keywordflow">for</font>(sint stage=0;stage<inlGetNumTextStages(); stage++) +01131 { +01132 <font class="comment">// init no texture.</font> +01133 _CurrentTexture[stage]= NULL; +01134 _CurrentTextureInfoGL[stage]= NULL; +01135 <font class="comment">// texture are disabled in DriverGLStates.forceDefaults().</font> +01136 +01137 <font class="comment">// init default env.</font> +01138 CMaterial::CTexEnv env; <font class="comment">// envmode init to default.</font> +01139 env.ConstantColor.set(255,255,255,255); +01140 forceActivateTexEnvMode(stage, env); +01141 forceActivateTexEnvColor(stage, env); +01142 +01143 <font class="comment">// Not special TexEnv.</font> +01144 _CurrentTexEnvSpecial[stage]= TexEnvSpecialDisabled; +01145 +01146 resetTextureShaders(); +01147 } +01148 +01149 <font class="comment">// Get num of light for this driver</font> +01150 <font class="keywordtype">int</font> numLight; +01151 glGetIntegerv (GL_MAX_LIGHTS, &numLight); +01152 _MaxDriverLight=(uint)numLight; +01153 <font class="keywordflow">if</font> (_MaxDriverLight>MaxLight) +01154 _MaxDriverLight=MaxLight; +01155 +01156 <font class="comment">// Reset the lights position flags</font> +01157 <font class="keywordflow">for</font> (uint i=0; i<MaxLight; i++) +01158 _LightEnable[i]=<font class="keyword">false</font>; +01159 +01160 +01161 _PPLExponent = 1.f; +01162 _PPLightDiffuseColor = <a class="code" href="classNLMISC_1_1CRGBA.html#p7">NLMISC::CRGBA::White</a>; +01163 _PPLightSpecularColor = <a class="code" href="classNLMISC_1_1CRGBA.html#p7">NLMISC::CRGBA::White</a>; +01164 +01165 <font class="comment">// Backward compatibility: default lighting is Light0 default openGL</font> +01166 <font class="comment">// meaning that light direction is always (0,1,0) in eye-space</font> +01167 <font class="comment">// use enableLighting(0....), to get normal behaviour</font> +01168 glEnable(GL_LIGHT0); +01169 +01170 _Initialized = <font class="keyword">true</font>; +01171 +01172 _ForceDXTCCompression= <font class="keyword">false</font>; +01173 _ForceTextureResizePower= 0; +01174 +01175 <font class="comment">// Reset profiling.</font> +01176 _AllocatedTextureMemory= 0; +01177 _TextureUsed.clear(); +01178 _PrimitiveProfileIn.reset(); +01179 _PrimitiveProfileOut.reset(); +01180 _NbSetupMaterialCall= 0; +01181 _NbSetupModelMatrixCall= 0; +01182 +01183 <font class="comment">// check wether per pixel lighting shader is supported</font> +01184 checkForPerPixelLightingSupport(); +01185 +01186 <font class="comment">// if EXTVertexShader is used, bind the standard GL arrays, and allocate constant</font> +01187 <font class="keywordflow">if</font> (!_Extensions.NVVertexProgram && _Extensions.EXTVertexShader) +01188 { +01189 _EVSPositionHandle = <a class="code" href="driver__opengl__extension_8h.html#a138">nglBindParameterEXT</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a329">GL_CURRENT_VERTEX_EXT</a>); +01190 _EVSNormalHandle = <a class="code" href="driver__opengl__extension_8h.html#a138">nglBindParameterEXT</a>(GL_CURRENT_NORMAL); +01191 _EVSColorHandle = <a class="code" href="driver__opengl__extension_8h.html#a138">nglBindParameterEXT</a>(GL_CURRENT_COLOR); +01192 <font class="keywordflow">if</font> (!_EVSPositionHandle || !_EVSNormalHandle || !_EVSColorHandle) +01193 { +01194 <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"Unable to bind input parameters for use with EXT_vertex_shader, vertex program support is disabled"</font>); +01195 _Extensions.EXTVertexShader = <font class="keyword">false</font>; +01196 } +01197 <font class="keywordflow">else</font> +01198 { +01199 <font class="comment">// bind texture units</font> +01200 <font class="keywordflow">for</font>(uint k = 0; k < 8; ++k) +01201 { +01202 _EVSTexHandle[k] = <a class="code" href="driver__opengl__extension_8h.html#a137">nglBindTextureUnitParameterEXT</a>(GL_TEXTURE0_ARB + k, GL_CURRENT_TEXTURE_COORDS); +01203 } +01204 <font class="comment">// Other attributes are managed using variant pointers :</font> +01205 <font class="comment">// Secondary color</font> +01206 <font class="comment">// Fog Coords</font> +01207 <font class="comment">// Skin Weight</font> +01208 <font class="comment">// Skin palette</font> +01209 <font class="comment">// This mean that they must have 4 components</font> +01210 +01211 <font class="comment">// Allocate variants</font> +01212 _EVSConstantHandle = <a class="code" href="driver__opengl__extension_8h.html#a128">nglGenSymbolsEXT</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a293">GL_VECTOR_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a296">GL_INVARIANT_EXT</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a328">GL_FULL_RANGE_EXT</a>, 97); +01213 +01214 <font class="keywordflow">if</font> (_EVSConstantHandle == 0) +01215 { +01216 <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"Unable to allocate constants for EXT_vertex_shader, vertex program support is disabled"</font>); +01217 _Extensions.EXTVertexShader = <font class="keyword">false</font>; +01218 } +01219 } +01220 } +01221 +01222 <font class="keywordflow">return</font> <font class="keyword">true</font>; +01223 } +01224 +01225 +<a name="l01226"></a><a class="code" href="classNL3D_1_1CDriverGL.html#z405_1">01226</a> <font class="keywordtype">void</font> CDriverGL::resetTextureShaders() +01227 { +01228 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CDriverGL.html#z403_0">_Extensions</a>.NVTextureShader) +01229 { +01230 glEnable(<a class="code" href="driver__opengl__extension__def_8h.html#a155">GL_TEXTURE_SHADER_NV</a>); +01231 <font class="keywordflow">for</font> (uint stage = 0; stage < (uint) <a class="code" href="classNL3D_1_1CDriverGL.html#c28">inlGetNumTextStages</a>(); ++stage) +01232 { +01233 <a class="code" href="classNL3D_1_1CDriverGL.html#z405_11">_DriverGLStates</a>.activeTextureARB(stage); +01234 <font class="keywordflow">if</font> (stage != 0) +01235 { +01236 glTexEnvi(<a class="code" href="driver__opengl__extension__def_8h.html#a155">GL_TEXTURE_SHADER_NV</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a164">GL_PREVIOUS_TEXTURE_INPUT_NV</a>, GL_TEXTURE0_ARB + stage - 1); +01237 } +01238 glTexEnvi(<a class="code" href="driver__opengl__extension__def_8h.html#a155">GL_TEXTURE_SHADER_NV</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a156">GL_SHADER_OPERATION_NV</a>, GL_NONE); +01239 <a class="code" href="classNL3D_1_1CDriverGL.html#z405_8">_CurrentTexAddrMode</a>[stage] = GL_NONE; +01240 } +01241 glDisable(<a class="code" href="driver__opengl__extension__def_8h.html#a155">GL_TEXTURE_SHADER_NV</a>); +01242 <a class="code" href="classNL3D_1_1CDriverGL.html#z405_9">_NVTextureShaderEnabled</a> = <font class="keyword">false</font>; +01243 } +01244 } +01245 +01246 <font class="comment">// --------------------------------------------------</font> +01247 +<a name="l01248"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a10">01248</a> <a class="code" href="namespaceNL3D.html#a29">emptyProc</a> CDriverGL::getWindowProc() +01249 { +01250 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font> +01251 <font class="preprocessor"></font> <font class="keywordflow">return</font> (emptyProc)GlWndProc; +01252 <font class="preprocessor">#else // NL_OS_WINDOWS</font> +01253 <font class="preprocessor"></font> <font class="keywordflow">return</font> NULL; +01254 <font class="preprocessor">#endif // NL_OS_WINDOWS</font> +01255 <font class="preprocessor"></font>} +01256 +01257 <font class="comment">// --------------------------------------------------</font> +01258 +<a name="l01259"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a11">01259</a> <font class="keywordtype">bool</font> CDriverGL::activate() +01260 { +01261 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font> +01262 <font class="preprocessor"></font> HGLRC hglrc=wglGetCurrentContext(); +01263 <font class="keywordflow">if</font> (hglrc!=_hRC) +01264 { +01265 wglMakeCurrent(_hDC,_hRC); +01266 } +01267 <font class="preprocessor">#elif defined (NL_OS_UNIX)</font> +01268 <font class="preprocessor"></font> GLXContext nctx=glXGetCurrentContext(); +01269 <font class="keywordflow">if</font> (nctx != NULL && nctx!=ctx) +01270 { +01271 glXMakeCurrent(dpy, win,ctx); +01272 } +01273 <font class="preprocessor">#endif // NL_OS_WINDOWS</font> +01274 <font class="preprocessor"></font> <font class="keywordflow">return</font> <font class="keyword">true</font>; +01275 } +01276 +01277 <font class="comment">// --------------------------------------------------</font> +01278 +<a name="l01279"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a13">01279</a> <font class="keywordtype">bool</font> CDriverGL::isTextureExist(<font class="keyword">const</font> ITexture&tex) +01280 { +01281 <font class="keywordtype">bool</font> result; +01282 +01283 <font class="comment">// Create the shared Name.</font> +01284 std::string name; +01285 <a class="code" href="classNL3D_1_1IDriver.html#d0">getTextureShareName</a> (tex, name); +01286 +01287 { +01288 CSynchronized<TTexDrvInfoPtrMap>::CAccessor access(&<a class="code" href="classNL3D_1_1IDriver.html#n0">_SyncTexDrvInfos</a>); +01289 TTexDrvInfoPtrMap &rTexDrvInfos = access.value(); +01290 result = (rTexDrvInfos.find(name) != rTexDrvInfos.end()); +01291 } +01292 <font class="keywordflow">return</font> result; +01293 } +01294 +01295 <font class="comment">// --------------------------------------------------</font> +01296 +<a name="l01297"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a15">01297</a> <font class="keywordtype">bool</font> CDriverGL::clear2D(CRGBA rgba) +01298 { +01299 glClearColor((<font class="keywordtype">float</font>)rgba.R/255.0f,(<font class="keywordtype">float</font>)rgba.G/255.0f,(<font class="keywordtype">float</font>)rgba.B/255.0f,(<font class="keywordtype">float</font>)rgba.A/255.0f); +01300 glClear(GL_COLOR_BUFFER_BIT); +01301 <font class="keywordflow">return</font> <font class="keyword">true</font>; +01302 } +01303 +01304 <font class="comment">// --------------------------------------------------</font> +01305 +<a name="l01306"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a16">01306</a> <font class="keywordtype">bool</font> CDriverGL::clearZBuffer(<font class="keywordtype">float</font> zval) +01307 { +01308 glClearDepth(zval); +01309 <a class="code" href="classNL3D_1_1CDriverGL.html#z405_11">_DriverGLStates</a>.enableZWrite(<font class="keyword">true</font>); +01310 glClear(GL_DEPTH_BUFFER_BIT); +01311 <font class="keywordflow">return</font> <font class="keyword">true</font>; +01312 } +01313 +01314 <font class="comment">// --------------------------------------------------</font> +01315 +<a name="l01316"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a17">01316</a> <font class="keywordtype">void</font> CDriverGL::setColorMask (<font class="keywordtype">bool</font> bRed, <font class="keywordtype">bool</font> bGreen, <font class="keywordtype">bool</font> bBlue, <font class="keywordtype">bool</font> bAlpha) +01317 { +01318 glColorMask (bRed, bGreen, bBlue, bAlpha); +01319 } +01320 +01321 +01322 <font class="comment">// --------------------------------------------------</font> +01323 +<a name="l01324"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a51">01324</a> <font class="keywordtype">bool</font> CDriverGL::swapBuffers() +01325 { +01326 <font class="comment">// Reset texture shaders</font> +01327 <font class="comment">//resetTextureShaders();</font> +01328 <font class="comment">// Reset VertexArrayRange.</font> +01329 <font class="keywordflow">if</font>(_CurrentVertexBufferHard) +01330 { +01331 <font class="comment">// Then, we'll wait for this VBHard to finish before this frame. Even if some rendering done</font> +01332 <a class="code" href="classNL3D_1_1CDriverGL.html#z411_4">_CurrentVertexBufferHard</a>->lock(); +01333 <a class="code" href="classNL3D_1_1CDriverGL.html#z411_4">_CurrentVertexBufferHard</a>->unlock(); +01334 <font class="comment">// and we disable it.</font> +01335 <a class="code" href="classNL3D_1_1CDriverGL.html#z411_4">_CurrentVertexBufferHard</a>->disable(); +01336 } +01337 +01338 +01339 <font class="comment">// Because of Bug with GeForce, must finishFence() for all VBHard.</font> +01340 set<IVertexBufferHardGL*>::iterator itVBHard= <a class="code" href="classNL3D_1_1CDriverGL.html#z411_2">_VertexBufferHardSet</a>.Set.begin(); +01341 <font class="keywordflow">while</font>(itVBHard != <a class="code" href="classNL3D_1_1CDriverGL.html#z411_2">_VertexBufferHardSet</a>.Set.end() ) +01342 { +01343 <font class="comment">// Need only to do it for NVidia VB ones.</font> +01344 <font class="keywordflow">if</font>((*itVBHard)->NVidiaVertexBufferHard) +01345 { +01346 <a class="code" href="classNL3D_1_1CDriverGL.html#z411_13">CVertexBufferHardGLNVidia</a> *vbHardNV= static_cast<CVertexBufferHardGLNVidia*>(*itVBHard); +01347 <font class="comment">// If needed, "flush" these VB.</font> +01348 vbHardNV->finishFence(); +01349 vbHardNV->GPURenderingAfterFence= <font class="keyword">false</font>; +01350 } +01351 itVBHard++; +01352 } +01353 +01354 <font class="comment">/* Yoyo: must do this (GeForce bug ??) esle weird results if end render with a VBHard.</font> +01355 <font class="comment"> Setup a std vertex buffer to ensure NVidia synchronisation.</font> +01356 <font class="comment"> */</font> +01357 <font class="keyword">static</font> CVertexBuffer dummyVB; +01358 <font class="keyword">static</font> <font class="keywordtype">bool</font> dummyVBinit= <font class="keyword">false</font>; +01359 <font class="keywordflow">if</font>(!dummyVBinit) +01360 { +01361 <font class="comment">// setup a full feature VB (maybe not usefull ... :( ).</font> +01362 dummyVB.setVertexFormat(CVertexBuffer::PositionFlag|CVertexBuffer::NormalFlag| +01363 CVertexBuffer::PrimaryColorFlag|CVertexBuffer::SecondaryColorFlag| +01364 CVertexBuffer::TexCoord0Flag|CVertexBuffer::TexCoord1Flag| +01365 CVertexBuffer::TexCoord2Flag|CVertexBuffer::TexCoord3Flag +01366 ); +01367 <font class="comment">// some vertices.</font> +01368 dummyVB.setNumVertices(10); +01369 } +01370 <font class="comment">// activate each frame to close VBHard rendering.</font> +01371 <a class="code" href="classNL3D_1_1CDriverGL.html#a43">activeVertexBuffer</a>(dummyVB); +01372 +01373 +01374 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font> +01375 <font class="preprocessor"></font> <font class="keywordflow">if</font> (_EventEmitter.getNumEmitters() > 1) <font class="comment">// is direct input running ?</font> +01376 { +01377 <font class="comment">// flush direct input messages if any</font> +01378 NLMISC::safe_cast<NLMISC::CDIEventEmitter *>(_EventEmitter.getEmitter(1))->poll(); +01379 } +01380 <font class="preprocessor">#endif</font> +01381 <font class="preprocessor"></font> +01382 +01383 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font> +01384 <font class="preprocessor"></font> SwapBuffers(_hDC); +01385 <font class="preprocessor">#else // NL_OS_WINDOWS</font> +01386 <font class="preprocessor"></font> glXSwapBuffers(dpy, win); +01387 <font class="preprocessor">#endif // NL_OS_WINDOWS</font> +01388 <font class="preprocessor"></font> +01389 <font class="comment">// Activate the default texture environnments for all stages.</font> +01390 <font class="comment">//===========================================================</font> +01391 <font class="comment">// This is not a requirement, but it ensure a more stable state each frame.</font> +01392 <font class="comment">// (well, maybe the good reason is "it hides much more the bugs" :o) ).</font> +01393 <font class="keywordflow">for</font>(sint stage=0;stage<<a class="code" href="classNL3D_1_1CDriverGL.html#c28">inlGetNumTextStages</a>(); stage++) +01394 { +01395 <font class="comment">// init no texture.</font> +01396 <a class="code" href="classNL3D_1_1CDriverGL.html#z405_4">_CurrentTexture</a>[stage]= NULL; +01397 <a class="code" href="classNL3D_1_1CDriverGL.html#z405_5">_CurrentTextureInfoGL</a>[stage]= NULL; +01398 <font class="comment">// texture are disabled in DriverGLStates.forceDefaults().</font> +01399 +01400 <font class="comment">// init default env.</font> +01401 CMaterial::CTexEnv env; <font class="comment">// envmode init to default.</font> +01402 env.ConstantColor.set(255,255,255,255); +01403 <a class="code" href="classNL3D_1_1CDriverGL.html#c5">forceActivateTexEnvMode</a>(stage, env); +01404 <a class="code" href="classNL3D_1_1CDriverGL.html#c7">forceActivateTexEnvColor</a>(stage, env); +01405 } +01406 +01407 +01408 <font class="comment">// Activate the default material.</font> +01409 <font class="comment">//===========================================================</font> +01410 <font class="comment">// Same reasoning as textures :)</font> +01411 <a class="code" href="classNL3D_1_1CDriverGL.html#z405_11">_DriverGLStates</a>.forceDefaults(<a class="code" href="classNL3D_1_1CDriverGL.html#c28">inlGetNumTextStages</a>()); +01412 <font class="keywordflow">if</font> (_NVTextureShaderEnabled) +01413 { +01414 glDisable(<a class="code" href="driver__opengl__extension__def_8h.html#a155">GL_TEXTURE_SHADER_NV</a>); +01415 <a class="code" href="classNL3D_1_1CDriverGL.html#z405_9">_NVTextureShaderEnabled</a> = <font class="keyword">false</font>; +01416 } +01417 <a class="code" href="classNL3D_1_1CDriverGL.html#z405_2">_CurrentMaterial</a>= NULL; +01418 +01419 +01420 <font class="comment">// Reset the profiling counter.</font> +01421 <a class="code" href="classNL3D_1_1CDriverGL.html#z412_1">_PrimitiveProfileIn</a>.reset(); +01422 <a class="code" href="classNL3D_1_1CDriverGL.html#z412_2">_PrimitiveProfileOut</a>.reset(); +01423 <a class="code" href="classNL3D_1_1CDriverGL.html#z412_4">_NbSetupMaterialCall</a>= 0; +01424 <a class="code" href="classNL3D_1_1CDriverGL.html#z412_5">_NbSetupModelMatrixCall</a>= 0; +01425 +01426 <font class="comment">// Reset the texture set</font> +01427 <a class="code" href="classNL3D_1_1CDriverGL.html#z412_7">_TextureUsed</a>.clear(); +01428 +01429 <font class="keywordflow">return</font> <font class="keyword">true</font>; +01430 } +01431 +01432 <font class="comment">// --------------------------------------------------</font> +01433 +<a name="l01434"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a58">01434</a> <font class="keywordtype">bool</font> CDriverGL::release() +01435 { +01436 <font class="comment">// release only if the driver was initialized</font> +01437 <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CDriverGL.html#o2">_Initialized</a>) <font class="keywordflow">return</font> <font class="keyword">true</font>; +01438 +01439 <font class="comment">// Call IDriver::release() before, to destroy textures, shaders and VBs...</font> +01440 IDriver::release(); +01441 +01442 <font class="comment">// release caustic cube map</font> +01443 <font class="comment">// _CauticCubeMap = NULL;</font> +01444 +01445 <font class="comment">// Reset VertexArrayRange.</font> +01446 <a class="code" href="classNL3D_1_1CDriverGL.html#z411_0">resetVertexArrayRange</a>(); +01447 +01448 <font class="comment">// delete containers</font> +01449 <font class="keyword">delete</font> <a class="code" href="classNL3D_1_1CDriverGL.html#z411_10">_AGPVertexArrayRange</a>; +01450 <font class="keyword">delete</font> <a class="code" href="classNL3D_1_1CDriverGL.html#z411_11">_VRAMVertexArrayRange</a>; +01451 <a class="code" href="classNL3D_1_1CDriverGL.html#z411_10">_AGPVertexArrayRange</a>= NULL; +01452 <a class="code" href="classNL3D_1_1CDriverGL.html#z411_11">_VRAMVertexArrayRange</a>= NULL; +01453 +01454 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font> +01455 <font class="preprocessor"></font> <font class="comment">// Then delete.</font> +01456 <font class="comment">// wglMakeCurrent(NULL,NULL);</font> +01457 +01458 <font class="comment">// Off-screen rendering ?</font> +01459 <font class="keywordflow">if</font> (_OffScreen) +01460 { +01461 <font class="keywordflow">if</font> (_PBuffer) +01462 { +01463 wglDeleteContext( _hRC ); +01464 wglReleasePbufferDCARB( _PBuffer, _hDC ); +01465 wglDestroyPbufferARB( _PBuffer ); +01466 } +01467 } +01468 <font class="keywordflow">else</font> +01469 { +01470 <font class="keywordflow">if</font> (_hRC) +01471 wglDeleteContext(_hRC); +01472 <font class="keywordflow">if</font> (_hWnd&&_hDC) +01473 { +01474 ReleaseDC(_hWnd,_hDC); +01475 <font class="keywordflow">if</font> (_DestroyWindow) +01476 DestroyWindow (_hWnd); +01477 } +01478 +01479 <font class="keywordflow">if</font>(_FullScreen) +01480 { +01481 ChangeDisplaySettings(&_OldScreenMode, 0); +01482 <a class="code" href="classNL3D_1_1CDriverGL.html#o0">_FullScreen</a>= <font class="keyword">false</font>; +01483 } +01484 } +01485 +01486 _hRC=NULL; +01487 _hDC=NULL; +01488 _hWnd=NULL; +01489 _PBuffer = NULL; +01490 +01491 <font class="comment">// Restaure monitor color parameters</font> +01492 <font class="keywordflow">if</font> (_NeedToRestaureGammaRamp) +01493 { +01494 HDC dc = CreateDC (<font class="stringliteral">"DISPLAY"</font>, NULL, NULL, NULL); +01495 <font class="keywordflow">if</font> (dc) +01496 { +01497 <font class="keywordflow">if</font> (!SetDeviceGammaRamp (dc, _GammaRampBackuped)) +01498 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"(CDriverGL::release): SetDeviceGammaRamp failed"</font>); +01499 +01500 <font class="comment">// Release the DC</font> +01501 ReleaseDC (NULL, dc); +01502 } +01503 <font class="keywordflow">else</font> +01504 { +01505 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"(CDriverGL::release): can't create DC"</font>); +01506 } +01507 } +01508 +01509 <font class="preprocessor">#elif defined (NL_OS_UNIX)// NL_OS_WINDOWS</font> +01510 <font class="preprocessor"></font> +01511 <font class="preprocessor">#ifdef XF86VIDMODE</font> +01512 <font class="preprocessor"></font> <font class="keywordflow">if</font>(_FullScreen) +01513 { +01514 XF86VidModeModeInfo info; +01515 <a class="code" href="debug_8h.html#a1">nlinfo</a>(<font class="stringliteral">"Switching back to original mode \n"</font>); +01516 +01517 <font class="comment">// This is a bit ugly - a quick hack to copy the ModeLine structure </font> +01518 <font class="comment">// into the modeInfo structure.</font> +01519 memcpy((XF86VidModeModeLine *)((<font class="keywordtype">char</font> *)&info + <font class="keyword">sizeof</font>(info.dotclock)),&_OldScreenMode, <font class="keyword">sizeof</font>(XF86VidModeModeLine)); +01520 info.dotclock = _OldDotClock; +01521 +01522 <a class="code" href="debug_8h.html#a1">nlinfo</a>(<font class="stringliteral">"Mode is %dx%d,\n"</font>,info.hdisplay,info.vdisplay); +01523 XF86VidModeSwitchToMode(dpy,DefaultScreen(dpy),&info); +01524 <a class="code" href="debug_8h.html#a1">nlinfo</a>(<font class="stringliteral">"Switching viewporr to %d,%d,\n"</font>,_OldX, _OldY); +01525 XF86VidModeSetViewPort(dpy,DefaultScreen(dpy),_OldX,_OldY); +01526 <font class="comment">// Ungrab the keyboard (probably not necessary);</font> +01527 XUngrabKeyboard(dpy, CurrentTime); +01528 } +01529 <font class="preprocessor">#endif // XF86VIDMODE</font> +01530 <font class="preprocessor"></font> +01531 <font class="preprocessor">#endif // NL_OS_UNIX</font> +01532 <font class="preprocessor"></font> +01533 +01534 <font class="comment">// released</font> +01535 <a class="code" href="classNL3D_1_1CDriverGL.html#o2">_Initialized</a>= <font class="keyword">false</font>; +01536 +01537 <font class="keywordflow">return</font> <font class="keyword">true</font>; +01538 } +01539 +01540 <font class="comment">// --------------------------------------------------</font> +01541 +01542 IDriver::TMessageBoxId CDriverGL::systemMessageBox (<font class="keyword">const</font> <font class="keywordtype">char</font>* message, <font class="keyword">const</font> <font class="keywordtype">char</font>* title, IDriver::TMessageBoxType <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>, TMessageBoxIcon icon) +01543 { +01544 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font> +01545 <font class="preprocessor"></font> <font class="keywordflow">switch</font> (::MessageBox (NULL, message, title, ((<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>==<a class="code" href="classNL3D_1_1IDriver.html#s42s13">retryCancelType</a>)?MB_RETRYCANCEL: +01546 (<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>==<a class="code" href="classNL3D_1_1IDriver.html#s42s12">yesNoCancelType</a>)?MB_YESNOCANCEL: +01547 (<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>==<a class="code" href="classNL3D_1_1IDriver.html#s42s9">okCancelType</a>)?MB_OKCANCEL: +01548 (<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>==<a class="code" href="classNL3D_1_1IDriver.html#s42s11">abortRetryIgnoreType</a>)?MB_ABORTRETRYIGNORE: +01549 (<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>==<a class="code" href="classNL3D_1_1IDriver.html#s42s10">yesNoType</a>)?MB_YESNO|MB_ICONQUESTION:MB_OK)| +01550 +01551 ((icon==<a class="code" href="classNL3D_1_1IDriver.html#s43s16">handIcon</a>)?MB_ICONHAND: +01552 (icon==<a class="code" href="classNL3D_1_1IDriver.html#s43s17">questionIcon</a>)?MB_ICONQUESTION: +01553 (icon==<a class="code" href="classNL3D_1_1IDriver.html#s43s18">exclamationIcon</a>)?MB_ICONEXCLAMATION: +01554 (icon==<a class="code" href="classNL3D_1_1IDriver.html#s43s19">asteriskIcon</a>)?MB_ICONASTERISK: +01555 (icon==<a class="code" href="classNL3D_1_1IDriver.html#s43s20">warningIcon</a>)?MB_ICONWARNING: +01556 (icon==<a class="code" href="classNL3D_1_1IDriver.html#s43s21">errorIcon</a>)?MB_ICONERROR: +01557 (icon==<a class="code" href="classNL3D_1_1IDriver.html#s43s22">informationIcon</a>)?MB_ICONINFORMATION: +01558 (icon==<a class="code" href="classNL3D_1_1IDriver.html#s43s23">stopIcon</a>)?MB_ICONSTOP:0))) +01559 { +01560 <font class="keywordflow">case</font> IDOK: +01561 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1IDriver.html#s41s0">okId</a>; +01562 <font class="keywordflow">case</font> IDCANCEL: +01563 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1IDriver.html#s41s5">cancelId</a>; +01564 <font class="keywordflow">case</font> IDABORT: +01565 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1IDriver.html#s41s3">abortId</a>; +01566 <font class="keywordflow">case</font> IDRETRY: +01567 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1IDriver.html#s41s4">retryId</a>; +01568 <font class="keywordflow">case</font> IDIGNORE: +01569 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1IDriver.html#s41s6">ignoreId</a>; +01570 <font class="keywordflow">case</font> IDYES: +01571 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1IDriver.html#s41s1">yesId</a>; +01572 <font class="keywordflow">case</font> IDNO: +01573 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1IDriver.html#s41s2">noId</a>; +01574 } +01575 <a class="code" href="debug_8h.html#a12">nlstop</a>; +01576 <font class="preprocessor">#else // NL_OS_WINDOWS</font> +01577 <font class="preprocessor"></font> <font class="comment">// Call the console version!</font> +01578 IDriver::systemMessageBox (message, title, <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>, icon); +01579 <font class="preprocessor">#endif // NL_OS_WINDOWS</font> +01580 <font class="preprocessor"></font> <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1IDriver.html#s41s0">okId</a>; +01581 } +01582 +01583 <font class="comment">// --------------------------------------------------</font> +01584 +<a name="l01585"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a61">01585</a> <font class="keywordtype">void</font> CDriverGL::setupViewport (<font class="keyword">const</font> <font class="keyword">class</font> CViewport& viewport) +01586 { +01587 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font> +01588 <font class="preprocessor"></font> <font class="keywordflow">if</font> (_hWnd == NULL) <font class="keywordflow">return</font>; +01589 +01590 <font class="comment">// Setup gl viewport</font> +01591 <font class="keywordtype">int</font> clientWidth = _WindowWidth; +01592 <font class="keywordtype">int</font> clientHeight = _WindowHeight; +01593 +01594 <font class="preprocessor">#else // NL_OS_WINDOWS</font> +01595 <font class="preprocessor"></font> +01596 XWindowAttributes win_attributes; +01597 <font class="keywordflow">if</font> (!XGetWindowAttributes(dpy, win, &win_attributes)) +01598 <font class="keywordflow">throw</font> EBadDisplay(<font class="stringliteral">"Can't get window attributes."</font>); +01599 +01600 <font class="comment">// Setup gl viewport</font> +01601 <font class="keywordtype">int</font> clientWidth=win_attributes.width; +01602 <font class="keywordtype">int</font> clientHeight=win_attributes.height; +01603 +01604 <font class="preprocessor">#endif // NL_OS_WINDOWS</font> +01605 <font class="preprocessor"></font> +01606 <font class="comment">// Get viewport</font> +01607 <font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>; +01608 <font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>; +01609 <font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>; +01610 <font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>; +01611 viewport.getValues (<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>); +01612 +01613 <font class="comment">// Setup gl viewport</font> +01614 <font class="keywordtype">int</font> ix=(int)((float)clientWidth*<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>); +01615 <a class="code" href="namespaceNLMISC.html#a215">clamp</a> (ix, 0, clientWidth); +01616 <font class="keywordtype">int</font> iy=(int)((float)clientHeight*<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>); +01617 <a class="code" href="namespaceNLMISC.html#a215">clamp</a> (iy, 0, clientHeight); +01618 <font class="keywordtype">int</font> iwidth=(int)((float)clientWidth*<a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>); +01619 <a class="code" href="namespaceNLMISC.html#a215">clamp</a> (iwidth, 0, clientWidth-ix); +01620 <font class="keywordtype">int</font> iheight=(int)((float)clientHeight*<a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>); +01621 <a class="code" href="namespaceNLMISC.html#a215">clamp</a> (iheight, 0, clientHeight-iy); +01622 glViewport (ix, iy, iwidth, iheight); +01623 } +01624 +01625 +01626 +01627 <font class="comment">// --------------------------------------------------</font> +<a name="l01628"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a60">01628</a> <font class="keywordtype">void</font> CDriverGL::setupScissor (<font class="keyword">const</font> <font class="keyword">class</font> CScissor& scissor) +01629 { +01630 <font class="comment">// Get viewport</font> +01631 <font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>= scissor.X; +01632 <font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>= scissor.Width; +01633 <font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>= scissor.Height; +01634 +01635 <font class="keywordflow">if</font>(<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>==0 && <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>==0 && <a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>==1 && <a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>==1) +01636 { +01637 glDisable(GL_SCISSOR_TEST); +01638 } +01639 <font class="keywordflow">else</font> +01640 { +01641 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font> +01642 <font class="preprocessor"></font> +01643 <font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>= scissor.Y; +01644 +01645 <font class="keywordflow">if</font> (_hWnd) +01646 { +01647 <font class="comment">// Get window rect</font> +01648 <font class="keywordtype">int</font> clientWidth = _WindowWidth; +01649 <font class="keywordtype">int</font> clientHeight = _WindowHeight; +01650 +01651 <font class="comment">// Setup gl scissor</font> +01652 <font class="keywordtype">int</font> ix0=(int)floor((<font class="keywordtype">float</font>)clientWidth * <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a> + 0.5f); +01653 <a class="code" href="namespaceNLMISC.html#a215">clamp</a> (ix0, 0, clientWidth); +01654 <font class="keywordtype">int</font> iy0=(int)floor((<font class="keywordtype">float</font>)clientHeight* <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a> + 0.5f); +01655 <a class="code" href="namespaceNLMISC.html#a215">clamp</a> (iy0, 0, clientHeight); +01656 +01657 <font class="keywordtype">int</font> ix1=(int)floor((<font class="keywordtype">float</font>)clientWidth * (<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>+<a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>) + 0.5f ); +01658 <a class="code" href="namespaceNLMISC.html#a215">clamp</a> (ix1, 0, clientWidth); +01659 <font class="keywordtype">int</font> iy1=(int)floor((<font class="keywordtype">float</font>)clientHeight* (<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>+<a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>) + 0.5f ); +01660 <a class="code" href="namespaceNLMISC.html#a215">clamp</a> (iy1, 0, clientHeight); +01661 +01662 +01663 <font class="keywordtype">int</font> iwidth= ix1 - ix0; +01664 <a class="code" href="namespaceNLMISC.html#a215">clamp</a> (iwidth, 0, clientWidth); +01665 <font class="keywordtype">int</font> iheight= iy1 - iy0; +01666 <a class="code" href="namespaceNLMISC.html#a215">clamp</a> (iheight, 0, clientHeight); +01667 +01668 glScissor (ix0, iy0, iwidth, iheight); +01669 glEnable(GL_SCISSOR_TEST); +01670 } +01671 <font class="preprocessor">#endif // NL_OS_WINDOWS</font> +01672 <font class="preprocessor"></font> } +01673 } +01674 +01675 +01676 +01677 <font class="comment">// --------------------------------------------------</font> +01678 +<a name="l01679"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a67">01679</a> <font class="keywordtype">void</font> CDriverGL::showCursor(<font class="keywordtype">bool</font> b) +01680 { +01681 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font> +01682 <font class="preprocessor"></font> ShowCursor(b); +01683 <font class="preprocessor">#elif defined (NL_OS_UNIX)</font> +01684 <font class="preprocessor"></font> +01685 <font class="keywordflow">if</font> (b) +01686 { +01687 <font class="keywordflow">if</font> (cursor != None) +01688 { +01689 XFreeCursor(dpy, cursor); +01690 cursor = None; +01691 } +01692 XUndefineCursor(dpy, win); +01693 } +01694 <font class="keywordflow">else</font> +01695 { +01696 <font class="keywordflow">if</font> (cursor == None) +01697 { +01698 <font class="keywordtype">char</font> bm_no_data[] = { 0,0,0,0, 0,0,0,0 }; +01699 Pixmap pixmap_no_data = XCreateBitmapFromData (dpy, win, bm_no_data, 8, 8); +01700 XColor black; +01701 memset(&black, 0, <font class="keyword">sizeof</font> (XColor)); +01702 black.flags = DoRed | DoGreen | DoBlue; +01703 cursor = XCreatePixmapCursor (dpy, pixmap_no_data, pixmap_no_data, &black, &black, 0, 0); +01704 XFreePixmap(dpy, pixmap_no_data); +01705 } +01706 XDefineCursor(dpy, win, cursor); +01707 } +01708 <font class="preprocessor">#endif // NL_OS_UNIX</font> +01709 <font class="preprocessor"></font>} +01710 +01711 +01712 <font class="comment">// --------------------------------------------------</font> +01713 +<a name="l01714"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a68">01714</a> <font class="keywordtype">void</font> CDriverGL::setMousePos(<font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>, <font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>) +01715 { +01716 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font> +01717 <font class="preprocessor"></font> <font class="keywordflow">if</font> (_hWnd) +01718 { +01719 <font class="comment">// NeL window coordinate to MSWindows coordinates</font> +01720 POINT pt; +01721 pt.x = (int)((float)(_WindowWidth)*<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>); +01722 pt.y = (int)((float)(_WindowHeight)*(1.0f-<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>)); +01723 ClientToScreen (_hWnd, &pt); +01724 SetCursorPos(pt.x, pt.y); +01725 } +01726 <font class="preprocessor">#elif defined (NL_OS_UNIX)</font> +01727 <font class="preprocessor"></font> XWindowAttributes xwa; +01728 XGetWindowAttributes (dpy, win, &xwa); +01729 <font class="keywordtype">int</font> x1 = (int)(<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a> * (float) xwa.width); +01730 <font class="keywordtype">int</font> y1 = (int)((1.0f - <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>) * (float) xwa.height); +01731 XWarpPointer (dpy, None, win, None, None, None, None, x1, y1); +01732 <font class="preprocessor">#endif // NL_OS_UNIX</font> +01733 <font class="preprocessor"></font>} +01734 +01735 +<a name="l01736"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a73">01736</a> <font class="keywordtype">void</font> CDriverGL::getWindowSize(uint32 &<a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>, uint32 &<a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>) +01737 { +01738 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font> +01739 <font class="preprocessor"></font> <font class="comment">// Off-srceen rendering ?</font> +01740 <font class="keywordflow">if</font> (_OffScreen) +01741 { +01742 <font class="keywordflow">if</font> (_PBuffer) +01743 { +01744 wglQueryPbufferARB( _PBuffer, <a class="code" href="driver__opengl__extension__def_8h.html#a140">WGL_PBUFFER_WIDTH_ARB</a>, (<font class="keywordtype">int</font>*)&<a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a> ); +01745 wglQueryPbufferARB( _PBuffer, <a class="code" href="driver__opengl__extension__def_8h.html#a141">WGL_PBUFFER_HEIGHT_ARB</a>, (<font class="keywordtype">int</font>*)&<a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a> ); +01746 } +01747 } +01748 <font class="keywordflow">else</font> +01749 { +01750 <font class="keywordflow">if</font> (_hWnd) +01751 { +01752 <a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a> = (uint32)(_WindowWidth); +01753 <a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a> = (uint32)(_WindowHeight); +01754 } +01755 } +01756 <font class="preprocessor">#elif defined (NL_OS_UNIX)</font> +01757 <font class="preprocessor"></font> XWindowAttributes xwa; +01758 XGetWindowAttributes (dpy, win, &xwa); +01759 <a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a> = (uint32) xwa.width; +01760 <a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a> = (uint32) xwa.height; +01761 <font class="preprocessor">#endif // NL_OS_UNIX</font> +01762 <font class="preprocessor"></font>} +01763 +01764 <font class="comment">// --------------------------------------------------</font> +01765 +<a name="l01766"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a65">01766</a> <font class="keywordtype">bool</font> CDriverGL::isActive() +01767 { +01768 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font> +01769 <font class="preprocessor"></font> <font class="keywordflow">return</font> (IsWindow(_hWnd) != 0); +01770 <font class="preprocessor">#elif defined (NL_OS_UNIX)</font> +01771 <font class="preprocessor"></font> <font class="keywordflow">return</font> <font class="keyword">true</font>; +01772 <font class="preprocessor">#endif // NL_OS_UNIX</font> +01773 <font class="preprocessor"></font>} +01774 +<a name="l01775"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a66">01775</a> uint8 CDriverGL::getBitPerPixel () +01776 { +01777 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CDriverGL.html#o3">_Depth</a>; +01778 } +01779 +<a name="l01780"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a64">01780</a> <font class="keyword">const</font> <font class="keywordtype">char</font> *CDriverGL::getVideocardInformation () +01781 { +01782 <font class="keyword">static</font> <font class="keywordtype">char</font> name[1024]; +01783 +01784 <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CDriverGL.html#o2">_Initialized</a>) <font class="keywordflow">return</font> <font class="stringliteral">"OpenGL isn't initialized"</font>; +01785 +01786 <font class="keyword">const</font> <font class="keywordtype">char</font> *vendor = (<font class="keyword">const</font> <font class="keywordtype">char</font> *) glGetString (GL_VENDOR); +01787 <font class="keyword">const</font> <font class="keywordtype">char</font> *renderer = (<font class="keyword">const</font> <font class="keywordtype">char</font> *) glGetString (GL_RENDERER); +01788 <font class="keyword">const</font> <font class="keywordtype">char</font> *version = (<font class="keyword">const</font> <font class="keywordtype">char</font> *) glGetString (GL_VERSION); +01789 +01790 <a class="code" href="namespaceNLMISC.html#a211">smprintf</a>(name, 1024, <font class="stringliteral">"%s / %s / %s"</font>, vendor, renderer, version); +01791 <font class="keywordflow">return</font> name; +01792 } +01793 +01794 +<a name="l01795"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a69">01795</a> <font class="keywordtype">void</font> CDriverGL::setCapture (<font class="keywordtype">bool</font> b) +01796 { +01797 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font> +01798 <font class="preprocessor"></font> +01799 <font class="keywordflow">if</font> (b) +01800 { +01801 RECT client; +01802 GetClientRect (_hWnd, &client); +01803 POINT pt1,pt2; +01804 pt1.x = client.left; +01805 pt1.y = client.top; +01806 ClientToScreen (_hWnd, &pt1); +01807 pt2.x = client.right; +01808 pt2.y = client.bottom; +01809 ClientToScreen (_hWnd, &pt2); +01810 client.bottom = pt2.y; +01811 client.top = pt1.y; +01812 client.left = pt1.x; +01813 client.right = pt2.x; +01814 ClipCursor (&client); +01815 } +01816 <font class="keywordflow">else</font> +01817 ClipCursor (NULL); +01818 +01819 <font class="comment">/*</font> +01820 <font class="comment"> if (b)</font> +01821 <font class="comment"> SetCapture (_hWnd);</font> +01822 <font class="comment"> else</font> +01823 <font class="comment"> ReleaseCapture ();</font> +01824 <font class="comment"> */</font> +01825 +01826 <font class="preprocessor">#elif defined (NL_OS_UNIX)</font> +01827 <font class="preprocessor"></font> +01828 <font class="preprocessor">#endif // NL_OS_UNIX</font> +01829 <font class="preprocessor"></font>} +01830 +01831 +<a name="l01832"></a><a class="code" href="classNL3D_1_1CDriverGL.html#c13">01832</a> <font class="keywordtype">bool</font> CDriverGL::clipRect(<a class="code" href="classNLMISC_1_1CRect.html">NLMISC::CRect</a> &rect) +01833 { +01834 <font class="comment">// Clip the wanted rectangle with window.</font> +01835 uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>; +01836 <a class="code" href="classNL3D_1_1CDriverGL.html#a73">getWindowSize</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>); +01837 +01838 sint32 xr=rect.<a class="code" href="classNLMISC_1_1CRect.html#a7">right</a>() ,yr=rect.<a class="code" href="classNLMISC_1_1CRect.html#a9">bottom</a>(); +01839 +01840 <a class="code" href="namespaceNLMISC.html#a215">clamp</a>((sint32&)rect.<a class="code" href="classNLMISC_1_1CRect.html#m0">X</a>, (sint32)0, (sint32)<a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>); +01841 <a class="code" href="namespaceNLMISC.html#a215">clamp</a>((sint32&)rect.<a class="code" href="classNLMISC_1_1CRect.html#m1">Y</a>, (sint32)0, (sint32)<a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>); +01842 <a class="code" href="namespaceNLMISC.html#a215">clamp</a>((sint32&)xr, (sint32)rect.<a class="code" href="classNLMISC_1_1CRect.html#m0">X</a>, (sint32)<a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>); +01843 <a class="code" href="namespaceNLMISC.html#a215">clamp</a>((sint32&)yr, (sint32)rect.<a class="code" href="classNLMISC_1_1CRect.html#m1">Y</a>, (sint32)<a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>); +01844 rect.<a class="code" href="classNLMISC_1_1CRect.html#m2">Width</a>= xr-rect.<a class="code" href="classNLMISC_1_1CRect.html#m0">X</a>; +01845 rect.<a class="code" href="classNLMISC_1_1CRect.html#m3">Height</a>= yr-rect.<a class="code" href="classNLMISC_1_1CRect.html#m1">Y</a>; +01846 +01847 <font class="keywordflow">return</font> rect.<a class="code" href="classNLMISC_1_1CRect.html#m2">Width</a>>0 && rect.<a class="code" href="classNLMISC_1_1CRect.html#m3">Height</a>>0; +01848 } +01849 +01850 +01851 +<a name="l01852"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a76">01852</a> <font class="keywordtype">void</font> CDriverGL::getBufferPart (CBitmap &bitmap, <a class="code" href="classNLMISC_1_1CRect.html">NLMISC::CRect</a> &rect) +01853 { +01854 bitmap.reset(); +01855 +01856 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CDriverGL.html#c13">clipRect</a>(rect)) +01857 { +01858 bitmap.resize(rect.<a class="code" href="classNLMISC_1_1CRect.html#m2">Width</a>, rect.<a class="code" href="classNLMISC_1_1CRect.html#m3">Height</a>, CBitmap::RGBA); +01859 vector<uint8> &d = bitmap.getPixels (); +01860 glReadPixels (rect.<a class="code" href="classNLMISC_1_1CRect.html#m0">X</a>, rect.<a class="code" href="classNLMISC_1_1CRect.html#m1">Y</a>, rect.<a class="code" href="classNLMISC_1_1CRect.html#m2">Width</a>, rect.<a class="code" href="classNLMISC_1_1CRect.html#m3">Height</a>, GL_RGBA, GL_UNSIGNED_BYTE, &(d[0])); +01861 } +01862 } +01863 +01864 +<a name="l01865"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a77">01865</a> <font class="keywordtype">void</font> CDriverGL::getZBufferPart (std::vector<float> &zbuffer, <a class="code" href="classNLMISC_1_1CRect.html">NLMISC::CRect</a> &rect) +01866 { +01867 zbuffer.clear(); +01868 +01869 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CDriverGL.html#c13">clipRect</a>(rect)) +01870 { +01871 zbuffer.resize(rect.<a class="code" href="classNLMISC_1_1CRect.html#m2">Width</a>*rect.<a class="code" href="classNLMISC_1_1CRect.html#m3">Height</a>); +01872 glPixelTransferf(GL_DEPTH_SCALE, 1.0f) ; +01873 glPixelTransferf(GL_DEPTH_BIAS, 0.f) ; +01874 glReadPixels (rect.<a class="code" href="classNLMISC_1_1CRect.html#m0">X</a>, rect.<a class="code" href="classNLMISC_1_1CRect.html#m1">Y</a>, rect.<a class="code" href="classNLMISC_1_1CRect.html#m2">Width</a>, rect.<a class="code" href="classNLMISC_1_1CRect.html#m3">Height</a>, GL_DEPTH_COMPONENT , GL_FLOAT, &(zbuffer[0])); +01875 } +01876 } +01877 +01878 +<a name="l01879"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a75">01879</a> <font class="keywordtype">void</font> CDriverGL::getZBuffer (std::vector<float> &zbuffer) +01880 { +01881 CRect rect(0,0); +01882 <a class="code" href="classNL3D_1_1CDriverGL.html#a73">getWindowSize</a>(rect.Width, rect.Height); +01883 <a class="code" href="classNL3D_1_1CDriverGL.html#a77">getZBufferPart</a>(zbuffer, rect); +01884 } +01885 +<a name="l01886"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a74">01886</a> <font class="keywordtype">void</font> CDriverGL::getBuffer (CBitmap &bitmap) +01887 { +01888 CRect rect(0,0); +01889 <a class="code" href="classNL3D_1_1CDriverGL.html#a73">getWindowSize</a>(rect.Width, rect.Height); +01890 <a class="code" href="classNL3D_1_1CDriverGL.html#a76">getBufferPart</a>(bitmap, rect); +01891 } +01892 +<a name="l01893"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a79">01893</a> <font class="keywordtype">bool</font> CDriverGL::fillBuffer (CBitmap &bitmap) +01894 { +01895 CRect rect(0,0); +01896 <a class="code" href="classNL3D_1_1CDriverGL.html#a73">getWindowSize</a>(rect.Width, rect.Height); +01897 <font class="keywordflow">if</font>( rect.Width!=bitmap.getWidth() || rect.Height!=bitmap.getHeight() || bitmap.getPixelFormat()!=CBitmap::RGBA ) +01898 <font class="keywordflow">return</font> <font class="keyword">false</font>; +01899 +01900 glPixelStorei(GL_UNPACK_ALIGNMENT,1); +01901 glDrawPixels (rect.Width, rect.Height, GL_RGBA, GL_UNSIGNED_BYTE, &(bitmap.getPixels()[0]) ); +01902 +01903 <font class="keywordflow">return</font> <font class="keyword">true</font>; +01904 } +01905 +01906 +<a name="l01907"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a78">01907</a> <font class="keywordtype">void</font> CDriverGL::copyFrameBufferToTexture(ITexture *tex, +01908 uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a387">level</a>, +01909 uint32 offsetx, +01910 uint32 offsety, +01911 uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>, +01912 uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>, +01913 uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>, +01914 uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a> +01915 ) +01916 { +01917 <a class="code" href="debug_8h.html#a6">nlassert</a>(!tex->isTextureCube()); +01918 <font class="keywordtype">bool</font> compressed = <font class="keyword">false</font>; +01919 <a class="code" href="classNL3D_1_1CDriverGL.html#c12">getGlTextureFormat</a>(*tex, compressed); +01920 <a class="code" href="debug_8h.html#a6">nlassert</a>(!compressed); +01921 <font class="comment">// first, mark the texture as valid, and make sure there is a corresponding texture in the device memory </font> +01922 <a class="code" href="classNL3D_1_1CDriverGL.html#a18">setupTexture</a>(*tex); +01923 <a class="code" href="classNL3D_1_1CDriverGL.html#l0">CTextureDrvInfosGL</a>* gltext = (<a class="code" href="classNL3D_1_1CDriverGL.html#l0">CTextureDrvInfosGL</a>*)(<a class="code" href="classNL3D_1_1IDriver.html#l2">ITextureDrvInfos</a>*)(tex->TextureDrvShare->DrvTexture); +01924 <a class="code" href="classNL3D_1_1CDriverGL.html#z405_11">_DriverGLStates</a>.activeTextureARB(0); +01925 <font class="comment">// setup texture mode, after activeTextureARB()</font> +01926 <a class="code" href="classNL3D_1_1CDriverGL.html#z405_11">_DriverGLStates</a>.setTextureMode(CDriverGLStates::Texture2D); +01927 glBindTexture(GL_TEXTURE_2D, gltext->ID); +01928 glCopyTexSubImage2D(GL_TEXTURE_2D, <a class="code" href="driver__opengl__extension__def_8h.html#a387">level</a>, offsetx, offsety, <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>); +01929 <font class="comment">// disable texturing.</font> +01930 <a class="code" href="classNL3D_1_1CDriverGL.html#z405_11">_DriverGLStates</a>.setTextureMode(CDriverGLStates::TextureDisabled); +01931 <a class="code" href="classNL3D_1_1CDriverGL.html#z405_4">_CurrentTexture</a>[0] = NULL; +01932 <a class="code" href="classNL3D_1_1CDriverGL.html#z405_5">_CurrentTextureInfoGL</a>[0] = NULL; +01933 } +01934 +01935 +<a name="l01936"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a80">01936</a> <font class="keywordtype">void</font> CDriverGL::setPolygonMode (TPolygonMode mode) +01937 { +01938 IDriver::setPolygonMode (mode); +01939 +01940 <font class="comment">// Set the polygon mode</font> +01941 <font class="keywordflow">switch</font> (_PolygonMode) +01942 { +01943 <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1IDriver.html#s44s25">Filled</a>: +01944 glPolygonMode (GL_FRONT_AND_BACK, GL_FILL); +01945 <font class="keywordflow">break</font>; +01946 <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1IDriver.html#s44s26">Line</a>: +01947 glPolygonMode (GL_FRONT_AND_BACK, GL_LINE); +01948 <font class="keywordflow">break</font>; +01949 <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1IDriver.html#s44s27">Point</a>: +01950 glPolygonMode (GL_FRONT_AND_BACK, GL_POINT); +01951 <font class="keywordflow">break</font>; +01952 } +01953 } +01954 +01955 +<a name="l01956"></a><a class="code" href="classNL3D_1_1CDriverGL.html#z399_0">01956</a> <font class="keywordtype">bool</font> CDriverGL::fogEnabled() +01957 { +01958 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CDriverGL.html#o16">_FogEnabled</a>; +01959 } +01960 +<a name="l01961"></a><a class="code" href="classNL3D_1_1CDriverGL.html#z399_1">01961</a> <font class="keywordtype">void</font> CDriverGL::enableFog(<font class="keywordtype">bool</font> enable) +01962 { +01963 <a class="code" href="classNL3D_1_1CDriverGL.html#o16">_FogEnabled</a>= enable; +01964 <font class="keywordflow">if</font>(enable) +01965 glEnable(GL_FOG); +01966 <font class="keywordflow">else</font> +01967 glDisable(GL_FOG); +01968 } +01969 +<a name="l01970"></a><a class="code" href="classNL3D_1_1CDriverGL.html#z399_2">01970</a> <font class="keywordtype">void</font> CDriverGL::setupFog(<font class="keywordtype">float</font> start, <font class="keywordtype">float</font> end, CRGBA color) +01971 { +01972 glFogf(GL_FOG_MODE, GL_LINEAR); +01973 glFogf(GL_FOG_START, start); +01974 glFogf(GL_FOG_END, end); +01975 +01976 <a class="code" href="classNL3D_1_1CDriverGL.html#o17">_CurrentFogColor</a>[0]= color.R/255.0f; +01977 <a class="code" href="classNL3D_1_1CDriverGL.html#o17">_CurrentFogColor</a>[1]= color.G/255.0f; +01978 <a class="code" href="classNL3D_1_1CDriverGL.html#o17">_CurrentFogColor</a>[2]= color.B/255.0f; +01979 <a class="code" href="classNL3D_1_1CDriverGL.html#o17">_CurrentFogColor</a>[3]= color.A/255.0f; +01980 +01981 glFogfv(GL_FOG_COLOR, <a class="code" href="classNL3D_1_1CDriverGL.html#o17">_CurrentFogColor</a>); +01982 +01985 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CDriverGL.html#z403_0">_Extensions</a>.EXTVertexShader && !<a class="code" href="classNL3D_1_1CDriverGL.html#z403_0">_Extensions</a>.NVVertexProgram) +01986 { +01987 <font class="comment">// register 96 is used to store fog informations</font> +01988 <font class="keywordflow">if</font> (start != end) +01989 { +01990 <a class="code" href="classNL3D_1_1CDriverGL.html#z413_3">setConstant</a>(96, 1.f / (start - end), - end / (start - end), 0, 0); +01991 } +01992 <font class="keywordflow">else</font> +01993 { +01994 <a class="code" href="classNL3D_1_1CDriverGL.html#z413_3">setConstant</a>(96, 0.f, 0, 0, 0); +01995 } +01996 } +01997 } +01998 +01999 +02000 +02001 <font class="comment">// ***************************************************************************</font> +<a name="l02002"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a52">02002</a> <font class="keywordtype">void</font> CDriverGL::profileRenderedPrimitives(CPrimitiveProfile &pIn, CPrimitiveProfile &pOut) +02003 { +02004 pIn= <a class="code" href="classNL3D_1_1CDriverGL.html#z412_1">_PrimitiveProfileIn</a>; +02005 pOut= <a class="code" href="classNL3D_1_1CDriverGL.html#z412_2">_PrimitiveProfileOut</a>; +02006 } +02007 +02008 +02009 <font class="comment">// ***************************************************************************</font> +<a name="l02010"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a53">02010</a> uint32 CDriverGL::profileAllocatedTextureMemory() +02011 { +02012 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CDriverGL.html#z412_3">_AllocatedTextureMemory</a>; +02013 } +02014 +02015 +02016 <font class="comment">// ***************************************************************************</font> +<a name="l02017"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a54">02017</a> uint32 CDriverGL::profileSetupedMaterials()<font class="keyword"> const</font> +02018 <font class="keyword"></font>{ +02019 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CDriverGL.html#z412_4">_NbSetupMaterialCall</a>; +02020 } +02021 +02022 +02023 <font class="comment">// ***************************************************************************</font> +<a name="l02024"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a55">02024</a> uint32 CDriverGL::profileSetupedModelMatrix()<font class="keyword"> const</font> +02025 <font class="keyword"></font>{ +02026 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CDriverGL.html#z412_5">_NbSetupModelMatrixCall</a>; +02027 } +02028 +02029 +02030 <font class="comment">// ***************************************************************************</font> +<a name="l02031"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a56">02031</a> <font class="keywordtype">void</font> CDriverGL::enableUsedTextureMemorySum (<font class="keywordtype">bool</font> enable) +02032 { +02033 <font class="keywordflow">if</font> (enable) +02034 <a class="code" href="debug_8h.html#a1">nlinfo</a> (<font class="stringliteral">"PERFORMANCE INFO: enableUsedTextureMemorySum has been set to true in CDriverGL\n"</font>); +02035 <a class="code" href="classNL3D_1_1CDriverGL.html#z412_6">_SumTextureMemoryUsed</a>=enable; +02036 } +02037 +02038 +02039 <font class="comment">// ***************************************************************************</font> +<a name="l02040"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a57">02040</a> uint32 CDriverGL::getUsedTextureMemory()<font class="keyword"> const</font> +02041 <font class="keyword"></font>{ +02042 <font class="comment">// Sum memory used</font> +02043 uint32 memory=0; +02044 +02045 <font class="comment">// For each texture used</font> +02046 set<CTextureDrvInfosGL*>::iterator ite=<a class="code" href="classNL3D_1_1CDriverGL.html#z412_7">_TextureUsed</a>.begin(); +02047 <font class="keywordflow">while</font> (ite!=<a class="code" href="classNL3D_1_1CDriverGL.html#z412_7">_TextureUsed</a>.end()) +02048 { +02049 <font class="comment">// Get the gl texture</font> +02050 <a class="code" href="classNL3D_1_1CDriverGL.html#l0">CTextureDrvInfosGL</a>* gltext; +02051 gltext= (*ite); +02052 +02053 <font class="comment">// Sum the memory used by this texture</font> +02054 memory+=gltext->TextureMemory; +02055 +02056 <font class="comment">// Next texture</font> +02057 ite++; +02058 } +02059 +02060 <font class="comment">// Return the count</font> +02061 <font class="keywordflow">return</font> memory; +02062 } +02063 +02064 +02065 <font class="comment">// ***************************************************************************</font> +<a name="l02066"></a><a class="code" href="classNL3D_1_1CDriverGL.html#z400_0">02066</a> <font class="keywordtype">bool</font> CDriverGL::supportTextureShaders()<font class="keyword"> const</font> +02067 <font class="keyword"></font>{ +02068 <font class="comment">// fully supported by NV_TEXTURE_SHADER </font> +02069 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CDriverGL.html#z403_0">_Extensions</a>.NVTextureShader; +02070 } +02071 +02072 <font class="comment">// ***************************************************************************</font> +<a name="l02073"></a><a class="code" href="classNL3D_1_1CDriverGL.html#z400_1">02073</a> <font class="keywordtype">bool</font> CDriverGL::isTextureAddrModeSupported(CMaterial::TTexAddressingMode mode)<font class="keyword"> const</font> +02074 <font class="keyword"></font>{ +02075 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CDriverGL.html#z403_0">_Extensions</a>.NVTextureShader) +02076 { +02077 <font class="comment">// all the given addessing mode are supported with this extension</font> +02078 <font class="keywordflow">return</font> <font class="keyword">true</font>; +02079 } +02080 <font class="keywordflow">else</font> +02081 { +02082 <font class="keywordflow">return</font> <font class="keyword">false</font>; +02083 } +02084 } +02085 +02086 <font class="comment">// ***************************************************************************</font> +<a name="l02087"></a><a class="code" href="classNL3D_1_1CDriverGL.html#z400_2">02087</a> <font class="keywordtype">void</font> CDriverGL::setMatrix2DForTextureOffsetAddrMode(<font class="keyword">const</font> uint stage, <font class="keyword">const</font> <font class="keywordtype">float</font> mat[4]) +02088 { +02089 <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CDriverGL.html#z400_0">supportTextureShaders</a>()) <font class="keywordflow">return</font>; +02090 <font class="comment">//nlassert(supportTextureShaders());</font> +02091 <a class="code" href="debug_8h.html#a6">nlassert</a>(stage < (uint) <a class="code" href="classNL3D_1_1CDriverGL.html#c28">inlGetNumTextStages</a>() ) +02092 <a class="code" href="classNL3D_1_1CDriverGL.html#z405_11">_DriverGLStates</a>.activeTextureARB(stage); +02093 glTexEnvfv(<a class="code" href="driver__opengl__extension__def_8h.html#a155">GL_TEXTURE_SHADER_NV</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a158">GL_OFFSET_TEXTURE_MATRIX_NV</a>, mat); +02094 } +02095 +02096 +02097 <font class="comment">// ***************************************************************************</font> +<a name="l02098"></a><a class="code" href="classNL3D_1_1CDriverGL.html#c9">02098</a> <font class="keywordtype">void</font> CDriverGL::enableNVTextureShader(<font class="keywordtype">bool</font> enabled) +02099 { +02100 <font class="keywordflow">if</font> (enabled != <a class="code" href="classNL3D_1_1CDriverGL.html#z405_9">_NVTextureShaderEnabled</a>) +02101 { +02102 +02103 <font class="keywordflow">if</font> (enabled) +02104 { +02105 glEnable(<a class="code" href="driver__opengl__extension__def_8h.html#a155">GL_TEXTURE_SHADER_NV</a>); +02106 } +02107 <font class="keywordflow">else</font> +02108 { +02109 glDisable(<a class="code" href="driver__opengl__extension__def_8h.html#a155">GL_TEXTURE_SHADER_NV</a>); +02110 } +02111 <a class="code" href="classNL3D_1_1CDriverGL.html#z405_9">_NVTextureShaderEnabled</a> = enabled; +02112 } +02113 } +02114 +02115 <font class="comment">// ***************************************************************************</font> +<a name="l02116"></a><a class="code" href="classNL3D_1_1CDriverGL.html#z404_0">02116</a> <font class="keywordtype">void</font> CDriverGL::checkForPerPixelLightingSupport() +02117 { +02118 <font class="comment">// we need at least 3 texture stages and cube map support + EnvCombine4 or 3 support </font> +02119 <font class="comment">// TODO : support for EnvCombine3</font> +02120 <font class="comment">// TODO : support for less than 3 stages</font> +02121 +02122 <a class="code" href="classNL3D_1_1CDriverGL.html#z404_2">_SupportPerPixelShaderNoSpec</a> = (<a class="code" href="classNL3D_1_1CDriverGL.html#z403_0">_Extensions</a>.NVTextureEnvCombine4 <font class="comment">/* || _Extensions.ATIXTextureEnvCombine3*/</font>) +02123 && <a class="code" href="classNL3D_1_1CDriverGL.html#z403_0">_Extensions</a>.ARBTextureCubeMap +02124 && <a class="code" href="classNL3D_1_1CDriverGL.html#z403_0">_Extensions</a>.NbTextureStages >= 3 +02125 && (<a class="code" href="classNL3D_1_1CDriverGL.html#z403_0">_Extensions</a>.NVVertexProgram <font class="comment">/* || _Extensions.EXTVertexShader*/</font>); +02126 +02127 <a class="code" href="classNL3D_1_1CDriverGL.html#z404_1">_SupportPerPixelShader</a> = (<a class="code" href="classNL3D_1_1CDriverGL.html#z403_0">_Extensions</a>.NVTextureEnvCombine4 <font class="comment">/*|| _Extensions.ATIXTextureEnvCombine3*/</font>) +02128 && <a class="code" href="classNL3D_1_1CDriverGL.html#z403_0">_Extensions</a>.ARBTextureCubeMap +02129 && <a class="code" href="classNL3D_1_1CDriverGL.html#z403_0">_Extensions</a>.NbTextureStages >= 2 +02130 && (<a class="code" href="classNL3D_1_1CDriverGL.html#z403_0">_Extensions</a>.NVVertexProgram <font class="comment">/*|| _Extensions.EXTVertexShader*/</font>); +02131 } +02132 +02133 <font class="comment">// ***************************************************************************</font> +<a name="l02134"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a86">02134</a> <font class="keywordtype">bool</font> CDriverGL::supportPerPixelLighting(<font class="keywordtype">bool</font> specular)<font class="keyword"> const</font> +02135 <font class="keyword"></font>{ +02136 <font class="keywordflow">return</font> specular ? <a class="code" href="classNL3D_1_1CDriverGL.html#z404_1">_SupportPerPixelShader</a> : <a class="code" href="classNL3D_1_1CDriverGL.html#z404_2">_SupportPerPixelShaderNoSpec</a>; +02137 } +02138 +02139 <font class="comment">// ***************************************************************************</font> +<a name="l02140"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a84">02140</a> <font class="keywordtype">void</font> CDriverGL::setPerPixelLightingLight(CRGBA diffuse, CRGBA specular, <font class="keywordtype">float</font> shininess) +02141 { +02142 <a class="code" href="classNL3D_1_1CDriverGL.html#z404_3">_PPLExponent</a> = shininess; +02143 <a class="code" href="classNL3D_1_1CDriverGL.html#z404_4">_PPLightDiffuseColor</a> = diffuse; +02144 <a class="code" href="classNL3D_1_1CDriverGL.html#z404_5">_PPLightSpecularColor</a> = specular; +02145 } +02146 +02147 <font class="comment">// ***************************************************************************</font> +<a name="l02148"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a70">02148</a> <a class="code" href="structNLMISC_1_1IMouseDevice.html">NLMISC::IMouseDevice</a> *CDriverGL::enableLowLevelMouse(<font class="keywordtype">bool</font> enable) +02149 { +02150 <font class="preprocessor"> #ifdef NL_OS_WINDOWS</font> +02151 <font class="preprocessor"></font> <font class="keywordflow">if</font> (_EventEmitter.getNumEmitters() < 2) <font class="keywordflow">return</font> NULL; +02152 NLMISC::CDIEventEmitter *diee = NLMISC::safe_cast<CDIEventEmitter *>(_EventEmitter.getEmitter(1)); +02153 <font class="keywordflow">if</font> (enable) +02154 { +02155 <font class="keywordflow">try</font> +02156 { +02157 <a class="code" href="structNLMISC_1_1IMouseDevice.html">NLMISC::IMouseDevice</a> *md = diee->getMouseDevice(); +02158 <font class="keywordflow">return</font> md; +02159 } +02160 <font class="keywordflow">catch</font> (EDirectInput &) +02161 { +02162 <font class="keywordflow">return</font> NULL; +02163 } +02164 } +02165 <font class="keywordflow">else</font> +02166 { +02167 diee->releaseMouse(); +02168 <font class="keywordflow">return</font> NULL; +02169 } +02170 <font class="preprocessor"> #else</font> +02171 <font class="preprocessor"></font> <font class="keywordflow">return</font> NULL; +02172 <font class="preprocessor"> #endif</font> +02173 <font class="preprocessor"></font>} +02174 +02175 <font class="comment">// ***************************************************************************</font> +<a name="l02176"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a71">02176</a> <a class="code" href="structNLMISC_1_1IKeyboardDevice.html">NLMISC::IKeyboardDevice</a> *CDriverGL::enableLowLevelKeyboard(<font class="keywordtype">bool</font> enable) +02177 { +02178 <font class="preprocessor"> #ifdef NL_OS_WINDOWS</font> +02179 <font class="preprocessor"></font> <font class="keywordflow">if</font> (_EventEmitter.getNumEmitters() < 2) <font class="keywordflow">return</font> NULL; +02180 NLMISC::CDIEventEmitter *diee = NLMISC::safe_cast<NLMISC::CDIEventEmitter *>(_EventEmitter.getEmitter(1)); +02181 <font class="keywordflow">if</font> (enable) +02182 { +02183 <font class="keywordflow">try</font> +02184 { +02185 <a class="code" href="structNLMISC_1_1IKeyboardDevice.html">NLMISC::IKeyboardDevice</a> *md = diee->getKeyboardDevice(); +02186 <font class="keywordflow">return</font> md; +02187 } +02188 <font class="keywordflow">catch</font> (EDirectInput &) +02189 { +02190 <font class="keywordflow">return</font> NULL; +02191 } +02192 } +02193 <font class="keywordflow">else</font> +02194 { +02195 diee->releaseKeyboard(); +02196 <font class="keywordflow">return</font> NULL; +02197 } +02198 <font class="preprocessor"> #else</font> +02199 <font class="preprocessor"></font> <font class="keywordflow">return</font> NULL; +02200 <font class="preprocessor"> #endif</font> +02201 <font class="preprocessor"></font>} +02202 +02203 <font class="comment">// ***************************************************************************</font> +<a name="l02204"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a72">02204</a> <a class="code" href="structNLMISC_1_1IInputDeviceManager.html">NLMISC::IInputDeviceManager</a> *CDriverGL::getLowLevelInputDeviceManager() +02205 { +02206 <font class="preprocessor"> #ifdef NL_OS_WINDOWS</font> +02207 <font class="preprocessor"></font> <font class="keywordflow">if</font> (_EventEmitter.getNumEmitters() < 2) <font class="keywordflow">return</font> NULL; +02208 NLMISC::CDIEventEmitter *diee = NLMISC::safe_cast<NLMISC::CDIEventEmitter *>(_EventEmitter.getEmitter(1)); +02209 <font class="keywordflow">return</font> diee; +02210 <font class="preprocessor"> #else</font> +02211 <font class="preprocessor"></font> <font class="keywordflow">return</font> NULL; +02212 <font class="preprocessor"> #endif</font> +02213 <font class="preprocessor"></font>} +02214 +02215 <font class="comment">// ***************************************************************************</font> +<a name="l02216"></a><a class="code" href="classNL3D_1_1CDriverGL.html#z402_0">02216</a> <font class="keywordtype">bool</font> CDriverGL::supportBlendConstantColor()<font class="keyword"> const</font> +02217 <font class="keyword"></font>{ +02218 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CDriverGL.html#z403_0">_Extensions</a>.EXTBlendColor; +02219 } +02220 <font class="comment">// ***************************************************************************</font> +<a name="l02221"></a><a class="code" href="classNL3D_1_1CDriverGL.html#z402_1">02221</a> <font class="keywordtype">void</font> CDriverGL::setBlendConstantColor(<a class="code" href="classNLMISC_1_1CRGBA.html">NLMISC::CRGBA</a> col) +02222 { +02223 <font class="comment">// bkup</font> +02224 <a class="code" href="classNL3D_1_1CDriverGL.html#o31">_CurrentBlendConstantColor</a>= col; +02225 +02226 <font class="comment">// update GL</font> +02227 <font class="keywordflow">if</font>(!<a class="code" href="classNL3D_1_1CDriverGL.html#z403_0">_Extensions</a>.EXTBlendColor) +02228 <font class="keywordflow">return</font>; +02229 <font class="keyword">static</font> <font class="keyword">const</font> <font class="keywordtype">float</font> OO255= 1.0f/255; +02230 <a class="code" href="driver__opengl__extension_8h.html#a171">nglBlendColorEXT</a>(col.<a class="code" href="classNLMISC_1_1CRGBA.html#m0">R</a>*OO255, col.<a class="code" href="classNLMISC_1_1CRGBA.html#m1">G</a>*OO255, col.<a class="code" href="classNLMISC_1_1CRGBA.html#m2">B</a>*OO255, col.<a class="code" href="classNLMISC_1_1CRGBA.html#m3">A</a>*OO255); +02231 } +02232 <font class="comment">// ***************************************************************************</font> +<a name="l02233"></a><a class="code" href="classNL3D_1_1CDriverGL.html#z402_2">02233</a> <a class="code" href="classNLMISC_1_1CRGBA.html">NLMISC::CRGBA</a> CDriverGL::getBlendConstantColor()<font class="keyword"> const</font> +02234 <font class="keyword"></font>{ +02235 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CDriverGL.html#o31">_CurrentBlendConstantColor</a>; +02236 } +02237 +02238 <font class="comment">// ***************************************************************************</font> +<a name="l02239"></a><a class="code" href="classNL3D_1_1CDriverGL.html#a12">02239</a> sint CDriverGL::getNbTextureStages()<font class="keyword"> const</font> +02240 <font class="keyword"></font>{ +02241 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CDriverGL.html#c28">inlGetNumTextStages</a>(); +02242 } +02243 +02244 +02245 <font class="comment">// ***************************************************************************</font> +<a name="l02246"></a><a class="code" href="classNL3D_1_1CDriverGL.html#c0">02246</a> <font class="keywordtype">void</font> CDriverGL::refreshProjMatrixFromGL() +02247 { +02248 <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CDriverGL.html#o7">_ProjMatDirty</a>) <font class="keywordflow">return</font>; +02249 <font class="keywordtype">float</font> mat[16]; +02250 glGetFloatv(GL_PROJECTION_MATRIX, mat); +02251 <a class="code" href="classNL3D_1_1CDriverGL.html#o8">_GLProjMat</a>.<a class="code" href="classNLMISC_1_1CMatrix.html#z290_10">set</a>(mat); +02252 <a class="code" href="classNL3D_1_1CDriverGL.html#o7">_ProjMatDirty</a> = <font class="keyword">false</font>; +02253 } +02254 +02255 +02256 <font class="comment">// ***************************************************************************</font> +<a name="l02257"></a><a class="code" href="classNL3D_1_1CDriverGL.html#z402_3">02257</a> <font class="keywordtype">bool</font> CDriverGL::setMonitorColorProperties (<font class="keyword">const</font> CMonitorColorProperties &properties) +02258 { +02259 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font> +02260 <font class="preprocessor"></font> +02261 <font class="comment">// Get a DC</font> +02262 HDC dc = CreateDC (<font class="stringliteral">"DISPLAY"</font>, NULL, NULL, NULL); +02263 <font class="keywordflow">if</font> (dc) +02264 { +02265 <font class="comment">// The ramp</font> +02266 WORD ramp[256*3]; +02267 +02268 <font class="comment">// For each composant</font> +02269 uint c; +02270 <font class="keywordflow">for</font>( c=0; c<3; c++ ) +02271 { +02272 uint i; +02273 <font class="keywordflow">for</font>( i=0; i<256; i++ ) +02274 { +02275 <font class="comment">// Floating value</font> +02276 <font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> = (float)i / 256; +02277 +02278 <font class="comment">// Contrast</font> +02279 <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> = (float) max (0.0f, (<a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a>-0.5f) * (<font class="keywordtype">float</font>) pow (3.f, properties.Contrast[c]) + 0.5f ); +02280 +02281 <font class="comment">// Gamma</font> +02282 <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> = (float) pow (<a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a>, (properties.Gamma[c]>0) ? 1 - 3 * properties.Gamma[c] / 4 : 1 - properties.Gamma[c] ); +02283 +02284 <font class="comment">// Luminosity</font> +02285 <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> = <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> + properties.Luminosity[c] / 2.f; +02286 ramp[i+(c<<8)] = <a class="code" href="bit__set_8cpp.html#a0">min</a> (65535, max (0, (<font class="keywordtype">int</font>)(<a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> * 65535))); +02287 } +02288 } +02289 +02290 <font class="comment">// Set the ramp</font> +02291 <font class="keywordtype">bool</font> result = SetDeviceGammaRamp (dc, ramp) != FALSE; +02292 +02293 <font class="comment">// Release the DC</font> +02294 ReleaseDC (NULL, dc); +02295 +02296 <font class="comment">// Returns result</font> +02297 <font class="keywordflow">return</font> result; +02298 } +02299 <font class="keywordflow">else</font> +02300 { +02301 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"(CDriverGL::setMonitorColorProperties): can't create DC"</font>); +02302 <font class="keywordflow">return</font> <font class="keyword">false</font>; +02303 } +02304 +02305 <font class="preprocessor">#else</font> +02306 <font class="preprocessor"></font> +02307 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"CDriverGL::setMonitorColorProperties not implemented"</font>); +02308 <font class="keywordflow">return</font> <font class="keyword">false</font>; +02309 +02310 <font class="preprocessor">#endif</font> +02311 <font class="preprocessor"></font>} +02312 +02313 <font class="comment">// ***************************************************************************</font> +<a name="l02314"></a><a class="code" href="classNL3D_1_1CDriverGL.html#z401_0">02314</a> <font class="keywordtype">bool</font> CDriverGL::supportEMBM()<font class="keyword"> const</font> +02315 <font class="keyword"></font>{ +02316 <font class="comment">// For now, supported via ATI extension</font> +02317 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CDriverGL.html#z403_0">_Extensions</a>.ATIEnvMapBumpMap; +02318 } +02319 +02320 <font class="comment">// ***************************************************************************</font> +<a name="l02321"></a><a class="code" href="classNL3D_1_1CDriverGL.html#z401_1">02321</a> <font class="keywordtype">bool</font> CDriverGL::isEMBMSupportedAtStage(uint stage)<font class="keyword"> const</font> +02322 <font class="keyword"></font>{ +02323 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CDriverGL.html#z401_0">supportEMBM</a>()); +02324 <a class="code" href="debug_8h.html#a6">nlassert</a>(stage < <a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>) +02325 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CDriverGL.html#z405_10">_StageSupportEMBM</a>[stage]; +02326 +02327 } +02328 +02329 <font class="comment">// ***************************************************************************</font> +<a name="l02330"></a><a class="code" href="classNL3D_1_1CDriverGL.html#z401_2">02330</a> <font class="keywordtype">void</font> CDriverGL::setEMBMMatrix(<font class="keyword">const</font> uint stage,<font class="keyword">const</font> <font class="keywordtype">float</font> mat[4]) +02331 { +02332 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CDriverGL.html#z401_0">supportEMBM</a>()); +02333 <a class="code" href="debug_8h.html#a6">nlassert</a>(stage < <a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>); +02334 <font class="comment">// </font> +02335 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CDriverGL.html#z403_0">_Extensions</a>.ATIEnvMapBumpMap) +02336 { +02337 <a class="code" href="classNL3D_1_1CDriverGL.html#z405_11">_DriverGLStates</a>.activeTextureARB(stage); +02338 <a class="code" href="driver__opengl__extension_8h.html#a151">nglTexBumpParameterfvATI</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a346">GL_BUMP_ROT_MATRIX_ATI</a>, const_cast<float *>(mat)); +02339 } +02340 } +02341 +02342 <font class="comment">// ***************************************************************************</font> +<a name="l02343"></a><a class="code" href="classNL3D_1_1CDriverGL.html#c29">02343</a> <font class="keywordtype">void</font> CDriverGL::initEMBM() +02344 { +02345 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CDriverGL.html#z401_0">supportEMBM</a>()) +02346 { +02347 std::fill(<a class="code" href="classNL3D_1_1CDriverGL.html#z405_10">_StageSupportEMBM</a>, <a class="code" href="classNL3D_1_1CDriverGL.html#z405_10">_StageSupportEMBM</a> + <a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a>, <font class="keyword">false</font>); +02348 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CDriverGL.html#z403_0">_Extensions</a>.ATIEnvMapBumpMap) +02349 { +02350 <font class="comment">// Test which stage support EMBM</font> +02351 GLint numEMBMUnits; +02352 <a class="code" href="driver__opengl__extension_8h.html#a152">nglGetTexBumpParameterivATI</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a348">GL_BUMP_NUM_TEX_UNITS_ATI</a>, &numEMBMUnits); +02353 std::vector<GLint> EMBMUnits(numEMBMUnits); +02354 <font class="comment">// get array of units that supports EMBM</font> +02355 <a class="code" href="driver__opengl__extension_8h.html#a152">nglGetTexBumpParameterivATI</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a349">GL_BUMP_TEX_UNITS_ATI</a>, &EMBMUnits[0]); +02356 uint k; +02357 <font class="keywordflow">for</font>(k = 0; k < (EMBMUnits.size() - 1); ++k) +02358 { +02359 uint stage = EMBMUnits[k] - GL_TEXTURE0_ARB; +02360 <font class="keywordflow">if</font> (stage < (<a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a> - 1)) +02361 { +02362 <a class="code" href="classNL3D_1_1CDriverGL.html#z405_10">_StageSupportEMBM</a>[k] = <font class="keyword">true</font>; +02363 } +02364 } +02365 <font class="comment">// setup each stage to apply the bump map to the next stage</font> +02366 <font class="keywordflow">for</font>(k = 0; k < <a class="code" href="namespaceNL3D.html#a94">IDRV_MAT_MAXTEXTURES</a> - 1; ++k) +02367 { +02368 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CDriverGL.html#z405_10">_StageSupportEMBM</a>[k]) +02369 { +02370 <font class="comment">// setup each stage so that it apply EMBM on the next stage</font> +02371 <a class="code" href="classNL3D_1_1CDriverGL.html#z405_11">_DriverGLStates</a>.activeTextureARB(k); +02372 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT); +02373 glTexEnvi(GL_TEXTURE_ENV, <a class="code" href="driver__opengl__extension__def_8h.html#a353">GL_BUMP_TARGET_ATI</a>, GL_TEXTURE0_ARB + k + 1); +02374 } +02375 } +02376 <a class="code" href="classNL3D_1_1CDriverGL.html#z405_11">_DriverGLStates</a>.activeTextureARB(0); +02377 } +02378 } +02379 } +02380 +02381 } <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> |