WebGLVertexArrayObjectOES.cpp [plain text]
#include "config.h"
#if ENABLE(WEBGL)
#include "WebGLVertexArrayObjectOES.h"
#include "ExtensionsGL.h"
#include "WebGLRenderingContextBase.h"
namespace WebCore {
Ref<WebGLVertexArrayObjectOES> WebGLVertexArrayObjectOES::create(WebGLRenderingContextBase& context, Type type)
{
return adoptRef(*new WebGLVertexArrayObjectOES(context, type));
}
WebGLVertexArrayObjectOES::WebGLVertexArrayObjectOES(WebGLRenderingContextBase& context, Type type)
: WebGLVertexArrayObjectBase(context, type)
{
switch (type) {
case Type::Default:
break;
case Type::User:
setObject(this->context()->graphicsContextGL()->getExtensions().createVertexArrayOES());
break;
}
}
WebGLVertexArrayObjectOES::~WebGLVertexArrayObjectOES()
{
if (!context())
return;
runDestructor();
}
void WebGLVertexArrayObjectOES::deleteObjectImpl(const WTF::AbstractLocker& locker, GraphicsContextGL* context3d, PlatformGLObject object)
{
switch (m_type) {
case Type::Default:
break;
case Type::User:
context3d->getExtensions().deleteVertexArrayOES(object);
break;
}
if (m_boundElementArrayBuffer)
m_boundElementArrayBuffer->onDetached(locker, context3d);
for (auto& state : m_vertexAttribState) {
if (state.bufferBinding)
state.bufferBinding->onDetached(locker, context3d);
}
}
}
#endif // ENABLE(WEBGL)