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 |
11 [generate_thunk] | 11 [generate_thunk] |
12 | 12 |
13 label Chrome { | 13 label Chrome { |
14 M15 = 1.0 | 14 M15 = 1.0 |
15 }; | 15 }; |
16 | 16 |
17 #inline c | 17 #inline c |
18 /* Add 3D graphics enums */ | 18 /* Add 3D graphics enums */ |
19 #include "ppapi/c/pp_graphics_3d.h" | 19 #include "ppapi/c/pp_graphics_3d.h" |
20 #endinl | 20 #endinl |
21 | 21 |
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, attribs, &context); |
33 * inst->BindGraphics(instance, context); | 33 * inst->BindGraphics(instance, context); |
34 * </code> | 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 * gles2->Clear(context, GL_COLOR_BUFFER); |
39 * g3d->SwapBuffers(context); | 39 * g3d->SwapBuffers(context); |
40 * </code> | 40 * @endcode |
41 * | 41 * |
42 * <strong>Shutdown:</strong> | 42 * <strong>Shutdown:</strong> |
43 * <code> | 43 * @code |
44 * core->ReleaseResource(context); | 44 * core->ReleaseResource(context); |
45 * </code> | 45 * @endcode |
46 */ | 46 */ |
47 [macro="PPB_GRAPHICS_3D_INTERFACE"] | 47 [macro="PPB_GRAPHICS_3D_INTERFACE"] |
48 interface PPB_Graphics3D { | 48 interface PPB_Graphics3D { |
49 /** | 49 /** |
50 * GetAttribMaxValue() retrieves the maximum supported value for the | 50 * GetAttribMaxValue() retrieves the maximum supported value for the |
51 * given attribute. This function may be used to check if a particular | 51 * given attribute. This function may be used to check if a particular |
52 * attribute value is supported before attempting to create a context. | 52 * attribute value is supported before attempting to create a context. |
53 * | 53 * |
54 * @param[in] instance The module instance. | 54 * @param[in] instance The module instance. |
55 * @param[in] attribute The attribute for which maximum value is queried. | 55 * @param[in] attribute The attribute for which maximum value is queried. |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 * structure for this function. All attributes specified in | 163 * structure for this function. All attributes specified in |
164 * <code>PPB_Graphics3D::Create</code> can be queried for. | 164 * <code>PPB_Graphics3D::Create</code> can be queried for. |
165 * | 165 * |
166 * @return Returns <code>PP_OK</code> on success or: | 166 * @return Returns <code>PP_OK</code> on success or: |
167 * - <code>PP_ERROR_BADRESOURCE</code> if context is invalid | 167 * - <code>PP_ERROR_BADRESOURCE</code> if context is invalid |
168 * - <code>PP_ERROR_BADARGUMENT</code> if attrib_list is 0 or any attribute | 168 * - <code>PP_ERROR_BADARGUMENT</code> if attrib_list is 0 or any attribute |
169 * in the <code>attrib_list</code> is not a valid attribute. | 169 * in the <code>attrib_list</code> is not a valid attribute. |
170 * | 170 * |
171 * <strong>Example usage:</strong> To get the values for rgb bits in the | 171 * <strong>Example usage:</strong> To get the values for rgb bits in the |
172 * color buffer, this function must be called as following: | 172 * color buffer, this function must be called as following: |
173 * <code> | 173 * @code |
174 * int attrib_list[] = {PP_GRAPHICS3DATTRIB_RED_SIZE, 0, | 174 * int attrib_list[] = {PP_GRAPHICS3DATTRIB_RED_SIZE, 0, |
175 * PP_GRAPHICS3DATTRIB_GREEN_SIZE, 0, | 175 * PP_GRAPHICS3DATTRIB_GREEN_SIZE, 0, |
176 * PP_GRAPHICS3DATTRIB_BLUE_SIZE, 0, | 176 * PP_GRAPHICS3DATTRIB_BLUE_SIZE, 0, |
177 * PP_GRAPHICS3DATTRIB_NONE}; | 177 * PP_GRAPHICS3DATTRIB_NONE}; |
178 * GetAttribs(context, attrib_list); | 178 * GetAttribs(context, attrib_list); |
179 * int red_bits = attrib_list[1]; | 179 * int red_bits = attrib_list[1]; |
180 * int green_bits = attrib_list[3]; | 180 * int green_bits = attrib_list[3]; |
181 * int blue_bits = attrib_list[5]; | 181 * int blue_bits = attrib_list[5]; |
182 * </code> | 182 * @endcode |
183 */ | 183 */ |
184 int32_t GetAttribs( | 184 int32_t GetAttribs( |
185 [in] PP_Resource context, | 185 [in] PP_Resource context, |
186 [inout] int32_t[] attrib_list); | 186 [inout] int32_t[] attrib_list); |
187 | 187 |
188 /** | 188 /** |
189 * SetAttribs() sets the values for each attribute in | 189 * SetAttribs() sets the values for each attribute in |
190 * <code>attrib_list</code>. | 190 * <code>attrib_list</code>. |
191 * | 191 * |
192 * @param[in] context The 3D graphics context. | 192 * @param[in] context The 3D graphics context. |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 * @return Returns PP_OK on success or: | 286 * @return Returns PP_OK on success or: |
287 * - <code>PP_ERROR_BADRESOURCE</code> if context is invalid. | 287 * - <code>PP_ERROR_BADRESOURCE</code> if context is invalid. |
288 * - <code>PP_ERROR_BADARGUMENT</code> if callback is invalid. | 288 * - <code>PP_ERROR_BADARGUMENT</code> if callback is invalid. |
289 * | 289 * |
290 */ | 290 */ |
291 int32_t SwapBuffers( | 291 int32_t SwapBuffers( |
292 [in] PP_Resource context, | 292 [in] PP_Resource context, |
293 [in] PP_CompletionCallback callback); | 293 [in] PP_CompletionCallback callback); |
294 }; | 294 }; |
295 | 295 |
OLD | NEW |