snark
Texture.h
1 // This file is part of snark, a generic and flexible library
2 // for robotics research.
3 //
4 // Copyright (C) 2011 The University of Sydney
5 //
6 // snark is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 3 of the License, or (at your option) any later version.
10 //
11 // snark is distributed in the hope that it will be useful, but WITHOUT ANY
12 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
14 // for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with snark. If not, see <http://www.gnu.org/licenses/>.
18 
20 
21 #ifndef SNARK_GRAPHICS_APPLICATIONS_VIEWPOINTS_TEXTURE_H_
22 #define SNARK_GRAPHICS_APPLICATIONS_VIEWPOINTS_TEXTURE_H_
23 
24 #include <Qt3D/qgltexture2d.h>
25 #include <Qt3D/qglscenenode.h>
26 #include <Qt3D/qglbuilder.h>
27 #include <Qt3D/qglabstractscene.h>
28 #include <Qt3D/qglpainter.h>
29 
30 namespace snark { namespace graphics { namespace View {
31 
32 class Quad
33 {
34 public:
35  Quad( const QImage& image );
36  QGLSceneNode* node() const;
37 
38 private:
39  QGLBuilder m_builder;
40  QGeometryData m_geometry;
41  QGLTexture2D m_texture;
42  QGLMaterial m_material;
43  QGLSceneNode* m_sceneNode;
44 };
45 
46 class Texture
47 {
48 public:
49  Texture( const QString& string, const QColor4ub& color );
50 
51  void draw( QGLPainter* painter );
52 
53 private:
54  QImage m_image;
55 
56 };
57 
58 
59 } } } // namespace snark { namespace graphics
60 
61 #endif /*SNARK_GRAPHICS_APPLICATIONS_VIEWPOINTS_TEXTURE_H_*/