MCPcopy Create free account
hub / github.com/Kitware/VTK / GetDefaultTextureInternalFormat

Method GetDefaultTextureInternalFormat

Rendering/OpenGL2/vtkOpenGLState.cxx:2045–2095  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2043}
2044
2045int vtkOpenGLState::GetDefaultTextureInternalFormat(
2046 int vtktype, int numComponents, bool needInt, bool needFloat, bool needSRGB)
2047{
2048 // 0 = none
2049 // 1 = float
2050 // 2 = int
2051 int dtypeCount = sizeof(this->TextureInternalFormats) / sizeof(this->TextureInternalFormats[0]);
2052 if (vtktype >= dtypeCount)
2053 {
2054 return 0;
2055 }
2056 if (needInt)
2057 {
2058 return this->TextureInternalFormats[vtktype][2][numComponents];
2059 }
2060 if (needFloat)
2061 {
2062 return this->TextureInternalFormats[vtktype][1][numComponents];
2063 }
2064 int result = this->TextureInternalFormats[vtktype][0][numComponents];
2065 if (needSRGB)
2066 {
2067 switch (result)
2068 {
2069#ifdef GL_ES_VERSION_3_0
2070 case GL_RGB:
2071 result = GL_SRGB8;
2072 break;
2073 case GL_RGBA:
2074 result = GL_SRGB8_ALPHA8;
2075 break;
2076#else
2077 case GL_RGB:
2078 result = GL_SRGB;
2079 break;
2080 case GL_RGBA:
2081 result = GL_SRGB_ALPHA;
2082 break;
2083#endif
2084 case GL_RGB8:
2085 result = GL_SRGB8;
2086 break;
2087 case GL_RGBA8:
2088 result = GL_SRGB8_ALPHA8;
2089 break;
2090 default:
2091 break;
2092 }
2093 }
2094 return result;
2095}
2096
2097void vtkOpenGLState::InitializeTextureInternalFormats()
2098{

Callers 4

BuildCellTexturesMethod · 0.45
GetShiftAndScaleMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected