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_CPP_GRAPHICS_3D_H_ | 5 #ifndef PPAPI_CPP_GRAPHICS_3D_H_ |
6 #define PPAPI_CPP_GRAPHICS_3D_H_ | 6 #define PPAPI_CPP_GRAPHICS_3D_H_ |
7 | 7 |
8 #include "ppapi/c/ppb_graphics_3d.h" | 8 #include "ppapi/c/ppb_graphics_3d.h" |
9 #include "ppapi/cpp/resource.h" | 9 #include "ppapi/cpp/resource.h" |
10 | 10 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 /// | 55 /// |
56 /// Exact attributes are: | 56 /// Exact attributes are: |
57 /// | 57 /// |
58 /// <code>PP_GRAPHICS3DATTRIB_WIDTH</code> Default 0 | 58 /// <code>PP_GRAPHICS3DATTRIB_WIDTH</code> Default 0 |
59 /// <code>PP_GRAPHICS3DATTRIB_HEIGHT</code> Default 0 | 59 /// <code>PP_GRAPHICS3DATTRIB_HEIGHT</code> Default 0 |
60 /// <code>PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR</code> | 60 /// <code>PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR</code> |
61 /// Default: Implementation defined. | 61 /// Default: Implementation defined. |
62 /// | 62 /// |
63 /// On failure, the object will be is_null(). | 63 /// On failure, the object will be is_null(). |
64 Graphics3D(const Instance* instance, | 64 Graphics3D(const Instance* instance, |
65 const int32_t* attrib_list); | 65 const int32_t attrib_list[]); |
66 | 66 |
67 /// A constructor for creating and initializing a 3D rendering context. The | 67 /// A constructor for creating and initializing a 3D rendering context. The |
68 /// returned context is created off-screen. It must be attached to a | 68 /// returned context is created off-screen. It must be attached to a |
69 /// module instance using <code>Instance::BindGraphics</code> to draw on the | 69 /// module instance using <code>Instance::BindGraphics</code> to draw on the |
70 /// web page. | 70 /// web page. |
71 /// | 71 /// |
72 /// This constructor is identical to the 2-argument version except that this | 72 /// This constructor is identical to the 2-argument version except that this |
73 /// version allows sharing of resources with another context. | 73 /// version allows sharing of resources with another context. |
74 /// | 74 /// |
75 /// @param[in] instance The instance that will own the new Graphics3D. | 75 /// @param[in] instance The instance that will own the new Graphics3D. |
76 /// | 76 /// |
77 /// @param[in] share_context Specifies the context with which all | 77 /// @param[in] share_context Specifies the context with which all |
78 /// shareable data will be shared. The shareable data is defined by the | 78 /// shareable data will be shared. The shareable data is defined by the |
79 /// client API (note that for OpenGL and OpenGL ES, shareable data excludes | 79 /// client API (note that for OpenGL and OpenGL ES, shareable data excludes |
80 /// texture objects named 0). An arbitrary number of Graphics3D resources | 80 /// texture objects named 0). An arbitrary number of Graphics3D resources |
81 /// can share data in this fashion. | 81 /// can share data in this fashion. |
82 // | 82 // |
83 /// @param[in] attrib_list The list of attributes for the context. See the | 83 /// @param[in] attrib_list The list of attributes for the context. See the |
84 /// 2-argument version of this constructor for more information. | 84 /// 2-argument version of this constructor for more information. |
85 /// | 85 /// |
86 /// On failure, the object will be is_null(). | 86 /// On failure, the object will be is_null(). |
87 Graphics3D(const Instance* instance, | 87 Graphics3D(const Instance* instance, |
88 const Graphics3D& share_context, | 88 const Graphics3D& share_context, |
89 const int32_t* attrib_list); | 89 const int32_t attrib_list[]); |
90 | 90 |
91 /// Destructor. | 91 /// Destructor. |
92 ~Graphics3D(); | 92 ~Graphics3D(); |
93 | 93 |
94 /// GetAttribs() retrieves the value for each attribute in | 94 /// GetAttribs() retrieves the value for each attribute in |
95 /// <code>attrib_list</code>. The list has the same structure as described | 95 /// <code>attrib_list</code>. The list has the same structure as described |
96 /// for the constructor. All attribute values specified in | 96 /// for the constructor. All attribute values specified in |
97 /// <code>pp_graphics_3d.h</code> can be retrieved. | 97 /// <code>pp_graphics_3d.h</code> can be retrieved. |
98 /// | 98 /// |
99 /// @param[in,out] attrib_list The list of attributes (name=value pairs) for | 99 /// @param[in,out] attrib_list The list of attributes (name=value pairs) for |
(...skipping 13 matching lines...) Expand all Loading... |
113 /// PP_GRAPHICS3DATTRIB_GREEN_SIZE, 0, | 113 /// PP_GRAPHICS3DATTRIB_GREEN_SIZE, 0, |
114 /// PP_GRAPHICS3DATTRIB_BLUE_SIZE, 0, | 114 /// PP_GRAPHICS3DATTRIB_BLUE_SIZE, 0, |
115 /// PP_GRAPHICS3DATTRIB_NONE}; | 115 /// PP_GRAPHICS3DATTRIB_NONE}; |
116 /// GetAttribs(context, attrib_list); | 116 /// GetAttribs(context, attrib_list); |
117 /// int red_bits = attrib_list[1]; | 117 /// int red_bits = attrib_list[1]; |
118 /// int green_bits = attrib_list[3]; | 118 /// int green_bits = attrib_list[3]; |
119 /// int blue_bits = attrib_list[5]; | 119 /// int blue_bits = attrib_list[5]; |
120 /// </code> | 120 /// </code> |
121 /// | 121 /// |
122 /// This example retrieves the values for rgb bits in the color buffer. | 122 /// This example retrieves the values for rgb bits in the color buffer. |
123 int32_t GetAttribs(int32_t* attrib_list) const; | 123 int32_t GetAttribs(int32_t attrib_list[]) const; |
124 | 124 |
125 /// SetAttribs() sets the values for each attribute in | 125 /// SetAttribs() sets the values for each attribute in |
126 /// <code>attrib_list</code>. The list has the same structure as the list | 126 /// <code>attrib_list</code>. The list has the same structure as the list |
127 /// used in the constructors. | 127 /// used in the constructors. |
128 /// | 128 /// |
129 /// Attributes that can be specified are: | 129 /// Attributes that can be specified are: |
130 /// - PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR | 130 /// - PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR |
131 /// | 131 /// |
132 /// On failure the following error codes may be returned: | 132 /// On failure the following error codes may be returned: |
133 /// - PP_ERROR_BADRESOURCE if context is invalid. | 133 /// - PP_ERROR_BADRESOURCE if context is invalid. |
134 /// - PP_ERROR_BADARGUMENT if attrib_list is NULL or any attribute in the | 134 /// - PP_ERROR_BADARGUMENT if attrib_list is NULL or any attribute in the |
135 /// attrib_list is not a valid attribute. | 135 /// attrib_list is not a valid attribute. |
136 int32_t SetAttribs(int32_t* attrib_list); | 136 int32_t SetAttribs(const int32_t attrib_list[]); |
137 | 137 |
138 /// ResizeBuffers() resizes the backing surface for the context. | 138 /// ResizeBuffers() resizes the backing surface for the context. |
139 /// | 139 /// |
140 /// @param[in] width The width of the backing surface. | 140 /// @param[in] width The width of the backing surface. |
141 /// @param[in] height The height of the backing surface. | 141 /// @param[in] height The height of the backing surface. |
142 /// | 142 /// |
143 /// @return An int32_t containing <code>PP_ERROR_BADRESOURCE</code> if | 143 /// @return An int32_t containing <code>PP_ERROR_BADRESOURCE</code> if |
144 /// context is invalid or <code>PP_ERROR_BADARGUMENT</code> if the value | 144 /// context is invalid or <code>PP_ERROR_BADARGUMENT</code> if the value |
145 /// specified for width or height is less than zero. | 145 /// specified for width or height is less than zero. |
146 /// <code>PP_ERROR_NOMEMORY</code> might be returned on the next | 146 /// <code>PP_ERROR_NOMEMORY</code> might be returned on the next |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 /// | 183 /// |
184 /// @return An int32_t containing <code>PP_ERROR_BADRESOURCE</code> if | 184 /// @return An int32_t containing <code>PP_ERROR_BADRESOURCE</code> if |
185 /// context is invalid or <code>PP_ERROR_BADARGUMENT</code> if callback is | 185 /// context is invalid or <code>PP_ERROR_BADARGUMENT</code> if callback is |
186 /// invalid. | 186 /// invalid. |
187 int32_t SwapBuffers(const CompletionCallback& cc); | 187 int32_t SwapBuffers(const CompletionCallback& cc); |
188 }; | 188 }; |
189 | 189 |
190 } // namespace pp | 190 } // namespace pp |
191 | 191 |
192 #endif // PPAPI_CPP_GRAPHICS_3D_H_ | 192 #endif // PPAPI_CPP_GRAPHICS_3D_H_ |
OLD | NEW |