OLD | NEW |
1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 * Use of this source code is governed by a BSD-style license that can be | 2 * Use of this source code is governed by a BSD-style license that can be |
3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
4 */ | 4 */ |
5 | 5 |
6 /** | 6 /** |
7 * Defines the <code>PPB_Graphics3D</code> struct representing a 3D graphics | 7 * Defines the <code>PPB_Graphics3D</code> struct representing a 3D graphics |
8 * context within the browser. | 8 * context within the browser. |
9 */ | 9 */ |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 /** | 22 /** |
23 * <code>PPB_Graphics3D</code> defines the interface for a 3D graphics context. | 23 * <code>PPB_Graphics3D</code> defines the interface for a 3D graphics context. |
24 * <strong>Example usage from plugin code:</strong> | 24 * <strong>Example usage from plugin code:</strong> |
25 * | 25 * |
26 * <strong>Setup:</strong> | 26 * <strong>Setup:</strong> |
27 * @code | 27 * @code |
28 * PP_Resource context; | 28 * PP_Resource context; |
29 * int32_t attribs[] = {PP_GRAPHICS3DATTRIB_WIDTH, 800, | 29 * int32_t attribs[] = {PP_GRAPHICS3DATTRIB_WIDTH, 800, |
30 * PP_GRAPHICS3DATTRIB_HEIGHT, 800, | 30 * PP_GRAPHICS3DATTRIB_HEIGHT, 800, |
31 * PP_GRAPHICS3DATTRIB_NONE}; | 31 * PP_GRAPHICS3DATTRIB_NONE}; |
32 * context = g3d->Create(instance, attribs, &context); | 32 * context = g3d->Create(instance, 0, attribs); |
33 * inst->BindGraphics(instance, context); | 33 * inst->BindGraphics(instance, context); |
34 * @endcode | 34 * @endcode |
35 * | 35 * |
36 * <strong>Present one frame:</strong> | 36 * <strong>Present one frame:</strong> |
37 * @code | 37 * @code |
38 * gles2->Clear(context, GL_COLOR_BUFFER); | 38 * PP_CompletionCallback callback = { |
39 * g3d->SwapBuffers(context); | 39 * DidFinishSwappingBuffers, 0, PP_COMPLETIONCALLBACK_FLAG_NONE, |
| 40 * }; |
| 41 * gles2->Clear(context, GL_COLOR_BUFFER_BIT); |
| 42 * g3d->SwapBuffers(context, callback); |
40 * @endcode | 43 * @endcode |
41 * | 44 * |
42 * <strong>Shutdown:</strong> | 45 * <strong>Shutdown:</strong> |
43 * @code | 46 * @code |
44 * core->ReleaseResource(context); | 47 * core->ReleaseResource(context); |
45 * @endcode | 48 * @endcode |
46 */ | 49 */ |
47 [macro="PPB_GRAPHICS_3D_INTERFACE"] | 50 [macro="PPB_GRAPHICS_3D_INTERFACE"] |
48 interface PPB_Graphics3D { | 51 interface PPB_Graphics3D { |
49 /** | 52 /** |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 * @param[in] instance The module instance. | 88 * @param[in] instance The module instance. |
86 * | 89 * |
87 * @param[in] share_context The 3D context with which the created context | 90 * @param[in] share_context The 3D context with which the created context |
88 * would share resources. If <code>share_context</code> is not 0, then all | 91 * would share resources. If <code>share_context</code> is not 0, then all |
89 * shareable data, as defined by the client API (note that for OpenGL and | 92 * shareable data, as defined by the client API (note that for OpenGL and |
90 * OpenGL ES, shareable data excludes texture objects named 0) will be shared | 93 * OpenGL ES, shareable data excludes texture objects named 0) will be shared |
91 * by <code>share_context<code>, all other contexts <code>share_context</code> | 94 * by <code>share_context<code>, all other contexts <code>share_context</code> |
92 * already shares with, and the newly created context. An arbitrary number of | 95 * already shares with, and the newly created context. An arbitrary number of |
93 * <code>PPB_Graphics3D</code> can share data in this fashion. | 96 * <code>PPB_Graphics3D</code> can share data in this fashion. |
94 * | 97 * |
95 * @param[out] attrib_list specifies a list of attributes for the context. | 98 * @param[in] attrib_list specifies a list of attributes for the context. |
96 * It is a list of attribute name-value pairs in which each attribute is | 99 * It is a list of attribute name-value pairs in which each attribute is |
97 * immediately followed by the corresponding desired value. The list is | 100 * immediately followed by the corresponding desired value. The list is |
98 * terminated with <code>PP_GRAPHICS3DATTRIB_NONE</code>. | 101 * terminated with <code>PP_GRAPHICS3DATTRIB_NONE</code>. |
99 * The <code>attrib_list<code> may be 0 or empty (first attribute is | 102 * The <code>attrib_list<code> may be 0 or empty (first attribute is |
100 * <code>PP_GRAPHICS3DATTRIB_NONE</code>). If an attribute is not | 103 * <code>PP_GRAPHICS3DATTRIB_NONE</code>). If an attribute is not |
101 * specified in <code>attrib_list</code>, then the default value is used | 104 * specified in <code>attrib_list</code>, then the default value is used |
102 * (it is said to be specified implicitly). | 105 * (it is said to be specified implicitly). |
103 * Attributes for the context are chosen according to an attribute-specific | 106 * Attributes for the context are chosen according to an attribute-specific |
104 * criteria. Attributes can be classified into two categories: | 107 * criteria. Attributes can be classified into two categories: |
105 * - AtLeast: The attribute value in the returned context meets or exceeds | 108 * - AtLeast: The attribute value in the returned context meets or exceeds |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 * @return Returns PP_OK on success or: | 289 * @return Returns PP_OK on success or: |
287 * - <code>PP_ERROR_BADRESOURCE</code> if context is invalid. | 290 * - <code>PP_ERROR_BADRESOURCE</code> if context is invalid. |
288 * - <code>PP_ERROR_BADARGUMENT</code> if callback is invalid. | 291 * - <code>PP_ERROR_BADARGUMENT</code> if callback is invalid. |
289 * | 292 * |
290 */ | 293 */ |
291 int32_t SwapBuffers( | 294 int32_t SwapBuffers( |
292 [in] PP_Resource context, | 295 [in] PP_Resource context, |
293 [in] PP_CompletionCallback callback); | 296 [in] PP_CompletionCallback callback); |
294 }; | 297 }; |
295 | 298 |
OLD | NEW |