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:
LaurentGom 2009-10-27 09:20:20 +00:00
parent 31b72b6385
commit 17190bd158
21 changed files with 217 additions and 225 deletions

View file

@ -16,9 +16,6 @@ namespace sample_opengl
// Create main window
RenderWindow window = new RenderWindow(new VideoMode(800, 600), "SFML.Net OpenGL");
// Activate it as the target for OpenGL calls
window.SetActive();
// Setup event handlers
window.Closed += new EventHandler(OnClosed);
window.KeyPressed += new EventHandler<KeyEventArgs>(OnKeyPressed);
@ -79,7 +76,9 @@ namespace sample_opengl
// will be rendered on top of the background sprite
window.Flush();
// Activate the window for OpenGL calls
// 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 depth buffer
@ -169,8 +168,6 @@ namespace sample_opengl
/// </summary>
static void OnResized(object sender, SizeEventArgs e)
{
RenderWindow window = (RenderWindow)sender;
window.SetActive();
Gl.glViewport(0, 0, (int)e.Width, (int)e.Height);
}
}