Esempio n. 1
0
bool WebGLFramebuffer::onAccess(GraphicsContext3D* context3d, bool needToInitializeRenderbuffers)
{
    if (checkStatus() != GraphicsContext3D::FRAMEBUFFER_COMPLETE)
        return false;
    if (needToInitializeRenderbuffers)
        return initializeRenderbuffers(context3d);
    return true;
}
bool WebGLFramebuffer::onAccess(bool needToInitializeRenderbuffers)
{
    if (isIncomplete(true))
        return false;
    if (needToInitializeRenderbuffers)
        return initializeRenderbuffers();
    return true;
}
void WebGLFramebuffer::onAttachedObjectChange(WebGLObject* object)
{
    // Currently object == 0 is not considered, but this might change if the
    // lifespan of WebGLObject changes.
    if (object
        && (object == m_colorAttachment || object == m_depthAttachment
            || object == m_stencilAttachment || object == m_depthStencilAttachment))
        initializeRenderbuffers();
}
void WebGLFramebuffer::setAttachment(unsigned long attachment, WebGLObject* attachedObject)
{
    if (!object())
        return;
    if (attachedObject && !attachedObject->object())
        attachedObject = 0;
    switch (attachment) {
    case GraphicsContext3D::COLOR_ATTACHMENT0:
        m_colorAttachment = attachedObject;
        break;
    case GraphicsContext3D::DEPTH_ATTACHMENT:
        m_depthAttachment = attachedObject;
        break;
    case GraphicsContext3D::STENCIL_ATTACHMENT:
        m_stencilAttachment = attachedObject;
        break;
    case GraphicsContext3D::DEPTH_STENCIL_ATTACHMENT:
        m_depthStencilAttachment = attachedObject;
        break;
    default:
        return;
    }
    initializeRenderbuffers();
}
void WebGLFramebuffer::onBind()
{
    initializeRenderbuffers();
}