2013-06-27 14:07:21 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#include "WebGLExtensions.h"
|
2014-11-13 20:03:50 -08:00
|
|
|
|
2013-09-04 05:14:52 -07:00
|
|
|
#include "GLContext.h"
|
2014-11-13 20:03:50 -08:00
|
|
|
#include "mozilla/dom/WebGLRenderingContextBinding.h"
|
|
|
|
#include "WebGLBuffer.h"
|
|
|
|
#include "WebGLContext.h"
|
|
|
|
#include "WebGLVertexArray.h"
|
2013-06-27 14:07:21 -07:00
|
|
|
|
2014-11-13 20:03:50 -08:00
|
|
|
namespace mozilla {
|
2013-06-27 14:07:21 -07:00
|
|
|
|
2014-11-13 20:03:50 -08:00
|
|
|
WebGLExtensionVertexArray::WebGLExtensionVertexArray(WebGLContext* webgl)
|
|
|
|
: WebGLExtensionBase(webgl)
|
2013-06-27 14:07:21 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
WebGLExtensionVertexArray::~WebGLExtensionVertexArray()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-11-13 20:03:50 -08:00
|
|
|
already_AddRefed<WebGLVertexArray>
|
|
|
|
WebGLExtensionVertexArray::CreateVertexArrayOES()
|
2013-06-27 14:07:21 -07:00
|
|
|
{
|
2014-03-11 19:51:39 -07:00
|
|
|
if (mIsLost) {
|
2014-11-13 20:03:50 -08:00
|
|
|
mContext->ErrorInvalidOperation("%s: Extension is lost.",
|
|
|
|
"createVertexArrayOES");
|
2014-03-11 19:51:39 -07:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2013-06-27 14:07:21 -07:00
|
|
|
return mContext->CreateVertexArray();
|
|
|
|
}
|
|
|
|
|
2014-11-13 20:03:50 -08:00
|
|
|
void
|
|
|
|
WebGLExtensionVertexArray::DeleteVertexArrayOES(WebGLVertexArray* array)
|
2013-06-27 14:07:21 -07:00
|
|
|
{
|
2014-11-13 20:03:50 -08:00
|
|
|
if (mIsLost) {
|
|
|
|
mContext->ErrorInvalidOperation("%s: Extension is lost.",
|
|
|
|
"deleteVertexArrayOES");
|
|
|
|
return;
|
|
|
|
}
|
2014-03-11 19:51:39 -07:00
|
|
|
|
2013-06-27 14:07:21 -07:00
|
|
|
mContext->DeleteVertexArray(array);
|
|
|
|
}
|
|
|
|
|
2014-11-13 20:03:50 -08:00
|
|
|
bool
|
|
|
|
WebGLExtensionVertexArray::IsVertexArrayOES(WebGLVertexArray* array)
|
2013-06-27 14:07:21 -07:00
|
|
|
{
|
2014-03-11 19:51:39 -07:00
|
|
|
if (mIsLost) {
|
2014-11-13 20:03:50 -08:00
|
|
|
mContext->ErrorInvalidOperation("%s: Extension is lost.",
|
|
|
|
"isVertexArrayOES");
|
2014-03-11 19:51:39 -07:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-06-27 14:07:21 -07:00
|
|
|
return mContext->IsVertexArray(array);
|
|
|
|
}
|
|
|
|
|
2014-11-13 20:03:50 -08:00
|
|
|
void
|
|
|
|
WebGLExtensionVertexArray::BindVertexArrayOES(WebGLVertexArray* array)
|
2013-06-27 14:07:21 -07:00
|
|
|
{
|
2014-11-13 20:03:50 -08:00
|
|
|
if (mIsLost) {
|
|
|
|
mContext->ErrorInvalidOperation("%s: Extension is lost.",
|
|
|
|
"bindVertexArrayOES");
|
|
|
|
return;
|
|
|
|
}
|
2014-03-11 19:51:39 -07:00
|
|
|
|
2013-06-27 14:07:21 -07:00
|
|
|
mContext->BindVertexArray(array);
|
|
|
|
}
|
|
|
|
|
|
|
|
IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionVertexArray)
|
2014-11-13 20:03:50 -08:00
|
|
|
|
|
|
|
} // namespace mozilla
|