Recent

Author Topic: Read texture from file via LoadGLTextureFromFile from VampyreImaging  (Read 2120 times)

LemonParty

  • Sr. Member
  • ****
  • Posts: 391
Hello.
I installed VampyreImaging library from online package manager.
I used function LoadGLTextureFromFile to load a texture from bmp file and this give SIGSEGV. Is there other ways I can load texture?
Lazarus v. 4.99. FPC v. 3.3.1. Windows 11

Khrys

  • Sr. Member
  • ****
  • Posts: 367
Re: Read texture from file via LoadGLTextureFromFile from VampyreImaging
« Reply #1 on: December 17, 2024, 07:14:19 am »
How are you calling  LoadGLTextureFromFile? Do you have a call stack/backtrace?
Looking at the function signature and knowing you're getting a segfault, I suspect that you might be passing invalid pointers as  CreatedWidth  and  CreatedHeight. It should be something like this:

Code: Pascal  [Select][+][-]
  1. var
  2.   Texture: GLuint;
  3.   Width, Height: LongInt;
  4. begin
  5.   Texture := LoadGLTextureFromFile('tex.bmp', @Width, @Height);
  6.   // Width and Height now contain the bitmap's dimensions
  7. end;

LemonParty

  • Sr. Member
  • ****
  • Posts: 391
Re: Read texture from file via LoadGLTextureFromFile from VampyreImaging
« Reply #2 on: December 17, 2024, 01:09:33 pm »
Falling even when I call it this way LoadGLTextureFromFile('tex.bmp', @Width, @Height).
Lazarus v. 4.99. FPC v. 3.3.1. Windows 11

 

TinyPortal © 2005-2018