Recent

Author Topic: BGRAOpenGL3D why is a picture not shown (Linux)  (Read 9029 times)

Michl

  • Full Member
  • ***
  • Posts: 226
BGRAOpenGL3D why is a picture not shown (Linux)
« on: June 23, 2016, 02:50:14 pm »
Hi,

I've played a little bit with BGRAOpenGL3D and made a little project, which runs fine on Windows:
Windows 7, 64bit, 32 bit Lazarus 1.7 Trunk, FPC 3.1.1 Trunk, BGRABitmap 8.9.2
Windows 7, 64bit, 64 bit Lazarus 1.6, FPC 3.0.0, BGRABitmap 8.9.2

If I start the same project on Linux:
64bit Linux Mint 17.3 KDE GTK2 Lazarus 1.6 FPC 3.0.0 BGRABitmap 8.9.2: TBGLScene3D.RenderGL doesn't paint the object with a picture on it.
32bit Linux Mint 17.3 KDE GTK2 Lazarus 1.6 FPC 3.0.0 BGRABitmap 8.9.2: TBGLScene3D.RenderGL throws a SIGSEGV.

I'm a newbee on Linux. Does anyone know, what I have to do, to get it started on Linux too?

I reduced the code to a little example (also attached as project):
Code: Pascal  [Select][+][-]
  1. unit PictureTestMain;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   BGRAOpenGL3D, BGRAOpenGL, BGLVirtualScreen,
  9.   BGRASceneTypes, BGRABitmapTypes, sysutils, Forms,
  10.   ExtCtrls;
  11.  
  12. type
  13.  
  14.   { TTestPicture }
  15.  
  16.   TTestPicture = class(TBGLScene3D)
  17.   private
  18.     FBGLBitmap: TBGLBitmap;
  19.   public
  20.     constructor Create;
  21.     destructor Destroy; override;
  22.   end;
  23.  
  24.   { TForm1 }
  25.  
  26.   TForm1 = class(TForm)
  27.     BGLVirtualScreen1: TBGLVirtualScreen;
  28.     Timer1: TTimer;
  29.     procedure BGLVirtualScreen1LoadTextures(Sender: TObject; BGLContext: TBGLContext);
  30.     procedure BGLVirtualScreen1Redraw(Sender: TObject;
  31.       BGLContext: TBGLContext);
  32.     procedure FormDestroy(Sender: TObject);
  33.     procedure Timer1Timer(Sender: TObject);
  34.   private
  35.     Scene: TTestPicture;
  36.   end;
  37.  
  38. var
  39.   Form1: TForm1;
  40.  
  41. implementation
  42.  
  43. {$R *.lfm}
  44.  
  45. { TTestPicture }
  46.  
  47. constructor TTestPicture.Create;
  48. var
  49.   aRectangle: array of IBGRAVertex3D;
  50.   aFace: IBGRAFace3D;
  51.   FObject: IBGRAObject3D;
  52. begin
  53.   inherited Create;
  54.   FBGLBitmap := TBGLBitmap.Create(GetCurrentDir + PathDelim + 'cheetah.ico');
  55.   FObject := CreateObject(FBGLBitmap);
  56.   aRectangle := FObject.MainPart.Add([
  57.     -1, -1, 5,
  58.      1, -1, 5,
  59.      1,  1, 5,
  60.     -1,  1, 5]);
  61.   aFace := FObject.AddFace(aRectangle);
  62.   aFace.TexCoord[0] := PointF(0, 0);
  63.   aFace.TexCoord[1] := PointF(FBGLBitmap.Width - 1, 0);
  64.   aFace.TexCoord[2] := PointF(FBGLBitmap.Width - 1, FBGLBitmap.Height - 1);
  65.   aFace.TexCoord[3] := PointF(0, FBGLBitmap.Height - 1);
  66. end;
  67.  
  68. destructor TTestPicture.Destroy;
  69. begin
  70.   if Assigned(FBGLBitmap) then FBGLBitmap.Free;
  71.   inherited Destroy;
  72. end;
  73.  
  74. { TForm1 }
  75.  
  76. procedure TForm1.BGLVirtualScreen1LoadTextures(Sender: TObject;
  77.   BGLContext: TBGLContext);
  78. begin
  79.   Scene := TTestPicture.Create;
  80.   Scene.Camera.ViewPoint := Point3D(0, 0, -1);
  81. end;
  82.  
  83. procedure TForm1.BGLVirtualScreen1Redraw(Sender: TObject;
  84.   BGLContext: TBGLContext);
  85. begin
  86.   BGLContext.Canvas.Fill(BGRA(0, 0, 0, 255));
  87.   Scene.Object3D[0].MainPart.RotateZDeg(2);
  88.   Scene.RenderGL(BGLContext.Canvas);
  89. end;
  90.  
  91. procedure TForm1.FormDestroy(Sender: TObject);
  92. begin
  93.   Scene.Free;
  94. end;
  95.  
  96. procedure TForm1.Timer1Timer(Sender: TObject);
  97. begin
  98.   if not Assigned(Scene) then Exit;
  99.   BGLVirtualScreen1.Invalidate;
  100. end;
  101.  
  102. end.
