1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
4
<title>Castle Game Engine: CastleWindowModes: Class TGLMode</title>
5
<meta name="generator" content="PasDoc 0.12.1">
6
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
7
<link rel="StyleSheet" type="text/css" href="pasdoc.css">
10
<table class="container"><tr><td class="navigation">
11
<h2>Castle Game Engine</h2><p><a href="introduction.html" class="navigation">Introduction</a></p><p><a href="AllUnits.html" class="navigation">Units</a></p><p><a href="ClassHierarchy.html" class="navigation">Class Hierarchy</a></p><p><a href="AllClasses.html" class="navigation">Classes, Interfaces, Objects and Records</a></p><p><a href="AllTypes.html" class="navigation">Types</a></p><p><a href="AllVariables.html" class="navigation">Variables</a></p><p><a href="AllConstants.html" class="navigation">Constants</a></p><p><a href="AllFunctions.html" class="navigation">Functions and Procedures</a></p><p><a href="AllIdentifiers.html" class="navigation">Identifiers</a></p></td><td class="content">
12
<a name="TGLMode"></a><h1 class="cio">Class TGLMode</h1>
13
<table class="sections wide_list">
15
<td><a class="section" href="#PasDoc-Description">Description</a></td><td><a class="section" href="#PasDoc-Hierarchy">Hierarchy</a></td><td>Fields</td><td><a class="section" href="#PasDoc-Methods">Methods</a></td><td><a class="section" href="#PasDoc-Properties">Properties</a></td></tr></table>
16
<a name="PasDoc-Description"></a><h2 class="unit">Unit</h2>
18
<a href="CastleWindowModes.html">CastleWindowModes</a></p>
19
<h2 class="declaration">Declaration</h2>
20
<p class="declaration">
21
<code>type TGLMode = class(TObject)</code></p>
22
<h2 class="description">Description</h2>
24
Enter / exit modal box on a <a class="normal" href="CastleWindow.TCastleWindowBase.html">TCastleWindowBase</a>. Saves/restores the state of <a class="normal" href="CastleWindow.TCastleWindowBase.html">TCastleWindowBase</a> properties (see <a class="normal" href="CastleWindowModes.TWindowState.html">TWindowState</a>) and various OpenGL state.</p>
25
<a name="PasDoc-Hierarchy"></a><h2 class="hierarchy">Hierarchy</h2>
26
<ul class="hierarchy"><li class="ancestor">TObject</li>
27
<li class="thisitem">TGLMode</li></ul><h2 class="overview">Overview</h2>
28
<a name="PasDoc-Methods"></a><h3 class="summary">Methods</h3>
29
<table class="summary wide_list">
31
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
32
<td class="itemcode"><code>constructor <b><a href="CastleWindowModes.TGLMode.html#Create">Create</a></b>(AWindow: <a href="CastleWindow.TCastleWindowBase.html">TCastleWindowBase</a>; AttribsToPush: <a href="CastleGLUtils.html#TGLbitfield">TGLbitfield</a>; APushPopMessagesTheme: boolean);</code></td>
35
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
36
<td class="itemcode"><code>constructor <b><a href="CastleWindowModes.TGLMode.html#CreateReset">CreateReset</a></b>(AWindow: <a href="CastleWindow.TCastleWindowBase.html">TCastleWindowBase</a>; AttribsToPush: <a href="CastleGLUtils.html#TGLbitfield">TGLbitfield</a>; APushPopMessagesTheme: boolean; NewDraw, NewResize, NewCloseQuery: <a href="CastleWindow.html#TWindowFunc">TWindowFunc</a>);</code></td>
39
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
40
<td class="itemcode"><code>destructor <b><a href="CastleWindowModes.TGLMode.html#Destroy">Destroy</a></b>; override;</code></td>
43
<a name="PasDoc-Properties"></a><h3 class="summary">Properties</h3>
44
<table class="summary wide_list">
46
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
47
<td class="itemcode"><code>property <b><a href="CastleWindowModes.TGLMode.html#FakeMouseDown">FakeMouseDown</a></b>: boolean
48
read FFakeMouseDown write FFakeMouseDown default false;</code></td>
51
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
52
<td class="itemcode"><code>property <b><a href="CastleWindowModes.TGLMode.html#RestoreProjectionMatrix">RestoreProjectionMatrix</a></b>: boolean
53
read FRestoreProjectionMatrix write FRestoreProjectionMatrix default true;</code></td>
56
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
57
<td class="itemcode"><code>property <b><a href="CastleWindowModes.TGLMode.html#RestoreModelviewMatrix">RestoreModelviewMatrix</a></b>: boolean
58
read FRestoreModelviewMatrix write FRestoreModelviewMatrix default true;</code></td>
61
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
62
<td class="itemcode"><code>property <b><a href="CastleWindowModes.TGLMode.html#RestoreTextureMatrix">RestoreTextureMatrix</a></b>: boolean
63
read FRestoreTextureMatrix write FRestoreTextureMatrix default true;</code></td>
66
<h2 class="description">Description</h2>
67
<h3 class="detail">Methods</h3>
68
<table class="detail wide_list">
70
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
71
<td class="itemcode"><a name="Create"></a><code>constructor <b>Create</b>(AWindow: <a href="CastleWindow.TCastleWindowBase.html">TCastleWindowBase</a>; AttribsToPush: <a href="CastleGLUtils.html#TGLbitfield">TGLbitfield</a>; APushPopMessagesTheme: boolean);</code></td>
75
Constructor saves open <a class="normal" href="CastleWindow.TCastleWindowBase.html">TCastleWindowBase</a> and OpenGL state. Destructor will restore them.
77
<p>Some gory details (that you will usually not care about... the point is: everything works sensibly of the box) :
81
<ul class="paragraph_spacing">
82
<li><p>We save/restore: </p>
84
<ul class="compact_spacing">
85
<li><p><a class="normal" href="CastleWindowModes.TWindowState.html">TWindowState</a></p></li>
86
<li><p>OpenGL attributes specified in AttribsToPush</p></li>
87
<li><p>OpenGL matrix mode</p></li>
88
<li><p>OpenGL matrices (saved without using OpenGL stack)</p></li>
89
<li><p>OpenGL PIXEL_STORE_* state</p></li>
90
<li><p><a class="normal" href="CastleMessages.html#MessagesTheme">MessagesTheme</a> (only if APushPopMessagesTheme)</p></li>
94
<li><p>OpenGL context connected to this window is also made current during constructor and destructor. Also, <a class="normal" href="CastleWindow.TCastleWindowBase.html#PostRedisplay">TCastleWindowBase.PostRedisplay</a> is called (since new callbacks, as well as original callbacks, probably want to redraw window contents.)</p></li>
95
<li><p> All pressed keys and mouse butons are saved and faked to be released, by calling <a class="normal" href="CastleWindow.TCastleWindowBase.html#EventRelease">TCastleWindowBase.EventRelease</a> with original callbacks. This way, if user releases some keys/mouse inside modal box, your original <a class="normal" href="CastleWindow.TCastleWindowBase.html">TCastleWindowBase</a> callbacks will not miss this fact. This way e.g. user scripts in VRML/X3D worlds that observe keys work fine.
97
<p>If <a class="normal" href="CastleWindowModes.TGLMode.html#FakeMouseDown">FakeMouseDown</a> then at destruction (after restoring original callbacks) we will also notify your original callbacks that user pressed these buttons (by sending TCastleWindowBase.EventMouseDown). Note that <a class="normal" href="CastleWindowModes.TGLMode.html#FakeMouseDown">FakeMouseDown</a> feature turned out to be usually more troublesome than usefull — too often some unwanted MouseDown event was caused by this mechanism. That's because if original callbacks do something in MouseDown (like e.g. activate some click) then you don't want to generate fake MouseDown by <a class="normal" href="CastleWindowModes.TGLMode.html#Destroy">TGLMode.Destroy</a>. So the default value of <a class="normal" href="CastleWindowModes.TGLMode.html#FakeMouseDown">FakeMouseDown</a> is <code>False</code>. But this means that original callbacks have to be careful and <i>never assume</i> that when some button is pressed (because it's included in MousePressed, or has EventRelease generated for it) then for sure there occurred some MouseDown for it. </p></li>
98
<li><p>At destructor, we notify original callbacks about size changes by sending <a class="normal" href="CastleWindow.TCastleWindowBase.html#EventResize">TCastleWindowBase.EventResize</a>. This way your original callbacks know about size changes, and can set OpenGL projection etc.</p></li>
99
<li><p> We call IgnoreNextIdleSpeed at the end, when closing our mode, see TCastleWindowBase.IgnoreNextIdleSpeed for comments why this is needed.</p></li>
100
<li><p>This also performs important optimization to avoid closing / reinitializing window <a class="normal" href="CastleWindow.TCastleWindowCustom.html#Controls">TCastleWindowCustom.Controls</a> OpenGL resources, see <a class="normal" href="CastleUIControls.TUIControl.html#DisableContextOpenClose">TUIControl.DisableContextOpenClose</a>.</p></li>
106
<table class="detail wide_list">
108
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
109
<td class="itemcode"><a name="CreateReset"></a><code>constructor <b>CreateReset</b>(AWindow: <a href="CastleWindow.TCastleWindowBase.html">TCastleWindowBase</a>; AttribsToPush: <a href="CastleGLUtils.html#TGLbitfield">TGLbitfield</a>; APushPopMessagesTheme: boolean; NewDraw, NewResize, NewCloseQuery: <a href="CastleWindow.html#TWindowFunc">TWindowFunc</a>);</code></td>
113
Save OpenGL and <a class="normal" href="CastleWindow.TCastleWindowBase.html">TCastleWindowBase</a> state, and then change this to a standard state. Destructor will restore saved state.
115
<p>This is a shortcut for <a class="normal" href="CastleWindowModes.TGLMode.html#Create">Create</a> followed by <a class="normal" href="CastleWindowModes.TWindowState.html#SetStandardState">TWindowState.SetStandardState</a>, see there for explanation of parameters.</p>
118
<table class="detail wide_list">
120
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
121
<td class="itemcode"><a name="Destroy"></a><code>destructor <b>Destroy</b>; override;</code></td>
126
<h3 class="detail">Properties</h3>
127
<table class="detail wide_list">
129
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
130
<td class="itemcode"><a name="FakeMouseDown"></a><code>property <b>FakeMouseDown</b>: boolean
131
read FFakeMouseDown write FFakeMouseDown default false;</code></td>
136
<table class="detail wide_list">
138
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
139
<td class="itemcode"><a name="RestoreProjectionMatrix"></a><code>property <b>RestoreProjectionMatrix</b>: boolean
140
read FRestoreProjectionMatrix write FRestoreProjectionMatrix default true;</code></td>
145
<table class="detail wide_list">
147
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
148
<td class="itemcode"><a name="RestoreModelviewMatrix"></a><code>property <b>RestoreModelviewMatrix</b>: boolean
149
read FRestoreModelviewMatrix write FRestoreModelviewMatrix default true;</code></td>
154
<table class="detail wide_list">
156
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
157
<td class="itemcode"><a name="RestoreTextureMatrix"></a><code>property <b>RestoreTextureMatrix</b>: boolean
158
read FRestoreTextureMatrix write FRestoreTextureMatrix default true;</code></td>
163
<hr noshade size="1"><span class="appinfo"><em>Generated by <a href="http://pasdoc.sourceforge.net/">PasDoc 0.12.1</a> on 2013-02-04 20:26:53</em>
165
</td></tr></table></body></html>