Jump to content
  • Advertisement
Sign in to follow this  
zgysx

Gamebryo: Program crash when render NiMeshScreenElements

This topic is 2345 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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 Edited by zgysx

Share this post


Link to post
Share on other sites
Advertisement
Gamebryo is a closed-source proprietary engine, so you'd be much better off asking for help inside that closed community. You might even get your company in trouble (i.e. have their license revoked) by discussing the internals of that product on a public forum... Does your company have a support contract for Gamebryo?

Look inside the NiD3DShader::PreRenderSubmesh to see what kind of cast it's attempting to do, and which object it's trying to do the cast on. Edited by Hodgman

Share this post


Link to post
Share on other sites

Gamebryo is a closed-source proprietary engine, so you'd be much better off asking for help inside that closed community. You might even get your company in trouble (i.e. have their license revoked) by discussing the internals of that product on a public forum... Does your company have a support contract for Gamebryo?

Look inside the NiD3DShader::PreRenderSubmesh to see what kind of cast it's attempting to do, and which object it's trying to do the cast on.

Of course, our company have the license, but Gamebryo source code have not opened for me at present,

I

need

a

complicated application if I want to watch the Gamebryo source code. I just a new employee. Edited by zgysx

Share this post


Link to post
Share on other sites
I solve this bug, because I created NiMeshScreenElements before create NiRender. so the NiMeshScreenElements::m_eColorFormat was F_FLOAT32_4.
I created a NiRender, and then create NiMeshScreenElements, NiMeshScreenElements::m_eColorFormat become F_NORMUINT8_4_BGRA, this is a correct value. Everything is ok.
I am so ashamed.
Thanks Hodgman all the same.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!