Code: [Select]
type
  TLiveSelection = (lsMoney, lsChilds, lsTime);
  TLive = Array[0..1] of TLiveSelection;

circular

  • Hero Member
  • *****
  • Posts: 4221
    • Personal webpage
Re: BGRAOpenGL3D why is a picture not shown (Linux)
« Reply #1 on: June 23, 2016, 03:09:33 pm »
Thanks for the feedback.

Can you turn off compilation optimisation and add debug info to BGRABitmap and BGLControls packages so that you can provide a specific location for the problem in the code?
Conscience is the debugger of the mind

Michl

  • Full Member
  • ***
  • Posts: 226
Re: BGRAOpenGL3D why is a picture not shown (Linux)
« Reply #2 on: June 23, 2016, 09:18:57 pm »
Here is the backtrace for the 32bit Linux:
Code: Text  [Select][+][-]
  1. Program received signal SIGSEGV, Segmentation fault.
  2. 0x083001c0 in BGRAOPENGLTYPE$_$TBGLCUSTOMTEXTURE_$__$$_GETWIDTH$$LONGINT ()
  3. (gdb) bt
  4. #0  0x083001c0 in BGRAOPENGLTYPE$_$TBGLCUSTOMTEXTURE_$__$$_GETWIDTH$$LONGINT ()
  5. #1  0x082d8fdb in BGRAOPENGL$_$TBGLTEXTURE_$__$$_DODRAWTRIANGLEORQUAD$crc88BFA6A1 ()
  6. #2  0x0830233e in BGRAOPENGLTYPE$_$TBGLCUSTOMTEXTURE_$__$$_DRAWQUAD$crc32E61180 ()
  7. #3  0x082d64a8 in BGRAOPENGL3D$_$TBGLRENDERER3D_$__$$_RENDERFACE$crcDEA8ECAA ()
  8. #4  0x082fde5b in BGRASCENE3D$_$TBGRASCENE3D_$_DORENDER_$$_DRAWFACE$LONGINT ()
  9. #5  0x082fd812 in BGRASCENE3D$_$TBGRASCENE3D_$__$$_DORENDER ()
  10. #6  0x082fd051 in BGRASCENE3D$_$TBGRASCENE3D_$__$$_RENDER$TCUSTOMRENDERER3D ()
  11. #7  0x082d5aa7 in BGRAOPENGL3D$_$TBGLSCENE3D_$__$$_RENDERGL$TBGLCUSTOMCANVAS$SINGLE ()
  12. #8  0x08095810 in BGLVIRTUALSCREEN1REDRAW (this=0xb6dc4210, SENDER=0xb6dc50d0, BGLCONTEXT=...)
  13.     at picturetestmain.pas:88
  14. #9  0x082da0ec in BGLVIRTUALSCREEN$_$TCUSTOMBGLVIRTUALSCREEN_$__$$_REDRAWCONTENT$TBGLCONTEXT ()
  15. #10 0x082d9d91 in BGLVIRTUALSCREEN$_$TCUSTOMBGLVIRTUALSCREEN_$__$$_DOONPAINT ()
  16. #11 0x083d137b in TCUSTOMOPENGLCONTROL__PAINT (this=<error reading variable>) at openglcontext.pas:533
  17. #12 0x083d0f2b in TCUSTOMOPENGLCONTROL__WMPAINT (MESSAGE=..., this=<error reading variable>)
  18.     at openglcontext.pas:446
  19. #13 0x0806fe88 in SYSTEM$_$TOBJECT_$__$$_DISPATCH$formal ()
  20. #14 0xbfffe6e4 in ?? ()
  21. #15 0x081d7480 in TWINCONTROL__WNDPROC (MESSAGE=..., this=<error reading variable>)
  22.     at ./include/wincontrol.inc:5383
  23. #16 0x08277629 in DELIVERMESSAGE (TARGET=0xb6dc50d0,
  24.     AMESSAGE=<Fehler beim Lesen der Variable: Attempt to dereference a generic pointer.>)
  25.     at lclmessageglue.pas:112
  26. #17 0x082448a3 in DELIVERMESSAGE (TARGET=0xb6dc50d0,
  27.     AMESSAGE=<Fehler beim Lesen der Variable: Attempt to dereference a generic pointer.>)
  28.     at ./gtk2/gtk2proc.inc:3628
  29. #18 0x0824d5b4 in DODELIVERPAINTMESSAGE (TARGET=0xb6dc50d0, PAINTMSG=...) at ./gtk2/gtk2callback.inc:26
  30. #19 0x0824d65e in DELIVERPAINTMESSAGE (TARGET=0xb6dc50d0,
  31.     THEMESSAGE=<Fehler beim Lesen der Variable: Attempt to dereference a generic pointer.>)
  32.     at ./gtk2/gtk2callback.inc:44
  33. #20 0x0824d7f3 in DELIVERGTKPAINTMESSAGE (TARGET=0xb6dc50d0, WIDGET=0x864cf48, AREA=0xbfffead4,
  34.     REPAINTALL=false, ISAFTERGTK=true) at ./gtk2/gtk2callback.inc:102
  35. #21 0x0824e6ac in GTKEXPOSEEVENTAFTER (WIDGET=0x864cf48, EVENT=0xbfffeac8, DATA=0xb6dc50d0)
  36.     at ./gtk2/gtk2callback.inc:735
  37. #22 0xb7afeebe in ?? () from /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
  38. #23 0xb78dda7e in g_closure_invoke () from /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
  39. #24 0xb78efe9b in ?? () from /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
  40. #25 0xb78f768f in g_signal_emit_valist () from /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
  41. ---Type <return> to continue, or q <return> to quit---
  42. #26 0xb78f7bf3 in g_signal_emit () from /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
  43. #27 0xb7c2ba03 in ?? () from /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
  44. #28 0xb7afd78e in gtk_main_do_event () from /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
  45. #29 0xb795d2d0 in ?? () from /usr/lib/i386-linux-gnu/libgdk-x11-2.0.so.0
  46. #30 0xb798de03 in ?? () from /usr/lib/i386-linux-gnu/libgdk-x11-2.0.so.0
  47. #31 0xb7959b18 in ?? () from /usr/lib/i386-linux-gnu/libgdk-x11-2.0.so.0
  48. #32 0xb795a477 in gdk_window_process_all_updates () from /usr/lib/i386-linux-gnu/libgdk-x11-2.0.so.0
  49. #33 0xb7a7726f in ?? () from /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
  50. #34 0xb7937098 in ?? () from /usr/lib/i386-linux-gnu/libgdk-x11-2.0.so.0
  51. #35 0xb7806c50 in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0
  52. #36 0xb780a0a7 in g_main_context_dispatch () from /lib/i386-linux-gnu/libglib-2.0.so.0
  53. #37 0xb780a468 in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0
  54. #38 0xb780a528 in g_main_context_iteration () from /lib/i386-linux-gnu/libglib-2.0.so.0
  55. #39 0x081930a2 in TGTK2WIDGETSET__APPPROCESSMESSAGES (this=<error reading variable>)
  56.     at ./gtk2/gtk2widgetset.inc:2326
  57. #40 0x0809004d in TAPPLICATION__HANDLEMESSAGE (this=<error reading variable>)
  58.     at ./include/application.inc:1260
  59. #41 0x0809045e in TAPPLICATION__RUNLOOP (this=<error reading variable>) at ./include/application.inc:1395
  60. #42 0x08097700 in TWIDGETSET__APPRUN (ALOOP=0x8090420 <TAPPLICATION__RUNLOOP>,
  61.     this=<error reading variable>) at ./include/interfacebase.inc:54
  62. #43 0x0809041e in TAPPLICATION__RUN (this=<error reading variable>) at ./include/application.inc:1383
  63. #44 0x0805eb6a in main () at PictureTest.lpr:27
