Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
9.2.2023: Due to updates GitLab will be unavailable for some minutes between 9:00 and 11:00.
Open sidebar
CAMP
campvis-public
Commits
2a6bc7a6
Commit
2a6bc7a6
authored
Jan 05, 2017
by
Jakob Weiss
Browse files
Added missing .cpp file
parent
79819c19
Changes
1
Hide whitespace changes
Inline
Side-by-side
ext/cgt/gltextureformattraits.cpp
0 → 100644
View file @
2a6bc7a6
/**********************************************************************
* *
* cgt - CAMP Graphics Toolbox, Copyright (C) 2012-2015 *
* Chair for Computer Aided Medical Procedures *
* Technische Universitaet Muenchen, Germany. *
* <http://campar.in.tum.de/> *
* *
* forked from tgt - Tiny Graphics Toolbox, Copyright (C) 2006-2011 *
* Visualization and Computer Graphics Group, Department of *
* Computer Science, University of Muenster, Germany. *
* <http://viscg.uni-muenster.de> *
* *
* This file is part of the cgt library. This library is free *
* software; you can redistribute it and/or modify it under the terms *
* of the GNU Lesser General Public License version 2.1 as published *
* by the Free Software Foundation. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License in the file "LICENSE.txt" along with this library. *
* If not, see <http://www.gnu.org/licenses/>. *
* *
**********************************************************************/
#include
"gltextureformattraits.h"
namespace
cgt
{
//#define defFormat(INTERNAL_FORMAT, BPP, CHANNELS, PIXEL_FORMAT, PIXEL_DATA_TYPE, GLSL_FORMAT_QUALIFIER, GLSL_IMAGE_TYPE) \
//template <> \
//class GLTextureFormatTraits<INTERNAL_FORMAT> { \
// const std::string internalFormatName() { return #INTERNAL_FORMAT; }; \
// const int bpp() { return BPP; };\
// const int channels() { return CHANNELS; };\
// const GLint internalFormat() { return INTERNAL_FORMAT; };\
// const GLint pixelFormat() { return PIXEL_FORMAT; };\
// const GLint pixelDataType() { return PIXEL_DATA_TYPE; };\
// const std::string glslFormatQualifier() { return GLSL_FORMAT_QUALIFIER; };\
// const std::string glslImageType() { return GLSL_IMAGE_TYPE; };\
//};
#define defFormat(INTERNAL_FORMAT, BPP, CHANNELS, PIXEL_FORMAT, PIXEL_DATA_TYPE, GLSL_FORMAT_QUALIFIER) \
case INTERNAL_FORMAT: return GLTextureFormatTraits(INTERNAL_FORMAT, #INTERNAL_FORMAT, BPP, CHANNELS, PIXEL_FORMAT, PIXEL_DATA_TYPE, GLSL_FORMAT_QUALIFIER);
GLTextureFormatTraits
GLTextureFormatTraits
::
get
(
GLint
internalFormat
)
{
switch
(
internalFormat
)
{
defFormat
(
GL_DEPTH_COMPONENT
,
1
,
1
,
GL_DEPTH_COMPONENT
,
GL_FLOAT
,
"**UNKNOWN**"
);
defFormat
(
GL_R8
,
1
,
1
,
GL_RED
,
GL_UNSIGNED_BYTE
,
"r8"
);
defFormat
(
GL_R8_SNORM
,
1
,
1
,
GL_RED
,
GL_BYTE
,
"r8_snorm"
);
defFormat
(
GL_R8I
,
1
,
1
,
GL_RED_INTEGER
,
GL_BYTE
,
"r8i"
);
defFormat
(
GL_R8UI
,
1
,
1
,
GL_RED_INTEGER
,
GL_UNSIGNED_BYTE
,
"r8ui"
);
defFormat
(
GL_R3_G3_B2
,
1
,
3
,
GL_RGB
,
GL_FLOAT
,
"**UNKNOWN**"
);
defFormat
(
GL_RGBA2
,
1
,
4
,
GL_RGB
,
GL_UNSIGNED_BYTE
,
"**UNKNOWN**"
);
// , bpp, chn, pixel_format , pixel_data_type, "**UNKNOWN**");
defFormat
(
GL_DEPTH_COMPONENT16
,
2
,
1
,
GL_DEPTH_COMPONENT
,
GL_FLOAT
,
"**UNKNOWN**"
);
defFormat
(
GL_R16
,
2
,
1
,
GL_RED
,
GL_UNSIGNED_SHORT
,
"r16"
);
defFormat
(
GL_R16_SNORM
,
2
,
1
,
GL_RED
,
GL_SHORT
,
"r16_snorm"
);
defFormat
(
GL_R16F
,
2
,
1
,
GL_RED
,
GL_FLOAT
,
"r16f"
);
defFormat
(
GL_R16I
,
2
,
1
,
GL_RED_INTEGER
,
GL_SHORT
,
"r16i"
);
defFormat
(
GL_R16UI
,
2
,
1
,
GL_RED_INTEGER
,
GL_UNSIGNED_SHORT
,
"r16ui"
);
defFormat
(
GL_DEPTH_STENCIL
,
2
,
1
,
GL_RG
,
GL_FLOAT
,
"**UNKNOWN**"
);
defFormat
(
GL_RG8
,
2
,
2
,
GL_RG
,
GL_UNSIGNED_BYTE
,
"rg8"
);
defFormat
(
GL_RG8_SNORM
,
2
,
2
,
GL_RG
,
GL_BYTE
,
"rg8_snorm"
);
defFormat
(
GL_RG8I
,
2
,
2
,
GL_RG_INTEGER
,
GL_BYTE
,
"rg8i"
);
defFormat
(
GL_RG8UI
,
2
,
2
,
GL_RG_INTEGER
,
GL_UNSIGNED_BYTE
,
"rg8ui"
);
defFormat
(
GL_RGB4
,
2
,
3
,
GL_RGB
,
GL_UNSIGNED_BYTE
,
"**UNKNOWN**"
);
defFormat
(
GL_RGB5
,
2
,
3
,
GL_RGB
,
GL_FLOAT
,
"**UNKNOWN**"
);
defFormat
(
GL_RGBA4
,
2
,
4
,
GL_RGBA
,
GL_UNSIGNED_BYTE
,
"**UNKNOWN**"
);
defFormat
(
GL_RGB5_A1
,
2
,
4
,
GL_RGBA
,
GL_FLOAT
,
"**UNKNOWN**"
);
// , bpp, chn, pixel_format , pixel_data_type, "**UNKNOWN**");
defFormat
(
GL_DEPTH_COMPONENT24
,
3
,
1
,
GL_DEPTH_COMPONENT
,
GL_FLOAT
,
"**UNKNOWN**"
);
defFormat
(
GL_RGB8
,
3
,
3
,
GL_RGB
,
GL_UNSIGNED_BYTE
,
"**UNKNOWN**"
);
defFormat
(
GL_RGB8_SNORM
,
3
,
3
,
GL_RGB
,
GL_BYTE
,
"**UNKNOWN**"
);
defFormat
(
GL_SRGB8
,
3
,
3
,
GL_RGB
,
GL_UNSIGNED_BYTE
,
"**UNKNOWN**"
);
defFormat
(
GL_RGB8I
,
3
,
3
,
GL_RGB_INTEGER
,
GL_BYTE
,
"**UNKNOWN**"
);
defFormat
(
GL_RGB8UI
,
3
,
3
,
GL_RGB_INTEGER
,
GL_UNSIGNED_BYTE
,
"**UNKNOWN**"
);
// , bpp, chn, pixel_format , pixel_data_type, "**UNKNOWN**");
defFormat
(
GL_DEPTH_COMPONENT32
,
4
,
1
,
GL_DEPTH_COMPONENT
,
GL_FLOAT
,
"**UNKNOWN**"
);
defFormat
(
GL_DEPTH_COMPONENT32F
,
4
,
1
,
GL_DEPTH_COMPONENT
,
GL_FLOAT
,
"**UNKNOWN**"
);
defFormat
(
GL_R32F
,
4
,
1
,
GL_RED
,
GL_FLOAT
,
"r32f"
);
defFormat
(
GL_R32I
,
4
,
1
,
GL_RED_INTEGER
,
GL_INT
,
"r32i"
);
defFormat
(
GL_R32UI
,
4
,
1
,
GL_RED_INTEGER
,
GL_UNSIGNED_INT
,
"r32ui"
);
defFormat
(
GL_RG16
,
4
,
2
,
GL_RG
,
GL_UNSIGNED_SHORT
,
"rg16"
);
defFormat
(
GL_RG16_SNORM
,
4
,
2
,
GL_RG
,
GL_SHORT
,
"rg16_snorm"
);
defFormat
(
GL_RG16F
,
4
,
2
,
GL_RG
,
GL_FLOAT
,
"rg16f"
);
defFormat
(
GL_RG16I
,
4
,
2
,
GL_RG_INTEGER
,
GL_SHORT
,
"rg16i"
);
defFormat
(
GL_RG16UI
,
4
,
2
,
GL_RG_INTEGER
,
GL_UNSIGNED_SHORT
,
"rg16ui"
);
defFormat
(
GL_RGB10
,
4
,
3
,
GL_RGB
,
GL_FLOAT
,
"**UNKNOWN**"
);
defFormat
(
GL_R11F_G11F_B10F
,
4
,
3
,
GL_RGB
,
GL_FLOAT
,
"r11f_g11f_b10f"
);
defFormat
(
GL_RGB9_E5
,
4
,
3
,
GL_RGB
,
GL_FLOAT
,
"**UNKNOWN**"
);
defFormat
(
GL_RGBA8
,
4
,
4
,
GL_RGBA
,
GL_UNSIGNED_BYTE
,
"rgba8"
);
defFormat
(
GL_RGBA8_SNORM
,
4
,
4
,
GL_RGBA
,
GL_BYTE
,
"rgba8_snorm"
);
defFormat
(
GL_RGB10_A2
,
4
,
4
,
GL_RGBA
,
GL_FLOAT
,
"rgb10_a2"
);
defFormat
(
GL_RGB10_A2UI
,
4
,
4
,
GL_RGBA_INTEGER
,
GL_FLOAT
,
"rgb10_a2ui"
);
defFormat
(
GL_SRGB8_ALPHA8
,
4
,
4
,
GL_RGBA
,
GL_UNSIGNED_BYTE
,
"**UNKNOWN**"
);
defFormat
(
GL_RGBA8I
,
4
,
4
,
GL_RGBA_INTEGER
,
GL_BYTE
,
"rgba8i"
);
defFormat
(
GL_RGBA8UI
,
4
,
4
,
GL_RGBA_INTEGER
,
GL_UNSIGNED_BYTE
,
"rgba8ui"
);
// , bpp, chn, pixel_format , pixel_data_type, "**UNKNOWN**");
defFormat
(
GL_RGB12
,
5
,
3
,
GL_RGB
,
GL_FLOAT
,
"**UNKNOWN**"
);
// , bpp, chn, pixel_format , pixel_data_type, "**UNKNOWN**");
defFormat
(
GL_RGB16
,
6
,
3
,
GL_RGB
,
GL_UNSIGNED_SHORT
,
"glslfmptq"
);
defFormat
(
GL_RGB16_SNORM
,
6
,
3
,
GL_RGB
,
GL_SHORT
,
"**UNKNOWN**"
);
defFormat
(
GL_RGB16F
,
6
,
3
,
GL_RGB
,
GL_FLOAT
,
"**UNKNOWN**"
);
defFormat
(
GL_RGB16I
,
6
,
3
,
GL_RGB_INTEGER
,
GL_SHORT
,
"**UNKNOWN**"
);
defFormat
(
GL_RGB16UI
,
6
,
3
,
GL_RGB_INTEGER
,
GL_UNSIGNED_SHORT
,
"**UNKNOWN**"
);
defFormat
(
GL_RGBA12
,
6
,
4
,
GL_RGBA
,
GL_FLOAT
,
"**UNKNOWN**"
);
// , bpp, chn, pixel_format , pixel_data_type, "**UNKNOWN**");
defFormat
(
GL_RG32F
,
8
,
2
,
GL_RG
,
GL_FLOAT
,
"rg32f"
);
defFormat
(
GL_RG32I
,
8
,
2
,
GL_RG_INTEGER
,
GL_INT
,
"rg32i"
);
defFormat
(
GL_RG32UI
,
8
,
2
,
GL_RG_INTEGER
,
GL_UNSIGNED_INT
,
"rg32ui"
);
defFormat
(
GL_RGBA16
,
8
,
4
,
GL_RGBA
,
GL_FLOAT
,
"rgba16"
);
defFormat
(
GL_RGBA16_SNORM
,
8
,
4
,
GL_RGBA
,
GL_SHORT
,
"rgba16_snorm"
);
defFormat
(
GL_RGBA16F
,
8
,
4
,
GL_RGBA
,
GL_FLOAT
,
"rgba16f"
);
defFormat
(
GL_RGBA16I
,
8
,
4
,
GL_RGBA_INTEGER
,
GL_SHORT
,
"rgba16i"
);
defFormat
(
GL_RGBA16UI
,
8
,
4
,
GL_RGBA_INTEGER
,
GL_UNSIGNED_SHORT
,
"rgba16ui"
);
// , bpp, chn, pixel_format , pixel_data_type, "**UNKNOWN**");
defFormat
(
GL_RGB32F
,
12
,
3
,
GL_RGB
,
GL_FLOAT
,
"**UNKNOWN**"
);
defFormat
(
GL_RGB32I
,
12
,
3
,
GL_RGB_INTEGER
,
GL_INT
,
"**UNKNOWN**"
);
defFormat
(
GL_RGB32UI
,
12
,
3
,
GL_RGB_INTEGER
,
GL_UNSIGNED_INT
,
"**UNKNOWN**"
);
// , bpp, chn, pixel_format , pixel_data_type, "**UNKNOWN**");
defFormat
(
GL_RGBA32F
,
16
,
4
,
GL_RGBA
,
GL_FLOAT
,
"rgba32f"
);
defFormat
(
GL_RGBA32I
,
16
,
4
,
GL_RGBA_INTEGER
,
GL_INT
,
"rgba32i"
);
defFormat
(
GL_RGBA32UI
,
16
,
4
,
GL_RGBA_INTEGER
,
GL_UNSIGNED_INT
,
"rgba32ui"
);
default:
// for unknown/invalid texture format specifiers
// Log a warning here??
return
GLTextureFormatTraits
(
internalFormat
);
}
}
};
// namspace cgt
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment