WebGLVertexArrayObjectOES.cpp [plain text]
#include "config.h"
#if ENABLE(WEBGL)
#include "WebGLVertexArrayObjectOES.h"
#include "Extensions3D.h"
#include "WebGLRenderingContextBase.h"
namespace WebCore {
Ref<WebGLVertexArrayObjectOES> WebGLVertexArrayObjectOES::create(WebGLRenderingContextBase* ctx, VAOType type)
{
return adoptRef(*new WebGLVertexArrayObjectOES(ctx, type));
}
WebGLVertexArrayObjectOES::WebGLVertexArrayObjectOES(WebGLRenderingContextBase* ctx, VAOType type)
: WebGLVertexArrayObjectBase(ctx, type)
{
Extensions3D* extensions = context()->graphicsContext3D()->getExtensions();
switch (m_type) {
case VAOTypeDefault:
break;
default:
setObject(extensions->createVertexArrayOES());
break;
}
}
WebGLVertexArrayObjectOES::~WebGLVertexArrayObjectOES()
{
deleteObject(0);
}
void WebGLVertexArrayObjectOES::deleteObjectImpl(GraphicsContext3D* context3d, Platform3DObject object)
{
Extensions3D* extensions = context3d->getExtensions();
switch (m_type) {
case VAOTypeDefault:
break;
default:
extensions->deleteVertexArrayOES(object);
break;
}
if (m_boundElementArrayBuffer)
m_boundElementArrayBuffer->onDetached(context3d);
for (auto& state : m_vertexAttribState) {
if (state.bufferBinding)
state.bufferBinding->onDetached(context3d);
}
}
}
#endif // ENABLE(WEBGL)