If I exclude Scene.RenderGL(BGLContext.Canvas), the example is running and paint a blue screen:
Code: Pascal  [Select][+][-]
  1. procedure TForm1.BGLVirtualScreen1Redraw(Sender: TObject;
  2.   BGLContext: TBGLContext);
  3. begin
  4.   BGLContext.Canvas.Fill(BGRA(0, 0, 255, 255));
  5.   Scene.Object3D[0].MainPart.RotateZDeg(2);
  6. //  Scene.RenderGL(BGLContext.Canvas);
  7. end;
On 32bit Bit Linux, it seems to be problem with GTK2.
On 64bit Linux, there is no SIGSEGV nor a other problem, I can find by GDB. There is simply nothing drawn, but the background (the image was loaded, I can see by debugging).
Code: [Select]
type
  TLiveSelection = (lsMoney, lsChilds, lsTime);
  TLive = Array[0..1] of TLiveSelection;

circular

  • Hero Member
  • *****
  • Posts: 4221
    • Personal webpage
Re: BGRAOpenGL3D why is a picture not shown (Linux)
« Reply #3 on: June 23, 2016, 10:43:38 pm »
The stack traces seems to points to GetWidth and I suppose this function could only fail if the pointer to the TBGLCustomTexture class would not be defined. What if you set the texture via aFace.Texture?

