1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
|
<!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="/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="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
<TD WIDTH=140 BGCOLOR=#dddddd><IMG SRC="/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD>
<TD WIDTH=16><IMG SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
<TD><IMG width=6 height=14 SRC="/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF='/'><b>Home</B></FONT></A> </TD>
<TD><IMG width=6 height=14 SRC="/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF='/'><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="/inc/img/black_banner.jpg"><A HREF=""><IMG SRC="/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="/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD>
<TD WIDTH=140 BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG SRC="/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="/news/" TITLE="Rubrique news"><img width=13 height=15 hspace=5 border=0 src=/inc/img/picto-news.gif ALT=#></A></td><td><a class='linkbox' href="/news/" TITLE="News">News</a></td></tr>
<tr><td ALIGN=middle><a class='linkbox' href="/mail/" TITLE="Rubrique mail"><img width=15 height=11 hspace=5 border=0 src=/inc/img/picto-mail.gif ALT=#></A></td><td><a class='linkbox' href="/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr>
<tr><td ALIGN=middle><a class='linkbox' href="/docs/" TITLE="Rubrique docs"><img width=14 height=16 hspace=5 border=0 src=/inc/img/picto-docs.gif ALT=#></A></td><td><a class='linkbox' href="/docs/" TITLE="Documentation">Documentation</a></td></tr>
<tr><td ALIGN=middle><a class='linkbox' href="/cvs/" TITLE="Rubrique cvs"><img width=13 height=17 hspace=5 border=0 src=/inc/img/picto-cvs.gif ALT=#></A></td><td><a class='linkbox' href="/cvs/" TITLE="CVS Web">CVS</a></td></tr>
<tr><td ALIGN=middle><a class='linkbox' href="/bugs/" TITLE="Rubrique bugs"><img width=20 height=16 hspace=5 border=0 src=/inc/img/picto-bugs.gif ALT=#></A></td><td><a class='linkbox' href="/bugs/" TITLE="Bugtracking">Bugs</a></td></tr>
<tr><td ALIGN=middle><a class='linkbox' href="/GPL.php3" TITLE="Rubrique license"><img width=18 height=12 hspace=5 border=0 src=/inc/img/picto-gpl.gif ALT=#></A></td><td><a class='linkbox' href="/GPL.php3" TITLE="License">License</a></td></tr>
</TABLE>
</TD></TR></TABLE></TD></TR></TABLE>
<!------ End Box ------>
</TD>
<TD WIDTH=15><IMG SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
<TD ALIGN=left valign=top><IMG SRC="/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">
<!-- title -->
<TABLE background="/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td>
<A HREF="/docs/"><img src="/inc/img/t_docs.gif" ALT="Docs" HEIGHT=20 BORDER=0></A>
</td><td><IMG SRC="/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="/inc/img/reddots.gif"></TD>
<TD><B>Documentation</B></TD>
<TD ALIGN=RIGHT> </td>
</tr></table>
<!-- Generated by Doxygen 1.2.2 on Wed May 30 22:01:07 2001 -->
<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:/cgi-bin/nel-search.cgi" href="/cgi-bin/nel-search.cgi">Search</a> </center>
<hr><h1>driver_opengl.h</h1><a href="driver_opengl_h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001
00007 <font class="comment">/* Copyright, 2000 Nevrax Ltd.
</font>00008 <font class="comment"> *
</font>00009 <font class="comment"> * This file is part of NEVRAX NEL.
</font>00010 <font class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify
</font>00011 <font class="comment"> * it under the terms of the GNU General Public License as published by
</font>00012 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option)
</font>00013 <font class="comment"> * any later version.
</font>00014 <font class="comment">
</font>00015 <font class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but
</font>00016 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of
</font>00017 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
</font>00018 <font class="comment"> * General Public License for more details.
</font>00019 <font class="comment">
</font>00020 <font class="comment"> * You should have received a copy of the GNU General Public License
</font>00021 <font class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the
</font>00022 <font class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
</font>00023 <font class="comment"> * MA 02111-1307, USA.
</font>00024 <font class="comment"> */</font>
00025
00026 <font class="preprocessor">#ifndef NL_OPENGL_H
</font>00027 <font class="preprocessor"></font><font class="preprocessor">#define NL_OPENGL_H
</font>00028 <font class="preprocessor"></font>
00029
00030 <font class="preprocessor">#include "<a class="code" href="types_nl_h.html">nel/misc/types_nl.h</a>"</font>
00031
00032 <font class="preprocessor">#ifdef NL_OS_WINDOWS
</font>00033 <font class="preprocessor"></font>
00034 <font class="preprocessor">#define WIN32_LEAN_AND_MEAN
</font>00035 <font class="preprocessor"></font><font class="preprocessor">#include <windows.h></font>
00036
00037 <font class="preprocessor">#else // NL_OS_UNIX
</font>00038 <font class="preprocessor"></font>
<a name="l00039"></a><a class="code" href="driver_opengl_h.html#a0">00039</a> <font class="preprocessor">#define GL_GLEXT_PROTOTYPES
</font>00040 <font class="preprocessor"></font><font class="preprocessor">#include <GL/glx.h></font>
00041
00042 <font class="preprocessor">#ifdef XF86VIDMODE
</font>00043 <font class="preprocessor"></font><font class="preprocessor">#include <X11/extensions/xf86vmode.h></font>
00044 <font class="preprocessor">#endif //XF86VIDMODE
</font>00045 <font class="preprocessor"></font>
00046 <font class="preprocessor">#endif // NL_OS_UNIX
</font>00047 <font class="preprocessor"></font>
00048 <font class="preprocessor">#include <GL/gl.h></font>
00049 <font class="preprocessor">#include "<a class="code" href="driver_opengl_extension_h.html">driver_opengl_extension.h</a>"</font>
00050
00051 <font class="preprocessor">#include "<a class="code" href="driver_h.html">nel/3d/driver.h</a>"</font>
00052 <font class="preprocessor">#include "<a class="code" href="material_h.html">nel/3d/material.h</a>"</font>
00053 <font class="preprocessor">#include "<a class="code" href="shader_h.html">nel/3d/shader.h</a>"</font>
00054 <font class="preprocessor">#include "<a class="code" href="vertex_buffer_h.html">nel/3d/vertex_buffer.h</a>"</font>
00055 <font class="preprocessor">#include "<a class="code" href="matrix_h.html">nel/misc/matrix.h</a>"</font>
00056 <font class="preprocessor">#include "<a class="code" href="smart_ptr_h.html">nel/misc/smart_ptr.h</a>"</font>
00057 <font class="preprocessor">#include "<a class="code" href="rgba_h.html">nel/misc/rgba.h</a>"</font>
00058 <font class="preprocessor">#include "<a class="code" href="event_emitter_h.html">nel/misc/event_emitter.h</a>"</font>
00059 <font class="preprocessor">#include "<a class="code" href="bit_set_h.html">nel/misc/bit_set.h</a>"</font>
00060
00061 <font class="preprocessor">#ifdef NL_OS_WINDOWS
</font>00062 <font class="preprocessor"></font><font class="preprocessor">#include "<a class="code" href="win_event_emitter_h.html">nel/misc/win_event_emitter.h</a>"</font>
00063 <font class="preprocessor">#elif defined (NL_OS_UNIX)
</font>00064 <font class="preprocessor"></font><font class="preprocessor">#include "<a class="code" href="unix_event_emitter_h.html">unix_event_emitter.h</a>"</font>
00065 <font class="preprocessor">#endif // NL_OS_UNIX
</font>00066 <font class="preprocessor"></font>
00067
00068 <font class="keyword">namespace</font> NL3D {
00069
00070 <font class="keyword">using</font> <a class="code" href="class_NLMISC__CMatrix.html">NLMISC::CMatrix</a>;
00071 <font class="keyword">using</font> <a class="code" href="class_NLMISC__CVector.html">NLMISC::CVector</a>;
00072
00073 <font class="comment">// --------------------------------------------------</font>
00074
<a name="l00075"></a><a class="code" href="class_NL3D__CTextureDrvInfosGL.html">00075</a> <font class="keyword">class </font>CTextureDrvInfosGL : <font class="keyword">public</font> ITextureDrvInfos
00076 {
00077 <font class="keyword">public</font>:
00078 <font class="comment">// The GL Id.</font>
<a name="l00079"></a><a class="code" href="class_NL3D__CTextureDrvInfosGL.html#m0">00079</a> GLuint ID;
00080 <font class="comment">// Is the internal format of the texture is a compressed one?</font>
<a name="l00081"></a><a class="code" href="class_NL3D__CTextureDrvInfosGL.html#m1">00081</a> <font class="keywordtype">bool</font> Compressed;
00082
00083 <font class="comment">// The current wrap modes assigned to the texture.</font>
<a name="l00084"></a><a class="code" href="class_NL3D__CTextureDrvInfosGL.html#m2">00084</a> ITexture::TWrapMode WrapS;
<a name="l00085"></a><a class="code" href="class_NL3D__CTextureDrvInfosGL.html#m3">00085</a> ITexture::TWrapMode WrapT;
<a name="l00086"></a><a class="code" href="class_NL3D__CTextureDrvInfosGL.html#m4">00086</a> ITexture::TMagFilter MagFilter;
<a name="l00087"></a><a class="code" href="class_NL3D__CTextureDrvInfosGL.html#m5">00087</a> ITexture::TMinFilter MinFilter;
00088
00089 <font class="comment">// The gl id is auto created here.</font>
00090 CTextureDrvInfosGL(IDriver *drv, ItTexDrvInfoPtrMap it);
00091 <font class="comment">// The gl id is auto deleted here.</font>
00092 ~CTextureDrvInfosGL();
00093 };
00094
00095
00096
00097 <font class="comment">// --------------------------------------------------</font>
00098
<a name="l00099"></a><a class="code" href="class_NL3D__CVBDrvInfosGL.html">00099</a> <font class="keyword">class </font>CVBDrvInfosGL : <font class="keyword">public</font> IVBDrvInfos
00100 {
00101 <font class="keyword">public</font>:
00102 <font class="comment">// Software Skinning: post-rendered vertices/normales.</font>
<a name="l00103"></a><a class="code" href="class_NL3D__CVBDrvInfosGL.html#m0">00103</a> std::vector<CVector> SoftSkinVertices;
<a name="l00104"></a><a class="code" href="class_NL3D__CVBDrvInfosGL.html#m1">00104</a> std::vector<CVector> SoftSkinNormals;
00105 <font class="comment">// Software Skinning: flags to know what vertex must be computed.</font>
<a name="l00106"></a><a class="code" href="class_NL3D__CVBDrvInfosGL.html#m2">00106</a> std::vector<uint8> SoftSkinFlags;
00107
<a name="l00108"></a><a class="code" href="class_NL3D__CVBDrvInfosGL.html#a0">00108</a> CVBDrvInfosGL(IDriver *drv, ItVBDrvInfoPtrList it) : IVBDrvInfos(drv, it) {}
00109 };
00110
00111 <font class="comment">// --------------------------------------------------</font>
00112
<a name="l00113"></a><a class="code" href="class_NL3D__CShaderGL.html">00113</a> <font class="keyword">class </font>CShaderGL : <font class="keyword">public</font> IShader
00114 {
00115 <font class="keyword">public</font>:
<a name="l00116"></a><a class="code" href="class_NL3D__CShaderGL.html#m0">00116</a> GLenum SrcBlend;
<a name="l00117"></a><a class="code" href="class_NL3D__CShaderGL.html#m1">00117</a> GLenum DstBlend;
<a name="l00118"></a><a class="code" href="class_NL3D__CShaderGL.html#m2">00118</a> GLenum ZComp;
00119
<a name="l00120"></a><a class="code" href="class_NL3D__CShaderGL.html#m3">00120</a> GLfloat Emissive[4];
<a name="l00121"></a><a class="code" href="class_NL3D__CShaderGL.html#m4">00121</a> GLfloat Ambient[4];
<a name="l00122"></a><a class="code" href="class_NL3D__CShaderGL.html#m5">00122</a> GLfloat Diffuse[4];
<a name="l00123"></a><a class="code" href="class_NL3D__CShaderGL.html#m6">00123</a> GLfloat Specular[4];
00124
<a name="l00125"></a><a class="code" href="class_NL3D__CShaderGL.html#a0">00125</a> CShaderGL(IDriver *drv, ItShaderPtrList it) : IShader(drv, it) {}
00126 };
00127
00128 <font class="comment">// --------------------------------------------------</font>
00129
<a name="l00130"></a><a class="code" href="class_NL3D__CDriverGL.html">00130</a> <font class="keyword">class </font>CDriverGL : <font class="keyword">public</font> IDriver
00131 {
00132 <font class="keyword">public</font>:
00133
00134 <font class="comment">// Some constants</font>
00135 <font class="keyword">enum</font> { MaxLight=8 };
00136
00137 <font class="comment">// Acces</font>
<a name="l00138"></a><a class="code" href="class_NL3D__CDriverGL.html#a0">00138</a> uint32 getHwnd ()<font class="keyword">
</font>00139 <font class="keyword"> </font>{
00140 <font class="preprocessor">#ifdef NL_OS_WINDOWS
</font>00141 <font class="preprocessor"></font> <font class="keywordflow">return</font> (uint32)_hWnd;
00142 <font class="preprocessor">#else // NL_OS_WINDOWS
</font>00143 <font class="preprocessor"></font> <font class="keywordflow">return</font> 0;
00144 <font class="preprocessor">#endif // NL_OS_WINDOWS
</font>00145 <font class="preprocessor"></font> }
00146
00147 CDriverGL();
<a name="l00148"></a><a class="code" href="class_NL3D__CDriverGL.html#a2">00148</a> <font class="keyword">virtual</font> ~CDriverGL()<font class="keyword"> </font>{ release(); };
00149
00150 <font class="keyword">virtual</font> <font class="keywordtype">bool</font> <a class="code" href="nel_3dsmax_shared_cpp.html#a2">init</a>();
00151
00152 <font class="keyword">virtual</font> ModeList enumModes();
00153
00154 <font class="keyword">virtual</font> <font class="keywordtype">bool</font> setDisplay(<font class="keywordtype">void</font>* wnd, <font class="keyword">const</font> GfxMode& mode) <font class="keywordflow">throw</font>(EBadDisplay);
00155
<a name="l00156"></a><a class="code" href="class_NL3D__CDriverGL.html#a6">00156</a> <font class="keyword">virtual</font> <font class="keywordtype">void</font>* getDisplay()<font class="keyword">
</font>00157 <font class="keyword"> </font>{
00158 <font class="preprocessor">#ifdef NL_OS_WINDOWS
</font>00159 <font class="preprocessor"></font> <font class="keywordflow">return</font> (<font class="keywordtype">void</font>*)_hWnd;
00160 <font class="preprocessor">#else // NL_OS_WINDOWS
</font>00161 <font class="preprocessor"></font> <font class="keywordflow">return</font> NULL;
00162 <font class="preprocessor">#endif // NL_OS_WINDOWS
</font>00163 <font class="preprocessor"></font> }
00164
00165 <font class="keyword">virtual</font> <font class="keywordtype">bool</font> activate();
00166
<a name="l00167"></a><a class="code" href="class_NL3D__CDriverGL.html#a8">00167</a> <font class="keyword">virtual</font> sint getNbTextureStages()<font class="keyword"> </font>{<font class="keywordflow">return</font> _Extensions.NbTextureStages;}
00168
00169 <font class="keyword">virtual</font> <font class="keywordtype">bool</font> isTextureExist(<font class="keyword">const</font> ITexture&tex);
00170
<a name="l00171"></a><a class="code" href="class_NL3D__CDriverGL.html#a10">00171</a> <font class="keyword">virtual</font> <a class="code" href="class_NLMISC__IEventEmitter.html">NLMISC::IEventEmitter</a> *getEventEmitter()<font class="keyword"> </font>{ <font class="keywordflow">return</font>&_EventEmitter; };
00172
00173 <font class="keyword">virtual</font> <font class="keywordtype">bool</font> clear2D(CRGBA rgba);
00174
00175 <font class="keyword">virtual</font> <font class="keywordtype">bool</font> clearZBuffer(<font class="keywordtype">float</font> zval=1);
00176
00177 <font class="keyword">virtual</font> <font class="keywordtype">bool</font> setupTexture(ITexture& tex);
00178
00179 <font class="keyword">virtual</font> <font class="keywordtype">bool</font> setupMaterial(CMaterial& mat);
00180
00181 <font class="keyword">virtual</font> <font class="keywordtype">void</font> setFrustum(<font class="keywordtype">float</font> left, <font class="keywordtype">float</font> right, <font class="keywordtype">float</font> bottom, <font class="keywordtype">float</font> top, <font class="keywordtype">float</font> znear, <font class="keywordtype">float</font> zfar, <font class="keywordtype">bool</font> perspective = <font class="keyword">true</font>);
00182
00183 <font class="keyword">virtual</font> <font class="keywordtype">void</font> setupViewMatrix(<font class="keyword">const</font> CMatrix& mtx);
00184
00185 <font class="keyword">virtual</font> <font class="keywordtype">void</font> setupModelMatrix(<font class="keyword">const</font> CMatrix& mtx, uint8 n=0);
00186
00187 <font class="keyword">virtual</font> CMatrix getViewMatrix() <font class="keyword">const</font>;
00188
<a name="l00189"></a><a class="code" href="class_NL3D__CDriverGL.html#a19">00189</a> <font class="keyword">virtual</font> <font class="keywordtype">void</font> setupVertexMode(uint vmode)<font class="keyword">
</font>00190 <font class="keyword"> </font>{
00191 _VertexMode= vmode;
00192 }
00193
00194 <font class="keyword">virtual</font> <font class="keywordtype">bool</font> activeVertexBuffer(CVertexBuffer& VB);
00195
00196 <font class="keyword">virtual</font> <font class="keywordtype">bool</font> activeVertexBuffer(CVertexBuffer& VB, uint first, uint end);
00197
00198 <font class="keyword">virtual</font> <font class="keywordtype">bool</font> render(CPrimitiveBlock& PB, CMaterial& Mat);
00199
00200 <font class="keyword">virtual</font> <font class="keywordtype">void</font> renderTriangles(CMaterial& Mat, uint32 *tri, uint32 ntris);
00201
00202 <font class="keyword">virtual</font> <font class="keywordtype">void</font> renderPoints(CMaterial& Mat, uint32 numPoints) ;
00203
00204
00205 <font class="keyword">virtual</font> <font class="keywordtype">bool</font> swapBuffers();
00206
00207 <font class="keyword">virtual</font> uint getNumMatrix();
00208
00209 <font class="keyword">virtual</font> <font class="keywordtype">bool</font> supportPaletteSkinning();
00210
00211 <font class="keyword">virtual</font> <font class="keywordtype">bool</font> release();
00212
00213 <font class="keyword">virtual</font> TMessageBoxId systemMessageBox (<font class="keyword">const</font> <font class="keywordtype">char</font>* message, <font class="keyword">const</font> <font class="keywordtype">char</font>* title, TMessageBoxType type=okType, TMessageBoxIcon icon=noIcon);
00214
00215 <font class="keyword">virtual</font> <font class="keywordtype">void</font> setupScissor (<font class="keyword">const</font> <font class="keyword">class</font> CViewport& viewport);
00216
00217 <font class="keyword">virtual</font> <font class="keywordtype">void</font> setupViewport (<font class="keyword">const</font> <font class="keyword">class</font> CViewport& viewport);
00218
<a name="l00219"></a><a class="code" href="class_NL3D__CDriverGL.html#a32">00219</a> <font class="keyword">virtual</font> uint32 getImplementationVersion ()<font class="keyword"> const
</font>00220 <font class="keyword"> </font>{
00221 <font class="keywordflow">return</font> ReleaseVersion;
00222 }
00223
<a name="l00224"></a><a class="code" href="class_NL3D__CDriverGL.html#a33">00224</a> <font class="keyword">virtual</font> <font class="keyword">const</font> <font class="keywordtype">char</font>* getDriverInformation ()<font class="keyword">
</font>00225 <font class="keyword"> </font>{
00226 <font class="keywordflow">return</font> <font class="stringliteral">"Opengl 1.2 NeL Driver"</font>;
00227 }
00228
00229 <font class="keyword">virtual</font> <font class="keyword">const</font> <font class="keywordtype">char</font>* getVideocardInformation ();
00230
00231 <font class="keyword">virtual</font> <font class="keywordtype">bool</font> isActive ();
00232
00233 <font class="keyword">virtual</font> <font class="keywordtype">void</font> showCursor (<font class="keywordtype">bool</font> b);
00234
00235 <font class="comment">// between 0.0 and 1.0</font>
00236 <font class="keyword">virtual</font> <font class="keywordtype">void</font> setMousePos(<font class="keywordtype">float</font> x, <font class="keywordtype">float</font> y);
00237
00238 <font class="keyword">virtual</font> <font class="keywordtype">void</font> setCapture (<font class="keywordtype">bool</font> b);
00239
00240 <font class="keyword">virtual</font> <font class="keywordtype">void</font> getWindowSize (uint32 &width, uint32 &height);
00241
00242 <font class="keyword">virtual</font> <font class="keywordtype">void</font> getBuffer (CBitmap &bitmap);
00243
00244 <font class="keyword">virtual</font> <font class="keywordtype">void</font> getZBuffer (std::vector<float> &zbuffer);
00245
00246 <font class="keyword">virtual</font> <font class="keywordtype">void</font> getBufferPart (CBitmap &bitmap, <a class="code" href="class_NLMISC__CRect.html">NLMISC::CRect</a> &rect);
00247
00248 <font class="keyword">virtual</font> <font class="keywordtype">void</font> getZBufferPart (std::vector<float> &zbuffer, <a class="code" href="class_NLMISC__CRect.html">NLMISC::CRect</a> &rect);
00249
00250 <font class="keyword">virtual</font> <font class="keywordtype">void</font> setPolygonMode (TPolygonMode mode);
00251
00252 <font class="keyword">virtual</font> <font class="keywordtype">void</font> setLight (uint8 num, <font class="keyword">const</font> CLight& light);
00253
00254 <font class="keyword">virtual</font> <font class="keywordtype">void</font> enableLight (uint8 num, <font class="keywordtype">bool</font> enable=<font class="keyword">true</font>);
00255
00256 <font class="keyword">virtual</font> <font class="keywordtype">void</font> setAmbientColor (CRGBA color);
00257
00259 <font class="comment">// @{</font>
00260 <font class="keyword">virtual</font> <font class="keywordtype">bool</font> fogEnabled();
00261 <font class="keyword">virtual</font> <font class="keywordtype">void</font> enableFog(<font class="keywordtype">bool</font> enable);
00263 <font class="keyword">virtual</font> <font class="keywordtype">void</font> setupFog(<font class="keywordtype">float</font> start, <font class="keywordtype">float</font> end, CRGBA color);
00264 <font class="comment">// @}</font>
00265
00266
00267 <font class="keyword">private</font>:
00268
00269 <font class="comment">// For fast vector/point multiplication.</font>
<a name="l00270"></a><a class="code" href="class_NL3D__CDriverGL__CMatrix3x4.html">00270</a> <font class="keyword">struct </font>CMatrix3x4
00271 {
00272 <font class="comment">// Order them in memory line first, for faster memory access.</font>
<a name="l00273"></a><a class="code" href="class_NL3D__CDriverGL__CMatrix3x4.html#m3">00273</a> <font class="keywordtype">float</font> a11, a12, a13, a14;
<a name="l00274"></a><a class="code" href="class_NL3D__CDriverGL__CMatrix3x4.html#m7">00274</a> <font class="keywordtype">float</font> a21, a22, a23, a24;
<a name="l00275"></a><a class="code" href="class_NL3D__CDriverGL__CMatrix3x4.html#m11">00275</a> <font class="keywordtype">float</font> a31, a32, a33, a34;
00276
00277 <font class="comment">// Copy from a matrix.</font>
00278 <font class="keywordtype">void</font> set(<font class="keyword">const</font> CMatrix &mat);
00279 <font class="comment">// mulAddvector. NB: in should be different as v!! (else don't work).</font>
<a name="l00280"></a><a class="code" href="class_NL3D__CDriverGL__CMatrix3x4.html#a1">00280</a> <font class="keywordtype">void</font> mulAddVector(<font class="keyword">const</font> CVector &in, <font class="keywordtype">float</font> scale, CVector &out)<font class="keyword">
</font>00281 <font class="keyword"> </font>{
00282 out.x+= (a11*in.x + a12*in.y + a13*in.z) * scale;
00283 out.y+= (a21*in.x + a22*in.y + a23*in.z) * scale;
00284 out.z+= (a31*in.x + a32*in.y + a33*in.z) * scale;
00285 }
00286 <font class="comment">// mulAddpoint. NB: in should be different as v!! (else don't work).</font>
<a name="l00287"></a><a class="code" href="class_NL3D__CDriverGL__CMatrix3x4.html#a2">00287</a> <font class="keywordtype">void</font> mulAddPoint(<font class="keyword">const</font> CVector &in, <font class="keywordtype">float</font> scale, CVector &out)<font class="keyword">
</font>00288 <font class="keyword"> </font>{
00289 out.x+= (a11*in.x + a12*in.y + a13*in.z + a14) * scale;
00290 out.y+= (a21*in.x + a22*in.y + a23*in.z + a24) * scale;
00291 out.z+= (a31*in.x + a32*in.y + a33*in.z + a34) * scale;
00292 }
00293 };
00294
00295
00296 <font class="keyword">private</font>:
00297 <font class="comment">// Version of the driver. Not the interface version!! Increment when implementation of the driver change.</font>
<a name="l00298"></a><a class="code" href="class_NL3D__CDriverGL.html#r0">00298</a> <font class="keyword">static</font> <font class="keyword">const</font> uint32 ReleaseVersion;
00299
<a name="l00300"></a><a class="code" href="class_NL3D__CDriverGL.html#o0">00300</a> <font class="keywordtype">bool</font> _FullScreen;
00301
00302 <font class="preprocessor">#ifdef NL_OS_WINDOWS
</font>00303 <font class="preprocessor"></font>
00304 <font class="keyword">friend</font> <font class="keyword">static</font> LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
00305
00306 HWND _hWnd;
00307 HDC _hDC;
00308 PIXELFORMATDESCRIPTOR _pfd;
00309 HGLRC _hRC;
00310 <font class="keyword">static</font> uint _Registered;
00311 DEVMODE _OldScreenMode;
00312 NLMISC::CWinEventEmitter _EventEmitter;
00313
00314 <font class="preprocessor">#elif defined (NL_OS_UNIX)
</font>00315 <font class="preprocessor"></font>
00316 Display *dpy;
00317 GLXContext ctx;
00318 Window win;
00319 Cursor cursor;
00320 NLMISC::CUnixEventEmitter _EventEmitter;
00321
00322 <font class="preprocessor">#ifdef XF86VIDMODE
</font>00323 <font class="preprocessor"></font> <font class="keywordtype">int</font> _OldDotClock; <font class="comment">// old dotclock</font>
00324 XF86VidModeModeLine _OldScreenMode; <font class="comment">// old modeline</font>
00325 <font class="keywordtype">int</font> _OldX, _OldY; <font class="comment">//Viewport settings</font>
00326 <font class="preprocessor">#endif //XF86VIDMODE
</font>00327 <font class="preprocessor"></font>
00328 <font class="preprocessor">#endif // NL_OS_UNIX
</font>00329 <font class="preprocessor"></font>
<a name="l00330"></a><a class="code" href="class_NL3D__CDriverGL.html#o1">00330</a> <font class="keywordtype">bool</font> _Initialized;
00331
00333 <font class="comment">// @{</font>
00334 <font class="comment">// OpenGL extensions Extensions.</font>
<a name="l00335"></a><a class="code" href="class_NL3D__CDriverGL.html#o2">00335</a> CGlExtensions _Extensions;
00336 <font class="comment">// Say if palette skinning can be done in Hardware</font>
<a name="l00337"></a><a class="code" href="class_NL3D__CDriverGL.html#o3">00337</a> <font class="keywordtype">bool</font> _PaletteSkinHard;
00338 <font class="comment">// @}</font>
00339
00340
00341 <font class="comment">// The vertex transform mode.</font>
<a name="l00342"></a><a class="code" href="class_NL3D__CDriverGL.html#o4">00342</a> uint _VertexMode;
00343
00344 <font class="comment">// To know if matrix setup has been changed from last activeVertexBuffer() (any call to setupViewMatrix() / setupModelMatrix()).</font>
<a name="l00345"></a><a class="code" href="class_NL3D__CDriverGL.html#o5">00345</a> <font class="keywordtype">bool</font> _MatrixSetupDirty;
00346
00347 <font class="comment">// To know if view matrix setup has been changed from last activeVertexBuffer() (any call to setupViewMatrix()).</font>
<a name="l00348"></a><a class="code" href="class_NL3D__CDriverGL.html#o6">00348</a> <font class="keywordtype">bool</font> _ViewMatrixSetupDirty;
00349
00350 <font class="comment">// for each model matrix, a flag to know if setuped.</font>
<a name="l00351"></a><a class="code" href="class_NL3D__CDriverGL.html#o7">00351</a> <a class="code" href="class_NLMISC__CBitSet.html">NLMISC::CBitSet</a> _ModelViewMatrixDirty;
00352 <font class="comment">// same flag, but for palette Skinning (because they don't share same setup).</font>
<a name="l00353"></a><a class="code" href="class_NL3D__CDriverGL.html#o8">00353</a> <a class="code" href="class_NLMISC__CBitSet.html">NLMISC::CBitSet</a> _ModelViewMatrixDirtyPaletteSkin;
00354
00355
00356 <font class="comment">// Current (OpenGL basis) View matrix.</font>
<a name="l00357"></a><a class="code" href="class_NL3D__CDriverGL.html#o9">00357</a> CMatrix _ViewMtx;
00358
00359 <font class="comment">// Current computed (OpenGL basis) ModelView matrix.</font>
<a name="l00360"></a><a class="code" href="class_NL3D__CDriverGL.html#o10">00360</a> CMatrix _ModelViewMatrix[MaxModelMatrix];
00361 <font class="comment">// For software skinning.</font>
<a name="l00362"></a><a class="code" href="class_NL3D__CDriverGL.html#o11">00362</a> CMatrix _ModelViewMatrixNormal[MaxModelMatrix];
<a name="l00363"></a><a class="code" href="class_NL3D__CDriverGL.html#o12">00363</a> CMatrix3x4 _ModelViewMatrix3x4[MaxModelMatrix];
<a name="l00364"></a><a class="code" href="class_NL3D__CDriverGL.html#o13">00364</a> CMatrix3x4 _ModelViewMatrixNormal3x4[MaxModelMatrix];
00365
00366
00367 <font class="comment">// Sofware Skinning.</font>
<a name="l00368"></a><a class="code" href="class_NL3D__CDriverGL.html#o14">00368</a> uint8 *_CurrentSoftSkinFlags;
<a name="l00369"></a><a class="code" href="class_NL3D__CDriverGL.html#o15">00369</a> uint8 *_CurrentSoftSkinSrc;
<a name="l00370"></a><a class="code" href="class_NL3D__CDriverGL.html#o16">00370</a> uint _CurrentSoftSkinNormalOff;
<a name="l00371"></a><a class="code" href="class_NL3D__CDriverGL.html#o17">00371</a> uint _CurrentSoftSkinPaletteSkinOff;
<a name="l00372"></a><a class="code" href="class_NL3D__CDriverGL.html#o18">00372</a> uint _CurrentSoftSkinWeightOff;
<a name="l00373"></a><a class="code" href="class_NL3D__CDriverGL.html#o19">00373</a> uint _CurrentSoftSkinSrcStride;
<a name="l00374"></a><a class="code" href="class_NL3D__CDriverGL.html#o20">00374</a> uint _CurrentSoftSkinFirst;
<a name="l00375"></a><a class="code" href="class_NL3D__CDriverGL.html#o21">00375</a> uint _CurrentSoftSkinEnd;
<a name="l00376"></a><a class="code" href="class_NL3D__CDriverGL.html#o22">00376</a> CVector *_CurrentSoftSkinVectorDst;
<a name="l00377"></a><a class="code" href="class_NL3D__CDriverGL.html#o23">00377</a> CVector *_CurrentSoftSkinNormalDst;
00378
00379 <font class="comment">// Fog.</font>
<a name="l00380"></a><a class="code" href="class_NL3D__CDriverGL.html#o24">00380</a> <font class="keywordtype">bool</font> _FogEnabled;
00381
00382 <font class="comment">// Num lights return by GL_MAX_LIGHTS</font>
<a name="l00383"></a><a class="code" href="class_NL3D__CDriverGL.html#o25">00383</a> uint _MaxDriverLight;
<a name="l00384"></a><a class="code" href="class_NL3D__CDriverGL.html#o26">00384</a> <font class="keywordtype">bool</font> _LightEnable[MaxLight]; <font class="comment">// Light enable.</font>
<a name="l00385"></a><a class="code" href="class_NL3D__CDriverGL.html#o27">00385</a> uint _LightMode[MaxLight]; <font class="comment">// Light mode.</font>
<a name="l00386"></a><a class="code" href="class_NL3D__CDriverGL.html#o28">00386</a> CVector _WorldLightPos[MaxLight]; <font class="comment">// World position of the lights.</font>
<a name="l00387"></a><a class="code" href="class_NL3D__CDriverGL.html#o29">00387</a> CVector _WorldLightDirection[MaxLight]; <font class="comment">// World direction of the lights.</font>
00388
00389 <font class="comment">// Prec settings, for optimisation.</font>
<a name="l00390"></a><a class="code" href="class_NL3D__CDriverGL.html#o30">00390</a> ITexture* _CurrentTexture[IDRV_MAT_MAXTEXTURES];
<a name="l00391"></a><a class="code" href="class_NL3D__CDriverGL.html#o31">00391</a> CMaterial* _CurrentMaterial;
<a name="l00392"></a><a class="code" href="class_NL3D__CDriverGL.html#o32">00392</a> CMaterial::CTexEnv _CurrentTexEnv[IDRV_MAT_MAXTEXTURES];
<a name="l00393"></a><a class="code" href="class_NL3D__CDriverGL.html#o33">00393</a> <font class="keywordtype">bool</font> _CurrentNormalize;
00394
00395 <font class="keyword">private</font>:
00396 <font class="keywordtype">bool</font> setupVertexBuffer(CVertexBuffer& VB);
00397 <font class="keywordtype">bool</font> activateTexture(uint stage, ITexture *tex);
00398 <font class="keywordtype">void</font> activateTexEnvMode(uint stage, <font class="keyword">const</font> CMaterial::CTexEnv &env);
00399 <font class="keywordtype">void</font> activateTexEnvColor(uint stage, <font class="keyword">const</font> CMaterial::CTexEnv &env);
00400
00401 <font class="comment">// Called by activeVertexBuffer when _ViewMatrixSetupDirty is true to clean the view matrix.</font>
00402 <font class="comment">// set _ViewMatrixSetupDirty to false;</font>
00403 <font class="keywordtype">void</font> cleanViewMatrix ();
00404
00405 <font class="comment">// According to extensions, retrieve GL tex format of the texture.</font>
00406 GLint getGlTextureFormat(ITexture& tex, <font class="keywordtype">bool</font> &compressed);
00407
00408
00409 <font class="comment">// Clip the wanted rectangle with window. return true if rect is not NULL.</font>
00410 <font class="keywordtype">bool</font> clipRect(<a class="code" href="class_NLMISC__CRect.html">NLMISC::CRect</a> &rect);
00411
00412
00413 <font class="comment">// software skinning. Use _CurrentSoftSkin* global setup.</font>
00414 <font class="keywordtype">void</font> computeSoftwareVertexSkinning(uint8 *pSrc, CVector *pVertexDst);
00415 <font class="keywordtype">void</font> computeSoftwareNormalSkinning(uint8 *pSrc, CVector *pNormalDst);
00416 <font class="keywordtype">void</font> refreshSoftwareSkinning();
00417
00418
00420 <font class="comment">// @{
</font>00422 <font class="comment"> sint beginMultiPass(const CMaterial &mat);
</font>00424 <font class="comment"> void setupPass(const CMaterial &mat, uint pass);
</font>00426 <font class="comment"> void endMultiPass(const CMaterial &mat);
</font><a name="l00428"></a><a class="code" href="class_NL3D__CDriverGL.html#o34">00428</a> <font class="comment"> CVertexBuffer *_LastVB;</font>
00429 <font class="comment">// @}</font>
00430
00431
00433 <font class="keywordtype">void</font> setupUVPtr(uint stage, CVertexBuffer &VB, uint uvId);
00434
00435 };
00436
00437 } <font class="comment">// NL3D</font>
00438
00439 <font class="preprocessor">#endif // NL_OPENGL_H
</font></div></pre>
<!-- footer -->
<BR><FONT Size=+5> </FONT>
</TD>
<TD WIDTH=15><IMG SRC=/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD>
</TR>
</TABLE>
</BODY>
</HTML>
|