3 This file is part of gldbg
4 Copyright © 2009-2011 Mikko Rasa, Mikkosoft Productions
5 Distributed under the GPL
10 int typesize(GLenum type)
14 case GL_BYTE: return sizeof(GLbyte);
15 case GL_SHORT: return sizeof(GLshort);
16 case GL_INT: return sizeof(GLint);
17 case GL_UNSIGNED_BYTE: return sizeof(GLubyte);
18 case GL_UNSIGNED_SHORT: return sizeof(GLushort);
19 case GL_UNSIGNED_INT: return sizeof(GLuint);
20 case GL_FLOAT: return sizeof(GLfloat);
21 case GL_DOUBLE: return sizeof(GLdouble);
22 // Short and byte packed types are broken
27 int formatsize(GLenum format)
31 case GL_COLOR_INDEX: return 1;
32 case GL_STENCIL_INDEX: return 1;
33 case GL_DEPTH_COMPONENT: return 1;
34 case GL_RED: return 1;
35 case GL_GREEN: return 1;
36 case GL_BLUE: return 1;
37 case GL_ALPHA: return 1;
38 case GL_RGB: return 3;
39 case GL_RGBA: return 4;
40 case GL_BGR: return 3;
41 case GL_BGRA: return 4;
42 case GL_LUMINANCE: return 1;
43 case GL_LUMINANCE_ALPHA: return 2;
48 int paramsize(GLenum pname)
52 case GL_VIEWPORT: return 4;
54 // Lighting and material
55 case GL_AMBIENT: return 4;
56 case GL_DIFFUSE: return 4;
57 case GL_AMBIENT_AND_DIFFUSE: return 4;
58 case GL_SPECULAR: return 4;
59 case GL_EMISSION: return 4;
60 case GL_SHININESS: return 1;
61 case GL_COLOR_INDEXES: return 3;
62 case GL_POSITION: return 4;
63 case GL_SPOT_DIRECTION: return 3;
64 case GL_SPOT_EXPONENT: return 1;
65 case GL_SPOT_CUTOFF: return 1;
66 case GL_CONSTANT_ATTENUATION: return 1;
67 case GL_LINEAR_ATTENUATION: return 1;
68 case GL_QUADRATIC_ATTENUATION: return 1;
69 case GL_LIGHT_MODEL_AMBIENT: return 4;
70 case GL_LIGHT_MODEL_LOCAL_VIEWER: return 1;
71 case GL_LIGHT_MODEL_TWO_SIDE: return 1;
72 case GL_LIGHT_MODEL_COLOR_CONTROL: return 1;
75 case GL_TEXTURE_WRAP_S: return 1;
76 case GL_TEXTURE_WRAP_T: return 1;
77 case GL_TEXTURE_WRAP_R: return 1;
78 case GL_TEXTURE_MIN_FILTER: return 1;
79 case GL_TEXTURE_MAG_FILTER: return 1;
80 case GL_TEXTURE_BORDER_COLOR: return 4;
81 case GL_TEXTURE_MIN_LOD: return 1;
82 case GL_TEXTURE_MAX_LOD: return 1;
83 case GL_TEXTURE_BASE_LEVEL: return 1;
84 case GL_TEXTURE_MAX_LEVEL: return 1;
85 case GL_TEXTURE_LOD_BIAS: return 1;
86 case GL_DEPTH_TEXTURE_MODE: return 1;
87 case GL_TEXTURE_COMPARE_MODE: return 1;
88 case GL_TEXTURE_COMPARE_FUNC: return 1;
89 case GL_GENERATE_MIPMAP: return 1;
95 int buffersize(GLenum buffer)
99 case GL_COLOR: return 4;
100 case GL_DEPTH: return 1;
101 case GL_STENCIL: return 1;