| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #include "config.h" | 26 #include "config.h" |
| 27 | 27 |
| 28 #include "core/html/canvas/OESVertexArrayObject.h" | 28 #include "core/html/canvas/OESVertexArrayObject.h" |
| 29 | 29 |
| 30 #include "bindings/v8/ExceptionState.h" | 30 #include "bindings/v8/ExceptionState.h" |
| 31 #include "core/html/canvas/WebGLRenderingContext.h" | 31 #include "core/html/canvas/WebGLRenderingContextBase.h" |
| 32 #include "core/html/canvas/WebGLVertexArrayObjectOES.h" | 32 #include "core/html/canvas/WebGLVertexArrayObjectOES.h" |
| 33 #include "core/platform/graphics/Extensions3D.h" | 33 #include "core/platform/graphics/Extensions3D.h" |
| 34 | 34 |
| 35 namespace WebCore { | 35 namespace WebCore { |
| 36 | 36 |
| 37 OESVertexArrayObject::OESVertexArrayObject(WebGLRenderingContext* context) | 37 OESVertexArrayObject::OESVertexArrayObject(WebGLRenderingContextBase* context) |
| 38 : WebGLExtension(context) | 38 : WebGLExtension(context) |
| 39 { | 39 { |
| 40 ScriptWrappable::init(this); | 40 ScriptWrappable::init(this); |
| 41 context->graphicsContext3D()->getExtensions()->ensureEnabled("GL_OES_vertex_
array_object"); | 41 context->graphicsContext3D()->getExtensions()->ensureEnabled("GL_OES_vertex_
array_object"); |
| 42 } | 42 } |
| 43 | 43 |
| 44 OESVertexArrayObject::~OESVertexArrayObject() | 44 OESVertexArrayObject::~OESVertexArrayObject() |
| 45 { | 45 { |
| 46 } | 46 } |
| 47 | 47 |
| 48 WebGLExtension::ExtensionName OESVertexArrayObject::getName() const | 48 WebGLExtension::ExtensionName OESVertexArrayObject::getName() const |
| 49 { | 49 { |
| 50 return OESVertexArrayObjectName; | 50 return OESVertexArrayObjectName; |
| 51 } | 51 } |
| 52 | 52 |
| 53 PassRefPtr<OESVertexArrayObject> OESVertexArrayObject::create(WebGLRenderingCont
ext* context) | 53 PassRefPtr<OESVertexArrayObject> OESVertexArrayObject::create(WebGLRenderingCont
extBase* context) |
| 54 { | 54 { |
| 55 return adoptRef(new OESVertexArrayObject(context)); | 55 return adoptRef(new OESVertexArrayObject(context)); |
| 56 } | 56 } |
| 57 | 57 |
| 58 PassRefPtr<WebGLVertexArrayObjectOES> OESVertexArrayObject::createVertexArrayOES
() | 58 PassRefPtr<WebGLVertexArrayObjectOES> OESVertexArrayObject::createVertexArrayOES
() |
| 59 { | 59 { |
| 60 if (isLost()) | 60 if (isLost()) |
| 61 return 0; | 61 return 0; |
| 62 | 62 |
| 63 RefPtr<WebGLVertexArrayObjectOES> o = WebGLVertexArrayObjectOES::create(m_co
ntext, WebGLVertexArrayObjectOES::VaoTypeUser); | 63 RefPtr<WebGLVertexArrayObjectOES> o = WebGLVertexArrayObjectOES::create(m_co
ntext, WebGLVertexArrayObjectOES::VaoTypeUser); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 extensions->bindVertexArrayOES(arrayObject->object()); | 103 extensions->bindVertexArrayOES(arrayObject->object()); |
| 104 | 104 |
| 105 arrayObject->setHasEverBeenBound(); | 105 arrayObject->setHasEverBeenBound(); |
| 106 m_context->setBoundVertexArrayObject(arrayObject); | 106 m_context->setBoundVertexArrayObject(arrayObject); |
| 107 } else { | 107 } else { |
| 108 extensions->bindVertexArrayOES(0); | 108 extensions->bindVertexArrayOES(0); |
| 109 m_context->setBoundVertexArrayObject(0); | 109 m_context->setBoundVertexArrayObject(0); |
| 110 } | 110 } |
| 111 } | 111 } |
| 112 | 112 |
| 113 bool OESVertexArrayObject::supported(WebGLRenderingContext* context) | 113 bool OESVertexArrayObject::supported(WebGLRenderingContextBase* context) |
| 114 { | 114 { |
| 115 Extensions3D* extensions = context->graphicsContext3D()->getExtensions(); | 115 Extensions3D* extensions = context->graphicsContext3D()->getExtensions(); |
| 116 return extensions->supports("GL_OES_vertex_array_object"); | 116 return extensions->supports("GL_OES_vertex_array_object"); |
| 117 } | 117 } |
| 118 | 118 |
| 119 const char* OESVertexArrayObject::getExtensionName() | 119 const char* OESVertexArrayObject::getExtensionName() |
| 120 { | 120 { |
| 121 return "OES_vertex_array_object"; | 121 return "OES_vertex_array_object"; |
| 122 } | 122 } |
| 123 | 123 |
| 124 } // namespace WebCore | 124 } // namespace WebCore |
| OLD | NEW |