Framebuffer.h 2.29 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//
// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//

// Framebuffer.h: Defines the gl::Framebuffer class. Implements GL framebuffer
// objects and related functionality. [OpenGL ES 2.0.24] section 4.4 page 105.

#ifndef LIBGLESV2_FRAMEBUFFER_H_
#define LIBGLESV2_FRAMEBUFFER_H_

#define GL_APICALL
#include <GLES2/gl2.h>
#include <d3d9.h>

#include "common/angleutils.h"
18
#include "libGLESv2/RefCountObject.h"
19
20
21

namespace gl
{
22
class Renderbuffer;
23
24
25
class Colorbuffer;
class Depthbuffer;
class Stencilbuffer;
26
class DepthStencilbuffer;
27
28
29
30
31
32

class Framebuffer
{
  public:
    Framebuffer();

33
    virtual ~Framebuffer();
34
35
36
37
38
39
40
41
42
43
44
45
46

    void setColorbuffer(GLenum type, GLuint colorbuffer);
    void setDepthbuffer(GLenum type, GLuint depthbuffer);
    void setStencilbuffer(GLenum type, GLuint stencilbuffer);

    void detachTexture(GLuint texture);
    void detachRenderbuffer(GLuint renderbuffer);

    IDirect3DSurface9 *getRenderTarget();
    IDirect3DSurface9 *getDepthStencil();

    unsigned int getRenderTargetSerial();
    unsigned int getDepthbufferSerial();
47
    unsigned int getStencilbufferSerial();
48
49

    Colorbuffer *getColorbuffer();
50
51
    DepthStencilbuffer *getDepthbuffer();
    DepthStencilbuffer *getStencilbuffer();
52
53
54
55
56
57
58
59
60

    GLenum getColorbufferType();
    GLenum getDepthbufferType();
    GLenum getStencilbufferType();

    GLuint getColorbufferHandle();
    GLuint getDepthbufferHandle();
    GLuint getStencilbufferHandle();

61
62
63
    bool hasStencil();
    bool isMultisample();
    int getSamples();
64

65
    virtual GLenum completeness();
66

67
  protected:
68
    GLenum mColorbufferType;
69
    BindingPointer<Renderbuffer> mColorbufferPointer;
70
71

    GLenum mDepthbufferType;
72
    BindingPointer<Renderbuffer> mDepthbufferPointer;
73
74

    GLenum mStencilbufferType;
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
    BindingPointer<Renderbuffer> mStencilbufferPointer;

  private:
    DISALLOW_COPY_AND_ASSIGN(Framebuffer);

    Renderbuffer *lookupRenderbuffer(GLenum type, GLuint handle) const;
};

class DefaultFramebuffer : public Framebuffer
{
  public:
    DefaultFramebuffer(Colorbuffer *color, DepthStencilbuffer *depthStencil);

    virtual GLenum completeness();

  private:
    DISALLOW_COPY_AND_ASSIGN(DefaultFramebuffer);
92
};
93

94
95
96
}

#endif   // LIBGLESV2_FRAMEBUFFER_H_