]> git.sesse.net Git - casparcg/blob - accelerator/ogl/util/texture.h
78fd008c4623474115a70b92faa1b6a9b5ebdae5
[casparcg] / accelerator / ogl / util / texture.h
1 /*\r
2 * Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>\r
3 *\r
4 * This file is part of CasparCG (www.casparcg.com).\r
5 *\r
6 * CasparCG is free software: you can redistribute it and/or modify\r
7 * it under the terms of the GNU General Public License as published by\r
8 * the Free Software Foundation, either version 3 of the License, or\r
9 * (at your option) any later version.\r
10 *\r
11 * CasparCG is distributed in the hope that it will be useful,\r
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
14 * GNU General Public License for more details.\r
15 *\r
16 * You should have received a copy of the GNU General Public License\r
17 * along with CasparCG. If not, see <http://www.gnu.org/licenses/>.\r
18 *\r
19 * Author: Robert Nagy, ronag89@gmail.com\r
20 */\r
21 \r
22 #pragma once\r
23 \r
24 #include <common/memory.h>\r
25 \r
26 #include <cstddef>\r
27 \r
28 namespace caspar { namespace accelerator { namespace ogl {\r
29                 \r
30 class buffer;\r
31 class device;\r
32 \r
33 class texture sealed\r
34 {\r
35         texture(const texture&);\r
36         texture& operator=(const texture&);\r
37 public: \r
38 \r
39         // Static Members\r
40 \r
41         // Constructors\r
42 \r
43         texture(int width, int height, int stride);\r
44         texture(texture&& other);\r
45         ~texture();\r
46         \r
47         // Methods\r
48 \r
49         texture& operator=(texture&& other);\r
50                 \r
51         void copy_from(buffer& source);\r
52         void copy_to(buffer& dest);\r
53                         \r
54         void attach();\r
55         void clear();\r
56         void bind(int index);\r
57         void unbind();\r
58 \r
59         // Properties\r
60 \r
61         int width() const;\r
62         int height() const;\r
63         int stride() const;     \r
64         std::size_t size() const;\r
65 \r
66         int id() const;\r
67 \r
68 private:\r
69         struct impl;\r
70         spl::unique_ptr<impl> impl_;\r
71 };\r
72         \r
73 }}}