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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 | 80 |
81 return scoped.context()->contextGL()->IsVertexArrayOES(arrayObject->object()); | 81 return scoped.context()->contextGL()->IsVertexArrayOES(arrayObject->object()); |
82 } | 82 } |
83 | 83 |
84 void OESVertexArrayObject::bindVertexArrayOES( | 84 void OESVertexArrayObject::bindVertexArrayOES( |
85 WebGLVertexArrayObjectOES* arrayObject) { | 85 WebGLVertexArrayObjectOES* arrayObject) { |
86 WebGLExtensionScopedContext scoped(this); | 86 WebGLExtensionScopedContext scoped(this); |
87 if (scoped.isLost()) | 87 if (scoped.isLost()) |
88 return; | 88 return; |
89 | 89 |
90 if (arrayObject && (arrayObject->isDeleted() || | 90 if (arrayObject && |
91 !arrayObject->validate(0, scoped.context()))) { | 91 (arrayObject->isDeleted() || |
| 92 !arrayObject->validate(0, scoped.context()))) { |
92 scoped.context()->synthesizeGLError( | 93 scoped.context()->synthesizeGLError( |
93 GL_INVALID_OPERATION, "bindVertexArrayOES", "invalid arrayObject"); | 94 GL_INVALID_OPERATION, "bindVertexArrayOES", "invalid arrayObject"); |
94 return; | 95 return; |
95 } | 96 } |
96 | 97 |
97 if (arrayObject && !arrayObject->isDefaultObject() && arrayObject->object()) { | 98 if (arrayObject && !arrayObject->isDefaultObject() && arrayObject->object()) { |
98 scoped.context()->contextGL()->BindVertexArrayOES(arrayObject->object()); | 99 scoped.context()->contextGL()->BindVertexArrayOES(arrayObject->object()); |
99 | 100 |
100 arrayObject->setHasEverBeenBound(); | 101 arrayObject->setHasEverBeenBound(); |
101 scoped.context()->setBoundVertexArrayObject(arrayObject); | 102 scoped.context()->setBoundVertexArrayObject(arrayObject); |
102 } else { | 103 } else { |
103 scoped.context()->contextGL()->BindVertexArrayOES(0); | 104 scoped.context()->contextGL()->BindVertexArrayOES(0); |
104 scoped.context()->setBoundVertexArrayObject(nullptr); | 105 scoped.context()->setBoundVertexArrayObject(nullptr); |
105 } | 106 } |
106 } | 107 } |
107 | 108 |
108 bool OESVertexArrayObject::supported(WebGLRenderingContextBase* context) { | 109 bool OESVertexArrayObject::supported(WebGLRenderingContextBase* context) { |
109 return context->extensionsUtil()->supportsExtension( | 110 return context->extensionsUtil()->supportsExtension( |
110 "GL_OES_vertex_array_object"); | 111 "GL_OES_vertex_array_object"); |
111 } | 112 } |
112 | 113 |
113 const char* OESVertexArrayObject::extensionName() { | 114 const char* OESVertexArrayObject::extensionName() { |
114 return "OES_vertex_array_object"; | 115 return "OES_vertex_array_object"; |
115 } | 116 } |
116 | 117 |
117 } // namespace blink | 118 } // namespace blink |
OLD | NEW |