Jump to content

  • Log In with Google      Sign In   
  • Create Account

Gamebryo: Program crash when render NiMeshScreenElements


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 zgysx   Members   -  Reputation: 109

Like
0Likes
Like

Posted 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

Attached Thumbnails

  • error dialog.jpg

Edited by zgysx, 11 July 2012 - 04:52 AM.


Sponsor:

#2 Hodgman   Moderators   -  Reputation: 31822

Like
0Likes
Like

Posted 11 July 2012 - 06:03 AM

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, 11 July 2012 - 06:06 AM.


#3 zgysx   Members   -  Reputation: 109

Like
0Likes
Like

Posted 11 July 2012 - 07:20 PM

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, 11 July 2012 - 07:23 PM.


#4 zgysx   Members   -  Reputation: 109

Like
1Likes
Like

Posted 11 July 2012 - 07:41 PM

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.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS