Beispiel #1
0
DWORD instantiateGL(const FFGLViewportStruct *pGLViewport)
{
	NosuchDebug(1,"instantiateGL in FFGL.cpp called");
	if (g_CurrPluginInfo==NULL || pGLViewport==NULL)
    return FF_FAIL;

  // If the plugin is not initialized, initialize it
  if (s_pPrototype == NULL)
  {
		DWORD dwRet = initialise();

	  if ((dwRet == FF_FAIL) || (s_pPrototype == NULL))
      return FF_FAIL;
	}
		
	//get the instantiate function pointer
  FPCREATEINSTANCEGL *pInstantiate = g_CurrPluginInfo->GetFactoryMethod();

	CFreeFrameGLPlugin *pInstance = NULL;

  //call the instantiate function
  DWORD dwRet = pInstantiate(&pInstance);

  //make sure the instantiate call worked
  if ((dwRet == FF_FAIL) || (pInstance == NULL))
    return FF_FAIL;

	pInstance->m_pPlugin = pInstance;
		
	// Initializing instance with default values
	for (int i = 0; i < s_pPrototype->GetNumParams(); ++i)
  {
		//DWORD dwType = s_pPrototype->GetParamType(DWORD(i));
		void* pValue = s_pPrototype->GetParamDefault(DWORD(i));
		SetParameterStruct ParamStruct;
		ParamStruct.ParameterNumber = DWORD(i);
		memcpy(&ParamStruct.NewParameterValue, pValue, 4);
		dwRet = pInstance->SetParameter(&ParamStruct);
		if (dwRet == FF_FAIL)
    {
      //SetParameter failed, delete the instance
      delete pInstance;
      return FF_FAIL;
    }
	}

	//call the InitGL method
  if (pInstance->InitGL(pGLViewport)==FF_SUCCESS)
  {
    //succes? we're done.
    return (DWORD)pInstance;
  }

  //InitGL failed, delete the instance
  pInstance->DeInitGL();
  delete pInstance;

  return FF_FAIL;
}
Beispiel #2
0
DWORD deInstantiateGL(void *instanceID)
{
  CFreeFrameGLPlugin *p = (CFreeFrameGLPlugin *)instanceID;

	if (p != NULL)
  {
    p->DeInitGL();
		delete p;

		return FF_SUCCESS;
	}

	return FF_FAIL;
}
Beispiel #3
0
DWORD deInstantiateGL(void *instanceID)
{
	NosuchDebug("deInstantiateGL in FFGL.cpp called");
	CFreeFrameGLPlugin *p = (CFreeFrameGLPlugin *)instanceID;

	if (p != NULL) {
		p->DeInitGL();
		delete p;

		return FF_SUCCESS;
	}

	return FF_FAIL;
}