Various improvements on OpenGL contexts handling
git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1245 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
31b72b6385
commit
17190bd158
21 changed files with 217 additions and 225 deletions
|
@ -15,9 +15,6 @@ namespace sample_window
|
|||
// Create the main window
|
||||
Window window = new Window(new VideoMode(640, 480, 32), "SFML.Net Window");
|
||||
|
||||
// Activate it as the target for OpenGL calls
|
||||
window.SetActive();
|
||||
|
||||
// Setup event handlers
|
||||
window.Closed += new EventHandler(OnClosed);
|
||||
window.KeyPressed += new EventHandler<KeyEventArgs>(OnKeyPressed);
|
||||
|
@ -44,7 +41,9 @@ namespace sample_window
|
|||
// Process events
|
||||
window.DispatchEvents();
|
||||
|
||||
// Set the active window before using OpenGL commands
|
||||
// Activate the window before using OpenGL commands.
|
||||
// This is useless here because we have only one window which is
|
||||
// always the active one, but don't forget it if you use multiple windows
|
||||
window.SetActive();
|
||||
|
||||
// Clear color and depth buffer
|
||||
|
@ -129,8 +128,6 @@ namespace sample_window
|
|||
/// </summary>
|
||||
static void OnResized(object sender, SizeEventArgs e)
|
||||
{
|
||||
Window window = (Window)sender;
|
||||
window.SetActive();
|
||||
Gl.glViewport(0, 0, (int)e.Width, (int)e.Height);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue