/***************************************************************************//** * Get Texture * Authors - Derek Stotz, Charles Parsons * * Loads a bmp file given by a filename string and stores it into a given byte array. ******************************************************************************/ void getTexture(GLubyte* image, const char* filename) { std::string name(filename); int num_rows = 256; int num_cols = 512; if (!LoadBmpFile( ("./resources/" + name).c_str(), num_rows, num_cols, image )) std::cout << "Failed to load" << "./resources/" + name << std::endl; }
void CLjz153View::OnPic2() { // TODO: Add your command handler code here CFileDialog pic2( TRUE, _T( ".bmp" ), _T( "test.bmp" ), OFN_FILEMUSTEXIST | OFN_HIDEREADONLY, _T( "图片(bmp)|*.bmp|所有文件|*||" ) ); if ( pic2.DoModal() == IDOK ) { CString path = pic2.GetPathName(); //获取路径 //AfxMessageBox(path); char* name = path.GetBuffer(path.GetLength()); path.ReleaseBuffer(); lpBitsInfo1 = LoadBmpFile(name); Invalidate(); picNum++; } }
bool TextureCubeMap::LoadTextureFaceFromBMPFile( const char *_filename, unsigned int _face) { void *pixels; pixels = LoadBmpFile(_filename); if (!CreateTextureFace(_face, pixels)) { m_faceLoaded[_face - GL_TEXTURE_CUBE_MAP_POSITIVE_X] = false; return false; } m_faceLoaded[_face - GL_TEXTURE_CUBE_MAP_POSITIVE_X] = true; return true; }
bool Texture2D::LoadTextureBMPFromFile(const char *filename, unsigned int _textureUnit) { void *pixels = LoadBmpFile(filename); m_textureUnit = _textureUnit; if (!CreateTexture(pixels)) { return false; } delete pixels; m_loaded = true; return true; }
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { DWORD result = false; DWORD dwr; do { dwr = LoadBmpFile(filename); if (dwr == false) break; dwr = CreateRTFFile("photo.rtf"); result = true; } while (false); if (result) ::MessageBox(NULL,"Operation success ","File convertion BMP to RTF",MB_OK); else ::MessageBox(NULL,"Operation failed","File convertion BMP to RTF",MB_OK); delete bmpbits; return 0; }
HBITMAP CImage::LoadImageFile( CString csFileName ) { HBITMAP hBmp = LoadBmpFile( csFileName ); return ( hBmp ); }