projects
/
LazOpenGLCore.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* added HasOpenGLSupport to FormatDescriptor to check if the given format is supporte...
[LazOpenGLCore.git]
/
examples
/
SimpleLoadFromFile
/
SimpleLoadFromFile.lpr
diff --git
a/examples/SimpleLoadFromFile/SimpleLoadFromFile.lpr
b/examples/SimpleLoadFromFile/SimpleLoadFromFile.lpr
index
bdb9c69
..
64d2db7
100644
(file)
--- a/
examples/SimpleLoadFromFile/SimpleLoadFromFile.lpr
+++ b/
examples/SimpleLoadFromFile/SimpleLoadFromFile.lpr
@@
-40,15
+40,17
@@
end;
begin
oglWindow := CreateOpenGLWindow('SimpleLoadFromFile', 800, 600, @WindowProc);
try
begin
oglWindow := CreateOpenGLWindow('SimpleLoadFromFile', 800, 600, @WindowProc);
try
- tex := TglBitmap2D.Create; // create texture object
- data := TglBitmapData.Create; // create texture data object
+ tex := TglBitmap2D.Create;
// create texture object
+ data := TglBitmapData.Create;
// create texture data object
try
try
- data.LoadFromFile( // load texture data from file
+ data.LoadFromFile(
// load texture data from file
ExtractFilePath(ApplicationName) +
'../textures/BMP_24_RGB8.bmp');
ExtractFilePath(ApplicationName) +
'../textures/BMP_24_RGB8.bmp');
- tex.UploadData(data); // upload data to video card
+ if not data.FormatDescriptor.HasOpenGLSupport then // check if format is supported by OpenGL
+ data.ConvertTo(data.FormatDescriptor.OpenGLFormat); // if not then convert
+ tex.UploadData(data); // upload data to video card
finally
finally
- FreeAndNil(data); // after upload is done, the data object could be freed to save memory
+ FreeAndNil(data);
// after upload is done, the data object could be freed to save memory
end;
while running and ProgressMesages do begin
end;
while running and ProgressMesages do begin