Updated CSFML and SFML.Net in the sfml2 branch

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1233 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
LaurentGom 2009-10-12 10:24:49 +00:00
parent fc22927874
commit 7f4de9033c
15 changed files with 164 additions and 42 deletions

View file

@ -16,6 +16,9 @@ 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);
@ -72,6 +75,13 @@ namespace sample_opengl
// Draw background
window.Draw(background);
// Flush the window, to make sure that our OpenGL cube
// will be rendered on top of the background sprite
window.Flush();
// Activate the window for OpenGL calls
window.SetActive();
// Clear depth buffer
Gl.glClear(Gl.GL_DEPTH_BUFFER_BIT);
@ -159,6 +169,8 @@ 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);
}
}