GL Studio API
ddsfile.h
Go to the documentation of this file.
1 /*! \file
2  \brief DDS file loading functions
3 
4  \par Copyright Information
5 
6  Copyright (c) 2015 by The DiSTI Corporation.<br>
7  11301 Corporate Blvd; Suite 100<br>
8  Orlando, Florida 32817<br>
9  USA<br>
10  <br>
11  All rights reserved.<br>
12 
13  This Software contains proprietary trade secrets of DiSTI and may not be
14 reproduced, in whole or part, in any form, or by any means of electronic,
15 mechanical, or otherwise, without the written permission of DiSTI. Said
16 permission may be derived through the purchase of applicable DiSTI product
17 licenses which detail the distribution rights of this content and any
18 Derivative Works based on this or other copyrighted DiSTI Software.
19 
20  NO WARRANTY. THE SOFTWARE IS PROVIDED "AS-IS," WITHOUT WARRANTY OF ANY KIND,
21 AND ANY USE OF THIS SOFTWARE PRODUCT IS AT YOUR OWN RISK. TO THE MAXIMUM EXTENT
22 PERMITTED BY APPLICABLE LAW, DISTI AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES
23 AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
24 IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY AND/OR FITNESS FOR A
25 PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT, WITH REGARD TO THE SOFTWARE.
26 
27  LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW,
28 IN NO EVENT SHALL DISTI OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
29 INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION,
30 DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS
31 INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
32 INABILITY TO USE THE SOFTWARE, EVEN IF DISTI HAS BEEN ADVISED OF THE POSSIBILITY
33 OF SUCH DAMAGES. DISTI'S ENTIRE LIABILITY AND YOUR EXCLUSIVE REMEDY SHALL NOT
34 EXCEED FIVE DOLLARS (US$5.00).
35 
36  The aforementioned terms and restrictions are governed by the laws of the
37 State of Florida and the United States of America. Use, distribution,
38 duplication, or disclosure by the U. S. Government is subject to
39 "Restricted Rights" as set forth in DFARS 252.227-7014(c)(1)(ii).
40 
41 */
42 #ifndef INCLUDED_DISTI_DDSFILE_H
43 #define INCLUDED_DISTI_DDSFILE_H
44 
45 #include "gls_gl.h"
46 
47 #if defined(WIN32) && _MSC_VER > 1600 // Greater than VS 2010
48 // GLS-3204: Remove this #define
49 #define BOOST_HAS_TR1_SHARED_PTR
50 #endif
51 #include <boost/tr1/memory.hpp>
52 #include <vector>
53 
54 #ifndef GL_COMPRESSED_RED_RGTC1
55 #define GL_COMPRESSED_RED_RGTC1 0x8DBB
56 #define GL_COMPRESSED_SIGNED_RED_RGTC1 0x8DBC
57 #define GL_COMPRESSED_RG_RGTC2 0x8DBD
58 #define GL_COMPRESSED_SIGNED_RG_RGTC2 0x8DBE
59 #endif
60 
61 #ifndef GL_COMPRESSED_LUMINANCE_LATC1_EXT
62 #define GL_COMPRESSED_LUMINANCE_LATC1_EXT 0x8C70
63 #define GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT 0x8C71
64 #define GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT 0x8C72
65 #define GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT 0x8C73
66 #endif
67 
68 namespace disti
69 {
70 
72 {
73  GLsizei _width;
74  GLsizei _height;
75  GLenum _pixelFormat;
76  GLenum _pixelType;
77  GLenum _internalFormat;
78  GLuint _textureID;
79  GLuint _numMipmaps;
80 
81  // Under protest: this shouldn't be a vector, but should instead be either a unique_ptr or
82  // boost::scoped_array. However, the former is only available in C++11 (can't use in VC8), and
83  // the latter is declared off-limits (avoid boost unless it's tr1).
84  std::vector<GLubyte> _texels;
85 
86  DDSTextureInfo() : _width(0),
87  _height(0),
88  _pixelFormat(0),
89  _pixelType(0),
90  _internalFormat(0),
91  _textureID(0),
92  _numMipmaps(0),
93  _texels()
94  {
95  }
96 };
97 
98 void DDSInitExtensions();
99 
100 std::tr1::shared_ptr<DDSTextureInfo> ReadDDSFile(const char *filename, bool loadTexels);
101 
102 GLuint BindDDSTexture(DDSTextureInfo *texInfo, unsigned int skipLevels=0);
103 
104 } // namespace disti
105 
106 #endif // INCLUDED_DISTI_DDSFILE_H
Definition: ddsfile.h:71
Definition: bmpimage.h:46
The gls_gl.