Fawkes API Fawkes Development Version
texture_drawer.h
1
2/***************************************************************************
3 * texture_drawer.h - Skeleton Visualization GUI: texture drawer
4 *
5 * Created: Tue Mar 29 17:06:46 2011 (on the way to Magdeburg for GO2011)
6 * Copyright 2006-2011 Tim Niemueller [www.niemueller.de]
7 *
8 ****************************************************************************/
9
10/* This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Library General Public License for more details.
19 *
20 * Read the full text in the LICENSE.GPL file in the doc directory.
21 */
22
23#ifndef _PLUGINS_OPENNI_SKELGUI_TEXTURE_DRAWER_H_
24#define _PLUGINS_OPENNI_SKELGUI_TEXTURE_DRAWER_H_
25
26#include <utils/misc/autofree.h>
27
28namespace firevision {
29class Camera;
30}
31
33{
34public:
35 SkelGuiTextureDrawer(unsigned int width, unsigned int height);
36 virtual ~SkelGuiTextureDrawer();
37
38 virtual void fill_texture() = 0;
39
40 void draw();
41
42protected:
43 void copy_rgb_to_texture(const unsigned char *rgb_buf);
44
45private:
46 unsigned int get_closest_power_of_two(unsigned int n);
47 void init_texture();
48 void draw_texture();
49 void draw_rectangle(float topLeftX, float topLeftY, float bottomRightX, float bottomRightY);
50
51protected:
52 const unsigned int width_; /**< Width of visible area from texture */
53 const unsigned int height_; /**< Height of visible area from texture */
54
55 const unsigned int texture_width_; /**< Real texture width */
56 const unsigned int texture_height_; /**< Real texture height */
57
58 unsigned char *texture_; /**< Texture buffer. */
59
60private:
61 fawkes::MemAutoFree texture_raii_;
62 bool texture_initialized_;
63 unsigned int texture_id_;
64 float texture_coords_[8];
65};
66
67#endif
Draw images from camera in texture.
unsigned char * texture_
Texture buffer.
SkelGuiTextureDrawer(unsigned int width, unsigned int height)
Constructor.
const unsigned int height_
Height of visible area from texture.
virtual ~SkelGuiTextureDrawer()
Destructor.
virtual void fill_texture()=0
Fill texture with data.
const unsigned int width_
Width of visible area from texture.
void copy_rgb_to_texture(const unsigned char *rgb_buf)
Copy an RGB buffer to texture.
const unsigned int texture_width_
Real texture width.
const unsigned int texture_height_
Real texture height.
void draw()
Draw texture to screen.
Automatically free memory on destruction.
Definition: autofree.h:30