What suggests you that the problem is related to GTK2?
Conscience is the debugger of the mind

Michl

  • Full Member
  • ***
  • Posts: 226
Re: BGRAOpenGL3D why is a picture not shown (Linux)
« Reply #4 on: June 23, 2016, 11:29:37 pm »
Thank you, for your feedback!

What if you set the texture via aFace.Texture?
I'm not sure, if you mean it so:
Code: Pascal  [Select][+][-]
  1. ...
  2.   aFace := FObject.AddFace(aRectangle);
  3.   aFace.SetTexture(FBGLBitmap);   // <- I've inserted this here
  4.   aFace.TexCoord[0] := PointF(0, 0);
  5. ...
If yes, the results are everywhere the same as before.

What suggests you that the problem is related to GTK2?
The variable reading errors by GDB, but maybe I'm wrong:
Code: Text  [Select][+][-]
  1. #11 0x083d137b in TCUSTOMOPENGLCONTROL__PAINT (this=<error reading variable>) at openglcontext.pas:533
  2. #12 0x083d0f2b in TCUSTOMOPENGLCONTROL__WMPAINT (MESSAGE=..., this=<error reading variable>)
  3.     at openglcontext.pas:446
  4. #13 0x0806fe88 in SYSTEM$_$TOBJECT_$__$$_DISPATCH$formal ()
  5. #14 0xbfffe6e4 in ?? ()
  6. #15 0x081d7480 in TWINCONTROL__WNDPROC (MESSAGE=..., this=<error reading variable>)
  7.     at ./include/wincontrol.inc:5383
  8. #16 0x08277629 in DELIVERMESSAGE (TARGET=0xb6dc50d0,
  9.     AMESSAGE=<Fehler beim Lesen der Variable: Attempt to dereference a generic pointer.>)
  10.     at lclmessageglue.pas:112
  11. #17 0x082448a3 in DELIVERMESSAGE (TARGET=0xb6dc50d0,
  12.     AMESSAGE=<Fehler beim Lesen der Variable: Attempt to dereference a generic pointer.>)
  13.     at ./gtk2/gtk2proc.inc:3628
  14. #18 0x0824d5b4 in DODELIVERPAINTMESSAGE (TARGET=0xb6dc50d0, PAINTMSG=...) at ./gtk2/gtk2callback.inc:26
