Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Everything posted by zgysx

  1. 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
  2. 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.
  3. 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.
  4. I approve your opinion, now I find the most suitable way is that include *.h file of static library in executable project explicitly. Thank you Trienco for your offer of examples.
  5. 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,
  6. Yes, actually. we can initialize the global object defined in *.h file of static project through include *.h file in executable project. But..... Can we link some *.h file of static library into executable project through link option? not through reference the object or function. Can we work that out by link option? I am using Visual C++ 2008. cheers.
  7. There is a number of samples which you want in DirectX SDK.
  8. The global variable defined in static library will not be initialized, Because I do not reference the global variable explicitly in the executable program. In face, I just want to implement a function which execute a section of code before enter main() function, but the code in static library. Dynamic crate of MFC just used global object initialization feature, but that not work when class define in static library.
  • 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!