Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your help!

We need 7 developers from Canada and 18 more from Australia to help us complete a research survey.

Support our site by taking a quick sponsored survey and win a chance at a $50 Amazon gift card. Click here to get started!


zgysx

Member Since 02 Apr 2012
Offline Last Active May 30 2013 06:46 PM

Topics I've Started

Gamebryo: Program crash when render NiMeshScreenElements

11 July 2012 - 04:49 AM

I use NiMeshScreenElements of Gamebryo to render 2D image in Game, First, I Create NiMeshScreenElements from a png file, and then rend this NiMeshScreenElements. Gamebyro popup an error dialog when rend the NiMeshScreenElements.

NiMeshScreenElements * g_pScreenElement;
bool GImage::LoadImageFromFile( const char * pszPath )
{
NiFile * pkFile = NiFile::GetFile( pszPath, NiFile::READ_ONLY );
if( pkFile == NULL )
  return false;
NiPNGReader pngReader;
NiPixelData * pSrcData = pngReader.ReadFile( *pkFile, NULL );
if( pSrcData == NULL )
  return false;
NiSourceTexture * pSrc = NiSourceTexture::Create( pSrcData );
if( pSrc == NULL )
  return false;
g_pScreenElement = NiMeshScreenElements::Create( pSrc);
return true;
}
g_pScreenElement->m_eColorFormat become F_FLOAT32_4 after executing above code. I suspect that is a error value.

and then I render NiMeshScreenElements * g_pScreenElement .
m_pDevice->SetScreenSpaceCameraData();
g_pScreenElement->RemoveAll();
g_pScreenElement->AddNewScreenRect( (short)fX, (short)fY, (short)fWidth, (short)fHeight, 0, 0, NiColorA::WHITE );
g_pScreenElement->RenderImmediate( m_pDevice ); //popup an error dialog when execute this line

popup error dialog as follow:
NiVerifyStaticCast() caught an invalid type cast
Stack Trace:
NiObject::VerifyStaticCastDebug
NiD3DShader::PreRenderSubmesh
NiD3DShader::Do_RenderMeshes
NiShader::RenderMeshes
......

Thanks

how to force global variable which define in a static library to initialize?

02 April 2012 - 09:57 PM

how to force global variable which define in a static library to initialize?
I have not reference that global variable explicitly in main() project.
I expect that implement reflect function in C++.

Thanks, Posted Image

PARTNERS