void GLSLProgram::setUniform(const char* uniformName, T& value) { if (!m_linked) { SAFE_THROW(GLException(E_BADSTATE, "GLSL program must be linked before binding uniforms")); } int loc = glGetUniformLocation(m_progID, uniformName); // the uniform could either not exist or be inactive (e.g. removed by the glsl compiler as it was not used) if (loc != -1) { this->setUniform(loc, value); } }
nImageManager::~nImageManager( void ) { if (m_Loader) { for (u32 i=0; i<m_nLoaderSize; i++) { SAFE_THROW(m_Loader[i]); } SAFE_DELETE(m_Loader); } }
void nAhmadENGINE::Release( void ) { /***************************** Render Device Destruction *****************************/ releaseRenderDevice(); /***************************** FileSystem Destruction *****************************/ SAFE_THROW(m_pFileSystem); }
bool nImageLoaderBmp::IsContentValid( const c8 *cFileName ) { IO::IFileIO *fp = IO::createFileIO( cFileName, IO::EFI_IO_Read ); if (!fp) return false; c8 header[2]; fp->Read(header, sizeof(c8)*2); if (strstr(header, "BM")) return true; fp->Close(); SAFE_THROW(fp); return false; }
ISurface *nImageManager::LoadImageFromFile( const c8 *filename ) { ISurface *surface = NULL; IO::IFileIO *fs = NULL; for (u32 i=0; i<m_nLoaderSize; i++) { if (m_Loader[i]->IsExtensionValid( filename )) { fs = IO::createFileIO( filename, IO::EFI_IO_Read ); if (fs) { surface = m_Loader[i]->LoadImage( fs ); } SAFE_DELETE(fs); if (surface) break; } if (!surface) { if (m_Loader[i]->IsContentValid( filename )) { fs = IO::createFileIO( filename, IO::EFI_IO_Read ); if (fs) { surface = m_Loader[i]->LoadImage( fs ); } SAFE_THROW(fs); if (surface) break; } } } return surface; }
void GLSLProgram::setUniform(const String& uniformName, T& value) { if (!m_linked) { SAFE_THROW(GLException(E_BADSTATE, "GLSL program must be linked before binding uniforms")); } this->setUniform(uniformName.c_str(), value); }