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

Method GetDefaultFormat

Rendering/OpenGL2/vtkTextureObject.cxx:791–837  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

789
790//------------------------------------------------------------------------------
791unsigned int vtkTextureObject::GetDefaultFormat(
792 int vtktype, int numComps, bool shaderSupportsTextureInt)
793{
794 if (vtktype == VTK_VOID)
795 {
796 return GL_DEPTH_COMPONENT;
797 }
798
799 if (this->SupportsTextureInteger && shaderSupportsTextureInt &&
800 (vtktype == VTK_SIGNED_CHAR || vtktype == VTK_UNSIGNED_CHAR || vtktype == VTK_SHORT ||
801 vtktype == VTK_UNSIGNED_SHORT || vtktype == VTK_INT || vtktype == VTK_UNSIGNED_INT))
802 {
803 switch (numComps)
804 {
805 case 1:
806 return GL_RED_INTEGER;
807 case 2:
808 return GL_RG_INTEGER;
809#ifdef GL_ES_VERSION_3_0
810 case 3:
811 return GL_RGB_INTEGER;
812 case 4:
813 return GL_RGBA_INTEGER;
814#else
815 case 3:
816 return GL_RGB_INTEGER_EXT;
817 case 4:
818 return GL_RGBA_INTEGER_EXT;
819#endif
820 }
821 }
822 else
823 {
824 switch (numComps)
825 {
826 case 1:
827 return GL_RED;
828 case 2:
829 return GL_RG;
830 case 3:
831 return GL_RGB;
832 case 4:
833 return GL_RGBA;
834 }
835 }
836 return GL_RGB;
837}
838
839//------------------------------------------------------------------------------
840void vtkTextureObject::SetFormat(unsigned int glFormat)

Callers 2

GetFormatMethod · 0.95
LoadVolumeMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected