X-Git-Url: https://git.delphigl.com/?p=glBitmap.git;a=blobdiff_plain;f=examples%2FSimpleLoadFromFile%2FSimpleLoadFromFile.lpr;fp=examples%2FSimpleLoadFromFile%2FSimpleLoadFromFile.lpr;h=bdb9c69eae12ed6790aff40c8a531073bf0de381;hp=cb7cc15b1447422305affc03056c20fe455c00c9;hb=c110c2d190cfdd632a622163d3edb7c9c90cf21a;hpb=fb955156e23a85973e7ee2f89954d90574982fef diff --git a/examples/SimpleLoadFromFile/SimpleLoadFromFile.lpr b/examples/SimpleLoadFromFile/SimpleLoadFromFile.lpr index cb7cc15..bdb9c69 100644 --- a/examples/SimpleLoadFromFile/SimpleLoadFromFile.lpr +++ b/examples/SimpleLoadFromFile/SimpleLoadFromFile.lpr @@ -12,6 +12,7 @@ var oglWindow: TOpenGLWindow; running: Boolean = true; tex: TglBitmap2D; + data: TglBitmapData; function WindowProc(hWnd: HWND; Msg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall; begin @@ -39,10 +40,16 @@ end; begin oglWindow := CreateOpenGLWindow('SimpleLoadFromFile', 800, 600, @WindowProc); try - // load texture - tex := TglBitmap2D.Create; - tex.LoadFromFile(ExtractFilePath(ApplicationName) + '../textures/BMP_24_RGB8.bmp'); - tex.GenTexture; + tex := TglBitmap2D.Create; // create texture object + data := TglBitmapData.Create; // create texture data object + try + data.LoadFromFile( // load texture data from file + ExtractFilePath(ApplicationName) + + '../textures/BMP_24_RGB8.bmp'); + tex.UploadData(data); // upload data to video card + finally + FreeAndNil(data); // after upload is done, the data object could be freed to save memory + end; while running and ProgressMesages do begin RenderLoop;