Code: [Select]
type
  TLiveSelection = (lsMoney, lsChilds, lsTime);
  TLive = Array[0..1] of TLiveSelection;

circular

  • Hero Member
  • *****
  • Posts: 4221
    • Personal webpage
Re: BGRAOpenGL3D why is a picture not shown (Linux)
« Reply #5 on: June 24, 2016, 11:00:34 pm »
Quote
I'm not sure, if you mean it so
Yes. Ok so that's not the problem.

Quote
The variable reading errors by GDB, but maybe I'm wrong
This indicates that a paint event is called, that's normal as we are indeed redrawing the screen.
Conscience is the debugger of the mind

Michl

  • Full Member
  • ***
  • Posts: 226
Re: BGRAOpenGL3D why is a picture not shown (Linux)
« Reply #6 on: June 24, 2016, 11:42:16 pm »
This indicates that a paint event is called, that's normal as we are indeed redrawing the screen.
Yes and no, I've meant such messages:
Code: Pascal  [Select][+][-]
  1. ...(this=<error reading variable>)...
When I debug other projects and the debugger can't read a pointer/handle or so, it could be, the pointer/handle shows to nowhere, but sometimes not.

If there is no general problem in my code (as I thought first), maybe, in the next days, I find some time, to debug the issue a little bit more.

Thank you till now!
« Last Edit: June 24, 2016, 11:44:25 pm by Michl »
Code: [Select]
type
  TLiveSelection = (lsMoney, lsChilds, lsTime);
  TLive = Array[0..1] of TLiveSelection;

circular

  • Hero Member
  • *****
  • Posts: 4221
    • Personal webpage
Re: BGRAOpenGL3D why is a picture not shown (Linux)
« Reply #7 on: June 25, 2016, 01:21:10 pm »
You're welcome. If I have some time, I will try to run install Linux to debug it.

Basically what I would look for is when the pointer to the bitmap becomes invalid.
Conscience is the debugger of the mind

Michl

  • Full Member
  • ***
  • Posts: 226
Re: BGRAOpenGL3D why is a picture not shown (Linux)
« Reply #8 on: June 28, 2016, 12:02:44 am »
Just as a status report:

1. The "cheetah.ico" is not shown on Linux as on Windows. If I replace it with a .jpg, the example is running on 64bit Linux.

2. The bug on 32bit Linux is a bad one (but maybe not one of BGRABitmap). The package was in the project dependences. If I add somewhere WriteLn('Something'), the output was visible, but breakpoints weren't jumped in (the project throws the SIGSEGV further). So I added the path to unit BGRAOpenGL3D manually and voilà it jumped in, but WTF, the project is running (no SIGSEGV anymore). Now I'm not able to create the SIGSEGV again.

