Gnash  0.8.11dev
GnashTexture.h
Go to the documentation of this file.
1 // GnashTexture.h: GnashImage class used for OpenGL rendering
2 //
3 // Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012
4 // Free Software Foundation, Inc.
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 //
20 
21 #ifndef GNASH_GNASHTEXTURE_H
22 #define GNASH_GNASHTEXTURE_H
23 
24 #include "GnashImage.h"
25 
26 namespace gnash {
27 
29 enum {
31 };
32 
35  unsigned int _internal_format;
36  unsigned int _format;
37 
38 public:
40 
42  unsigned int internal_format() const
43  { return _internal_format; }
44 
46  unsigned int format() const
47  { return _format; }
48 };
49 
52  unsigned int _width;
53  unsigned int _height;
54  unsigned int _texture;
55  GnashTextureFormat _format;
56 
58  struct TextureState {
59  unsigned int old_texture;
60  unsigned int was_enabled : 1;
61  unsigned int was_bound : 1;
62  } _texture_state;
63 
64 protected:
65  unsigned int _flags;
66 
67 private:
68  bool init();
69 
70 public:
71  GnashTexture(unsigned int width, unsigned int height,
73  virtual ~GnashTexture();
74 
76  unsigned int flags() const
77  { return _flags; }
78 
80  unsigned int width() const
81  { return _width; }
82 
84  unsigned int height() const
85  { return _height; }
86 
88  unsigned int texture() const
89  { return _texture; }
90 
92  unsigned int internal_format() const
93  { return _format.internal_format(); }
94 
96  unsigned int format() const
97  { return _format.format(); }
98 
100  bool bind();
101 
103  void release();
104 
106  //
112  void update(const std::uint8_t *data);
113 };
114 
115 } // gnash namespace
116 
117 #endif /* GNASH_GNASHTEXTURE_H */
unsigned int format() const
Return GL format.
Definition: GnashTexture.h:46
unsigned int flags() const
Return texture flags.
Definition: GnashTexture.h:76
Definition: GnashTexture.h:30
unsigned int internal_format() const
Return GL internal format.
Definition: GnashTexture.h:92
SimpleBuffer data
Definition: LocalConnection_as.cpp:151
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:40
type
Definition: GnashKey.h:329
Definition: klash_part.cpp:329
unsigned int height() const
Return texture height.
Definition: GnashTexture.h:84
unsigned int format() const
Return GL format.
Definition: GnashTexture.h:96
Definition: klash_part.cpp:329
ImageType
The types of images handled in Gnash.
Definition: GnashImage.h:46
#define DSOEXPORT
Definition: dsodefs.h:55
OpenGL texture abstraction.
Definition: GnashTexture.h:51
unsigned int width() const
Return texture width.
Definition: GnashTexture.h:80
OpenGL texture format.
Definition: GnashTexture.h:34
unsigned int internal_format() const
Return GL internal format.
Definition: GnashTexture.h:42
unsigned int _flags
Definition: GnashTexture.h:65
unsigned int texture() const
Return GL texture.
Definition: GnashTexture.h:88