Improved the API documentation of sf::View

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1263 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
LaurentGom 2009-11-04 16:04:18 +00:00
parent 0f8b8d6c0f
commit 5d778b2bc4
3 changed files with 161 additions and 100 deletions

View file

@ -15,12 +15,9 @@
////////////////////////////////////////////////////////////
int main()
{
// Create the main window and activate it
// Create the main window
sf::RenderWindow window(sf::VideoMode(800, 600), "SFML OpenGL");
// Activate it as the target for OpenGL calls
window.SetActive();
// Create a sprite for the background
sf::Image backgroundImage;
if (!backgroundImage.LoadFromFile("datas/opengl/background.jpg"))
@ -77,10 +74,7 @@ int main()
// Adjust the viewport when the window is resized
if (event.Type == sf::Event::Resized)
{
window.SetActive();
glViewport(0, 0, event.Size.Width, event.Size.Height);
}
}
// Draw the background
@ -90,7 +84,9 @@ int main()
// will be rendered on top of the background sprite
window.Flush();
// Activate the window
// 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 the depth buffer