I'll try to repeat the things to get to know, what the problem was.

Till then
Code: [Select]
type
  TLiveSelection = (lsMoney, lsChilds, lsTime);
  TLive = Array[0..1] of TLiveSelection;

circular

  • Hero Member
  • *****
  • Posts: 4221
    • Personal webpage
Re: BGRAOpenGL3D why is a picture not shown (Linux)
« Reply #9 on: June 28, 2016, 12:38:06 am »
Thanks.

1. So the ico file format would not be supported on Linux?
2. That could be related to linking. What if you just use the package, but do a clean build?
Conscience is the debugger of the mind

Michl

  • Full Member
  • ***
  • Posts: 226
Re: BGRAOpenGL3D why is a picture not shown (Linux)
« Reply #10 on: June 28, 2016, 11:25:41 am »
1. So the ico file format would not be supported on Linux?
Just tested:

Code: Pascal  [Select][+][-]
  1. procedure TForm1.FormCreate(Sender: TObject);
  2. begin
  3.   FPict := TPicture.Create;
  4.   FPict.LoadFromFile(GetCurrentDir + PathDelim + 'cheetah.ico');
  5.   Caption := 'Width: ' + IntToStr(FPict.Width) + ' Height: ' + IntToStr(FPict.Height);
  6. end;
  7.  
  8. procedure TForm1.FormPaint(Sender: TObject);
  9. begin
  10.   Canvas.Draw(0, 0, FPict.Bitmap);
  11. end;
Windows: Caption shows "Width: 32 Height: 32", the icon is painted correct 32 x 32
Linux: Caption shows  "Width: 128 Height: 128", the icon is painted correct 128 x 128

A second test:
Code: Pascal  [Select][+][-]
  1. procedure TForm1.FormCreate(Sender: TObject);
  2. begin
  3.   FBitmap := TBGRABitmap.Create;
  4.   FBitmap.LoadFromFile(GetCurrentDir + PathDelim + 'cheetah.ico');
  5.   Caption := 'Width: ' + IntToStr(FBitmap.Width) + ' Height: ' + IntToStr(FBitmap.Height);
  6. end;
  7.  
  8. procedure TForm1.FormPaint(Sender: TObject);
  9. begin
  10.   Canvas.Draw(0, 0, FBitmap.Bitmap);
  11. end;
Windows: Caption shows "Width: 256 Height: 256", the icon is painted correct 256 x 256
Linux: Caption shows  "Width: 256 Height: 256", nothing is painted

This test also failed on Linux (on Windows it works):
Code: Pascal  [Select][+][-]
  1. procedure TForm1.FormPaint(Sender: TObject);
  2. begin
  3. //  Canvas.Draw(0, 0, FBitmap.Bitmap);  // paint nothing
  4.   FBitmap.Draw(Canvas, 0, 0, True);  // paints a 256x256 black field
  5. //  FBitmap.Draw(Canvas, 0, 0, False);  //paint nothing
  6. end;

Projects added
Code: [Select]
type
  TLiveSelection = (lsMoney, lsChilds, lsTime);
  TLive = Array[0..1] of TLiveSelection;

Michl

  • Full Member
  • ***
  • Posts: 226
Re: BGRAOpenGL3D why is a picture not shown (Linux)
« Reply #11 on: June 28, 2016, 11:18:03 pm »
2. That could be related to linking. What if you just use the package, but do a clean build?
Yes a clean build brings the error again.

Found the line, which brings that bug (unit BGRAOpenGL):
Code: Pascal  [Select][+][-]
  1. procedure ApplyBlendMode(ABlendMode: TOpenGLBlendMode);
  2. ...
  3.   if not glBlendFuncSeparateFetched then
  4.   begin
  5.     glBlendFuncSeparate := TBlendFuncSeparateProc(wglGetProcAddress('glBlendFuncSeparate'));
  6.     glBlendFuncSeparateFetched := true;
  7.   end;
  8.   if Assigned(glBlendFuncSeparate) then
  9.     glBlendFuncSeparate( srcBlend, dstBlend, GL_ONE, GL_ONE_MINUS_SRC_ALPHA )
  10.   else
  11.     glBlendFunc( srcBlend, dstBlend );
  12. end;   ;

