~ubuntu-branches/ubuntu/trusty/3depict/trusty-proposed

« back to all changes in this revision

Viewing changes to src/gl/textures.h

  • Committer: Package Import Robot
  • Author(s): D Haley
  • Date: 2013-07-20 18:31:32 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20130720183132-5ak932y2x6pwo4fs
Tags: 0.0.14-1
* Update to upstream, 0.0.14
* Enable mathgl2.x configure option
* Modify build-depends, libmgl-dev >= 2.1.32

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
#include <GL/glu.h>
31
31
#endif
32
32
 
 
33
#include <vector>
 
34
#include <string>
33
35
 
34
36
 
35
37
//Named Textures
51
53
};
52
54
 
53
55
//Paths to named textures
54
 
extern const char *TEST_OVERLAY_PNG[]; 
 
56
extern const char *TEXTURE_OVERLAY_PNG[]; 
55
57
 
56
58
typedef struct {
57
 
GLuint name; /* OpenGL name assigned by the thingy */
 
59
GLuint glID; /* OpenGL name assigned by by glGenTexture*/
58
60
GLuint width;
59
61
GLuint height;
 
62
GLuint depth;
60
63
unsigned char *data;
61
64
} texture;
62
65
 
63
66
class TexturePool
64
67
{
65
68
private:
66
 
                UniqueIDHandler texUniqIds;
 
69
                //Filename of textures, or "" if using a generated texture, bound to the texture data
67
70
                std::vector<std::pair<std::string,texture> > openTextures;
68
71
 
69
72
        public:
72
75
                //Open the texture specified by the following file, and
73
76
                //then return the texture ID; or just return the texture 
74
77
                //if already loaded. Return true on success.
75
 
                bool openTexture(const char *texName,unsigned int &texID, unsigned int &uniqID);
76
 
 
77
 
                //Close the specified texture, using its unique ID
 
78
                bool openTexture(const char *texName,unsigned int &texID);
 
79
                //Open a set of identically sized images  into a 3D texture object
 
80
                bool openTexture3D(const std::vector<std::string> &texName,unsigned int &texID);
 
81
 
 
82
                void genTexID(unsigned int &textureID, size_t texType=GL_TEXTURE_2D)  ;
 
83
 
 
84
                //Close the specified texture, using its texture ID 
78
85
                void closeTexture(unsigned int texID);
79
86
 
80
87
                //Close all textures
84
91
 
85
92
//!Type can be GL_TEXTURE_1D or GL_TEXTURE_2D
86
93
int pngTexture(texture* dest, const char* filename, GLenum type);
 
94
 
 
95
//Read a stack of equi-sized PNG images into a 3D opengl texture
 
96
int pngTexture3D(texture*, const std::vector<std::string> &filenames);
 
97
//read a single PNG image as an opengl texture
87
98
int pngTexture2D(texture*, const char*);
88
99
int pngTexture1D(texture*, const char*);
89
100