I made a class Color
with float r, float g, float b, float alpha. It has a base class with a virtual destructor.
I am trying to pass an array of Color to the opengl function glTexImage2D
, with a GL_RGBA
organization of type float (which would be an array of {float r, float g, float b, float alpha}). This requires Color
to contain only 4 floats (size of 16 bytes).
However, sizeof(Color)
reveals that my class has a size of 20 bytes due to the base class of Color
having a vtable, thanks to the destructor.
How can I keep my vtable and still pass my Color array to glTexImage2D
?