MCPcopy Create free account
hub / github.com/cginternals/globjects / numberOfComponents

Function numberOfComponents

source/globjects/source/pixelformat.cpp:48–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46}
47
48int numberOfComponents(const GLenum format)
49{
50 switch (format)
51 {
52 case GL_RED:
53 case GL_GREEN:
54 case GL_BLUE:
55 case GL_RED_INTEGER:
56 case GL_GREEN_INTEGER:
57 case GL_BLUE_INTEGER:
58
59 case GL_ALPHA:
60 case GL_LUMINANCE:
61 case GL_LUMINANCE_ALPHA:
62
63 case GL_STENCIL_INDEX:
64 case GL_COLOR_INDEX:
65 case GL_DEPTH_COMPONENT:
66 case GL_DEPTH_STENCIL:
67 return 1;
68
69 case GL_RG:
70 case GL_RG_INTEGER:
71 return 2;
72
73 case GL_RGB:
74 case GL_BGR:
75 case GL_RGB_INTEGER:
76 case GL_BGR_INTEGER:
77 return 3;
78
79 case GL_RGBA:
80 case GL_BGRA:
81 case GL_RGBA_INTEGER:
82 case GL_BGRA_INTEGER:
83 return 4;
84 default:
85 return 1;
86 }
87}
88
89int bytesPerPixel(const GLenum format, const GLenum type)
90{

Callers 1

bytesPerPixelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected