Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


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