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 namespace firevision {
27  class Camera;
28 }
29 
31 {
32  public:
33  SkelGuiTextureDrawer(unsigned int width, unsigned int height);
34  virtual ~SkelGuiTextureDrawer();
35 
36  virtual void fill_texture() = 0;
37 
38  void draw();
39 
40  protected:
41  void copy_rgb_to_texture(const unsigned char *rgb_buf);
42 
43  private:
44  unsigned int get_closest_power_of_two(unsigned int n);
45  void init_texture();
46  void draw_texture();
47  void draw_rectangle(float topLeftX, float topLeftY,
48  float bottomRightX, float bottomRightY);
49 
50  protected:
51  unsigned char *__texture; /**< Texture buffer. */
52 
53  const unsigned int __width; /**< Width of visible area from texture */
54  const unsigned int __height; /**< Height of visible area from texture */
55 
56  const unsigned int __texture_width; /**< Real texture width */
57  const unsigned int __texture_height; /**< Real texture height */
58 
59  private:
60  bool __texture_initialized;
61  unsigned int __texture_id;
62  float __texture_coords[8];
63 
64 };
65 
66 #endif
const unsigned int __texture_width
Real texture width.
const unsigned int __width
Width of visible area from texture.
unsigned char * __texture
Texture buffer.
Draw images from camera in texture.
const unsigned int __texture_height
Real texture height.
const unsigned int __height
Height of visible area from texture.