Game Development Community

GFXTextureManager (error C2352)

by Thomas Bang · in Torque 3D Professional · 06/18/2011 (2:26 am) · 2 replies

Hi

I need a GFXTextureObject of a given texture. To reach that, i am using GFXTextureManager::hashFind.
Here is the code, i have so far:

gfxTextureManager.h

class GFXTextureManager 
{   
public:
...
...
   GFXTextureObject * getPtr(const char* tex);
...
...
protected: 
...
...
}

gfxTextureManager.cpp
...
...
GFXTextureObject * GFXTextureManager::getPtr(const char* tex)
{
	GFXTextureObject *texObj = GFXTextureManager::hashFind(tex);
	return texObj;
}

void getThePtr()
{
	GFXTextureObject *tex = GFXTextureManager::getPtr("something");
}
...
...

The problem is in the getThePtr-function, because i get the compiler error C2352.

A static member function called a nonstatic member function. Or, a nonstatic member function was called from outside the class as a static function.

How can i avoid that?

#1
06/20/2011 (1:19 pm)
GFXTextureManager is a singleton... look for the static singleton pointer and call getPtr() thru that.
#2
06/22/2011 (1:00 am)
Thank you very much. I got it.

GFXTextureObject * tex = static_cast<GFXTextureManager*>(GFX->getTextureManager())->getPtr("something");