Long time no chat, I've been on lurking from time to time however. I've been working on my own 3d engine in modern opengl and I keep coming back to a c++ issue and I hope the great minds here can help.
So I have a class Sun, this has code that keeps track of the time of day rotates the sun graphic around the world, vec3 position etc. The sun is drawn as a 2d quad made of 2 triangles, I call this a billboard. What make s this special is it always orients itself to the camera so you see it's face always.
Sun is a public child of Billboard since the sun is a billboard in my engine. Each class Sun and Billboard have initialize() functions.
From the main game however I can only call sun.initialize();
The Billboard class's initialize's job is to take an argument that is the file path of the .png (a.k.a. texture) that is displayed on the quad.
The way I have gotten around my problem is changing the name of the billboard.initialize() to initializeBill();
Now since they are different names I can call the billboard initialize() function from inside the Sun.initialize function().
There has to be a better way to solve this parented classes with same function name issue.
Code: Select all
class Sun : public Billboard
{
public:
Sun();
~Sun();
void initialize( float positionX, float positionY, float positionZ, const char* filePath );
...
}
void Sun::initialize( float positionX, float positionY, float positionZ, const char* filePath )
{
this->setPosition( positionX, positionY, positionZ );
this->initializeBill( filePath );
}
~Logan