OLD | NEW |
---|---|
1 /* Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2011 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 #ifndef PPAPI_C_DEV_PPB_GRAPHICS_3D_DEV_H_ | 5 #ifndef PPAPI_C_DEV_PPB_GRAPHICS_3D_DEV_H_ |
6 #define PPAPI_C_DEV_PPB_GRAPHICS_3D_DEV_H_ | 6 #define PPAPI_C_DEV_PPB_GRAPHICS_3D_DEV_H_ |
7 | 7 |
8 #include "ppapi/c/dev/pp_graphics_3d_dev.h" | 8 #include "ppapi/c/dev/pp_graphics_3d_dev.h" |
9 | 9 |
10 #include "ppapi/c/pp_bool.h" | 10 #include "ppapi/c/pp_bool.h" |
11 #include "ppapi/c/pp_instance.h" | 11 #include "ppapi/c/pp_instance.h" |
12 #include "ppapi/c/pp_resource.h" | 12 #include "ppapi/c/pp_resource.h" |
13 #include "ppapi/c/pp_var.h" | |
14 | 13 |
15 // Example usage from plugin code: | 14 // Example usage from plugin code: |
16 // | 15 // |
17 // // Setup. | 16 // // Setup. |
18 // PP_Resource context; | 17 // PP_Resource context; |
19 // int32_t attribs[] = {PP_GRAPHICS3DATTRIB_WIDTH, 800, | 18 // int32_t attribs[] = {PP_GRAPHICS3DATTRIB_WIDTH, 800, |
20 // PP_GRAPHICS3DATTRIB_HEIGHT, 800, | 19 // PP_GRAPHICS3DATTRIB_HEIGHT, 800, |
21 // PP_GRAPHICS3DATTRIB_NONE}; | 20 // PP_GRAPHICS3DATTRIB_NONE}; |
22 // context = g3d->Create(instance, attribs, &context); | 21 // context = g3d->Create(instance, attribs, &context); |
23 // inst->BindGraphics(instance, context); | 22 // inst->BindGraphics(instance, context); |
24 // | 23 // |
25 // // Present one frame. | 24 // // Present one frame. |
26 // gles2->Clear(context, GL_COLOR_BUFFER); | 25 // gles2->Clear(context, GL_COLOR_BUFFER); |
27 // g3d->SwapBuffers(context); | 26 // g3d->SwapBuffers(context); |
28 // | 27 // |
29 // // Shutdown. | 28 // // Shutdown. |
30 // core->ReleaseResource(context); | 29 // core->ReleaseResource(context); |
31 | 30 |
32 #define PPB_GRAPHICS_3D_DEV_INTERFACE_0_7 "PPB_Graphics3D(Dev);0.7" | 31 #define PPB_GRAPHICS_3D_DEV_INTERFACE_0_7 "PPB_Graphics3D(Dev);0.7" |
33 #define PPB_GRAPHICS_3D_DEV_INTERFACE PPB_GRAPHICS_3D_DEV_INTERFACE_0_7 | 32 #define PPB_GRAPHICS_3D_DEV_INTERFACE PPB_GRAPHICS_3D_DEV_INTERFACE_0_7 |
piman
2011/08/16 22:21:51
Please rev interface.
| |
34 | 33 |
35 struct PPB_Graphics3D_Dev { | 34 struct PPB_Graphics3D_Dev { |
36 // Returns a string describing some aspect of the Graphics3D implementation. | |
37 // name may be one of: | |
38 // - PP_GRAPHICS3DSTRING_EXTENSIONS: describes which extensions are supported | |
39 // by the implementation. The string is zero-terminated and contains a | |
40 // space-separated list of extension names; extension names themselves do | |
41 // not contain spaces. If there are no extensions, then the empty string is | |
42 // returned. | |
43 // - PP_GRAPHICS3DSTRING_VENDOR: Implementation dependent. | |
44 // - PP_GRAPHICS3DSTRING_VERSION: The format of the string is: | |
45 // <major version.minor version><space><vendor specific info> | |
46 // Both the major and minor portions of the version number are numeric. | |
47 // The vendor-specific information is optional; if present, its format and | |
48 // contents are implementation specific. | |
49 // On failure, PP_VARTYPE_UNDEFINED is returned. | |
50 // | |
51 // TODO(alokp): Does this function need module argument? | |
52 // | |
53 struct PP_Var (*GetString)(int32_t name); | |
54 | |
55 // Creates and initializes a rendering context and returns a handle to it. | 35 // Creates and initializes a rendering context and returns a handle to it. |
56 // The returned context is off-screen to start with. It must be attached to | 36 // The returned context is off-screen to start with. It must be attached to |
57 // a plugin instance using PPB_Instance::BindGraphics to draw on the web page. | 37 // a plugin instance using PPB_Instance::BindGraphics to draw on the web page. |
58 // | 38 // |
59 // If share_context is not NULL, then all shareable data, as defined | 39 // If share_context is not NULL, then all shareable data, as defined |
60 // by the client API (note that for OpenGL and OpenGL ES, shareable data | 40 // by the client API (note that for OpenGL and OpenGL ES, shareable data |
61 // excludes texture objects named 0) will be shared by share_context, all | 41 // excludes texture objects named 0) will be shared by share_context, all |
62 // other contexts share_context already shares with, and the newly created | 42 // other contexts share_context already shares with, and the newly created |
63 // context. An arbitrary number of PPB_Graphics3D_Dev can share data in | 43 // context. An arbitrary number of PPB_Graphics3D_Dev can share data in |
64 // this fashion. | 44 // this fashion. |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
165 // Because the callback is executed (or thread unblocked) only when the | 145 // Because the callback is executed (or thread unblocked) only when the |
166 // plugin's current state is actually on the screen, this function provides a | 146 // plugin's current state is actually on the screen, this function provides a |
167 // way to rate limit animations. By waiting until the image is on the screen | 147 // way to rate limit animations. By waiting until the image is on the screen |
168 // before painting the next frame, you can ensure you're not generating | 148 // before painting the next frame, you can ensure you're not generating |
169 // updates faster than the screen can be updated. | 149 // updates faster than the screen can be updated. |
170 int32_t (*SwapBuffers)(PP_Resource context, | 150 int32_t (*SwapBuffers)(PP_Resource context, |
171 struct PP_CompletionCallback callback); | 151 struct PP_CompletionCallback callback); |
172 }; | 152 }; |
173 | 153 |
174 #endif /* PPAPI_C_DEV_PPB_GRAPHICS_3D_DEV_H_ */ | 154 #endif /* PPAPI_C_DEV_PPB_GRAPHICS_3D_DEV_H_ */ |
OLD | NEW |