This repository has been archived by the owner on Sep 24, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
BayerRendererCPU.hpp
executable file
·134 lines (110 loc) · 2.05 KB
/
BayerRendererCPU.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/**
* @file BayerRendererCPU.hpp
* @author Max Smolens
* @brief Bayer pattern image renderer using CPU.
*/
#ifndef BAYER_RENDERER_CPU_HPP
#define BAYER_RENDERER_CPU_HPP
#include <GL/glew.h>
/**
* Bayer pattern image renderer using CPU. Renders a Bayer pattern
* image in memory to an OpenGL texture.
*/
class BayerRendererCPU {
public:
/**
* Constructor.
*/
BayerRendererCPU ();
/**
* Destructor.
*/
~BayerRendererCPU ();
/**
* Initializes the renderer.
*
* @return true on success, false otherwise.
*/
bool Initialize ();
/**
* Initializes the renderer.
*
* @param width the image width.
* @param height the image height.
*
* @return true on success, false otherwise.
*/
bool Initialize (int width,
int height);
/**
* Updates Bayer texture from image data in memory and renders to texture.
*/
void SetBayer (const GLubyte *) const;
/**
* Binds the texture to the active texture unit.
*/
void Bind () const;
/**
* Enables the texture target.
*/
void EnableTextureTarget () const;
/**
* Disables the texture target.
*/
void DisableTextureTarget () const;
/**
* Gets the image width.
*
* @return the image width.
*/
int GetWidth () const;
/**
* Gets the image height.
*
* @return the image height.
*/
int GetHeight () const;
/**
* Sets the image width.
*
* @param width the image width.
*/
void SetWidth (int width);
/**
* Sets the image height.
*
* @param height the image height.
*/
void SetHeight (int height);
private:
/// Image width.
int width;
/// Image height.
int height;
/// Texture id.
GLuint tex;
/// RGB image.
GLubyte *rgb;
private:
/**
* Sets texture parameters for all textures.
*/
void InitializeTextures ();
};
inline int
BayerRendererCPU::GetWidth () const {
return width;
}
inline int
BayerRendererCPU::GetHeight () const {
return height;
}
inline void
BayerRendererCPU::SetWidth (int w) {
width = w;
}
inline void
BayerRendererCPU::SetHeight (int h) {
height = h;
}
#endif // BAYER_RENDERER_CPU_HPP