WebGLVertexArrayGL.cpp (902B)
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/. */ 5 6 #include "WebGLVertexArrayGL.h" 7 8 #include "GLContext.h" 9 #include "WebGLBuffer.h" 10 #include "WebGLContext.h" 11 12 namespace mozilla { 13 14 WebGLVertexArrayGL::WebGLVertexArrayGL(WebGLContext* webgl) 15 : WebGLVertexArray(webgl), mGLName([&]() { 16 GLuint ret = 0; 17 webgl->gl->fGenVertexArrays(1, &ret); 18 return ret; 19 }()) {} 20 21 WebGLVertexArrayGL::~WebGLVertexArrayGL() { 22 if (!mContext) return; 23 mContext->gl->fDeleteVertexArrays(1, &mGLName); 24 } 25 26 void WebGLVertexArrayGL::BindVertexArray() { 27 mContext->mBoundVertexArray = this; 28 mContext->gl->fBindVertexArray(mGLName); 29 } 30 31 } // namespace mozilla