GLIP-Lib
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
HdlTextureTools.hpp
Go to the documentation of this file.
1 /* ************************************************************************************************************* */
2 /* */
3 /* GLIP-LIB */
4 /* OpenGL Image Processing LIBrary */
5 /* */
6 /* Author : R. Kerviche */
7 /* LICENSE : MIT License */
8 /* Website : glip-lib.net */
9 /* */
10 /* File : HdlTextureTools.hpp */
11 /* Original Date : August 18th 2012 */
12 /* */
13 /* Description : OpenGL Texture Handle and descriptors */
14 /* */
15 /* ************************************************************************************************************* */
16 
24 #ifndef __HDLTEXTURETOOLS_INCLUDE__
25 #define __HDLTEXTURETOOLS_INCLUDE__
26 
27  #include <vector>
28  #include "Core/LibTools.hpp"
29  #include "Core/OglInclude.hpp"
30 
31  namespace Glip
32  {
33  namespace CoreGL
34  {
40  {
41  #define HdlTextureFormatDescriptor_MaxNumChannels (4)
42  static const int maxNumChannels;
43  static const int maxPixelSizeInBits;
44  static const int maxPixelSize;
45 
47  const GLenum mode,
49  aliasMode,
53  compressedMode;
55  const int numChannels;
57  const GLenum channels[HdlTextureFormatDescriptor_MaxNumChannels];
59  const int channelsSizeInBits[HdlTextureFormatDescriptor_MaxNumChannels];
61  const GLenum channelsDepth[HdlTextureFormatDescriptor_MaxNumChannels];
63  const bool isFloatingPoint,
65  isCompressed,
68 
69  bool isDepthValid(GLenum depth) const;
70  bool hasChannel(GLenum channel) const;
71  int getChannelIndex(GLenum channel) const;
72  int getChannelOffsetInBits(int channelIndex, GLenum depth) const;
73  int getChannelOffset(int channelIndex, GLenum depth) const;
74  int getChannelSizeInBits(int channelIndex, GLenum depth) const;
75  int getChannelSize(int channelIndex, GLenum depth) const;
76  int getPixelSizeInBits(GLenum depth) const;
77  int getPixelSize(GLenum depth) const;
78 
79  static int getTypeSizeInBits(GLenum depth);
80  static int getTypeSize(GLenum depth);
81  static void getShuffle(const HdlTextureFormatDescriptor& dst, const HdlTextureFormatDescriptor& src, char* shuffleIndex, const int length);
82  static int getBitShuffle(const HdlTextureFormatDescriptor& dst, const GLenum& dstDepth, const HdlTextureFormatDescriptor& src, const GLenum& srcDepth, char* shuffleBitIndex, const int length, bool* isBlack=NULL);
83  static void applyBitShuffle(char* dst, const char* src, const char* shuffleBitIndex, const int length);
84  };
85 
91  {
92  private :
93  static const HdlTextureFormatDescriptor textureFormatDescriptors[];
94 
96  public :
97  static int getNumDescriptors(void);
98  static const HdlTextureFormatDescriptor& get(int id);
99  static const HdlTextureFormatDescriptor& get(const GLenum& modeID);
100  };
101  }
102  }
103 
104 #endif
Specific defines for the API structure.
Object handle describing an OpenGL Texture mode.
Definition: HdlTextureTools.hpp:39
Definition: Component.hpp:32
const int numChannels
Number of channels.
Definition: HdlTextureTools.hpp:55
const GLenum uncompressedMode
Name of the corresponding uncompressed mode (the same as mode if not a compressed format)...
Definition: HdlTextureTools.hpp:47
Singleton handling the static list of all available HdlTextureFormatDescriptor objects.
Definition: HdlTextureTools.hpp:90
const bool isSupported
If the format is supported.
Definition: HdlTextureTools.hpp:63
OpenGL includes and tools.