If I comment out the glBlendFuncSeparate call and use glBlendFunc, the app is running. So IMHO it seems to be a problem with:
Code: Pascal  [Select][+][-]
  1.     glBlendFuncSeparate := TBlendFuncSeparateProc(wglGetProcAddress('glBlendFuncSeparate'));

This problem is solved, if I add the path of BGRAComponent to the project. Its a 32bit Linux problem only. The problem exists for Lazarus 1.6 and Lazarus 1.7 trunk.
Code: [Select]
type
  TLiveSelection = (lsMoney, lsChilds, lsTime);
  TLive = Array[0..1] of TLiveSelection;

Michl

  • Full Member
  • ***
  • Posts: 226
Re: BGRAOpenGL3D why is a picture not shown (Linux)
« Reply #12 on: June 28, 2016, 11:50:03 pm »
Possible patch for second problem added.
Code: [Select]
type
  TLiveSelection = (lsMoney, lsChilds, lsTime);
  TLive = Array[0..1] of TLiveSelection;

Michl

  • Full Member
  • ***
  • Posts: 226
Re: BGRAOpenGL3D why is a picture not shown (Linux)
« Reply #13 on: June 29, 2016, 01:08:41 pm »
The patch for the second problem works fine (on Linux, you have to call "cdecl" not "stdcall"). For the first problem, I found no solution (but the reason):

In unit BGRAReadIco:
Code: Pascal  [Select][+][-]
  1. procedure TBGRAReaderIco.InternalRead(Str: TStream; Img: TFPCustomImage);
  2. ...
  3.       ico.Current := bestIdx;
  4.       with Img as TBGRACustomBitmap do
  5.       begin
  6.         SetSize(bestWidth,bestHeight);
  7.         GetImageFromCanvas(ico.Canvas,0,0);  // this is called
  8.       end;
  9. ...

In unit BGRAGtkBitmap:
Code: Pascal  [Select][+][-]
  1. procedure TBGRAGtkBitmap.GetImageFromCanvas(CanvasSource: TCanvas; x, y: integer);
  2. ...
  3.   cw := CanvasSource.Width;  //  CanvasSource.Width is always 0
  4.   ch := CanvasSource.Height;  //  CanvasSource.Height is always 0
  5.   if (x < 0) or (y < 0) or (x+Width > cw) or
  6.     (y+Height > ch) then
  7.   begin
  8.     FillTransparent;
  9.     if (x+Width <= 0) or (y+Height <= 0) or
  10.       (x >= cw) or (y >= ch) then
  11.       exit;  // ist transparent filled and here it jump out
  12. ...

Of cause, if I modify the code (not valid)
Code: Pascal  [Select][+][-]
  1. //  cw := CanvasSource.Width;
  2. //  ch := CanvasSource.Height;
  3.   cw := Width;
  4.   ch := Height;  
the icon is painted, but it lost its alpha canal.

Maybe I find a solution later.
Code: [Select]
type
  TLiveSelection = (lsMoney, lsChilds, lsTime);
  TLive = Array[0..1] of TLiveSelection;

circular

  • Hero Member
  • *****
  • Posts: 4221
    • Personal webpage
Re: BGRAOpenGL3D why is a picture not shown (Linux)
« Reply #14 on: June 29, 2016, 06:46:55 pm »
Thanks. I will have a look at your suggestions.

EDIT: I applied the patch for the OpenGL call.
« Last Edit: June 30, 2016, 06:47:09 pm by circular »
Conscience is the debugger of the mind

 

TinyPortal © 2005-2018