blob: 3cf25727eef3512d98028e49496b42b97a09222f [file] [log] [blame]
{{+bindTo:partials.standard_nacl_api}}
<h1>PPB_Graphics3D Struct Reference</h1>
<div id="doxygen-ref">
{{- dummy div to appease doxygen -}}
<div>
<!-- Generated by Doxygen 1.7.6.1 -->
</div>
<!--header-->
<div class="contents">
<!-- doxytag: class="PPB_Graphics3D" --><h2>
Data Fields</h2><table class="memberdecls">
<tr><td class="memItemLeft" align="right" valign="top">int32_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___graphics3_d__1__0.html#a80698c6d8c8b04e07d08c4595e0e977b">GetAttribMaxValue</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> instance, int32_t attribute, int32_t *value)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___graphics3_d__1__0.html#a818bc5829aac77215321b30f85e26e01">Create</a> )(<a class="el" href="group___typedefs.html#ga89b662403e6a687bb914b80114c0d19d">PP_Instance</a> instance, <a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> share_context, const int32_t attrib_list[])</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___graphics3_d__1__0.html#af59ffbcc71e08386f66594a138ab4ea5">IsGraphics3D</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> resource)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int32_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___graphics3_d__1__0.html#aae3be34b7308c4510a3952b06fb7d6d9">GetAttribs</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> context, int32_t attrib_list[])</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int32_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___graphics3_d__1__0.html#a093c4674cef82a08f5726bed8361d49d">SetAttribs</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> context, const int32_t attrib_list[])</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int32_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___graphics3_d__1__0.html#ae6e9764a94663000dcb2aa610fac724c">GetError</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> context)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int32_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___graphics3_d__1__0.html#a3bea5a6f3fc77df73c1cf4f02d32b4ec">ResizeBuffers</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> context, int32_t width, int32_t height)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int32_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___graphics3_d__1__0.html#a293c6941c0da084267ffba3954793497">SwapBuffers</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> context, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</td></tr>
</table>
<hr /><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p><code>PPB_Graphics3D</code> defines the interface for a 3D graphics context. </p>
<p><b>Example usage from plugin code:</b></p>
<p><b>Setup:</b> </p>
<div class="fragment"><pre class="fragment"> <a class="code" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7" title="This typedef represents an opaque handle assigned by the browser to the resource.">PP_Resource</a> context;
int32_t attribs[] = {<a class="code" href="group___enums.html#gga7df48e1c55f6401beea2a1b9c07967e8a378f15587369cdefbcf565bc8f15db2c" title="Width of surface in pixels.">PP_GRAPHICS3DATTRIB_WIDTH</a>, 800,
<a class="code" href="group___enums.html#gga7df48e1c55f6401beea2a1b9c07967e8ac37b92e8426753d7a24d0cf193a5923d" title="Height of surface in pixels.">PP_GRAPHICS3DATTRIB_HEIGHT</a>, 800,
<a class="code" href="group___enums.html#gga7df48e1c55f6401beea2a1b9c07967e8a66b15e43e8159f71751be033d44fda21" title="Attrib list terminator.">PP_GRAPHICS3DATTRIB_NONE</a>};
context = g3d-&gt;Create(instance, 0, attribs);
inst-&gt;BindGraphics(instance, context);
</pre></div><p><b>Present one frame:</b> </p>
<div class="fragment"><pre class="fragment"> <a class="code" href="struct_p_p___completion_callback.html" title="PP_CompletionCallback is a common mechanism for supporting potentially asynchronous calls in browser ...">PP_CompletionCallback</a> callback = {
DidFinishSwappingBuffers, 0, <a class="code" href="group___enums.html#gga7610f0fba2396d46384859caa4d91798a6eedc0f315784a4cb47c5806b828c7cc" title="By default any non-NULL callback will always invoked asynchronously, on success or error...">PP_COMPLETIONCALLBACK_FLAG_NONE</a>,
};
gles2-&gt;Clear(context, GL_COLOR_BUFFER_BIT);
g3d-&gt;SwapBuffers(context, callback);
</pre></div><p><b>Shutdown:</b> </p>
<div class="fragment"><pre class="fragment"> core-&gt;ReleaseResource(context);
</pre></div> </div><hr /><h2>Field Documentation</h2>
<a class="anchor" id="a818bc5829aac77215321b30f85e26e01"></a><!-- doxytag: member="PPB_Graphics3D::Create" ref="a818bc5829aac77215321b30f85e26e01" args=")(PP_Instance instance, PP_Resource share_context, const int32_t attrib_list[])" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a>(* <a class="el" href="struct_p_p_b___graphics3_d__1__0.html#a818bc5829aac77215321b30f85e26e01">PPB_Graphics3D::Create</a>)(<a class="el" href="group___typedefs.html#ga89b662403e6a687bb914b80114c0d19d">PP_Instance</a> instance, <a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> share_context, const int32_t attrib_list[])</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___graphics3_d__1__0.html#a818bc5829aac77215321b30f85e26e01" title="Create() creates and initializes a 3D rendering context.">Create()</a> creates and initializes a 3D rendering context. </p>
<p>The returned context is off-screen to start with. It must be attached to a plugin instance using <code><a class="el" href="struct_p_p_b___instance__1__0.html#ae5b0da2fc0975c82213f687d96434625" title="BindGraphics() binds the given graphics as the current display surface.">PPB_Instance::BindGraphics</a></code> to draw on the web page.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">instance</td><td>The module instance.</td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">share_context</td><td>The 3D context with which the created context would share resources. If <code>share_context</code> is not 0, then all shareable data, as defined by the client API (note that for OpenGL and OpenGL ES, shareable data excludes texture objects named 0) will be shared by <code>share_context</code><code>, all other contexts </code><code>share_context</code> already shares with, and the newly created context. An arbitrary number of <code>PPB_Graphics3D</code> can share data in this fashion.</td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">attrib_list</td><td><code></code><code>specifies a list of attributes for the context. It is a list of attribute name-value pairs in which each attribute is immediately followed by the corresponding desired value. The list is terminated with </code><code>PP_GRAPHICS3DATTRIB_NONE</code>. The <code>attrib_list</code><code> may be 0 or empty (first attribute is </code><code>PP_GRAPHICS3DATTRIB_NONE</code>). If an attribute is not specified in <code>attrib_list</code>, then the default value is used (it is said to be specified implicitly). Attributes for the context are chosen according to an attribute-specific criteria. Attributes can be classified into two categories:<ul>
<li>AtLeast: The attribute value in the returned context meets or exceeds the value specified in <code>attrib_list</code>.</li>
<li>Exact: The attribute value in the returned context is equal to the value specified in <code>attrib_list</code>.</li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<p>Attributes that can be specified in <code>attrib_list</code> include:</p>
<ul>
<li><code></code><code></code><code></code><code></code><code>PP_GRAPHICS3DATTRIB_ALPHA_SIZE</code>: Category: AtLeast Default: 0.</li>
<li><code></code><code></code><code></code><code></code><code>PP_GRAPHICS3DATTRIB_BLUE_SIZE</code>: Category: AtLeast Default: 0.</li>
<li><code></code><code></code><code></code><code></code><code>PP_GRAPHICS3DATTRIB_GREEN_SIZE</code>: Category: AtLeast Default: 0.</li>
<li><code></code><code></code><code></code><code></code><code>PP_GRAPHICS3DATTRIB_RED_SIZE</code>: Category: AtLeast Default: 0.</li>
<li><code></code><code></code><code></code><code></code><code>PP_GRAPHICS3DATTRIB_DEPTH_SIZE</code>: Category: AtLeast Default: 0.</li>
<li><code></code><code></code><code></code><code></code><code>PP_GRAPHICS3DATTRIB_STENCIL_SIZE</code>: Category: AtLeast Default: 0.</li>
<li><code></code><code></code><code></code><code></code><code>PP_GRAPHICS3DATTRIB_SAMPLES</code>: Category: AtLeast Default: 0.</li>
<li><code></code><code></code><code></code><code></code><code>PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS</code>: Category: AtLeast Default: 0.</li>
<li><code></code><code></code><code></code><code></code><code>PP_GRAPHICS3DATTRIB_WIDTH</code>: Category: Exact Default: 0.</li>
<li><code></code><code></code><code></code><code></code><code>PP_GRAPHICS3DATTRIB_HEIGHT</code>: Category: Exact Default: 0.</li>
<li><code></code><code></code><code></code><code></code><code>PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR</code>: Category: Exact Default: Implementation defined.</li>
</ul>
<p><code></code><code></code><code></code><code> </code></p>
<dl class="return"><dt><b>Returns:</b></dt><dd>A <code>PP_Resource</code> containing the 3D graphics context if successful or 0 if unsuccessful. </dd></dl>
<p></p>
</div>
</div>
<a class="anchor" id="a80698c6d8c8b04e07d08c4595e0e977b"></a><!-- doxytag: member="PPB_Graphics3D::GetAttribMaxValue" ref="a80698c6d8c8b04e07d08c4595e0e977b" args=")(PP_Resource instance, int32_t attribute, int32_t *value)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t(* <a class="el" href="struct_p_p_b___graphics3_d__1__0.html#a80698c6d8c8b04e07d08c4595e0e977b">PPB_Graphics3D::GetAttribMaxValue</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> instance, int32_t attribute, int32_t *value)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___graphics3_d__1__0.html#a80698c6d8c8b04e07d08c4595e0e977b" title="GetAttribMaxValue() retrieves the maximum supported value for the given attribute.">GetAttribMaxValue()</a> retrieves the maximum supported value for the given attribute. </p>
<p>This function may be used to check if a particular attribute value is supported before attempting to create a context.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">instance</td><td>The module instance. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">attribute</td><td>The attribute for which maximum value is queried. Attributes that can be queried for include:<ul>
<li><code>PP_GRAPHICS3DATTRIB_ALPHA_SIZE</code></li>
<li><code>PP_GRAPHICS3DATTRIB_BLUE_SIZE</code></li>
<li><code>PP_GRAPHICS3DATTRIB_GREEN_SIZE</code></li>
<li><code>PP_GRAPHICS3DATTRIB_RED_SIZE</code></li>
<li><code>PP_GRAPHICS3DATTRIB_DEPTH_SIZE</code></li>
<li><code>PP_GRAPHICS3DATTRIB_STENCIL_SIZE</code></li>
<li><code>PP_GRAPHICS3DATTRIB_SAMPLES</code></li>
<li><code>PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS</code></li>
<li><code>PP_GRAPHICS3DATTRIB_WIDTH</code></li>
<li><code>PP_GRAPHICS3DATTRIB_HEIGHT</code> </li>
</ul>
</td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">value</td><td>The maximum supported value for <code>attribute</code></td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Returns <code>PP_TRUE</code> on success or the following on error:<ul>
<li><code>PP_ERROR_BADRESOURCE</code> if <code>instance</code> is invalid</li>
<li><code>PP_ERROR_BADARGUMENT</code> if <code>attribute</code> is invalid or <code>value</code> is 0 </li>
</ul>
</dd></dl>
</div>
</div>
<a class="anchor" id="aae3be34b7308c4510a3952b06fb7d6d9"></a><!-- doxytag: member="PPB_Graphics3D::GetAttribs" ref="aae3be34b7308c4510a3952b06fb7d6d9" args=")(PP_Resource context, int32_t attrib_list[])" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t(* <a class="el" href="struct_p_p_b___graphics3_d__1__0.html#aae3be34b7308c4510a3952b06fb7d6d9">PPB_Graphics3D::GetAttribs</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> context, int32_t attrib_list[])</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___graphics3_d__1__0.html#aae3be34b7308c4510a3952b06fb7d6d9" title="GetAttribs() retrieves the value for each attribute in attrib_list.">GetAttribs()</a> retrieves the value for each attribute in <code>attrib_list</code>. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">context</td><td>The 3D graphics context. </td></tr>
<tr><td class="paramdir">[in,out]</td><td class="paramname">attrib_list</td><td>The list of attributes that are queried. <code>attrib_list</code> has the same structure as described for <code><a class="el" href="struct_p_p_b___graphics3_d__1__0.html#a818bc5829aac77215321b30f85e26e01" title="Create() creates and initializes a 3D rendering context.">PPB_Graphics3D::Create</a></code>. It is both input and output structure for this function. All attributes specified in <code><a class="el" href="struct_p_p_b___graphics3_d__1__0.html#a818bc5829aac77215321b30f85e26e01" title="Create() creates and initializes a 3D rendering context.">PPB_Graphics3D::Create</a></code> can be queried for.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Returns <code>PP_OK</code> on success or:<ul>
<li><code>PP_ERROR_BADRESOURCE</code> if context is invalid</li>
<li><code>PP_ERROR_BADARGUMENT</code> if attrib_list is 0 or any attribute in the <code>attrib_list</code> is not a valid attribute.</li>
</ul>
</dd></dl>
<p><b>Example usage:</b> To get the values for rgb bits in the color buffer, this function must be called as following: </p>
<div class="fragment"><pre class="fragment"> <span class="keywordtype">int</span> attrib_list[] = {<a class="code" href="group___enums.html#gga7df48e1c55f6401beea2a1b9c07967e8a7caad99c8c857fdb804c6755551398f5" title="Bits of Red in the color buffer.">PP_GRAPHICS3DATTRIB_RED_SIZE</a>, 0,
<a class="code" href="group___enums.html#gga7df48e1c55f6401beea2a1b9c07967e8ade95a6e685ca23522da80c1703d294a7" title="Bits of Green in the color buffer.">PP_GRAPHICS3DATTRIB_GREEN_SIZE</a>, 0,
<a class="code" href="group___enums.html#gga7df48e1c55f6401beea2a1b9c07967e8a519cd199423721033780ee13ecb0e60b" title="Bits of Blue in the color buffer.">PP_GRAPHICS3DATTRIB_BLUE_SIZE</a>, 0,
<a class="code" href="group___enums.html#gga7df48e1c55f6401beea2a1b9c07967e8a66b15e43e8159f71751be033d44fda21" title="Attrib list terminator.">PP_GRAPHICS3DATTRIB_NONE</a>};
<a class="code" href="struct_p_p_b___graphics3_d__1__0.html#aae3be34b7308c4510a3952b06fb7d6d9" title="GetAttribs() retrieves the value for each attribute in attrib_list.">GetAttribs</a>(context, attrib_list);
<span class="keywordtype">int</span> red_bits = attrib_list[1];
<span class="keywordtype">int</span> green_bits = attrib_list[3];
<span class="keywordtype">int</span> blue_bits = attrib_list[5];
</pre></div>
</div>
</div>
<a class="anchor" id="ae6e9764a94663000dcb2aa610fac724c"></a><!-- doxytag: member="PPB_Graphics3D::GetError" ref="ae6e9764a94663000dcb2aa610fac724c" args=")(PP_Resource context)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t(* <a class="el" href="struct_p_p_b___graphics3_d__1__0.html#ae6e9764a94663000dcb2aa610fac724c">PPB_Graphics3D::GetError</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> context)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___graphics3_d__1__0.html#ae6e9764a94663000dcb2aa610fac724c" title="GetError() returns the current state of the given 3D context.">GetError()</a> returns the current state of the given 3D context. </p>
<p>The recoverable error conditions that have no side effect are detected and returned immediately by all functions in this interface. In addition the implementation may get into a fatal state while processing a command. In this case the application must destroy the context and reinitialize client API state and objects to continue rendering.</p>
<p>Note that the same error code is also returned in the SwapBuffers callback. It is recommended to handle error in the SwapBuffers callback because GetError is synchronous. This function may be useful in rare cases where drawing a frame is expensive and you want to verify the result of ResizeBuffers before attempting to draw a frame.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">The</td><td>3D graphics context. </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Returns:<ul>
<li><code>PP_OK</code> if no error</li>
<li><code>PP_ERROR_NOMEMORY</code></li>
<li><code>PP_ERROR_CONTEXT_LOST</code> </li>
</ul>
</dd></dl>
</div>
</div>
<a class="anchor" id="af59ffbcc71e08386f66594a138ab4ea5"></a><!-- doxytag: member="PPB_Graphics3D::IsGraphics3D" ref="af59ffbcc71e08386f66594a138ab4ea5" args=")(PP_Resource resource)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(* <a class="el" href="struct_p_p_b___graphics3_d__1__0.html#af59ffbcc71e08386f66594a138ab4ea5">PPB_Graphics3D::IsGraphics3D</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> resource)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___graphics3_d__1__0.html#af59ffbcc71e08386f66594a138ab4ea5" title="IsGraphics3D() determines if the given resource is a valid Graphics3D context.">IsGraphics3D()</a> determines if the given resource is a valid <code>Graphics3D</code> context. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">resource</td><td>A <code>Graphics3D</code> context resource.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>PP_TRUE if the given resource is a valid <code>Graphics3D</code>, <code>PP_FALSE</code> if it is an invalid resource or is a resource of another type. </dd></dl>
</div>
</div>
<a class="anchor" id="a3bea5a6f3fc77df73c1cf4f02d32b4ec"></a><!-- doxytag: member="PPB_Graphics3D::ResizeBuffers" ref="a3bea5a6f3fc77df73c1cf4f02d32b4ec" args=")(PP_Resource context, int32_t width, int32_t height)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t(* <a class="el" href="struct_p_p_b___graphics3_d__1__0.html#a3bea5a6f3fc77df73c1cf4f02d32b4ec">PPB_Graphics3D::ResizeBuffers</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> context, int32_t width, int32_t height)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___graphics3_d__1__0.html#a3bea5a6f3fc77df73c1cf4f02d32b4ec" title="ResizeBuffers() resizes the backing surface for context.">ResizeBuffers()</a> resizes the backing surface for context. </p>
<p>If the surface could not be resized due to insufficient resources, <code>PP_ERROR_NOMEMORY</code> error is returned on the next <code>SwapBuffers</code> callback.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">context</td><td>The 3D graphics context. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">width</td><td>The width of the backing surface. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">height</td><td>The height of the backing surface. </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Returns <code>PP_OK</code> on success or:<ul>
<li><code>PP_ERROR_BADRESOURCE</code> if context is invalid.</li>
<li><code>PP_ERROR_BADARGUMENT</code> if the value specified for <code>width</code> or <code>height</code> is less than zero. </li>
</ul>
</dd></dl>
</div>
</div>
<a class="anchor" id="a093c4674cef82a08f5726bed8361d49d"></a><!-- doxytag: member="PPB_Graphics3D::SetAttribs" ref="a093c4674cef82a08f5726bed8361d49d" args=")(PP_Resource context, const int32_t attrib_list[])" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t(* <a class="el" href="struct_p_p_b___graphics3_d__1__0.html#a093c4674cef82a08f5726bed8361d49d">PPB_Graphics3D::SetAttribs</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> context, const int32_t attrib_list[])</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___graphics3_d__1__0.html#a093c4674cef82a08f5726bed8361d49d" title="SetAttribs() sets the values for each attribute in attrib_list.">SetAttribs()</a> sets the values for each attribute in <code>attrib_list</code>. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">context</td><td>The 3D graphics context. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">attrib_list</td><td>The list of attributes whose values need to be set. <code>attrib_list</code> has the same structure as described for <code><a class="el" href="struct_p_p_b___graphics3_d__1__0.html#a818bc5829aac77215321b30f85e26e01" title="Create() creates and initializes a 3D rendering context.">PPB_Graphics3D::Create</a></code>. Attributes that can be specified are:<ul>
<li><code>PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR</code></li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Returns <code>PP_OK</code> on success or:<ul>
<li><code>PP_ERROR_BADRESOURCE</code> if <code>context</code> is invalid.</li>
<li><code>PP_ERROR_BADARGUMENT</code> if <code>attrib_list</code> is 0 or any attribute in the <code>attrib_list</code> is not a valid attribute. </li>
</ul>
</dd></dl>
</div>
</div>
<a class="anchor" id="a293c6941c0da084267ffba3954793497"></a><!-- doxytag: member="PPB_Graphics3D::SwapBuffers" ref="a293c6941c0da084267ffba3954793497" args=")(PP_Resource context, struct PP_CompletionCallback callback)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t(* <a class="el" href="struct_p_p_b___graphics3_d__1__0.html#a293c6941c0da084267ffba3954793497">PPB_Graphics3D::SwapBuffers</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> context, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___graphics3_d__1__0.html#a293c6941c0da084267ffba3954793497" title="SwapBuffers() makes the contents of the color buffer available for compositing.">SwapBuffers()</a> makes the contents of the color buffer available for compositing. </p>
<p>This function has no effect on off-screen surfaces - ones not bound to any plugin instance. The contents of ancillary buffers are always undefined after calling <code>SwapBuffers</code>. The contents of the color buffer are undefined if the value of the <code>PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR</code> attribute of context is not <code>PP_GRAPHICS3DATTRIB_BUFFER_PRESERVED</code>.</p>
<p><code>SwapBuffers</code> runs in asynchronous mode. Specify a callback function and the argument for that callback function. The callback function will be executed on the calling thread after the color buffer has been composited with rest of the html page. While you are waiting for a SwapBuffers callback, additional calls to SwapBuffers will fail.</p>
<p>Because the callback is executed (or thread unblocked) only when the plugin's current state is actually on the screen, this function provides a way to rate limit animations. By waiting until the image is on the screen before painting the next frame, you can ensure you're not generating updates faster than the screen can be updated.</p>
<p>SwapBuffers performs an implicit flush operation on context. If the context gets into an unrecoverable error condition while processing a command, the error code will be returned as the argument for the callback. The callback may return the following error codes:</p>
<ul>
<li><code>PP_ERROR_NOMEMORY</code></li>
<li><code>PP_ERROR_CONTEXT_LOST</code> Note that the same error code may also be obtained by calling GetError.</li>
</ul>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">context</td><td>The 3D graphics context. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">callback</td><td>The callback that will executed when <code>SwapBuffers</code> completes.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Returns PP_OK on success or:<ul>
<li><code>PP_ERROR_BADRESOURCE</code> if context is invalid.</li>
<li><code>PP_ERROR_BADARGUMENT</code> if callback is invalid. </li>
</ul>
</dd></dl>
</div>
</div>
<hr />The documentation for this struct was generated from the following file:<ul>
<li><a class="el" href="ppb__graphics__3d_8h.html">ppb_graphics_3d.h</a></li>
</ul>
</div><!-- contents -->
</div>
{{/partials.standard_nacl_api}}