1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "WebGLVertexArrayGL.h"
9 #include "WebGLBuffer.h"
10 #include "WebGLContext.h"
14 WebGLVertexArrayGL::WebGLVertexArrayGL(WebGLContext
* webgl
)
15 : WebGLVertexArray(webgl
), mGLName([&]() {
17 webgl
->gl
->fGenVertexArrays(1, &ret
);
21 WebGLVertexArrayGL::~WebGLVertexArrayGL() {
22 if (!mContext
) return;
23 mContext
->gl
->fDeleteVertexArrays(1, &mGLName
);
26 void WebGLVertexArrayGL::BindVertexArray() {
27 mContext
->mBoundVertexArray
= this;
28 mContext
->gl
->fBindVertexArray(mGLName
);
31 } // namespace mozilla