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 25 matching lines...) Expand all Loading... |
36 { | 36 { |
37 return adoptRef(new WebGLVertexArrayObjectOES(ctx, type)); | 37 return adoptRef(new WebGLVertexArrayObjectOES(ctx, type)); |
38 } | 38 } |
39 | 39 |
40 WebGLVertexArrayObjectOES::WebGLVertexArrayObjectOES(WebGLRenderingContext* ctx,
VaoType type) | 40 WebGLVertexArrayObjectOES::WebGLVertexArrayObjectOES(WebGLRenderingContext* ctx,
VaoType type) |
41 : WebGLContextObject(ctx) | 41 : WebGLContextObject(ctx) |
42 , m_type(type) | 42 , m_type(type) |
43 , m_hasEverBeenBound(false) | 43 , m_hasEverBeenBound(false) |
44 , m_boundElementArrayBuffer(0) | 44 , m_boundElementArrayBuffer(0) |
45 { | 45 { |
| 46 ScriptWrappable::init(this); |
46 m_vertexAttribState.resize(ctx->getMaxVertexAttribs()); | 47 m_vertexAttribState.resize(ctx->getMaxVertexAttribs()); |
47 | 48 |
48 Extensions3D* extensions = context()->graphicsContext3D()->getExtensions(); | 49 Extensions3D* extensions = context()->graphicsContext3D()->getExtensions(); |
49 switch (m_type) { | 50 switch (m_type) { |
50 case VaoTypeDefault: | 51 case VaoTypeDefault: |
51 break; | 52 break; |
52 default: | 53 default: |
53 setObject(extensions->createVertexArrayOES()); | 54 setObject(extensions->createVertexArrayOES()); |
54 break; | 55 break; |
55 } | 56 } |
56 } | 57 } |
57 | 58 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 for (size_t i = 0; i < m_vertexAttribState.size(); ++i) { | 124 for (size_t i = 0; i < m_vertexAttribState.size(); ++i) { |
124 VertexAttribState& state = m_vertexAttribState[i]; | 125 VertexAttribState& state = m_vertexAttribState[i]; |
125 if (state.bufferBinding == buffer) { | 126 if (state.bufferBinding == buffer) { |
126 buffer->onDetached(context()->graphicsContext3D()); | 127 buffer->onDetached(context()->graphicsContext3D()); |
127 state.bufferBinding = 0; | 128 state.bufferBinding = 0; |
128 } | 129 } |
129 } | 130 } |
130 } | 131 } |
131 | 132 |
132 } | 133 } |
OLD | NEW |