Fawkes API
Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * texture_drawer.h - Skeleton Visualization GUI: texture drawer 00004 * 00005 * Created: Tue Mar 29 17:06:46 2011 (on the way to Magdeburg for GO2011) 00006 * Copyright 2006-2011 Tim Niemueller [www.niemueller.de] 00007 * 00008 ****************************************************************************/ 00009 00010 /* This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU Library General Public License for more details. 00019 * 00020 * Read the full text in the LICENSE.GPL file in the doc directory. 00021 */ 00022 00023 #ifndef __PLUGINS_OPENNI_SKELGUI_TEXTURE_DRAWER_H_ 00024 #define __PLUGINS_OPENNI_SKELGUI_TEXTURE_DRAWER_H_ 00025 00026 namespace firevision { 00027 class Camera; 00028 } 00029 00030 class SkelGuiTextureDrawer 00031 { 00032 public: 00033 SkelGuiTextureDrawer(unsigned int width, unsigned int height); 00034 virtual ~SkelGuiTextureDrawer(); 00035 00036 virtual void fill_texture() = 0; 00037 00038 void draw(); 00039 00040 protected: 00041 void copy_rgb_to_texture(const unsigned char *rgb_buf); 00042 00043 private: 00044 unsigned int get_closest_power_of_two(unsigned int n); 00045 void init_texture(); 00046 void draw_texture(); 00047 void draw_rectangle(float topLeftX, float topLeftY, 00048 float bottomRightX, float bottomRightY); 00049 00050 protected: 00051 unsigned char *__texture; /**< Texture buffer. */ 00052 00053 const unsigned int __width; /**< Width of visible area from texture */ 00054 const unsigned int __height; /**< Height of visible area from texture */ 00055 00056 const unsigned int __texture_width; /**< Real texture width */ 00057 const unsigned int __texture_height; /**< Real texture height */ 00058 00059 private: 00060 bool __texture_initialized; 00061 unsigned int __texture_id; 00062 float __texture_coords[8]; 00063 00064 }; 00065 00066 #endif