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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 } | 50 } |
51 | 51 |
52 PassRefPtr<OESVertexArrayObject> OESVertexArrayObject::create(WebGLRenderingCont
ext* context) | 52 PassRefPtr<OESVertexArrayObject> OESVertexArrayObject::create(WebGLRenderingCont
ext* context) |
53 { | 53 { |
54 return adoptRef(new OESVertexArrayObject(context)); | 54 return adoptRef(new OESVertexArrayObject(context)); |
55 } | 55 } |
56 | 56 |
57 PassRefPtr<WebGLVertexArrayObjectOES> OESVertexArrayObject::createVertexArrayOES
() | 57 PassRefPtr<WebGLVertexArrayObjectOES> OESVertexArrayObject::createVertexArrayOES
() |
58 { | 58 { |
59 if (isLost()) | 59 if (isLost()) |
60 return 0; | 60 return nullptr; |
61 | 61 |
62 RefPtr<WebGLVertexArrayObjectOES> o = WebGLVertexArrayObjectOES::create(m_co
ntext, WebGLVertexArrayObjectOES::VaoTypeUser); | 62 RefPtr<WebGLVertexArrayObjectOES> o = WebGLVertexArrayObjectOES::create(m_co
ntext, WebGLVertexArrayObjectOES::VaoTypeUser); |
63 m_context->addContextObject(o.get()); | 63 m_context->addContextObject(o.get()); |
64 return o.release(); | 64 return o.release(); |
65 } | 65 } |
66 | 66 |
67 void OESVertexArrayObject::deleteVertexArrayOES(WebGLVertexArrayObjectOES* array
Object) | 67 void OESVertexArrayObject::deleteVertexArrayOES(WebGLVertexArrayObjectOES* array
Object) |
68 { | 68 { |
69 if (!arrayObject || isLost()) | 69 if (!arrayObject || isLost()) |
70 return; | 70 return; |
71 | 71 |
72 if (!arrayObject->isDefaultObject() && arrayObject == m_context->m_boundVert
exArrayObject) | 72 if (!arrayObject->isDefaultObject() && arrayObject == m_context->m_boundVert
exArrayObject) |
73 m_context->setBoundVertexArrayObject(0); | 73 m_context->setBoundVertexArrayObject(nullptr); |
74 | 74 |
75 arrayObject->deleteObject(m_context->webGraphicsContext3D()); | 75 arrayObject->deleteObject(m_context->webGraphicsContext3D()); |
76 } | 76 } |
77 | 77 |
78 GLboolean OESVertexArrayObject::isVertexArrayOES(WebGLVertexArrayObjectOES* arra
yObject) | 78 GLboolean OESVertexArrayObject::isVertexArrayOES(WebGLVertexArrayObjectOES* arra
yObject) |
79 { | 79 { |
80 if (!arrayObject || isLost()) | 80 if (!arrayObject || isLost()) |
81 return 0; | 81 return 0; |
82 | 82 |
83 if (!arrayObject->hasEverBeenBound()) | 83 if (!arrayObject->hasEverBeenBound()) |
(...skipping 12 matching lines...) Expand all Loading... |
96 return; | 96 return; |
97 } | 97 } |
98 | 98 |
99 if (arrayObject && !arrayObject->isDefaultObject() && arrayObject->object())
{ | 99 if (arrayObject && !arrayObject->isDefaultObject() && arrayObject->object())
{ |
100 m_context->webGraphicsContext3D()->bindVertexArrayOES(arrayObject->objec
t()); | 100 m_context->webGraphicsContext3D()->bindVertexArrayOES(arrayObject->objec
t()); |
101 | 101 |
102 arrayObject->setHasEverBeenBound(); | 102 arrayObject->setHasEverBeenBound(); |
103 m_context->setBoundVertexArrayObject(arrayObject); | 103 m_context->setBoundVertexArrayObject(arrayObject); |
104 } else { | 104 } else { |
105 m_context->webGraphicsContext3D()->bindVertexArrayOES(0); | 105 m_context->webGraphicsContext3D()->bindVertexArrayOES(0); |
106 m_context->setBoundVertexArrayObject(0); | 106 m_context->setBoundVertexArrayObject(nullptr); |
107 } | 107 } |
108 } | 108 } |
109 | 109 |
110 bool OESVertexArrayObject::supported(WebGLRenderingContext* context) | 110 bool OESVertexArrayObject::supported(WebGLRenderingContext* context) |
111 { | 111 { |
112 return context->extensionsUtil()->supportsExtension("GL_OES_vertex_array_obj
ect"); | 112 return context->extensionsUtil()->supportsExtension("GL_OES_vertex_array_obj
ect"); |
113 } | 113 } |
114 | 114 |
115 const char* OESVertexArrayObject::extensionName() | 115 const char* OESVertexArrayObject::extensionName() |
116 { | 116 { |
117 return "OES_vertex_array_object"; | 117 return "OES_vertex_array_object"; |
118 } | 118 } |
119 | 119 |
120 } // namespace WebCore | 120 } // namespace WebCore |
OLD | NEW |