blob: 8a702fcf726e1418304bdef102c5f31c823da73a [file] [log] [blame]
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +00001//
2// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
3// Use of this source code is governed by a BSD-style license that can be
4// found in the LICENSE file.
5//
6
7// Renderbuffer.h: Defines the virtual gl::Renderbuffer class and its derived
8// classes Colorbuffer, Depthbuffer and Stencilbuffer. Implements GL renderbuffer
9// objects and related functionality. [OpenGL ES 2.0.24] section 4.4.3 page 108.
10
11#ifndef LIBGLESV2_RENDERBUFFER_H_
12#define LIBGLESV2_RENDERBUFFER_H_
13
14#define GL_APICALL
15#include <GLES2/gl2.h>
16#include <d3d9.h>
17
18#include "angleutils.h"
19
20namespace gl
21{
22class Renderbuffer
23{
24 public:
25 Renderbuffer();
26
27 virtual ~Renderbuffer();
28
29 virtual bool isColorbuffer();
30 virtual bool isDepthbuffer();
31 virtual bool isStencilbuffer();
32
33 virtual IDirect3DSurface9 *getRenderTarget();
34 virtual IDirect3DSurface9 *getDepthStencil();
35
36 int getWidth();
37 int getHeight();
38
39 protected:
40 int mWidth;
41 int mHeight;
42
43 private:
44 DISALLOW_COPY_AND_ASSIGN(Renderbuffer);
45};
46
47class Colorbuffer : public Renderbuffer
48{
49 public:
50 Colorbuffer(IDirect3DSurface9 *renderTarget);
51
52 ~Colorbuffer();
53
54 bool isColorbuffer();
55
56 GLuint getRedSize();
57 GLuint getGreenSize();
58 GLuint getBlueSize();
59 GLuint getAlphaSize();
60
61 IDirect3DSurface9 *getRenderTarget();
62
63 protected:
64 IDirect3DSurface9 *mRenderTarget;
65
66 private:
67 DISALLOW_COPY_AND_ASSIGN(Colorbuffer);
68};
69
70class Depthbuffer : public Renderbuffer
71{
72 public:
73 Depthbuffer(IDirect3DSurface9 *depthStencil);
74 Depthbuffer(int width, int height);
75
76 ~Depthbuffer();
77
78 bool isDepthbuffer();
79
80 GLuint getDepthSize();
81
82 IDirect3DSurface9 *getDepthStencil();
83
84 private:
85 DISALLOW_COPY_AND_ASSIGN(Depthbuffer);
86 IDirect3DSurface9 *mDepthStencil;
87};
88
89class Stencilbuffer : public Renderbuffer
90{
91 public:
92 Stencilbuffer(IDirect3DSurface9 *depthStencil);
daniel@transgaming.com4a9d65c2010-03-08 21:30:56 +000093 Stencilbuffer(int width, int height);
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +000094
95 ~Stencilbuffer();
96
97 bool isStencilbuffer();
98
99 GLuint getStencilSize();
100
101 IDirect3DSurface9 *getDepthStencil();
102
103 private:
104 DISALLOW_COPY_AND_ASSIGN(Stencilbuffer);
105 IDirect3DSurface9 *mDepthStencil;
106};
107}
108
109#endif // LIBGLESV2_RENDERBUFFER_H_