<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>SFML - Simple and Fast Multimedia Library</title> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /> <link href="doxygen.css" rel="stylesheet" type="text/css" /> <link href="tabs.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="logo"> <img src="./logo.jpg" width="770" height="200" title="SFML home" alt="SFML logo" /> </div> <!-- Generated by Doxygen 1.6.3 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.htm"><span>Main Page</span></a></li> <li><a href="modules.htm"><span>Modules</span></a></li> <li class="current"><a href="annotated.htm"><span>Classes</span></a></li> <li><a href="files.htm"><span>Files</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="annotated.htm"><span>Class List</span></a></li> <li><a href="classes.htm"><span>Class Index</span></a></li> <li><a href="hierarchy.htm"><span>Class Hierarchy</span></a></li> <li><a href="functions.htm"><span>Class Members</span></a></li> </ul> </div> <div class="navpath"><b>sf</b>::<a class="el" href="classsf_1_1Context.htm">Context</a> </div> </div> <div class="contents"> <h1>sf::Context Class Reference<br/> <small> [<a class="el" href="group__window.htm">Window module</a>]</small> </h1><!-- doxytag: class="sf::Context" --><!-- doxytag: inherits="sf::GlResource,sf::NonCopyable" --> <p>Class holding a valid drawing context. <a href="#_details">More...</a></p> <p><code>#include <<a class="el" href="Context_8hpp_source.htm">Context.hpp</a>></code></p> <div class="dynheader"> Inheritance diagram for sf::Context:</div> <div class="dynsection"> <div class="center"> <img src="classsf_1_1Context.png" usemap="#sf::Context_map" alt=""/> <map id="sf::Context_map" name="sf::Context_map"> <area href="classsf_1_1GlResource.htm" alt="sf::GlResource" shape="rect" coords="0,0,105,24"/> <area href="classsf_1_1NonCopyable.htm" alt="sf::NonCopyable" shape="rect" coords="115,0,220,24"/> </map> </div> </div> <p><a href="classsf_1_1Context-members.htm">List of all members.</a></p> <table border="0" cellpadding="0" cellspacing="0"> <tr><td colspan="2"><h2>Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Context.htm#aba22797a790706ca2c5c04ee39f2b555">Context</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Default constructor. <a href="#aba22797a790706ca2c5c04ee39f2b555"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Context.htm#a805b1bbdb3e52b1fda7c9bf2cd6ca86b">~Context</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Destructor. <a href="#a805b1bbdb3e52b1fda7c9bf2cd6ca86b"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Context.htm#aaddb73012bfda0785a2fa46eebc78fc8">SetActive</a> (bool active)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Activate or deactivate explicitely the context. <a href="#aaddb73012bfda0785a2fa46eebc78fc8"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Context.htm#a2a9e3529e48919120e6b6fc10bad296c">Context</a> (const <a class="el" href="structsf_1_1ContextSettings.htm">ContextSettings</a> &settings, unsigned int width, unsigned int height)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Construct a in-memory context. <a href="#a2a9e3529e48919120e6b6fc10bad296c"></a><br/></td></tr> <tr><td colspan="2"><h2>Static Private Member Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a01c5ad327b847c8a107dbc69ee308711"></a><!-- doxytag: member="sf::Context::EnsureGlContext" ref="a01c5ad327b847c8a107dbc69ee308711" args="()" --> static void </td><td class="memItemRight" valign="bottom"><b>EnsureGlContext</b> ()</td></tr> </table> <hr/><a name="_details"></a><h2>Detailed Description</h2> <p>Class holding a valid drawing context. </p> <p>If you need to make OpenGL calls without having an active window (like in a thread), you can use an instance of this class to get a valid context.</p> <p>Having a valid context is necessary for *every* OpenGL call.</p> <p>Note that a context is only active in its current thread, if you create a new thread it will have no valid context by default.</p> <p>To use a <a class="el" href="classsf_1_1Context.htm" title="Class holding a valid drawing context.">sf::Context</a> instance, just construct it and let it live as long as you need a valid context. No explicit activation is needed, all it has to do is to exist. Its destructor will take care of deactivating and freeing all the attached resources.</p> <p>Usage example: </p> <div class="fragment"><pre class="fragment"> <span class="keywordtype">void</span> ThreadFunction(<span class="keywordtype">void</span>*) { <a class="code" href="classsf_1_1Context.htm" title="Class holding a valid drawing context.">sf::Context</a> context; <span class="comment">// from now on, you have a valid context</span> <span class="comment">// you can make OpenGL calls</span> glClear(GL_DEPTH_BUFFER_BIT); } <span class="comment">// the context is automatically deactivated and destroyed</span> <span class="comment">// by the sf::Context destructor</span> </pre></div> <p>Definition at line <a class="el" href="Context_8hpp_source.htm#l00048">48</a> of file <a class="el" href="Context_8hpp_source.htm">Context.hpp</a>.</p> <hr/><h2>Constructor & Destructor Documentation</h2> <a class="anchor" id="aba22797a790706ca2c5c04ee39f2b555"></a><!-- doxytag: member="sf::Context::Context" ref="aba22797a790706ca2c5c04ee39f2b555" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">sf::Context::Context </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Default constructor. </p> <p>The constructor creates and activates the context </p> </div> </div> <a class="anchor" id="a805b1bbdb3e52b1fda7c9bf2cd6ca86b"></a><!-- doxytag: member="sf::Context::~Context" ref="a805b1bbdb3e52b1fda7c9bf2cd6ca86b" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">sf::Context::~Context </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Destructor. </p> <p>The desctructor deactivates and destroys the context </p> </div> </div> <a class="anchor" id="a2a9e3529e48919120e6b6fc10bad296c"></a><!-- doxytag: member="sf::Context::Context" ref="a2a9e3529e48919120e6b6fc10bad296c" args="(const ContextSettings &settings, unsigned int width, unsigned int height)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">sf::Context::Context </td> <td>(</td> <td class="paramtype">const <a class="el" href="structsf_1_1ContextSettings.htm">ContextSettings</a> & </td> <td class="paramname"> <em>settings</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int </td> <td class="paramname"> <em>width</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int </td> <td class="paramname"> <em>height</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Construct a in-memory context. </p> <p>This constructor is for internal use, you don't need to bother with it.</p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>settings</em> </td><td>Creation parameters </td></tr> <tr><td valign="top"></td><td valign="top"><em>width</em> </td><td>Back buffer width </td></tr> <tr><td valign="top"></td><td valign="top"><em>height</em> </td><td>Back buffer height </td></tr> </table> </dd> </dl> </div> </div> <hr/><h2>Member Function Documentation</h2> <a class="anchor" id="aaddb73012bfda0785a2fa46eebc78fc8"></a><!-- doxytag: member="sf::Context::SetActive" ref="aaddb73012bfda0785a2fa46eebc78fc8" args="(bool active)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">bool sf::Context::SetActive </td> <td>(</td> <td class="paramtype">bool </td> <td class="paramname"> <em>active</em></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Activate or deactivate explicitely the context. </p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>active</em> </td><td>True to activate, false to deactivate</td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>True on success, false on failure </dd></dl> </div> </div> <hr/>The documentation for this class was generated from the following file:<ul> <li><a class="el" href="Context_8hpp_source.htm">Context.hpp</a></li> </ul> </div> <p id="footer"> :: Copyright © 2007-2008 Laurent Gomila, all rights reserved :: Documentation generated by <a href="http://www.doxygen.org/" title="doxygen website">doxygen 1.5.2</a> :: </p> </body> </html>