CSD462 Library Documentation  1.0
15-462/15-662: Computer Graphics (Fall 2015)
viewport.h
1 #ifndef CSD462_VIEWPORT_H
2 #define CSD462_VIEWPORT_H
3 
4 #include "glew.h"
5 
6 namespace CSD462 {
7 
14 class Viewport {
15  public:
16 
20  Viewport( void );
21 
25  ~Viewport( void );
26 
35  int bind( char *buffer, size_t w, size_t h );
36 
40  void update( void );
41 
42 private:
43 
44  size_t w, h;
45 
46  void *pixels;
47 
48  GLuint vertex_buffer;
49  GLuint uv_buffer;
50 
51  GLuint texture;
52  GLuint textureID;
53 
54  GLuint program;
55 
56  GLuint compile_shaders( void );
57 
58  GLuint make_buffer( GLenum target,
59  GLsizei buffer_size,
60  const void *buffer_data );
61 
62  GLuint make_texture_rgb( void* pixel_buffer,
63  unsigned int width,
64  unsigned int height );
65 
66  GLuint make_texture_rgba( void* pixel_buffer,
67  unsigned int width,
68  unsigned int height );
69 
70  void update_texture_rgb( GLuint textureID,
71  void* pixel_buffer,
72  unsigned int width,
73  unsigned int height );
74 
75  void update_texture_rgba( GLuint textureID,
76  void* pixel_buffer,
77  unsigned int width,
78  unsigned int height );
79 };
80 
81 }; // namespace CSD462
82 
83 #endif // CSD462_VIEWPORT_H
Viewport(void)
Constructor.
Definition: viewport.cpp:8
void update(void)
Update the viewport.
Definition: viewport.cpp:69
Draws buffered image data as texture.
Definition: viewport.h:14
~Viewport(void)
Destructor.
Definition: viewport.cpp:48
int bind(char *buffer, size_t w, size_t h)
Bind the viewport to a bitmap buffer.
Definition: viewport.cpp:58
Definition: color.cpp:10