| 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 #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 |
| 11 /// @file | 11 /// @file |
| 12 /// This file defines the API to create a 3D rendering context in the browser. | 12 /// This file defines the API to create a 3D rendering context in the browser. |
| 13 namespace pp { | 13 namespace pp { |
| 14 | 14 |
| 15 class CompletionCallback; | 15 class CompletionCallback; |
| 16 class Instance; | 16 class InstanceHandle; |
| 17 | 17 |
| 18 /// This class represents a 3D rendering context in the browser. | 18 /// This class represents a 3D rendering context in the browser. |
| 19 class Graphics3D : public Resource { | 19 class Graphics3D : public Resource { |
| 20 public: | 20 public: |
| 21 /// Default constructor for creating an is_null() Graphics3D object. | 21 /// Default constructor for creating an is_null() Graphics3D object. |
| 22 Graphics3D(); | 22 Graphics3D(); |
| 23 | 23 |
| 24 /// A constructor for creating and and initializing a 3D rendering context. | 24 /// A constructor for creating and and initializing a 3D rendering context. |
| 25 /// The returned context is created off-screen and must be attached | 25 /// The returned context is created off-screen and must be attached |
| 26 /// to a module instance using <code>Instance::BindGraphics</code> to draw on | 26 /// to a module instance using <code>Instance::BindGraphics</code> to draw on |
| 27 /// the web page. | 27 /// the web page. |
| 28 /// | 28 /// |
| 29 /// @param[in] instance The instance that will own the new Graphics3D. | 29 /// @param[in] instance The instance with which this resource will be |
| 30 /// associated. |
| 30 /// | 31 /// |
| 31 /// @param[in] attrib_list The list of attributes (name=value pairs) for the | 32 /// @param[in] attrib_list The list of attributes (name=value pairs) for the |
| 32 /// context. The list is terminated with | 33 /// context. The list is terminated with |
| 33 /// <code>PP_GRAPHICS3DATTRIB_NONE</code>. The <code>attrib_list</code> may | 34 /// <code>PP_GRAPHICS3DATTRIB_NONE</code>. The <code>attrib_list</code> may |
| 34 /// be <code>NULL</code> or empty (first attribute is | 35 /// be <code>NULL</code> or empty (first attribute is |
| 35 /// <code>PP_GRAPHICS3DATTRIB_NONE</code>). If an attribute is not specified | 36 /// <code>PP_GRAPHICS3DATTRIB_NONE</code>). If an attribute is not specified |
| 36 /// in <code>attrib_list</code>, then the default value is used. | 37 /// in <code>attrib_list</code>, then the default value is used. |
| 37 /// | 38 /// |
| 38 /// Attributes are classified into two categories: | 39 /// Attributes are classified into two categories: |
| 39 /// | 40 /// |
| (...skipping 14 matching lines...) Expand all Loading... |
| 54 /// <code>PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS</code> | 55 /// <code>PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS</code> |
| 55 /// | 56 /// |
| 56 /// Exact attributes are: | 57 /// Exact attributes are: |
| 57 /// | 58 /// |
| 58 /// <code>PP_GRAPHICS3DATTRIB_WIDTH</code> Default 0 | 59 /// <code>PP_GRAPHICS3DATTRIB_WIDTH</code> Default 0 |
| 59 /// <code>PP_GRAPHICS3DATTRIB_HEIGHT</code> Default 0 | 60 /// <code>PP_GRAPHICS3DATTRIB_HEIGHT</code> Default 0 |
| 60 /// <code>PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR</code> | 61 /// <code>PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR</code> |
| 61 /// Default: Implementation defined. | 62 /// Default: Implementation defined. |
| 62 /// | 63 /// |
| 63 /// On failure, the object will be is_null(). | 64 /// On failure, the object will be is_null(). |
| 64 Graphics3D(const Instance* instance, | 65 Graphics3D(const InstanceHandle& instance, |
| 65 const int32_t attrib_list[]); | 66 const int32_t attrib_list[]); |
| 66 | 67 |
| 67 /// A constructor for creating and initializing a 3D rendering context. The | 68 /// A constructor for creating and initializing a 3D rendering context. The |
| 68 /// returned context is created off-screen. It must be attached to a | 69 /// returned context is created off-screen. It must be attached to a |
| 69 /// module instance using <code>Instance::BindGraphics</code> to draw on the | 70 /// module instance using <code>Instance::BindGraphics</code> to draw on the |
| 70 /// web page. | 71 /// web page. |
| 71 /// | 72 /// |
| 72 /// This constructor is identical to the 2-argument version except that this | 73 /// This constructor is identical to the 2-argument version except that this |
| 73 /// version allows sharing of resources with another context. | 74 /// version allows sharing of resources with another context. |
| 74 /// | 75 /// |
| 75 /// @param[in] instance The instance that will own the new Graphics3D. | 76 /// @param[in] instance The instance that will own the new Graphics3D. |
| 76 /// | 77 /// |
| 77 /// @param[in] share_context Specifies the context with which all | 78 /// @param[in] share_context Specifies the context with which all |
| 78 /// shareable data will be shared. The shareable data is defined by the | 79 /// 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 | 80 /// client API (note that for OpenGL and OpenGL ES, shareable data excludes |
| 80 /// texture objects named 0). An arbitrary number of Graphics3D resources | 81 /// texture objects named 0). An arbitrary number of Graphics3D resources |
| 81 /// can share data in this fashion. | 82 /// can share data in this fashion. |
| 82 // | 83 // |
| 83 /// @param[in] attrib_list The list of attributes for the context. See the | 84 /// @param[in] attrib_list The list of attributes for the context. See the |
| 84 /// 2-argument version of this constructor for more information. | 85 /// 2-argument version of this constructor for more information. |
| 85 /// | 86 /// |
| 86 /// On failure, the object will be is_null(). | 87 /// On failure, the object will be is_null(). |
| 87 Graphics3D(const Instance* instance, | 88 Graphics3D(const InstanceHandle& instance, |
| 88 const Graphics3D& share_context, | 89 const Graphics3D& share_context, |
| 89 const int32_t attrib_list[]); | 90 const int32_t attrib_list[]); |
| 90 | 91 |
| 91 /// Destructor. | 92 /// Destructor. |
| 92 ~Graphics3D(); | 93 ~Graphics3D(); |
| 93 | 94 |
| 94 /// GetAttribs() retrieves the value for each attribute in | 95 /// GetAttribs() retrieves the value for each attribute in |
| 95 /// <code>attrib_list</code>. The list has the same structure as described | 96 /// <code>attrib_list</code>. The list has the same structure as described |
| 96 /// for the constructor. All attribute values specified in | 97 /// for the constructor. All attribute values specified in |
| 97 /// <code>pp_graphics_3d.h</code> can be retrieved. | 98 /// <code>pp_graphics_3d.h</code> can be retrieved. |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 /// | 184 /// |
| 184 /// @return An int32_t containing <code>PP_ERROR_BADRESOURCE</code> if | 185 /// @return An int32_t containing <code>PP_ERROR_BADRESOURCE</code> if |
| 185 /// context is invalid or <code>PP_ERROR_BADARGUMENT</code> if callback is | 186 /// context is invalid or <code>PP_ERROR_BADARGUMENT</code> if callback is |
| 186 /// invalid. | 187 /// invalid. |
| 187 int32_t SwapBuffers(const CompletionCallback& cc); | 188 int32_t SwapBuffers(const CompletionCallback& cc); |
| 188 }; | 189 }; |
| 189 | 190 |
| 190 } // namespace pp | 191 } // namespace pp |
| 191 | 192 |
| 192 #endif // PPAPI_CPP_GRAPHICS_3D_H_ | 193 #endif // PPAPI_CPP_GRAPHICS_3D_H_ |
| OLD | NEW |