I made a class Colorwith float r, float g, float b, float alpha. It has a base class with a virtual destructor .
I am trying to pass the Color array to an opengl function glTexImage2D, with an organization of GL_RGBAtype float (which will be an array of {float r, float g, float b, float alpha}). For this, you Coloronly need to contain 4 floats ( size 16 bytes ).
However, it sizeof(Color)shows that my class is 20 bytes in size due to the base class Colorhaving vtable , thanks to the destructor.
How can I save a vtable and still pass my array of colors to glTexImage2D?
source
share