WebGLFramebuffer.h [plain text]
#ifndef WebGLFramebuffer_h
#define WebGLFramebuffer_h
#include "WebGLObject.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
namespace WebCore {
class WebGLRenderbuffer;
class WebGLTexture;
class WebGLFramebuffer : public WebGLObject {
public:
virtual ~WebGLFramebuffer() { deleteObject(); }
static PassRefPtr<WebGLFramebuffer> create(WebGLRenderingContext*);
void setAttachment(GC3Denum attachment, GC3Denum texTarget, WebGLTexture*, GC3Dint level);
void setAttachment(GC3Denum attachment, WebGLRenderbuffer*);
void removeAttachment(WebGLObject*);
WebGLObject* getAttachment(GC3Denum) const;
GC3Denum getColorBufferFormat() const;
GC3Dsizei getWidth() const;
GC3Dsizei getHeight() const;
bool onAccess(bool needToInitializeRenderbuffers);
bool isIncomplete(bool checkInternalFormat) const;
bool hasEverBeenBound() const { return object() && m_hasEverBeenBound; }
void setHasEverBeenBound() { m_hasEverBeenBound = true; }
protected:
WebGLFramebuffer(WebGLRenderingContext*);
virtual void deleteObjectImpl(Platform3DObject);
private:
virtual bool isFramebuffer() const { return true; }
bool initializeRenderbuffers();
bool isColorAttached() const { return (m_colorAttachment && m_colorAttachment->object()); }
bool isDepthAttached() const { return (m_depthAttachment && m_depthAttachment->object()); }
bool isStencilAttached() const { return (m_stencilAttachment && m_stencilAttachment->object()); }
bool isDepthStencilAttached() const { return (m_depthStencilAttachment && m_depthStencilAttachment->object()); }
RefPtr<WebGLObject> m_colorAttachment;
RefPtr<WebGLObject> m_depthAttachment;
RefPtr<WebGLObject> m_stencilAttachment;
RefPtr<WebGLObject> m_depthStencilAttachment;
bool m_hasEverBeenBound;
GC3Denum m_texTarget;
GC3Dint m_texLevel;
};
}
#endif // WebGLFramebuffer_h