mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-27 10:45:32 +00:00
8dcb8601a2
Hopefully this is the first and last time we have to do this.
25 lines
1.8 KiB
Plaintext
25 lines
1.8 KiB
Plaintext
{\rtf1\ansi\ansicpg1253\deff0{\fonttbl{\f0\fswiss\fprq2\fcharset161{\*\fname Arial;}Arial Greek;}{\f1\fswiss\fprq2\fcharset0 Arial;}{\f2\fswiss\fprq2\fcharset238{\*\fname Arial;}Arial CE;}{\f3\fnil\fcharset0 Courier New;}}
|
||
{\colortbl ;\red163\green21\blue21;}
|
||
{\*\generator Msftedit 5.41.21.2509;}\viewkind4\uc1\pard\nowidctlpar\cf1\lang1032\b\f0\fs28 Introduction\b0\fs22\par
|
||
\par
|
||
This sample showcases the multi-threading capabilities of the GameWindow. It simulates particle movement that interacts with the window bounds and reacts to window Resize and Move events.\par
|
||
\par
|
||
\b\fs28 Controls\par
|
||
\b0\fs22\par
|
||
Move or resize the window with your mouse.\par
|
||
\lang1033\f1 Press F11 to toggle between fullscreen and windowed modes.\par
|
||
Press Esc to exit.\lang1032\f0\par
|
||
\par
|
||
\b\fs28 Implementation\par
|
||
\b0\fs22\par
|
||
This sample spawns a background thread to handle OpenGL rendering. The main thread reacts to IGameWindow events as usual but contains no OpenGL commands. Instead, it notifies the background thread of the necessary IGameWindow state changes (e.g. Resize events) and lets it handle them\lang1033\f2\'ff\lang1032\f0 .\par
|
||
\par
|
||
1. The constructor hooks IGameWindow events using anonymous delegates. These hooks handle keyboard input, resize and move events. In the case of resize and move events, they set flags to notify the render thread of the state changes.\par
|
||
\par
|
||
2. The Load event releases the OpenGL context from the main thread (Context.MakeCurrent(null)) and spawns the background render thread.\par
|
||
\par
|
||
3. The background render thread make the OpenGL context current (MakeCurrent()) and then enters a continuous game loop until exit. This loop handles logic updates, OpenGL rendering and the necessary timing tasks.\par
|
||
\par
|
||
4. The Unload event notifies the background thread that it should shut down and waits until it does.\cf0\lang1033\f3\par
|
||
}
|
||
|